From 9b506ff0c1e48fa805eab86eb43bd99ac1ae24a3 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 29 Feb 2024 10:06:53 -0500 Subject: [PATCH] Activate `hermetic.nix` variation only for new layered store tests --- tests/functional/hermetic.nix | 9 +++++++-- tests/functional/local-overlay-store/common.sh | 2 +- .../functional/local-overlay-store/delete-refs-inner.sh | 8 ++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/functional/hermetic.nix b/tests/functional/hermetic.nix index 810180ac6..d1dccdff3 100644 --- a/tests/functional/hermetic.nix +++ b/tests/functional/hermetic.nix @@ -1,4 +1,9 @@ -{ busybox, seed }: +{ busybox +, seed +# If we want the final derivation output to have references to its +# dependencies. Some tests need/want this, other don't. +, withFinalRefs ? false +}: with import ./config.nix; @@ -54,6 +59,6 @@ in '' read x < ${input1} read y < ${input3} - echo ${input1} ${input3} "$x $y" > $out + echo ${if (builtins.trace withFinalRefs withFinalRefs) then "${input1} ${input3}" else ""} "$x $y" > $out ''; } diff --git a/tests/functional/local-overlay-store/common.sh b/tests/functional/local-overlay-store/common.sh index e1da00b42..13d921c5e 100644 --- a/tests/functional/local-overlay-store/common.sh +++ b/tests/functional/local-overlay-store/common.sh @@ -65,7 +65,7 @@ initLowerStore () { nix-store --store "$storeA" --add ../dummy # Build something in lower store - drvPath=$(nix-instantiate --store $storeA ../hermetic.nix --arg busybox "$busybox" --arg seed 1) + drvPath=$(nix-instantiate --store $storeA ../hermetic.nix --arg withFinalRefs true --arg busybox "$busybox" --arg seed 1) pathInLowerStore=$(nix-store --store "$storeA" --realise $drvPath) } diff --git a/tests/functional/local-overlay-store/delete-refs-inner.sh b/tests/functional/local-overlay-store/delete-refs-inner.sh index e24f34a85..385eeadc9 100644 --- a/tests/functional/local-overlay-store/delete-refs-inner.sh +++ b/tests/functional/local-overlay-store/delete-refs-inner.sh @@ -16,10 +16,10 @@ mountOverlayfs export NIX_REMOTE="$storeB" stateB="$storeBRoot/nix/var/nix" -hermetic=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg seed 2) -input1=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg seed 2 -A passthru.input1 -j0) -input2=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg seed 2 -A passthru.input2 -j0) -input3=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg seed 2 -A passthru.input3 -j0) +hermetic=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg withFinalRefs true --arg seed 2) +input1=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg withFinalRefs true --arg seed 2 -A passthru.input1 -j0) +input2=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg withFinalRefs true --arg seed 2 -A passthru.input2 -j0) +input3=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg withFinalRefs true --arg seed 2 -A passthru.input3 -j0) # Can't delete because referenced expectStderr 1 nix-store --delete $input1 | grepQuiet "Cannot delete path"