lol

kcov: add metadata and passthru.tests (#121308)

authored by

Léo Gaspard and committed by
GitHub
b522e483 248a57d6

+75 -29
+75 -29
pkgs/development/tools/analysis/kcov/default.nix
··· 1 - {lib, stdenv, fetchFromGitHub, cmake, pkg-config, zlib, curl, elfutils, python3, libiberty, libopcodes}: 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , cmake 5 + , pkg-config 6 + , zlib 7 + , curl 8 + , elfutils 9 + , python3 10 + , libiberty 11 + , libopcodes 12 + , runCommand 13 + , gcc 14 + , rustc 15 + }: 2 16 3 - stdenv.mkDerivation rec { 4 - pname = "kcov"; 5 - version = "38"; 17 + let 18 + self = 19 + stdenv.mkDerivation rec { 20 + pname = "kcov"; 21 + version = "38"; 6 22 7 - src = fetchFromGitHub { 8 - owner = "SimonKagstrom"; 9 - repo = "kcov"; 10 - rev = "v${version}"; 11 - sha256 = "sha256-6LoIo2/yMUz8qIpwJVcA3qZjjF+8KEM1MyHuyHsQD38="; 12 - }; 23 + src = fetchFromGitHub { 24 + owner = "SimonKagstrom"; 25 + repo = "kcov"; 26 + rev = "v${version}"; 27 + sha256 = "sha256-6LoIo2/yMUz8qIpwJVcA3qZjjF+8KEM1MyHuyHsQD38="; 28 + }; 13 29 14 - preConfigure = "patchShebangs src/bin-to-c-source.py"; 15 - nativeBuildInputs = [ cmake pkg-config python3 ]; 30 + preConfigure = "patchShebangs src/bin-to-c-source.py"; 31 + nativeBuildInputs = [ cmake pkg-config python3 ]; 16 32 17 - buildInputs = [ curl zlib elfutils libiberty libopcodes ]; 33 + buildInputs = [ curl zlib elfutils libiberty libopcodes ]; 18 34 19 - strictDeps = true; 35 + strictDeps = true; 20 36 21 - meta = with lib; { 22 - description = "Code coverage tester for compiled programs, Python scripts and shell scripts"; 37 + passthru.tests = { 38 + works-on-c = runCommand "works-on-c" {} '' 39 + set -ex 40 + cat - > a.c <<EOF 41 + int main() {} 42 + EOF 43 + ${gcc}/bin/gcc a.c -o a.out 44 + ${self}/bin/kcov /tmp/kcov ./a.out 45 + test -e /tmp/kcov/index.html 46 + touch $out 47 + set +x 48 + ''; 23 49 24 - longDescription = '' 25 - Kcov is a code coverage tester for compiled programs, Python 26 - scripts and shell scripts. It allows collecting code coverage 27 - information from executables without special command-line 28 - arguments, and continuosly produces output from long-running 29 - applications. 30 - ''; 50 + works-on-rust = runCommand "works-on-rust" {} '' 51 + set -ex 52 + cat - > a.rs <<EOF 53 + fn main() {} 54 + EOF 55 + # Put gcc in the path so that `cc` is found 56 + PATH=${gcc}/bin:$PATH ${rustc}/bin/rustc a.rs -o a.out 57 + ${self}/bin/kcov /tmp/kcov ./a.out 58 + test -e /tmp/kcov/index.html 59 + touch $out 60 + set +x 61 + ''; 62 + }; 31 63 32 - homepage = "http://simonkagstrom.github.io/kcov/index.html"; 33 - license = licenses.gpl2; 64 + meta = with lib; { 65 + description = "Code coverage tester for compiled programs, Python scripts and shell scripts"; 34 66 35 - maintainers = with maintainers; [ gal_bolle ekleog ]; 36 - platforms = platforms.linux; 37 - }; 38 - } 67 + longDescription = '' 68 + Kcov is a code coverage tester for compiled programs, Python 69 + scripts and shell scripts. It allows collecting code coverage 70 + information from executables without special command-line 71 + arguments, and continuosly produces output from long-running 72 + applications. 73 + ''; 74 + 75 + homepage = "http://simonkagstrom.github.io/kcov/index.html"; 76 + license = licenses.gpl2; 77 + changelog = "https://github.com/SimonKagstrom/kcov/blob/master/ChangeLog"; 78 + 79 + maintainers = with maintainers; [ gal_bolle ekleog ]; 80 + platforms = platforms.linux; 81 + }; 82 + }; 83 + in 84 + self