about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-10-11T11·14+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-10-11T11·14+0000
commit7d314b8c959ca5c3dda8aea9c74079f4be63e19e (patch)
tree0eac8ab98c9a313bfa1aeb25a9b4c2b97362fc15 /tests
parent5193db048e06578191ddd3085d76aab1d2e15ad3 (diff)
* Work around a race condition starting the Nix daemon.
Diffstat (limited to 'tests')
-rw-r--r--tests/common.sh.in9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/common.sh.in b/tests/common.sh.in
index 567f5b460651..62ac669df665 100644
--- a/tests/common.sh.in
+++ b/tests/common.sh.in
@@ -32,7 +32,7 @@ export REAL_DATA_DIR=@datadir@
 export REAL_STORE_DIR=@storedir@
 export NIX_BUILD_HOOK=
 export PERL=perl
-export PERL5LIB=$TOP/perl/lib
+export PERL5LIB=$TOP/perl/lib:$PERL5LIB
 export NIX_BZIP2="@bzip2_bin_test@/bzip2"
 if test "${NIX_BZIP2:0:1}" != "/"; then
     NIX_BZIP2=`pwd`/${NIX_BZIP2}
@@ -74,7 +74,14 @@ clearManifests() {
 }
 
 startDaemon() {
+    # Start the daemon, wait for the socket to appear.  !!!
+    # ‘nix-worker’ should have an option to fork into the background.
+    rm -f $NIX_STATE_DIR/daemon-socket/socket
     nix-worker --daemon &
+    for ((i = 0; i < 30; i++)); do
+        if [ -e $NIX_STATE_DIR/daemon-socket/socket ]; then break; fi
+        sleep 1
+    done
     pidDaemon=$!
     trap "kill -9 $pidDaemon" EXIT
     export NIX_REMOTE=daemon