diff options
Diffstat (limited to 'nixpkgs/pkgs/development/tools/analysis/sparse/tests.nix')
-rw-r--r-- | nixpkgs/pkgs/development/tools/analysis/sparse/tests.nix | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/analysis/sparse/tests.nix b/nixpkgs/pkgs/development/tools/analysis/sparse/tests.nix new file mode 100644 index 000000000000..5eba254e537a --- /dev/null +++ b/nixpkgs/pkgs/development/tools/analysis/sparse/tests.nix @@ -0,0 +1,24 @@ +{ runCommand, gcc, sparse, writeText }: +let + src = writeText "CODE.c" '' + #include <stdio.h> + #include <stddef.h> + #include <stdlib.h> + + int main(int argc, char *argv[]) { + return EXIT_SUCCESS; + } + ''; +in + runCommand "${sparse.pname}-tests" { buildInputs = [ gcc sparse ]; meta.timeout = 3; } +'' + set -eu + ${sparse}/bin/cgcc ${src} > output 2>&1 || ret=$? + if [[ -z $(<output) ]]; then + mv output $out + else + echo "Test build returned $ret" + cat output + exit 1 + fi +'' |