Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ runCommand, gcc, sparse, writeText }: 2let 3 src = writeText "CODE.c" '' 4 #include <stdio.h> 5 #include <stddef.h> 6 #include <stdlib.h> 7 8 int main(int argc, char *argv[]) { 9 return EXIT_SUCCESS; 10 } 11 ''; 12in 13 runCommand "${sparse.pname}-tests" { buildInputs = [ gcc sparse ]; meta.timeout = 3; } 14'' 15 set -eu 16 ${sparse}/bin/cgcc ${src} > output 2>&1 || ret=$? 17 if [[ -z $(<output) ]]; then 18 mv output $out 19 else 20 echo "Test build returned $ret" 21 cat output 22 exit 1 23 fi 24''