From 8dc54f89cdaf2e029230adbd14242ba0db6832ab Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 23 Nov 2021 20:23:13 +0100 Subject: fix(nix/runTestsuite): don't crash on big test suites 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 --- nix/runTestsuite/default.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'nix/runTestsuite') 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" ]); -- cgit 1.4.1