about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-01-19T13·53+0100
committerEelco Dolstra <edolstra@gmail.com>2018-01-19T14·00+0100
commit3c4c30eadd879f512ac2075a7ba39c37ff77bf5c (patch)
treef6588bf8f0c0ab2d117ae27a09ed7cd7c4dd4a8c /tests
parent2896bb682691e8ce2be055a386bdeef93ae05586 (diff)
Rewrite builtin derivation environment
Also add a test.

Fixes #1803.
Closes #1805.
Diffstat (limited to 'tests')
-rw-r--r--tests/check.nix5
-rw-r--r--tests/check.sh14
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/check.nix b/tests/check.nix
index b330ab9c984c..585d43032a91 100644
--- a/tests/check.nix
+++ b/tests/check.nix
@@ -9,4 +9,9 @@ with import ./config.nix;
         date +%s.%N > $out/date
       '';
   };
+
+  fetchurl = import <nix/fetchurl.nix> {
+    url = "file://" + toString ./lang/eval-okay-xml.out;
+    sha256 = "426fefcd2430e986551db13fcc2b1e45eeec17e68ffeb6ff155be2f8aaf5407e";
+  };
 }
diff --git a/tests/check.sh b/tests/check.sh
index 3efcef044921..a3067e06f149 100644
--- a/tests/check.sh
+++ b/tests/check.sh
@@ -16,3 +16,17 @@ nix-build dependencies.nix --no-out-link --repeat 3
 (! nix-build check.nix -A nondeterministic --no-out-link --repeat 1 2> $TEST_ROOT/log)
 grep 'differs from previous round' $TEST_ROOT/log
 
+path=$(nix-build check.nix -A fetchurl --no-out-link)
+
+chmod +w $path
+echo foo > $path
+chmod -w $path
+
+nix-build check.nix -A fetchurl --no-out-link --check
+
+# Note: "check" doesn't repair anything, it just compares to the hash stored in the database.
+[[ $(cat $path) = foo ]]
+
+nix-build check.nix -A fetchurl --no-out-link --repair
+
+[[ $(cat $path) != foo ]]