2024-05-28 19:43:04 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-03-01 02:15:05 +02:00
|
|
|
source common.sh
|
|
|
|
|
|
|
|
clearStore
|
|
|
|
|
|
|
|
# https://github.com/NixOS/nix/issues/6572
|
|
|
|
issue_6572_independent_outputs() {
|
2024-06-03 23:47:41 +03:00
|
|
|
nix build -f multiple-outputs.nix --json independent --no-link > "$TEST_ROOT"/independent.json
|
2021-03-01 02:15:05 +02:00
|
|
|
|
|
|
|
# Make sure that 'nix build' can build a derivation that depends on both outputs of another derivation.
|
|
|
|
p=$(nix build -f multiple-outputs.nix use-independent --no-link --print-out-paths)
|
|
|
|
nix-store --delete "$p" # Clean up for next test
|
|
|
|
|
|
|
|
# Make sure that 'nix build' tracks input-outputs correctly when a single output is already present.
|
2024-06-03 23:47:41 +03:00
|
|
|
nix-store --delete "$(jq -r <"$TEST_ROOT"/independent.json .[0].outputs.first)"
|
2021-03-01 02:15:05 +02:00
|
|
|
p=$(nix build -f multiple-outputs.nix use-independent --no-link --print-out-paths)
|
2024-06-03 23:47:41 +03:00
|
|
|
cmp "$p" <<EOF
|
2021-03-01 02:15:05 +02:00
|
|
|
first
|
|
|
|
second
|
|
|
|
EOF
|
|
|
|
nix-store --delete "$p" # Clean up for next test
|
|
|
|
|
|
|
|
# Make sure that 'nix build' tracks input-outputs correctly when a single output is already present.
|
2024-06-03 23:47:41 +03:00
|
|
|
nix-store --delete "$(jq -r <"$TEST_ROOT"/independent.json .[0].outputs.second)"
|
2021-03-01 02:15:05 +02:00
|
|
|
p=$(nix build -f multiple-outputs.nix use-independent --no-link --print-out-paths)
|
2024-06-03 23:47:41 +03:00
|
|
|
cmp "$p" <<EOF
|
2021-03-01 02:15:05 +02:00
|
|
|
first
|
|
|
|
second
|
|
|
|
EOF
|
|
|
|
nix-store --delete "$p" # Clean up for next test
|
|
|
|
}
|
|
|
|
issue_6572_independent_outputs
|
|
|
|
|
|
|
|
|
|
|
|
# https://github.com/NixOS/nix/issues/6572
|
|
|
|
issue_6572_dependent_outputs() {
|
|
|
|
|
2024-06-03 23:47:41 +03:00
|
|
|
nix build -f multiple-outputs.nix --json a --no-link > "$TEST_ROOT"/a.json
|
2021-03-01 02:15:05 +02:00
|
|
|
|
|
|
|
# # Make sure that 'nix build' can build a derivation that depends on both outputs of another derivation.
|
|
|
|
p=$(nix build -f multiple-outputs.nix use-a --no-link --print-out-paths)
|
|
|
|
nix-store --delete "$p" # Clean up for next test
|
|
|
|
|
|
|
|
# Make sure that 'nix build' tracks input-outputs correctly when a single output is already present.
|
2024-06-03 23:47:41 +03:00
|
|
|
nix-store --delete "$(jq -r <"$TEST_ROOT"/a.json .[0].outputs.second)"
|
2021-03-01 02:15:05 +02:00
|
|
|
p=$(nix build -f multiple-outputs.nix use-a --no-link --print-out-paths)
|
2024-06-03 23:47:41 +03:00
|
|
|
cmp "$p" <<EOF
|
2021-03-01 02:15:05 +02:00
|
|
|
first
|
|
|
|
second
|
|
|
|
EOF
|
|
|
|
nix-store --delete "$p" # Clean up for next test
|
|
|
|
}
|
|
|
|
if isDaemonNewer "2.12pre0"; then
|
|
|
|
issue_6572_dependent_outputs
|
|
|
|
fi
|