about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/check-refs.nix12
-rw-r--r--tests/check-refs.sh6
-rw-r--r--tests/check-reqs.nix14
-rw-r--r--tests/check-reqs.sh5
4 files changed, 35 insertions, 2 deletions
diff --git a/tests/check-refs.nix b/tests/check-refs.nix
index 63791fe16094..9d90b0920542 100644
--- a/tests/check-refs.nix
+++ b/tests/check-refs.nix
@@ -55,4 +55,16 @@ rec {
     inherit dep;
   };
 
+  test9 = makeTest 9 {
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
+    inherit dep;
+    disallowedReferences = [dep];
+  };
+
+  test10 = makeTest 10 {
+    builder = builtins.toFile "builder.sh" "mkdir $out; echo $test5; ln -s $dep $out/link";
+    inherit dep test5;
+    disallowedReferences = [test5];
+  };
+
 }
diff --git a/tests/check-refs.sh b/tests/check-refs.sh
index 9e103664a3a7..34ee22cfc8f7 100644
--- a/tests/check-refs.sh
+++ b/tests/check-refs.sh
@@ -32,3 +32,9 @@ nix-build -o $RESULT check-refs.nix -A test7
 
 # test8 should fail (toFile depending on derivation output).
 (! nix-build -o $RESULT check-refs.nix -A test8)
+
+# test9 should fail (disallowed reference).
+(! nix-build -o $RESULT check-refs.nix -A test9)
+
+# test10 should succeed (no disallowed references).
+nix-build -o $RESULT check-refs.nix -A test10
diff --git a/tests/check-reqs.nix b/tests/check-reqs.nix
index 5af8ea6fa185..41436cb48e08 100644
--- a/tests/check-reqs.nix
+++ b/tests/check-reqs.nix
@@ -40,4 +40,18 @@ rec {
   test3 = makeTest 3 [ dep1 deps ];
   test4 = makeTest 4 [ deps ];
   test5 = makeTest 5 [];
+
+  test6 = mkDerivation {
+    name = "check-reqs";
+    inherit deps;
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $deps $out/depdir1";
+    disallowedRequisites = [dep1];
+  };
+
+  test7 = mkDerivation {
+    name = "check-reqs";
+    inherit deps;
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $deps $out/depdir1";
+    disallowedRequisites = [test1];
+  };
 }
diff --git a/tests/check-reqs.sh b/tests/check-reqs.sh
index 643c2d0cdc0d..8b2454915a52 100644
--- a/tests/check-reqs.sh
+++ b/tests/check-reqs.sh
@@ -2,11 +2,12 @@ source common.sh
 
 RESULT=$TEST_ROOT/result
 
-# test1 should succeed.
 nix-build -o $RESULT check-reqs.nix -A test1
 
-# test{2,3,4,5} should fail.
 (! nix-build -o $RESULT check-reqs.nix -A test2)
 (! nix-build -o $RESULT check-reqs.nix -A test3)
 (! nix-build -o $RESULT check-reqs.nix -A test4)
 (! nix-build -o $RESULT check-reqs.nix -A test5)
+(! nix-build -o $RESULT check-reqs.nix -A test6)
+
+nix-build -o $RESULT check-reqs.nix -A test7