Skip to content

Commit

Permalink
[utils/nix] actually check that the unit tests passed
Browse files Browse the repository at this point in the history
  • Loading branch information
rrbutani committed Feb 8, 2023
1 parent 812198a commit 16c4517
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utils/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
, makeWrapper
, python3
, wget
, gnugrep
, cacert
, parallel
, elfutils
Expand All @@ -24,6 +25,12 @@ stdenvNoCC.mkDerivation {
| ${parallel}/bin/parallel --will-cite --line-buffer --keep-order \
"${lib.getExe pkg} --turbo --silent --headless --frames 200" \
| tee -a $out
${lib.getExe gnugrep} -i "unit test passed" $out >/dev/null || {

This comment has been minimized.

Copy link
@jbboehr

jbboehr Feb 10, 2023

Unless there's some kind of platform difference between linux and darwin, this won't get executed because the above command will fail. For example:

diff --git a/utils/derivation.nix b/utils/derivation.nix
index 2610840..47cc494 100644
--- a/utils/derivation.nix
+++ b/utils/derivation.nix
@@ -21,10 +21,11 @@ stdenvNoCC.mkDerivation rec {
     # we have to make $out or building will fail...
     mkBlargg = pkg: runCommand "rosettaboy-checks-blargg-${pkg.name}" {} ''
         echo ${pkg.name}
-        find ${gb-autotest-roms} -name '*.gb' \
+        find ${gb-autotest-roms} -name '*.md' \
           | ${parallel}/bin/parallel --will-cite --line-buffer --keep-order \
               "${lib.getExe pkg} --turbo --silent --headless --frames 200" \
           | tee -a $out
+        echo testing
       '';
     devTools = [ wget cacert parallel ]
       ++ lib.optional (!stdenvNoCC.isDarwin) elfutils;

produces this output for me:

$ nix eval --impure --expr 'builtins.currentSystem' | xargs -i nix build -L ".#checks.{}.rs"
rosettaboy-checks-blargg-rosettaboy-rs> rosettaboy-rs-0.1.0
rosettaboy-checks-blargg-rosettaboy-rs> Error: No discriminant in enum `CartType` matches the value `117`
error: builder for '/nix/store/x8x1y7g3crjbir15alpjffdsbami2j19-rosettaboy-checks-blargg-rosettaboy-rs-0.1.0.drv' failed with exit code 1;
       last 2 log lines:
       > rosettaboy-rs-0.1.0
       > Error: No discriminant in enum `CartType` matches the value `117`
       For full logs, run 'nix log /nix/store/x8x1y7g3crjbir15alpjffdsbami2j19-rosettaboy-checks-blargg-rosettaboy-rs-0.1.0.drv'.

This comment has been minimized.

Copy link
@jbboehr

jbboehr Feb 10, 2023

I did want to use utils/blargg.py, but it'll need some changes to work with the nix directory structure and didn't want to deal with it now.

echo "tests didn't seem to pass?"
exit 4
}
! ${lib.getExe gnugrep} -i "unit test failed" $out >/dev/null
'';
devTools = [ wget cacert parallel ]
++ lib.optional (!stdenvNoCC.isDarwin) elfutils;
Expand Down

0 comments on commit 16c4517

Please sign in to comment.