3 # -------------------------------------------------------------------------- #
5 # trivial-builders test
7 # -------------------------------------------------------------------------- #
9 # Execute this build script directly (quick):
12 # $ NIX_PATH="nixpkgs=$PWD" nix-shell -p tests.trivial-builders.references.testScriptBin --run references-test
15 # $ nix run .#tests.trivial-builders.references.testScriptBin
17 # or in the build sandbox with a ~20s VM overhead:
20 # $ nix-build --no-out-link -A tests.trivial-builders.references
23 # $ nix build -L --no-link .#tests.trivial-builders.references
25 # -------------------------------------------------------------------------- #
32 # PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
34 cd "$(dirname "${BASH_SOURCE[0]}")" # nixpkgs root
36 # Inject the path to compare from the Nix expression
39 declare -A samples
=( @SAMPLES@
)
40 declare -A directRefs
=( @DIRECT_REFS@
)
41 declare -A closures
=( @CLOSURES@
)
44 collectiveClosure
=@COLLECTIVE_CLOSURE@
46 echo >&2 Testing direct closures...
47 for i
in "${!samples[@]}"; do
48 echo >&2 Checking
"$i" "${samples[$i]}" "${directRefs[$i]}"
50 <(sort <"${directRefs[$i]}") \
51 <(nix-store
-q --references "${samples[$i]}" |
sort)
54 echo >&2 Testing closure...
55 for i
in "${!samples[@]}"; do
56 echo >&2 Checking
"$i" "${samples[$i]}" "${closures[$i]}"
58 <(sort <"${closures[$i]}") \
59 <(nix-store
-q --requisites "${samples[$i]}" |
sort)
62 echo >&2 Testing mixed closures...
63 echo >&2 Checking all samples
"(${samples[*]})" "$collectiveClosure"
65 <(sort <"$collectiveClosure") \
66 <(nix-store
-q --requisites "${samples[@]}" |
sort)