about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-09-11T17·25+0200
committersterni <sternenseemann@systemli.org>2021-09-14T14·10+0000
commit987b9b551c42642c7be9363737faa0629fe87117 (patch)
tree2c920f8ba45a9bd014307a6ce4b8a9d2d2b9ba4c
parent3a8e8120de2f0ac6188003b81efafa64d5bb6959 (diff)
feat(nix/runTestsuite): rebuild if test case list changes r/2857
If the result of the assertions changes for a successful test
suite (this happens if tests are reworded, added or removed), this
makes sure the no-op derivation is rebuilt.

This makes sure that test suites show up in buildkite on ocassions other
than channel bumps, since they are only added to the job list if their
`outPath` is missing nowadays (see cl/3427).

Change-Id: Ia1050cca5eeed8b7da84c40f6154b40760a3047f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3536
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
-rw-r--r--nix/runTestsuite/default.nix7
1 files changed, 5 insertions, 2 deletions
diff --git a/nix/runTestsuite/default.nix b/nix/runTestsuite/default.nix
index 78cf5389e42a..dc8e40f8ad4b 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" ];
+      // depot.nix.getBins pkgs.s6-portable-utils [ "s6-touch" "s6-false" ];
 
   # Returns true if the given expression throws when `deepSeq`-ed
   throws = expr:
@@ -157,10 +157,13 @@ let
         };
         goodIts = partitionTests (it: (goodIt it).asserts.err == []);
         res = goodIts itResults;
+        prettyRes = lib.generators.toPretty {} res;
       in
         if res.err == []
         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 ]
           "if" [ bins.printf "%s\n" "testsuite ${name} successful!" ]
           bins.s6-touch "$out"
         ]
@@ -169,7 +172,7 @@ let
           "if" [
             bins.printf "%s\n%s\n"
               "testsuite ${name} failed!"
-              (lib.generators.toPretty {} res)
+              prettyRes
           ]
           "exit" "1"
         ]);