aboutsummaryrefslogtreecommitdiff
path: root/tests/gc-non-blocking.sh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-10 16:20:01 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-10 16:20:01 +0000
commit938650700fafe76e3755982d670855fed3db35c6 (patch)
tree7a6ac217f87cad07bb963ec658bd60625b868466 /tests/gc-non-blocking.sh
parent195daa82995b43b3cbd552735a678afb85f4ae28 (diff)
parent8ba089597fa19bfd49ba5f22a5e821740ca4eb5d (diff)
Merge branch 'path-info' into ca-drv-exotic
Diffstat (limited to 'tests/gc-non-blocking.sh')
-rw-r--r--tests/gc-non-blocking.sh33
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..0d781485d
--- /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 --max-silent-time 60 -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