summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-08-14 09:26:30 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-08-14 09:26:30 +0000
commitc03b729319997b4e38c3f586d7c76352228b22e7 (patch)
tree90b7d1288117975295b7d6f990c5f9e6698775a5 /tests
parent5664b6d7ba28453ccdd6d1c07a707f98608500ff (diff)
downloadguix-c03b729319997b4e38c3f586d7c76352228b22e7.tar.gz
* Increase the sleep periods a bit to make the test less likely to
  fail on slow machines.  Of course it would be better if this test
  wasn't timing dependent...

Diffstat (limited to 'tests')
-rw-r--r--tests/gc-concurrent.builder.sh7
-rw-r--r--tests/gc-concurrent.sh20
-rw-r--r--tests/gc-concurrent2.builder.sh2
3 files changed, 17 insertions, 12 deletions
diff --git a/tests/gc-concurrent.builder.sh b/tests/gc-concurrent.builder.sh
index 6b2177ddff..0cd67df3ae 100644
--- a/tests/gc-concurrent.builder.sh
+++ b/tests/gc-concurrent.builder.sh
@@ -1,8 +1,11 @@
 mkdir $out
 echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar
 
-sleep 5
-mkdir $out || true
+sleep 10
+
+# $out should not have been GC'ed while we were sleeping, but just in
+# case...
+mkdir -p $out
 
 # Check that the GC hasn't deleted the lock on our output.
 test -e "$out.lock"
diff --git a/tests/gc-concurrent.sh b/tests/gc-concurrent.sh
index 446e79f138..6cf6520788 100644
--- a/tests/gc-concurrent.sh
+++ b/tests/gc-concurrent.sh
@@ -1,5 +1,7 @@
 source common.sh
 
+$NIX_BIN_DIR/nix-collect-garbage -vvvvv
+
 drvPath1=$($nixinstantiate gc-concurrent.nix)
 outPath1=$($nixstore -q $drvPath1)
 
@@ -13,15 +15,13 @@ ln -s $drvPath2 "$NIX_STATE_DIR"/gcroots/foo
 $nixstore -rvv "$drvPath1" &
 pid1=$!
 
-# Start build #2 in the background after 3 seconds.
-(sleep 3 && $nixstore -rvv "$drvPath2") &
+# Start build #2 in the background after 6 seconds.
+(sleep 6 && $nixstore -rvv "$drvPath2") &
 pid2=$!
 
-# Run the garbage collector while the build is running.  Note: the GC
-# sleeps for *another* 2 seconds after acquiring the GC lock.  This
-# checks whether build #1
-sleep 2
-NIX_DEBUG_GC_WAIT=1 $NIX_BIN_DIR/nix-collect-garbage -vvvvv
+# Run the garbage collector while the build is running.
+sleep 4
+$NIX_BIN_DIR/nix-collect-garbage -vvvvv
 
 # Wait for build #1/#2 to finish.
 echo waiting for pid $pid1 to finish...
@@ -30,11 +30,13 @@ echo waiting for pid $pid2 to finish...
 wait $pid2
 
 # Check that the root of build #1 and its dependencies haven't been
-# deleted.
+# deleted.  The should not be deleted by the GC because they were
+# being built during the GC.
 cat $outPath1/foobar
 cat $outPath1/input-2/bar
 
-# Build #2 should have failed because its derivation got garbage collected.
+# Check that build #2 has succeeded.  It should succeed because the
+# derivation is a GC root.
 cat $outPath2/foobar
 
 rm "$NIX_STATE_DIR"/gcroots/foo
diff --git a/tests/gc-concurrent2.builder.sh b/tests/gc-concurrent2.builder.sh
index f7b6094e8b..4bfb33103e 100644
--- a/tests/gc-concurrent2.builder.sh
+++ b/tests/gc-concurrent2.builder.sh
@@ -4,4 +4,4 @@ echo $(cat $input1/foo)$(cat $input2/bar)xyzzy > $out/foobar
 # Check that the GC hasn't deleted the lock on our output.
 test -e "$out.lock"
 
-sleep 3
\ No newline at end of file
+sleep 6