@@ -70,3 +70,54 @@ testNormalization () {
7070}
7171
7272testNormalization
73+
74+ # https://github.com/NixOS/nix/issues/6572
75+ issue_6572_independent_outputs () {
76+ nix build -f multiple-outputs.nix --json independent --no-link > $TEST_ROOT /independent.json
77+
78+ # Make sure that 'nix build' can build a derivation that depends on both outputs of another derivation.
79+ p=$( nix build -f multiple-outputs.nix use-independent --no-link --print-out-paths)
80+ nix-store --delete " $p " # Clean up for next test
81+
82+ # Make sure that 'nix build' tracks input-outputs correctly when a single output is already present.
83+ nix-store --delete " $( jq -r < $TEST_ROOT /independent.json .[0].outputs.first) "
84+ p=$( nix build -f multiple-outputs.nix use-independent --no-link --print-out-paths)
85+ cmp $p << EOF
86+ first
87+ second
88+ EOF
89+ nix-store --delete " $p " # Clean up for next test
90+
91+ # Make sure that 'nix build' tracks input-outputs correctly when a single output is already present.
92+ nix-store --delete " $( jq -r < $TEST_ROOT /independent.json .[0].outputs.second) "
93+ p=$( nix build -f multiple-outputs.nix use-independent --no-link --print-out-paths)
94+ cmp $p << EOF
95+ first
96+ second
97+ EOF
98+ nix-store --delete " $p " # Clean up for next test
99+ }
100+ issue_6572_independent_outputs
101+
102+
103+ # https://github.com/NixOS/nix/issues/6572
104+ issue_6572_dependent_outputs () {
105+
106+ nix build -f multiple-outputs.nix --json a --no-link > $TEST_ROOT /a.json
107+
108+ # # Make sure that 'nix build' can build a derivation that depends on both outputs of another derivation.
109+ p=$( nix build -f multiple-outputs.nix use-a --no-link --print-out-paths)
110+ nix-store --delete " $p " # Clean up for next test
111+
112+ # Make sure that 'nix build' tracks input-outputs correctly when a single output is already present.
113+ nix-store --delete " $( jq -r < $TEST_ROOT /a.json .[0].outputs.second) "
114+ p=$( nix build -f multiple-outputs.nix use-a --no-link --print-out-paths)
115+ cmp $p << EOF
116+ first
117+ second
118+ EOF
119+ nix-store --delete " $p " # Clean up for next test
120+ }
121+ if isDaemonNewer " 2.12pre0" ; then
122+ issue_6572_dependent_outputs
123+ fi
0 commit comments