about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/binary-cache.sh35
-rw-r--r--tests/binary-patching.sh9
-rw-r--r--tests/common.sh.in3
-rw-r--r--tests/install-package.sh2
-rw-r--r--tests/nix-channel.sh2
-rw-r--r--tests/nix-pull.sh2
-rw-r--r--tests/nix-push.sh4
-rw-r--r--tests/referrers.sh2
-rw-r--r--tests/remote-store.sh2
-rwxr-xr-xtests/substituter.sh32
-rwxr-xr-xtests/substituter2.sh32
12 files changed, 90 insertions, 38 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a562db52bc57..641e29d7e7a7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -9,7 +9,8 @@ TESTS = init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \
   gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \
   remote-store.sh export.sh export-graph.sh negative-caching.sh \
   binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh \
-  multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh
+  multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \
+  binary-cache.sh
 
 XFAIL_TESTS =
 
diff --git a/tests/binary-cache.sh b/tests/binary-cache.sh
new file mode 100644
index 000000000000..0704a2bb3b8f
--- /dev/null
+++ b/tests/binary-cache.sh
@@ -0,0 +1,35 @@
+source common.sh
+
+clearStore
+
+# Create the binary cache.
+cacheDir=$TEST_ROOT/binary-cache
+rm -rf $cacheDir
+
+outPath=$(nix-build dependencies.nix --no-out-link)
+
+nix-push --dest $cacheDir $outPath
+
+
+# By default, a binary cache doesn't support "nix-env -qas", but does
+# support installation.
+clearStore
+rm -f $NIX_STATE_DIR/binary-cache*
+
+nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "---"
+
+nix-store --option binary-caches "file://$cacheDir" -r $outPath
+
+
+# But with the right configuration, "nix-env -qas" should also work.
+clearStore
+rm -f $NIX_STATE_DIR/binary-cache*
+echo "WantMassQuery: 1" >> $cacheDir/nix-cache-info
+
+nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "--S"
+
+nix-store --option binary-caches "file://$cacheDir" -r $outPath
+
+nix-store --check-validity $outPath
+nix-store -qR $outPath | grep input-2
+
diff --git a/tests/binary-patching.sh b/tests/binary-patching.sh
index 8c52c2f1421b..188be109a0b5 100644
--- a/tests/binary-patching.sh
+++ b/tests/binary-patching.sh
@@ -7,14 +7,17 @@ mkdir -p $TEST_ROOT/cache2 $TEST_ROOT/patches
 RESULT=$TEST_ROOT/result
 
 # Build version 1 and 2 of the "foo" package.
-nix-push --copy $TEST_ROOT/cache2 $TEST_ROOT/manifest1 \
+nix-push --dest $TEST_ROOT/cache2 --manifest --bzip2 \
     $(nix-build -o $RESULT binary-patching.nix --arg version 1)
+mv $TEST_ROOT/cache2/MANIFEST $TEST_ROOT/manifest1 
 
 out2=$(nix-build -o $RESULT binary-patching.nix --arg version 2)
-nix-push --copy $TEST_ROOT/cache2 $TEST_ROOT/manifest2 $out2
+nix-push --dest $TEST_ROOT/cache2 --manifest --bzip2 $out2
+mv $TEST_ROOT/cache2/MANIFEST $TEST_ROOT/manifest2
     
 out3=$(nix-build -o $RESULT binary-patching.nix --arg version 3)
-nix-push --copy $TEST_ROOT/cache2 $TEST_ROOT/manifest3 $out3
+nix-push --dest $TEST_ROOT/cache2 --manifest --bzip2 $out3
+mv $TEST_ROOT/cache2/MANIFEST $TEST_ROOT/manifest3
 
 rm $RESULT
 
diff --git a/tests/common.sh.in b/tests/common.sh.in
index 031a0d66d1b8..1d473ca0585e 100644
--- a/tests/common.sh.in
+++ b/tests/common.sh.in
@@ -16,6 +16,7 @@ export NIX_DB_DIR=$TEST_ROOT/db
 export NIX_CONF_DIR=$TEST_ROOT/etc
 export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
 export SHARED=$TEST_ROOT/shared
+export NIX_REMOTE=$NIX_REMOTE_
 
 export PATH=@bindir@:$PATH
 
@@ -79,3 +80,5 @@ fail() {
     echo "$1"
     exit 1
 }
+
+set -x
diff --git a/tests/install-package.sh b/tests/install-package.sh
index b818eda121cf..653dfee4c8d1 100644
--- a/tests/install-package.sh
+++ b/tests/install-package.sh
@@ -9,7 +9,7 @@ clearStore
 clearProfiles
 
 cat > $TEST_ROOT/foo.nixpkg <<EOF
-NIXPKG1 file://$TEST_ROOT/manifest simple $system $drvPath $outPath
+NIXPKG1 file://$TEST_ROOT/cache/MANIFEST simple $system $drvPath $outPath
 EOF
 
 nix-install-package --non-interactive -p $profiles/test $TEST_ROOT/foo.nixpkg
diff --git a/tests/nix-channel.sh b/tests/nix-channel.sh
index eb1d572953d7..a25d56bec11e 100644
--- a/tests/nix-channel.sh
+++ b/tests/nix-channel.sh
@@ -19,7 +19,7 @@ nix-channel --remove xyzzy
 # Create a channel.
 rm -rf $TEST_ROOT/foo
 mkdir -p $TEST_ROOT/foo
-nix-push --copy $TEST_ROOT/foo $TEST_ROOT/foo/MANIFEST $(nix-store -r $(nix-instantiate dependencies.nix))
+nix-push --dest $TEST_ROOT/foo --manifest --bzip2 $(nix-store -r $(nix-instantiate dependencies.nix))
 rm -rf $TEST_ROOT/nixexprs
 mkdir -p $TEST_ROOT/nixexprs
 cp config.nix dependencies.nix dependencies.builder*.sh $TEST_ROOT/nixexprs/
diff --git a/tests/nix-pull.sh b/tests/nix-pull.sh
index 9a89676cb99f..79e7ae26b5cc 100644
--- a/tests/nix-pull.sh
+++ b/tests/nix-pull.sh
@@ -2,7 +2,7 @@ source common.sh
 
 pullCache () {
     echo "pulling cache..."
-    nix-pull file://$TEST_ROOT/manifest
+    nix-pull file://$TEST_ROOT/cache/MANIFEST
 }
 
 clearStore
diff --git a/tests/nix-push.sh b/tests/nix-push.sh
index 69f05141af69..8ea59516c62c 100644
--- a/tests/nix-push.sh
+++ b/tests/nix-push.sh
@@ -1,5 +1,7 @@
 source common.sh
 
+clearStore
+
 drvPath=$(nix-instantiate dependencies.nix)
 outPath=$(nix-store -r $drvPath)
 
@@ -7,4 +9,4 @@ echo "pushing $drvPath"
 
 mkdir -p $TEST_ROOT/cache
 
-nix-push --copy $TEST_ROOT/cache $TEST_ROOT/manifest $drvPath
+nix-push --dest $TEST_ROOT/cache --manifest $drvPath --bzip2
diff --git a/tests/referrers.sh b/tests/referrers.sh
index d4604aec930b..e57b2d8e31ff 100644
--- a/tests/referrers.sh
+++ b/tests/referrers.sh
@@ -10,6 +10,7 @@ touch $reference
 
 echo "making registration..."
 
+set +x
 for ((n = 0; n < $max; n++)); do
     storePath=$NIX_STORE_DIR/$n
     echo -n > $storePath
@@ -19,6 +20,7 @@ for ((n = 0; n < $max; n++)); do
     fi
     echo $storePath; echo; echo 2; echo $reference; echo $ref2
 done > $TEST_ROOT/reg_info
+set -x
 
 echo "registering..."
 
diff --git a/tests/remote-store.sh b/tests/remote-store.sh
index e27631a006ea..ef289ab79a1a 100644
--- a/tests/remote-store.sh
+++ b/tests/remote-store.sh
@@ -3,7 +3,7 @@ source common.sh
 echo '*** testing slave mode ***'
 clearStore
 clearManifests
-NIX_REMOTE=slave $SHELL ./user-envs.sh
+NIX_REMOTE_=slave $SHELL ./user-envs.sh
 
 echo '*** testing daemon mode ***'
 clearStore
diff --git a/tests/substituter.sh b/tests/substituter.sh
index 65c4fa1856d0..885655760e05 100755
--- a/tests/substituter.sh
+++ b/tests/substituter.sh
@@ -2,22 +2,25 @@
 echo substituter args: $* >&2
 
 if test $1 = "--query"; then
-    while read cmd; do
-        echo FOO $cmd >&2
+    while read cmd args; do
+        echo "CMD = $cmd, ARGS = $args" >&2
         if test "$cmd" = "have"; then
-            read path
-            if grep -q "$path" $TEST_ROOT/sub-paths; then
-                echo 1
-            else
-                echo 0
-            fi
+            for path in $args; do 
+                read path
+                if grep -q "$path" $TEST_ROOT/sub-paths; then
+                    echo $path
+                fi
+            done
+            echo
         elif test "$cmd" = "info"; then
-            read path
-            echo 1
-            echo "" # deriver
-            echo 0 # nr of refs
-            echo $((1 * 1024 * 1024)) # download size
-            echo $((2 * 1024 * 1024)) # nar size
+            for path in $args; do
+                echo $path
+                echo "" # deriver
+                echo 0 # nr of refs
+                echo $((1 * 1024 * 1024)) # download size
+                echo $((2 * 1024 * 1024)) # nar size
+            done
+            echo
         else
             echo "bad command $cmd"
             exit 1
@@ -26,6 +29,7 @@ if test $1 = "--query"; then
 elif test $1 = "--substitute"; then
     mkdir $2
     echo "Hallo Wereld" > $2/hello
+    echo # no expected hash
 else
     echo "unknown substituter operation"
     exit 1
diff --git a/tests/substituter2.sh b/tests/substituter2.sh
index c56a1bc47b5c..34b2c0eafaf8 100755
--- a/tests/substituter2.sh
+++ b/tests/substituter2.sh
@@ -2,21 +2,23 @@
 echo substituter2 args: $* >&2
 
 if test $1 = "--query"; then
-    while read cmd; do
-        if test "$cmd" = "have"; then
-            read path
-            if grep -q "$path" $TEST_ROOT/sub-paths; then
-                echo 1
-            else
-                echo 0
-            fi
-        elif test "$cmd" = "info"; then
-            read path
-            echo 1
-            echo "" # deriver
-            echo 0 # nr of refs
-            echo 0 # download size
-            echo 0 # nar size
+    while read cmd args; do
+        if test "$cmd" = have; then
+            for path in $args; do
+                if grep -q "$path" $TEST_ROOT/sub-paths; then
+                    echo $path
+                fi
+            done
+            echo
+        elif test "$cmd" = info; then
+            for path in $args; do
+                echo $path
+                echo "" # deriver
+                echo 0 # nr of refs
+                echo 0 # download size
+                echo 0 # nar size
+            done
+            echo
         else
             echo "bad command $cmd"
             exit 1