summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-09 12:57:13 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-09 12:57:13 +0000
commit98df735b5149bc1e39ce6b0bae13fbf7cebcdc05 (patch)
tree9a9549e0689400b71e230ba51317a2590969b63d /tests
parent582e01c06f9ecee25a31c34562926b41dc2856eb (diff)
downloadguix-98df735b5149bc1e39ce6b0bae13fbf7cebcdc05.tar.gz
* Propagate the deriver of a path through the substitute mechanism.
* Removed some dead code (successor stuff) from nix-push.
* Updated terminology in the tests (store expr -> drv path).
* Check that the deriver is set properly in the tests.

Diffstat (limited to 'tests')
-rw-r--r--tests/build-hook.sh6
-rw-r--r--tests/dependencies.sh12
-rw-r--r--tests/fallback.sh10
-rw-r--r--tests/gc-concurrent.sh14
-rw-r--r--tests/gc.sh6
-rw-r--r--tests/locking.sh8
-rw-r--r--tests/nix-pull.sh4
-rw-r--r--tests/parallel.sh6
-rw-r--r--tests/simple.sh6
-rw-r--r--tests/substitutes.sh10
-rw-r--r--tests/substitutes2.sh10
11 files changed, 50 insertions, 42 deletions
diff --git a/tests/build-hook.sh b/tests/build-hook.sh
index 402ed83c96..f11cd15b8b 100644
--- a/tests/build-hook.sh
+++ b/tests/build-hook.sh
@@ -1,10 +1,10 @@
 export NIX_BUILD_HOOK="build-hook.hook.sh"
 
-storeExpr=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix)
+drvPath=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix)
 
-echo "store expr is $storeExpr"
+echo "derivation is $drvPath"
 
-outPath=$($TOP/src/nix-store/nix-store -quf "$storeExpr")
+outPath=$($TOP/src/nix-store/nix-store -quf "$drvPath")
 
 echo "output path is $outPath"
 
diff --git a/tests/dependencies.sh b/tests/dependencies.sh
index 56cb1e4c38..87f0682ac4 100644
--- a/tests/dependencies.sh
+++ b/tests/dependencies.sh
@@ -1,15 +1,15 @@
-storeExpr=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
+drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
 
-echo "store expr is $storeExpr"
+echo "derivation is $drvPath"
 
-outPath=$($TOP/src/nix-store/nix-store -rvv "$storeExpr")
+outPath=$($TOP/src/nix-store/nix-store -rvv "$drvPath")
 
 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 "$storeExpr")
+deps=$($TOP/src/nix-store/nix-store -quR "$drvPath")
 
 echo "output closure contains $deps"
 
@@ -24,3 +24,7 @@ input2OutPath=$(echo "$deps" | grep "dependencies-input-2")
 
 # The referers closure of input-2 should include outPath.
 $TOP/src/nix-store/nix-store -q --referers-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" 
diff --git a/tests/fallback.sh b/tests/fallback.sh
index ac4370c61b..24e5784100 100644
--- a/tests/fallback.sh
+++ b/tests/fallback.sh
@@ -1,14 +1,14 @@
-storeExpr=$($TOP/src/nix-instantiate/nix-instantiate fallback.nix)
-echo "store expr is $storeExpr"
+drvPath=$($TOP/src/nix-instantiate/nix-instantiate fallback.nix)
+echo "derivation is $drvPath"
 
-outPath=$($TOP/src/nix-store/nix-store -q --fallback "$storeExpr")
+outPath=$($TOP/src/nix-store/nix-store -q --fallback "$drvPath")
 echo "output path is $outPath"
 
 # Register a non-existant substitute
-(echo $outPath && echo $TOP/no-such-program && echo 0 && echo 0) | $TOP/src/nix-store/nix-store --substitute
+(echo $outPath && echo "" && echo $TOP/no-such-program && echo 0 && echo 0) | $TOP/src/nix-store/nix-store --substitute
 
 # Build the derivation
-$TOP/src/nix-store/nix-store -r --fallback "$storeExpr"
+$TOP/src/nix-store/nix-store -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 b3fb06535d..8cc24565dc 100644
--- a/tests/gc-concurrent.sh
+++ b/tests/gc-concurrent.sh
@@ -1,17 +1,17 @@
-storeExpr1=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix)
-outPath1=$($TOP/src/nix-store/nix-store -q $storeExpr1)
+drvPath1=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix)
+outPath1=$($TOP/src/nix-store/nix-store -q $drvPath1)
 
-storeExpr2=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent2.nix)
-outPath2=$($TOP/src/nix-store/nix-store -q $storeExpr2)
+drvPath2=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent2.nix)
+outPath2=$($TOP/src/nix-store/nix-store -q $drvPath2)
 
-ln -s $storeExpr2 "$NIX_STATE_DIR"/gcroots/foo2
+ln -s $drvPath2 "$NIX_STATE_DIR"/gcroots/foo2
 
 # Start build #1 in the background.  It starts immediately.
-$TOP/src/nix-store/nix-store -rvv "$storeExpr1" &
+$TOP/src/nix-store/nix-store -rvv "$drvPath1" &
 pid1=$!
 
 # Start build #2 in the background after 3 seconds.
-(sleep 3 && $TOP/src/nix-store/nix-store -rvv "$storeExpr2") &
+(sleep 3 && $TOP/src/nix-store/nix-store -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 e45e35a8c9..9fe0068b38 100644
--- a/tests/gc.sh
+++ b/tests/gc.sh
@@ -1,5 +1,5 @@
-storeExpr=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
-outPath=$($TOP/src/nix-store/nix-store -rvv "$storeExpr")
+drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
+outPath=$($TOP/src/nix-store/nix-store -rvv "$drvPath")
 
 # Set a GC root.
 ln -s $outPath "$NIX_STATE_DIR"/gcroots/foo
@@ -11,4 +11,4 @@ cat $outPath/foobar
 cat $outPath/input-2/bar
 
 # Check that the derivation has been GC'd.
-if cat $storeExpr > /dev/null; then false; fi
+if cat $drvPath > /dev/null; then false; fi
diff --git a/tests/locking.sh b/tests/locking.sh
index 5cafa2910e..eeac569b81 100644
--- a/tests/locking.sh
+++ b/tests/locking.sh
@@ -1,15 +1,15 @@
-storeExpr=$($TOP/src/nix-instantiate/nix-instantiate locking.nix)
+drvPath=$($TOP/src/nix-instantiate/nix-instantiate locking.nix)
 
-echo "store expr is $storeExpr"
+echo "derivation is $drvPath"
 
 for i in 1 2 3 4 5; do
     echo "WORKER $i"
-    $TOP/src/nix-store/nix-store -rvv "$storeExpr" &
+    $TOP/src/nix-store/nix-store -rvv "$drvPath" &
 done
 
 sleep 5
 
-outPath=$($TOP/src/nix-store/nix-store -qvvf "$storeExpr")
+outPath=$($TOP/src/nix-store/nix-store -qvvf "$drvPath")
 
 echo "output path is $outPath"
 
diff --git a/tests/nix-pull.sh b/tests/nix-pull.sh
index 9a17f5bf60..b4a5e33711 100644
--- a/tests/nix-pull.sh
+++ b/tests/nix-pull.sh
@@ -31,3 +31,7 @@ echo "building $drvPath using substitutes..."
 $TOP/src/nix-store/nix-store -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 $(readlink $outPath/input-2) | grep -q -- "-input-2.drv" 
diff --git a/tests/parallel.sh b/tests/parallel.sh
index 0044aaea60..0cc4ea9c34 100644
--- a/tests/parallel.sh
+++ b/tests/parallel.sh
@@ -1,8 +1,8 @@
-storeExpr=$($TOP/src/nix-instantiate/nix-instantiate parallel.nix)
+drvPath=$($TOP/src/nix-instantiate/nix-instantiate parallel.nix)
 
-echo "store expr is $storeExpr"
+echo "derivation is $drvPath"
 
-outPath=$($TOP/src/nix-store/nix-store -qfvv -j10000 "$storeExpr")
+outPath=$($TOP/src/nix-store/nix-store -qfvv -j10000 "$drvPath")
 
 echo "output path is $outPath"
 
diff --git a/tests/simple.sh b/tests/simple.sh
index a5435a53bd..996ef4e78f 100644
--- a/tests/simple.sh
+++ b/tests/simple.sh
@@ -1,8 +1,8 @@
-storeExpr=$($TOP/src/nix-instantiate/nix-instantiate simple.nix)
+drvPath=$($TOP/src/nix-instantiate/nix-instantiate simple.nix)
 
-echo "store expr is $storeExpr"
+echo "derivation is $drvPath"
 
-outPath=$($TOP/src/nix-store/nix-store -rvv "$storeExpr")
+outPath=$($TOP/src/nix-store/nix-store -rvv "$drvPath")
 
 echo "output path is $outPath"
 
diff --git a/tests/substitutes.sh b/tests/substitutes.sh
index 061f5f32af..cfc3fa71a1 100644
--- a/tests/substitutes.sh
+++ b/tests/substitutes.sh
@@ -1,20 +1,20 @@
 # Instantiate.
-storeExpr=$($TOP/src/nix-instantiate/nix-instantiate substitutes.nix)
-echo "store expr is $storeExpr"
+drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes.nix)
+echo "derivation is $drvPath"
 
 # Find the output path.
-outPath=$($TOP/src/nix-store/nix-store -qvv "$storeExpr")
+outPath=$($TOP/src/nix-store/nix-store -qvv "$drvPath")
 echo "output path is $outPath"
 
 regSub() {
-    (echo $1 && echo $2 && echo 3 && echo $outPath && echo Hallo && echo Wereld && echo 0) | $TOP/src/nix-store/nix-store --substitute
+    (echo $1 && echo "" && echo $2 && echo 3 && echo $outPath && echo Hallo && echo Wereld && echo 0) | $TOP/src/nix-store/nix-store --substitute
 }
 
 # Register a substitute for the output path.
 regSub $outPath $(pwd)/substituter.sh
 
 
-$TOP/src/nix-store/nix-store -rvv "$storeExpr"
+$TOP/src/nix-store/nix-store -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 e48e12a8f4..1a7b848ca3 100644
--- a/tests/substitutes2.sh
+++ b/tests/substitutes2.sh
@@ -1,13 +1,13 @@
 # Instantiate.
-storeExpr=$($TOP/src/nix-instantiate/nix-instantiate substitutes2.nix)
-echo "store expr is $storeExpr"
+drvPath=$($TOP/src/nix-instantiate/nix-instantiate substitutes2.nix)
+echo "derivation is $drvPath"
 
 # Find the output path.
-outPath=$($TOP/src/nix-store/nix-store -qvvvvv "$storeExpr")
+outPath=$($TOP/src/nix-store/nix-store -qvvvvv "$drvPath")
 echo "output path is $outPath"
 
 regSub() {
-    (echo $1 && echo $2 && echo 3 && echo $outPath && echo Hallo && echo Wereld && echo 0) | $TOP/src/nix-store/nix-store --substitute
+    (echo $1 && echo "" && echo $2 && echo 3 && echo $outPath && echo Hallo && echo Wereld && echo 0) | $TOP/src/nix-store/nix-store --substitute
 }
 
 # Register a substitute for the output path.
@@ -17,7 +17,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 "$storeExpr"
+$TOP/src/nix-store/nix-store -rvv "$drvPath"
 
 text=$(cat "$outPath"/hello)
 if test "$text" != "Hallo Wereld"; then exit 1; fi