about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-11-23T19·23+0100
committersterni <sternenseemann@systemli.org>2021-11-25T11·15+0100
commit8dc54f89cdaf2e029230adbd14242ba0db6832ab (patch)
treedc1c30c035c69c1d50734ae1fa0ce11150173a83
parent0e9c770972afe787565c7ba5475ff8398f807f20 (diff)
fix(nix/runTestsuite): don't crash on big test suites r/3093
Having `prettyRes` in the execline script causes it to fail because of
the argv limit if your test suite is long enough. For the succeeding one
we can work around this by hashing it (since we only care that something
changes if the test suite changes), in the case of the failing one where
we want to print the results, we use runExecline's stdin mechanism.

Change-Id: I2489f76acfbe809351f51caefe2a477328a70ee3
-rw-r--r--nix/runTestsuite/default.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/nix/runTestsuite/default.nix b/nix/runTestsuite/default.nix
index f9a156047928..9eb507099678 100644
--- a/nix/runTestsuite/default.nix
+++ b/nix/runTestsuite/default.nix
@@ -38,7 +38,7 @@ let
     ;
 
   bins = depot.nix.getBins pkgs.coreutils [ "printf" ]
-      // depot.nix.getBins pkgs.s6-portable-utils [ "s6-touch" "s6-false" ];
+      // depot.nix.getBins pkgs.s6-portable-utils [ "s6-touch" "s6-false" "s6-cat" ];
 
   # Returns true if the given expression throws when `deepSeq`-ed
   throws = expr:
@@ -153,17 +153,18 @@ let
         then depot.nix.runExecline.local "testsuite-${name}-successful" {} [
           "importas" "out" "out"
           # force derivation to rebuild if test case list changes
-          "ifelse" [ bins.s6-false ] [ bins.printf "" prettyRes ]
+          "ifelse" [ bins.s6-false ] [
+            bins.printf "" (builtins.hashString "sha512" prettyRes)
+          ]
           "if" [ bins.printf "%s\n" "testsuite ${name} successful!" ]
           bins.s6-touch "$out"
         ]
-        else depot.nix.runExecline.local "testsuite-${name}-failed" {} [
+        else depot.nix.runExecline.local "testsuite-${name}-failed" {
+          stdin = prettyRes + "\n";
+        } [
           "importas" "out" "out"
-          "if" [
-            bins.printf "%s\n%s\n"
-              "testsuite ${name} failed!"
-              prettyRes
-          ]
+          "if" [ bins.printf "%s\n" "testsuite ${name} failed!" ]
+          "if" [ bins.s6-cat ]
           "exit" "1"
         ]);