aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/build-hook.sh4
-rw-r--r--tests/common.sh.in5
-rw-r--r--tests/dependencies.sh18
-rw-r--r--tests/fallback.sh8
-rw-r--r--tests/gc-concurrent.sh12
-rw-r--r--tests/gc.sh4
-rw-r--r--tests/hash.sh4
-rw-r--r--tests/init.sh8
-rw-r--r--tests/lang.sh8
-rw-r--r--tests/locking.sh6
-rw-r--r--tests/misc.sh14
-rw-r--r--tests/nix-pull.sh14
-rw-r--r--tests/nix-push.sh4
-rw-r--r--tests/parallel.sh4
-rw-r--r--tests/referrers.sh6
-rw-r--r--tests/simple.sh4
-rw-r--r--tests/substitutes.sh8
-rw-r--r--tests/substitutes2.sh8
-rw-r--r--tests/user-envs.sh1
-rw-r--r--tests/verify.sh2
21 files changed, 77 insertions, 67 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d8493496d..dc753e781 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 6a71bbe56..8cd9e8171 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 979e60db2..ca5ef5ecc 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 0d19cd2bb..cc912f8ef 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 2ff4b0b9c..482e4ce5b 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 7606a64c8..5004a6e4e 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 c1bfc9ce4..afbda953e 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 fbbf1a761..c6232539c 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 cd9fe6021..a11d63f75 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 5e9d8d51e..f743a1830 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 3e1788660..4b41de391 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 2220ea18c..9be2ac2f0 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 a8dca8fea..146227b71 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 6dbb24840..46f1edb40 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 2382db783..84326978e 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 2ee97e65b..9744a30d4 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 3e58bcc84..225e7c522 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 680f114b5..c44f012f5 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 7303255af..416e81536 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 eddd4c22a..debba74ff 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 a38544331..39609c7ce 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