diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-10-15 16:52:37 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-10-15 16:52:37 +0200 |
commit | 10f9a8e77d504354deafbcf7351a6d46d4528542 (patch) | |
tree | 27989dea7b8e87e31a32b3f1bae161176f39b06f /tests/gc-non-blocking.sh | |
parent | ac54c6faa6b73c3da180dec666fadd6e8d7d18e3 (diff) |
Add a test for the non-blocking GC
Diffstat (limited to 'tests/gc-non-blocking.sh')
-rw-r--r-- | tests/gc-non-blocking.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/gc-non-blocking.sh b/tests/gc-non-blocking.sh new file mode 100644 index 000000000..8b21c6f1c --- /dev/null +++ b/tests/gc-non-blocking.sh @@ -0,0 +1,33 @@ +# Test whether the collector is non-blocking, i.e. a build can run in +# parallel with it. +source common.sh + +needLocalStore "the GC test needs a synchronisation point" + +clearStore + +fifo=$TEST_ROOT/test.fifo +mkfifo "$fifo" + +dummy=$(nix store add-path ./simple.nix) + +running=$TEST_ROOT/running +touch $running + +(_NIX_TEST_GC_SYNC=$fifo nix-store --gc -vvvvv; rm $running) & +pid=$! + +sleep 2 + +outPath=$(nix-build -o "$TEST_ROOT/result" -E " + with import ./config.nix; + mkDerivation { + name = \"non-blocking\"; + buildCommand = \"set -x; test -e $running; mkdir \$out; echo > $fifo\"; + }") + +wait $pid + +(! test -e $running) +(! test -e $dummy) +test -e $outPath |