diff --git a/tests/Makefile.am b/tests/Makefile.am index d8493496d2b3868b8d209fee4a1ad9a5559ea085..dc753e781bf65097f50844d7b0f6758e8e4c153d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,7 @@ TESTS_ENVIRONMENT = $(SHELL) -e +extra1 = $(shell pwd)/test-tmp/shared + simple.sh: simple.nix dependencies.sh: dependencies.nix locking.sh: locking.nix diff --git a/tests/build-hook.sh b/tests/build-hook.sh index 6a71bbe56173108d6f219ff9f3dc62435ffdc4e4..8cd9e8171fe1b575baaf98364c7f6ade6c34fec5 100644 --- a/tests/build-hook.sh +++ b/tests/build-hook.sh @@ -2,11 +2,11 @@ source common.sh export NIX_BUILD_HOOK="build-hook.hook.sh" -drvPath=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix) +drvPath=$($nixinstantiate build-hook.nix) echo "derivation is $drvPath" -outPath=$($TOP/src/nix-store/nix-store -quf "$drvPath") +outPath=$($nixstore -quf "$drvPath") echo "output path is $outPath" diff --git a/tests/common.sh.in b/tests/common.sh.in index 979e60db26ac72eefaa1aeabb38e5656333c3046..ca5ef5ecc89b1ca796a95da2fd7448437b1088cb 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -24,3 +24,8 @@ export aterm_bin=@aterm_bin@ export dot=@dot@ export version=@version@ + +export nixinstantiate=$TOP/src/nix-instantiate/nix-instantiate +export nixstore=$TOP/src/nix-store/nix-store +export nixenv=$TOP/src/nix-env/nix-env +export nixhash=$TOP/src/nix-hash/nix-hash diff --git a/tests/dependencies.sh b/tests/dependencies.sh index 0d19cd2bb0be0cb3c5763d16f88069337d95a8cc..cc912f8ef6caf8131e8d52538eaa403c4593ccb7 100644 --- a/tests/dependencies.sh +++ b/tests/dependencies.sh @@ -1,35 +1,35 @@ source common.sh -drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix) +drvPath=$($nixinstantiate dependencies.nix) echo "derivation is $drvPath" $TOP/src/nix-store/nix-store -q --tree "$drvPath" | grep ' +---.*builder1.sh' # Test Graphviz graph generation. -$TOP/src/nix-store/nix-store -q --graph "$drvPath" > $TEST_ROOT/graph +$nixstore -q --graph "$drvPath" > $TEST_ROOT/graph if test -n "$dot"; then # Does it parse? $dot < $TEST_ROOT/graph fi -outPath=$($TOP/src/nix-store/nix-store -rvv "$drvPath") +outPath=$($nixstore -rvv "$drvPath") # Test Graphviz graph generation. -$TOP/src/nix-store/nix-store -q --graph "$outPath" > $TEST_ROOT/graph +$nixstore -q --graph "$outPath" > $TEST_ROOT/graph if test -n "$dot"; then # Does it parse? $dot < $TEST_ROOT/graph fi -$TOP/src/nix-store/nix-store -q --tree "$outPath" | grep '+---.*dependencies-input-2' +$nixstore -q --tree "$outPath" | grep '+---.*dependencies-input-2' echo "output path is $outPath" text=$(cat "$outPath"/foobar) if test "$text" != "FOOBAR"; then exit 1; fi -deps=$($TOP/src/nix-store/nix-store -quR "$drvPath") +deps=$($nixstore -quR "$drvPath") echo "output closure contains $deps" @@ -43,8 +43,8 @@ if echo "$deps" | grep -q "dependencies-input-1"; then exit 1; fi input2OutPath=$(echo "$deps" | grep "dependencies-input-2") # The referrers closure of input-2 should include outPath. -$TOP/src/nix-store/nix-store -q --referrers-closure "$input2OutPath" | grep "$outPath" +$nixstore -q --referrers-closure "$input2OutPath" | grep "$outPath" # Check that the derivers are set properly. -test $($TOP/src/nix-store/nix-store -q --deriver "$outPath") = "$drvPath" -$TOP/src/nix-store/nix-store -q --deriver "$input2OutPath" | grep -q -- "-input-2.drv" +test $($nixstore -q --deriver "$outPath") = "$drvPath" +$nixstore -q --deriver "$input2OutPath" | grep -q -- "-input-2.drv" diff --git a/tests/fallback.sh b/tests/fallback.sh index 2ff4b0b9ceb47f82cbe56495d5c749adc5515a9c..482e4ce5b72ccafa5c4410bc2ddc626e2b8b42e0 100644 --- a/tests/fallback.sh +++ b/tests/fallback.sh @@ -1,16 +1,16 @@ source common.sh -drvPath=$($TOP/src/nix-instantiate/nix-instantiate fallback.nix) +drvPath=$($nixinstantiate fallback.nix) echo "derivation is $drvPath" -outPath=$($TOP/src/nix-store/nix-store -q --fallback "$drvPath") +outPath=$($nixstore -q --fallback "$drvPath") echo "output path is $outPath" # Register a non-existant substitute -(echo $outPath && echo "" && echo $TOP/no-such-program && echo 0 && echo 0) | $TOP/src/nix-store/nix-store --register-substitutes +(echo $outPath && echo "" && echo $TOP/no-such-program && echo 0 && echo 0) | $nixstore --register-substitutes # Build the derivation -$TOP/src/nix-store/nix-store -r --fallback "$drvPath" +$nixstore -r --fallback "$drvPath" text=$(cat "$outPath"/hello) if test "$text" != "Hello World!"; then exit 1; fi diff --git a/tests/gc-concurrent.sh b/tests/gc-concurrent.sh index 7606a64c87e505ee658d4caa7afa70671914d65c..5004a6e4e27000e3e17bfee135633cc5b0d41360 100644 --- a/tests/gc-concurrent.sh +++ b/tests/gc-concurrent.sh @@ -1,19 +1,19 @@ source common.sh -drvPath1=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix) -outPath1=$($TOP/src/nix-store/nix-store -q $drvPath1) +drvPath1=$($nixinstantiate gc-concurrent.nix) +outPath1=$($nixstore -q $drvPath1) -drvPath2=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent2.nix) -outPath2=$($TOP/src/nix-store/nix-store -q $drvPath2) +drvPath2=$($nixinstantiate gc-concurrent2.nix) +outPath2=$($nixstore -q $drvPath2) ln -s $drvPath2 "$NIX_STATE_DIR"/gcroots/foo2 # Start build #1 in the background. It starts immediately. -$TOP/src/nix-store/nix-store -rvv "$drvPath1" & +$nixstore -rvv "$drvPath1" & pid1=$! # Start build #2 in the background after 3 seconds. -(sleep 3 && $TOP/src/nix-store/nix-store -rvv "$drvPath2") & +(sleep 3 && $nixstore -rvv "$drvPath2") & pid2=$! # Run the garbage collector while the build is running. Note: the GC diff --git a/tests/gc.sh b/tests/gc.sh index c1bfc9ce4104c0b147a41ebb34b5da226d20d69b..afbda953eadc00e1bee452463e2d119e1de80a38 100644 --- a/tests/gc.sh +++ b/tests/gc.sh @@ -1,7 +1,7 @@ source common.sh -drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix) -outPath=$($TOP/src/nix-store/nix-store -rvv "$drvPath") +drvPath=$($nixinstantiate dependencies.nix) +outPath=$($nixstore -rvv "$drvPath") # Set a GC root. ln -s $outPath "$NIX_STATE_DIR"/gcroots/foo diff --git a/tests/hash.sh b/tests/hash.sh index fbbf1a761e91369c4ebf0698db43161ff9843d61..c6232539c22ee41391f036d12efb96704e1bd94a 100644 --- a/tests/hash.sh +++ b/tests/hash.sh @@ -2,7 +2,7 @@ source common.sh try () { echo -n "$2" > $TEST_ROOT/vector - hash=$($TOP/src/nix-hash/nix-hash $EXTRA --flat --type "$1" $TEST_ROOT/vector) + hash=$($nixhash $EXTRA --flat --type "$1" $TEST_ROOT/vector) if test "$hash" != "$3"; then echo "hash $1, expected $3, got $hash" exit 1 @@ -28,7 +28,7 @@ try sha256 "abc" "1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s" EXTRA= try2 () { - hash=$($TOP/src/nix-hash/nix-hash --type "$1" $TEST_ROOT/hash-path) + hash=$($nixhash --type "$1" $TEST_ROOT/hash-path) if test "$hash" != "$2"; then echo "hash $1, expected $2, got $hash" exit 1 diff --git a/tests/init.sh b/tests/init.sh index cd9fe60219dd787977954a4da2a61e19b1022e05..a11d63f7592484adea6bc9aa92d55c8340afdbae 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -18,9 +18,9 @@ mkdir "$NIX_DB_DIR" mkdir "$NIX_CONF_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 $nixstore $NIX_BIN_DIR/ +ln -s $nixinstantiate $NIX_BIN_DIR/ +ln -s $nixhash $NIX_BIN_DIR/ ln -s $TOP/scripts/nix-prefetch-url $NIX_BIN_DIR/ ln -s $TOP/scripts/nix-collect-garbage $NIX_BIN_DIR/ mkdir $NIX_BIN_DIR/nix @@ -66,7 +66,7 @@ chmod +x tmp mv tmp $NIX_DATA_DIR/nix/corepkgs/nar/nar.sh # Initialise the database. -$TOP/src/nix-store/nix-store --init +$nixstore --init # Did anything happen? test -e "$NIX_DB_DIR"/validpaths diff --git a/tests/lang.sh b/tests/lang.sh index 5e9d8d51e0f18bb432aea245f9092757ae595eaa..f743a183050273b2b41513072f7b8366ae6806b8 100644 --- a/tests/lang.sh +++ b/tests/lang.sh @@ -5,7 +5,7 @@ fail=0 for i in lang/parse-fail-*.nix; do echo "parsing $i (should fail)"; i=$(basename $i .nix) - if $TOP/src/nix-instantiate/nix-instantiate --parse-only - < lang/$i.nix; then + if $nixinstantiate --parse-only - < lang/$i.nix; then echo "FAIL: $i shouldn't parse" fail=1 fi @@ -14,7 +14,7 @@ done for i in lang/parse-okay-*.nix; do echo "parsing $i (should succeed)"; i=$(basename $i .nix) - if ! $TOP/src/nix-instantiate/nix-instantiate --parse-only - < lang/$i.nix > lang/$i.ast; then + if ! $nixinstantiate --parse-only - < lang/$i.nix > lang/$i.ast; then echo "FAIL: $i should parse" fail=1 fi @@ -27,7 +27,7 @@ done for i in lang/eval-fail-*.nix; do echo "evaluating $i (should fail)"; i=$(basename $i .nix) - if $TOP/src/nix-instantiate/nix-instantiate --eval-only - < lang/$i.nix; then + if $nixinstantiate --eval-only - < lang/$i.nix; then echo "FAIL: $i shouldn't evaluate" fail=1 fi @@ -36,7 +36,7 @@ done for i in lang/eval-okay-*.nix; do echo "evaluating $i (should succeed)"; i=$(basename $i .nix) - if ! $TOP/src/nix-instantiate/nix-instantiate --eval-only - < lang/$i.nix > lang/$i.out; then + if ! $nixinstantiate --eval-only - < lang/$i.nix > lang/$i.out; then echo "FAIL: $i should evaluate" fail=1 fi diff --git a/tests/locking.sh b/tests/locking.sh index 3e1788660602d718731b0dfe08b07f9dc372db33..4b41de3916a92ffb9dd5dd399d05e0ff404d2c36 100644 --- a/tests/locking.sh +++ b/tests/locking.sh @@ -1,17 +1,17 @@ source common.sh -drvPath=$($TOP/src/nix-instantiate/nix-instantiate locking.nix) +drvPath=$($nixinstantiate locking.nix) echo "derivation is $drvPath" for i in 1 2 3 4 5; do echo "WORKER $i" - $TOP/src/nix-store/nix-store -rvv "$drvPath" & + $nixstore -rvv "$drvPath" & done sleep 5 -outPath=$($TOP/src/nix-store/nix-store -qvvf "$drvPath") +outPath=$($nixstore -qvvf "$drvPath") echo "output path is $outPath" diff --git a/tests/misc.sh b/tests/misc.sh index 2220ea18cb86372523c3d472a406764985109101..9be2ac2f041cbb0c73cccb0eb5b628340c135a78 100644 --- a/tests/misc.sh +++ b/tests/misc.sh @@ -3,10 +3,14 @@ source common.sh # Tests miscellaneous commands. # Do all commands have help? -$TOP/src/nix-env/nix-env --help | grep -q install -$TOP/src/nix-store/nix-store --help | grep -q realise -$TOP/src/nix-instantiate/nix-instantiate --help | grep -q eval-only -$TOP/src/nix-hash/nix-hash --help | grep -q base32 +$nixenv --help | grep -q install +$nixstore --help | grep -q realise +$nixinstantiate --help | grep -q eval-only +$nixhash --help | grep -q base32 # Can we ask for the version number? -$TOP/src/nix-env/nix-env --version | grep "$version" +$nixenv --version | grep "$version" + +# Usage errors. +$nixenv --foo 2>&1 | grep "no operation" +$nixenv -q --foo 2>&1 | grep "unknown flag" diff --git a/tests/nix-pull.sh b/tests/nix-pull.sh index a8dca8feaa422cb67fde3f2e07e5b0e1b300c35a..146227b71aacf521c91328aee9e5cdef9be009fc 100644 --- a/tests/nix-pull.sh +++ b/tests/nix-pull.sh @@ -7,7 +7,7 @@ clearStore () { mkdir "$NIX_STORE_DIR" rm -rf "$NIX_DB_DIR" mkdir "$NIX_DB_DIR" - $TOP/src/nix-store/nix-store --init + $nixstore --init } pullCache () { @@ -18,11 +18,11 @@ pullCache () { clearStore pullCache -drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix) -outPath=$($TOP/src/nix-store/nix-store -q $drvPath) +drvPath=$($nixinstantiate dependencies.nix) +outPath=$($nixstore -q $drvPath) echo "building $outPath using substitutes..." -$TOP/src/nix-store/nix-store -r $outPath +$nixstore -r $outPath cat $outPath/input-2/bar @@ -30,10 +30,10 @@ clearStore pullCache echo "building $drvPath using substitutes..." -$TOP/src/nix-store/nix-store -r $drvPath +$nixstore -r $drvPath cat $outPath/input-2/bar # Check that the derivers are set properly. -test $($TOP/src/nix-store/nix-store -q --deriver "$outPath") = "$drvPath" -$TOP/src/nix-store/nix-store -q --deriver $(/bin/ls -l $outPath/input-2 | sed 's/.*->\ //') | grep -q -- "-input-2.drv" +test $($nixstore -q --deriver "$outPath") = "$drvPath" +$nixstore -q --deriver $(/bin/ls -l $outPath/input-2 | sed 's/.*->\ //') | grep -q -- "-input-2.drv" diff --git a/tests/nix-push.sh b/tests/nix-push.sh index 6dbb2484013a3a84b428d964d429272189c680ca..46f1edb4014be9364382cad600b23f7f826578b2 100644 --- a/tests/nix-push.sh +++ b/tests/nix-push.sh @@ -1,7 +1,7 @@ source common.sh -drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix) -outPath=$($TOP/src/nix-store/nix-store -r $drvPath) +drvPath=$($nixinstantiate dependencies.nix) +outPath=$($nixstore -r $drvPath) echo "pushing $drvPath" diff --git a/tests/parallel.sh b/tests/parallel.sh index 2382db7834ba0bd5f47ee84e79fb05f21697a4fd..84326978e74ef95048bfb65ec319c29bde5fea1c 100644 --- a/tests/parallel.sh +++ b/tests/parallel.sh @@ -1,10 +1,10 @@ source common.sh -drvPath=$($TOP/src/nix-instantiate/nix-instantiate parallel.nix) +drvPath=$($nixinstantiate parallel.nix) echo "derivation is $drvPath" -outPath=$($TOP/src/nix-store/nix-store -qfvv -j10000 "$drvPath") +outPath=$($nixstore -qfvv -j10000 "$drvPath") echo "output path is $outPath" diff --git a/tests/referrers.sh b/tests/referrers.sh index 2ee97e65b5a9f7af100eb39e970cf6cbe6048983..9744a30d44efeb2c2d38e82d1d4816dd723c9b00 100644 --- a/tests/referrers.sh +++ b/tests/referrers.sh @@ -4,14 +4,14 @@ max=5000 reference=$NIX_STORE_DIR/abcdef touch $reference -(echo $reference && echo && echo 0) | $TOP/src/nix-store/nix-store --register-validity +(echo $reference && echo && echo 0) | $nixstore --register-validity echo "registering..." time for ((n = 0; n < $max; n++)); do storePath=$NIX_STORE_DIR/$n touch $storePath (echo $storePath && echo && echo 1 && echo $reference) -done | $TOP/src/nix-store/nix-store --register-validity +done | $nixstore --register-validity echo "collecting garbage..." -time $TOP/src/nix-store/nix-store --gc 2> /dev/null +time $nixstore --gc 2> /dev/null diff --git a/tests/simple.sh b/tests/simple.sh index 3e58bcc845c282fa5d271fc78c583ab838b948be..225e7c52249867746ae70d99af8c11493c0a496b 100644 --- a/tests/simple.sh +++ b/tests/simple.sh @@ -1,10 +1,10 @@ source common.sh -drvPath=$($TOP/src/nix-instantiate/nix-instantiate simple.nix) +drvPath=$($nixinstantiate simple.nix) echo "derivation is $drvPath" -outPath=$($TOP/src/nix-store/nix-store -rvv "$drvPath") +outPath=$($nixstore -rvv "$drvPath") echo "output path is $outPath" diff --git a/tests/substitutes.sh b/tests/substitutes.sh index 680f114b5e174d445f591b0736ccb8bb6f39327a..c44f012f5924696973f751733e8d86107ad5db6d 100644 --- a/tests/substitutes.sh +++ b/tests/substitutes.sh @@ -1,22 +1,22 @@ source common.sh # Instantiate. -drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes.nix) +drvPath=$($nixinstantiate substitutes.nix) echo "derivation is $drvPath" # Find the output path. -outPath=$($TOP/src/nix-store/nix-store -qvv "$drvPath") +outPath=$($nixstore -qvv "$drvPath") echo "output path is $outPath" regSub() { - (echo $1 && echo "" && echo $2 && echo 3 && echo $outPath && echo Hallo && echo Wereld && echo 0) | $TOP/src/nix-store/nix-store --register-substitutes + (echo $1 && echo "" && echo $2 && echo 3 && echo $outPath && echo Hallo && echo Wereld && echo 0) | $nixstore --register-substitutes } # Register a substitute for the output path. regSub $outPath $(pwd)/substituter.sh -$TOP/src/nix-store/nix-store -rvv "$drvPath" +$nixstore -rvv "$drvPath" text=$(cat "$outPath"/hello) if test "$text" != "Hallo Wereld"; then exit 1; fi diff --git a/tests/substitutes2.sh b/tests/substitutes2.sh index 7303255af0caeb98586211f911d7f46ecc693b5b..416e815360c20c0065fac0f5b6b56507a362916f 100644 --- a/tests/substitutes2.sh +++ b/tests/substitutes2.sh @@ -1,15 +1,15 @@ source common.sh # Instantiate. -drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes2.nix) +drvPath=$($nixinstantiate substitutes2.nix) echo "derivation is $drvPath" # Find the output path. -outPath=$($TOP/src/nix-store/nix-store -qvvvvv "$drvPath") +outPath=$($nixstore -qvvvvv "$drvPath") echo "output path is $outPath" regSub() { - (echo $1 && echo "" && echo $2 && echo 3 && echo $outPath && echo Hallo && echo Wereld && echo 0) | $TOP/src/nix-store/nix-store --register-substitutes + (echo $1 && echo "" && echo $2 && echo 3 && echo $outPath && echo Hallo && echo Wereld && echo 0) | $nixstore --register-substitutes } # Register a substitute for the output path. @@ -19,7 +19,7 @@ regSub $outPath $(pwd)/substituter.sh # precedence over the previous one. It will fail. regSub $outPath $(pwd)/substituter2.sh -$TOP/src/nix-store/nix-store -rvv "$drvPath" +$nixstore -rvv "$drvPath" text=$(cat "$outPath"/hello) if test "$text" != "Hallo Wereld"; then exit 1; fi diff --git a/tests/user-envs.sh b/tests/user-envs.sh index eddd4c22abe7998e677b014066f2ee0c09414d69..debba74ff22326db7c9e5b87edfb661cf6d5ccdc 100644 --- a/tests/user-envs.sh +++ b/tests/user-envs.sh @@ -1,6 +1,5 @@ source common.sh -nixenv=$TOP/src/nix-env/nix-env profiles="$NIX_STATE_DIR"/profiles # Query installed: should be empty. diff --git a/tests/verify.sh b/tests/verify.sh index a38544331af3184e34f1086fbc48cda374250293..39609c7cecf6a3bb5349bf570d0bd3104447992d 100644 --- a/tests/verify.sh +++ b/tests/verify.sh @@ -1,3 +1,3 @@ source common.sh -$TOP/src/nix-store/nix-store --verify +$nixstore --verify