about summary refs log tree commit diff
path: root/tests/substitutes2.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/substitutes2.sh')
-rw-r--r--tests/substitutes2.sh18
1 files changed, 7 insertions, 11 deletions
diff --git a/tests/substitutes2.sh b/tests/substitutes2.sh
index 416e815360c2..0bbc13913dac 100644
--- a/tests/substitutes2.sh
+++ b/tests/substitutes2.sh
@@ -1,25 +1,21 @@
 source common.sh
 
+clearStore
+
 # Instantiate.
-drvPath=$($nixinstantiate substitutes2.nix)
+drvPath=$($nixinstantiate simple.nix)
 echo "derivation is $drvPath"
 
 # Find the output path.
 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) | $nixstore --register-substitutes
-}
-
-# Register a substitute for the output path.
-regSub $outPath $(pwd)/substituter.sh
+echo $outPath > $TEST_ROOT/sub-paths
 
-# Register another substitute for the output path.  This one takes
-# precedence over the previous one.  It will fail.
-regSub $outPath $(pwd)/substituter2.sh
+# First try a substituter that fails, then one that succeeds
+export NIX_SUBSTITUTERS=$(pwd)/substituter2.sh:$(pwd)/substituter.sh
 
 $nixstore -rvv "$drvPath"
 
 text=$(cat "$outPath"/hello)
-if test "$text" != "Hallo Wereld"; then exit 1; fi
+if test "$text" != "Hallo Wereld"; then echo "wrong substitute output: $text"; exit 1; fi