diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 18 | ||||
-rw-r--r-- | tests/init.sh | 30 | ||||
-rw-r--r-- | tests/nix-pull.sh | 33 | ||||
-rw-r--r-- | tests/nix-push.sh | 9 |
4 files changed, 88 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index d91b021cacf6..9094d39f5041 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,7 +8,16 @@ TESTS_ENVIRONMENT = TEST_ROOT=$(TEST_ROOT) \ NIX_LOG_DIR=$(TEST_ROOT)/log \ NIX_STATE_DIR=$(TEST_ROOT)/state \ NIX_DB_DIR=$(TEST_ROOT)/db \ + NIX_BIN_DIR=$(TEST_ROOT)/bin \ + NIX_LIBEXEC_DIR=$(TEST_ROOT)/bin \ + NIX_LOCALSTATE_DIR=$(TEST_ROOT)/state \ + REAL_BIN_DIR=$(bindir) \ + REAL_LIBEXEC_DIR=$(libexecdir) \ + REAL_LOCALSTATE_DIR=$(localstatedir) \ + REAL_DATA_DIR=$(datadir) \ + REAL_STORE_DIR=$(storedir) \ NIX_BUILD_HOOK= \ + PERL=$(perl) \ TOP=$(shell pwd)/.. \ SHARED=$(extra1) \ aterm_bin=$(aterm_bin) \ @@ -22,9 +31,14 @@ build-hook.sh: build-hook.nix substitutes.sh: substitutes.nix substitutes2.sh: substitutes2.nix fallback.sh: fallback.nix +nix-push.sh: dependencies.nix +nix-pull.sh: dependencies.nix -TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \ - build-hook.sh substitutes.sh substitutes2.sh fallback.sh verify.sh +#TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \ +# build-hook.sh substitutes.sh substitutes2.sh fallback.sh nix-push.sh verify.sh \ +# nix-pull.sh + +TESTS = init.sh nix-push.sh nix-pull.sh XFAIL_TESTS = diff --git a/tests/init.sh b/tests/init.sh index 627cdae1752c..504cb14f12dc 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -13,6 +13,36 @@ mkdir "$NIX_LOG_DIR" mkdir "$NIX_STATE_DIR" mkdir "$NIX_DB_DIR" +mkdir $NIX_BIN_DIR +ln -s $TOP/src/nix-store/nix-store $NIX_BIN_DIR/ +ln -s $TOP/src/nix-instantiate/nix-instantiate $NIX_BIN_DIR/ +ln -s $TOP/src/nix-hash/nix-hash $NIX_BIN_DIR/ +ln -s $TOP/scripts/nix-prefetch-url $NIX_BIN_DIR/ +mkdir $NIX_BIN_DIR/nix +ln -s $TOP/scripts/download-using-manifests.pl $NIX_BIN_DIR/nix/ +ln -s $TOP/scripts/readmanifest.pm $NIX_BIN_DIR/nix/ + +mkdir -p "$NIX_LOCALSTATE_DIR"/nix/manifests +mkdir -p "$NIX_LOCALSTATE_DIR"/log/nix + +mkdir $NIX_DATA_DIR/nix +cp -prd $TOP/corepkgs $NIX_DATA_DIR/nix/ +# Bah, script has the prefix hard-coded. +for i in $NIX_DATA_DIR/nix/corepkgs/nar/nar.sh \ + $NIX_BIN_DIR/nix/download-using-manifests.pl \ + $NIX_BIN_DIR/nix-prefetch-url \ + ; do + echo "$REAL_BIN_DIR" + sed < $i > $i.tmp \ + -e "s^$REAL_BIN_DIR^$NIX_BIN_DIR^" \ + -e "s^$REAL_LIBEXEC_DIR^$NIX_LIBEXEC_DIR^" \ + -e "s^$REAL_LOCALSTATE_DIR^$NIX_LOCALSTATE_DIR^" \ + -e "s^$REAL_DATA_DIR^$NIX_DATA_DIR^" \ + -e "s^$REAL_STORE_DIR^$NIX_STORE_DIR^" + mv $i.tmp $i + chmod +x $i +done + # Initialise the database. $TOP/src/nix-store/nix-store --init diff --git a/tests/nix-pull.sh b/tests/nix-pull.sh new file mode 100644 index 000000000000..9a17f5bf6026 --- /dev/null +++ b/tests/nix-pull.sh @@ -0,0 +1,33 @@ +clearStore () { + echo "clearing store..." + chmod -R +w "$NIX_STORE_DIR" + rm -rf "$NIX_STORE_DIR" + mkdir "$NIX_STORE_DIR" + rm -rf "$NIX_DB_DIR" + mkdir "$NIX_DB_DIR" + $TOP/src/nix-store/nix-store --init +} + +pullCache () { + echo "pulling cache..." + $PERL -w -I$TOP/scripts $TOP/scripts/nix-pull file://$TEST_ROOT/manifest +} + +clearStore +pullCache + +drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix) +outPath=$($TOP/src/nix-store/nix-store -q $drvPath) + +echo "building $outPath using substitutes..." +$TOP/src/nix-store/nix-store -r $outPath + +cat $outPath/input-2/bar + +clearStore +pullCache + +echo "building $drvPath using substitutes..." +$TOP/src/nix-store/nix-store -r $drvPath + +cat $outPath/input-2/bar diff --git a/tests/nix-push.sh b/tests/nix-push.sh new file mode 100644 index 000000000000..73499f1e9e35 --- /dev/null +++ b/tests/nix-push.sh @@ -0,0 +1,9 @@ +drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix) +outPath=$($TOP/src/nix-store/nix-store -r $drvPath) + +echo "pushing $drvPath" + +mkdir $TEST_ROOT/cache + +$PERL -w -I$TOP/scripts $TOP/scripts/nix-push \ + --copy $TEST_ROOT/cache $TEST_ROOT/manifest $drvPath |