2006-10-19 20:44:51 +03:00
|
|
|
source common.sh
|
|
|
|
|
2018-10-27 16:40:09 +03:00
|
|
|
clearStore
|
|
|
|
|
2006-10-19 20:44:51 +03:00
|
|
|
RESULT=$TEST_ROOT/result
|
|
|
|
|
2011-10-11 00:32:34 +03:00
|
|
|
dep=$(nix-build -o $RESULT check-refs.nix -A dep)
|
2006-10-19 20:44:51 +03:00
|
|
|
|
|
|
|
# test1 references dep, not itself.
|
2011-10-11 00:32:34 +03:00
|
|
|
test1=$(nix-build -o $RESULT check-refs.nix -A test1)
|
2021-12-09 17:26:46 +02:00
|
|
|
nix-store -q --references $test1 | grepQuietInverse $test1
|
|
|
|
nix-store -q --references $test1 | grepQuiet $dep
|
2006-10-19 20:44:51 +03:00
|
|
|
|
|
|
|
# test2 references src, not itself nor dep.
|
2011-10-11 00:32:34 +03:00
|
|
|
test2=$(nix-build -o $RESULT check-refs.nix -A test2)
|
2021-12-09 17:26:46 +02:00
|
|
|
nix-store -q --references $test2 | grepQuietInverse $test2
|
|
|
|
nix-store -q --references $test2 | grepQuietInverse $dep
|
|
|
|
nix-store -q --references $test2 | grepQuiet aux-ref
|
2006-10-19 20:44:51 +03:00
|
|
|
|
|
|
|
# test3 should fail (unallowed ref).
|
2014-08-21 22:50:19 +03:00
|
|
|
(! nix-build -o $RESULT check-refs.nix -A test3)
|
2006-10-19 20:44:51 +03:00
|
|
|
|
|
|
|
# test4 should succeed.
|
2011-10-11 00:32:34 +03:00
|
|
|
nix-build -o $RESULT check-refs.nix -A test4
|
2006-10-19 20:44:51 +03:00
|
|
|
|
|
|
|
# test5 should succeed.
|
2011-10-11 00:32:34 +03:00
|
|
|
nix-build -o $RESULT check-refs.nix -A test5
|
2006-10-19 20:44:51 +03:00
|
|
|
|
|
|
|
# test6 should fail (unallowed self-ref).
|
2014-08-21 22:50:19 +03:00
|
|
|
(! nix-build -o $RESULT check-refs.nix -A test6)
|
2006-10-19 20:44:51 +03:00
|
|
|
|
|
|
|
# test7 should succeed (allowed self-ref).
|
2011-10-11 00:32:34 +03:00
|
|
|
nix-build -o $RESULT check-refs.nix -A test7
|
2006-10-19 20:44:51 +03:00
|
|
|
|
|
|
|
# test8 should fail (toFile depending on derivation output).
|
2014-08-21 22:50:19 +03:00
|
|
|
(! nix-build -o $RESULT check-refs.nix -A test8)
|
2014-08-28 19:57:13 +03: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
|
2022-09-24 00:30:29 +03:00
|
|
|
|
|
|
|
if isDaemonNewer 2.12pre20230103; then
|
2023-05-12 10:56:39 +03:00
|
|
|
if ! isDaemonNewer 2.16.0; then
|
|
|
|
enableFeatures discard-references
|
|
|
|
restartDaemon
|
|
|
|
fi
|
2022-09-24 00:30:29 +03:00
|
|
|
|
|
|
|
# test11 should succeed.
|
|
|
|
test11=$(nix-build -o $RESULT check-refs.nix -A test11)
|
|
|
|
[[ -z $(nix-store -q --references "$test11") ]]
|
|
|
|
fi
|