speed up tests by doing reflink copies

This commit is contained in:
Jörg Thalheim
2025-08-18 16:50:20 +02:00
parent 5b1a9d6848
commit 3e664255d6
2 changed files with 4 additions and 5 deletions

View File

@@ -15,8 +15,7 @@
mkdir -p "$CLAN_TEST_STORE/nix/store" mkdir -p "$CLAN_TEST_STORE/nix/store"
mkdir -p "$CLAN_TEST_STORE/nix/var/nix/gcroots" mkdir -p "$CLAN_TEST_STORE/nix/var/nix/gcroots"
if [[ -n "''${closureInfo-}" ]]; then if [[ -n "''${closureInfo-}" ]]; then
# ${pkgs.findutils}/bin/xargs ${pkgs.xcp}/bin/xcp --recursive --target-directory "$CLAN_TEST_STORE/nix/store" < "$closureInfo/store-paths" ${pkgs.findutils}/bin/xargs ${pkgs.xcp}/bin/xcp --recursive --target-directory "$CLAN_TEST_STORE/nix/store" < "$closureInfo/store-paths"
${pkgs.findutils}/bin/xargs ${pkgs.coreutils}/bin/cp --recursive --target "$CLAN_TEST_STORE/nix/store" < "$closureInfo/store-paths"
${pkgs.nix}/bin/nix-store --load-db --store "$CLAN_TEST_STORE" < "$closureInfo/registration" ${pkgs.nix}/bin/nix-store --load-db --store "$CLAN_TEST_STORE" < "$closureInfo/registration"
fi fi
''; '';
@@ -39,7 +38,7 @@
]; ];
postPatch = '' postPatch = ''
substituteInPlace nixos_test_lib/nix_setup.py \ substituteInPlace nixos_test_lib/nix_setup.py \
--replace '@cp@' '${pkgs.coreutils}/bin/cp' \ --replace '@xcp@' '${pkgs.xcp}/bin/xcp' \
--replace '@nix-store@' '${pkgs.nix}/bin/nix-store' \ --replace '@nix-store@' '${pkgs.nix}/bin/nix-store' \
--replace '@xargs@' '${pkgs.findutils}/bin/xargs' --replace '@xargs@' '${pkgs.findutils}/bin/xargs'
''; '';

View File

@@ -5,7 +5,7 @@ import subprocess
from pathlib import Path from pathlib import Path
# These paths will be substituted during package build # These paths will be substituted during package build
CP_BIN = "@cp@" XCP_BIN = "@xcp@"
NIX_STORE_BIN = "@nix-store@" NIX_STORE_BIN = "@nix-store@"
XARGS_BIN = "@xargs@" XARGS_BIN = "@xargs@"
@@ -52,7 +52,7 @@ def setup_nix_in_nix(closure_info: str | None) -> None:
subprocess.run( # noqa: S603 subprocess.run( # noqa: S603
[ [
XARGS_BIN, XARGS_BIN,
CP_BIN, XCP_BIN,
"--recursive", "--recursive",
"--target-directory", "--target-directory",
f"{tmpdir}/store/nix/store", f"{tmpdir}/store/nix/store",