aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-10-30 12:33:40 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-10-30 12:34:30 +0100
commit1f735a34406c1856fd2f6f9a522a06b429c4f799 (patch)
tree0d3495cc6cb753b5b241ceb2d85ff98f831e37ec /tests
parentdae5dc7ade60aa6a9a05e41133da7faebe6bdc1b (diff)
<nix/fetchurl.nix>: Support xz-compressed NARs
Diffstat (limited to 'tests')
-rw-r--r--tests/fetchurl.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/fetchurl.sh b/tests/fetchurl.sh
index 495d42a25..b6fa3a27e 100644
--- a/tests/fetchurl.sh
+++ b/tests/fetchurl.sh
@@ -2,12 +2,14 @@ source common.sh
clearStore
+# Test fetching a flat file.
hash=$(nix-hash --flat --type sha256 ./fetchurl.sh)
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr sha256 $hash --no-out-link)
cmp $outPath fetchurl.sh
+# Test unpacking a NAR.
rm -rf $TEST_ROOT/archive
mkdir -p $TEST_ROOT/archive
cp ./fetchurl.sh $TEST_ROOT/archive
@@ -25,3 +27,15 @@ echo $outPath | grep -q 'xyzzy'
test -x $outPath/fetchurl.sh
test -L $outPath/symlink
+
+nix-store --delete $outPath
+
+# Test unpacking a compressed NAR.
+narxz=$TEST_ROOT/archive.nar.xz
+rm -f $narxz
+xz --keep $nar
+outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$narxz --argstr sha256 $hash \
+ --arg unpack true --argstr name xyzzy --no-out-link)
+
+test -x $outPath/fetchurl.sh
+test -L $outPath/symlink