From 4bdb51e621e2690e561b7581d5670af08e7b3170 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 20 Jul 2011 11:50:13 +0000 Subject: [PATCH] * Refactoring. --- tests/common.sh.in | 17 ++++++++++++++--- tests/remote-store.sh | 12 +++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/tests/common.sh.in b/tests/common.sh.in index 2c47d75ee..b03cd49ec 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -18,9 +18,7 @@ export NIX_LIBEXEC_DIR=$TEST_ROOT/bin export NIX_ROOT_FINDER= export SHARED=$TEST_ROOT/shared -if test -z "$FORCE_NIX_REMOTE"; then - export NIX_REMOTE= -fi +export NIX_REMOTE= export REAL_BIN_DIR=@bindir@ export REAL_LIBEXEC_DIR=@libexecdir@ @@ -77,6 +75,19 @@ clearManifests() { rm -f $NIX_STATE_DIR/manifests/* } +startDaemon() { + $nixworker --daemon & + pidDaemon=$! + trap "kill -9 $pidDaemon" EXIT + export NIX_REMOTE=daemon +} + +killDaemon() { + kill -9 $pidDaemon + wait $pidDaemon || true + trap "" EXIT +} + fail() { echo "$1" exit 1 diff --git a/tests/remote-store.sh b/tests/remote-store.sh index 260fdeb76..e27631a00 100644 --- a/tests/remote-store.sh +++ b/tests/remote-store.sh @@ -1,7 +1,5 @@ source common.sh -export FORCE_NIX_REMOTE=1 - echo '*** testing slave mode ***' clearStore clearManifests @@ -10,10 +8,6 @@ NIX_REMOTE=slave $SHELL ./user-envs.sh echo '*** testing daemon mode ***' clearStore clearManifests -$nixworker --daemon & -pidDaemon=$! -trap "kill -9 $pidDaemon" EXIT -NIX_REMOTE=daemon $SHELL ./user-envs.sh -kill -9 $pidDaemon -wait $pidDaemon || true -trap "" EXIT +startDaemon +$SHELL ./user-envs.sh +killDaemon