2006-10-19 19:44:51 +02:00
|
|
|
source common.sh
|
|
|
|
|
2018-10-27 15:40:09 +02:00
|
|
|
clearStore
|
|
|
|
|
2006-10-19 19:44:51 +02:00
|
|
|
RESULT=$TEST_ROOT/result
|
|
|
|
|
2011-10-10 23:32:34 +02:00
|
|
|
dep=$(nix-build -o $RESULT check-refs.nix -A dep)
|
2006-10-19 19:44:51 +02:00
|
|
|
|
|
|
|
# test1 references dep, not itself.
|
2011-10-10 23:32:34 +02:00
|
|
|
test1=$(nix-build -o $RESULT check-refs.nix -A test1)
|
2014-08-21 21:50:19 +02:00
|
|
|
(! nix-store -q --references $test1 | grep -q $test1)
|
2011-10-10 23:32:34 +02:00
|
|
|
nix-store -q --references $test1 | grep -q $dep
|
2006-10-19 19:44:51 +02:00
|
|
|
|
|
|
|
# test2 references src, not itself nor dep.
|
2011-10-10 23:32:34 +02:00
|
|
|
test2=$(nix-build -o $RESULT check-refs.nix -A test2)
|
2014-08-21 21:50:19 +02:00
|
|
|
(! nix-store -q --references $test2 | grep -q $test2)
|
|
|
|
(! nix-store -q --references $test2 | grep -q $dep)
|
2011-10-10 23:32:34 +02:00
|
|
|
nix-store -q --references $test2 | grep -q aux-ref
|
2006-10-19 19:44:51 +02:00
|
|
|
|
|
|
|
# test3 should fail (unallowed ref).
|
2014-08-21 21:50:19 +02:00
|
|
|
(! nix-build -o $RESULT check-refs.nix -A test3)
|
2006-10-19 19:44:51 +02:00
|
|
|
|
|
|
|
# test4 should succeed.
|
2011-10-10 23:32:34 +02:00
|
|
|
nix-build -o $RESULT check-refs.nix -A test4
|
2006-10-19 19:44:51 +02:00
|
|
|
|
|
|
|
# test5 should succeed.
|
2011-10-10 23:32:34 +02:00
|
|
|
nix-build -o $RESULT check-refs.nix -A test5
|
2006-10-19 19:44:51 +02:00
|
|
|
|
|
|
|
# test6 should fail (unallowed self-ref).
|
2014-08-21 21:50:19 +02:00
|
|
|
(! nix-build -o $RESULT check-refs.nix -A test6)
|
2006-10-19 19:44:51 +02:00
|
|
|
|
|
|
|
# test7 should succeed (allowed self-ref).
|
2011-10-10 23:32:34 +02:00
|
|
|
nix-build -o $RESULT check-refs.nix -A test7
|
2006-10-19 19:44:51 +02:00
|
|
|
|
|
|
|
# test8 should fail (toFile depending on derivation output).
|
2014-08-21 21:50:19 +02:00
|
|
|
(! nix-build -o $RESULT check-refs.nix -A test8)
|
2014-08-28 18:57:13 +02:00
|
|
|
|
|
|
|
# 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
|