From 3e664255d65b04d380bd594c2072985994e77e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 18 Aug 2025 16:50:20 +0200 Subject: [PATCH] speed up tests by doing reflink copies --- pkgs/testing/flake-module.nix | 5 ++--- pkgs/testing/nixos_test_lib/nix_setup.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/testing/flake-module.nix b/pkgs/testing/flake-module.nix index 235514393..3772259e9 100644 --- a/pkgs/testing/flake-module.nix +++ b/pkgs/testing/flake-module.nix @@ -15,8 +15,7 @@ mkdir -p "$CLAN_TEST_STORE/nix/store" mkdir -p "$CLAN_TEST_STORE/nix/var/nix/gcroots" 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.coreutils}/bin/cp --recursive --target "$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.nix}/bin/nix-store --load-db --store "$CLAN_TEST_STORE" < "$closureInfo/registration" fi ''; @@ -39,7 +38,7 @@ ]; postPatch = '' 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 '@xargs@' '${pkgs.findutils}/bin/xargs' ''; diff --git a/pkgs/testing/nixos_test_lib/nix_setup.py b/pkgs/testing/nixos_test_lib/nix_setup.py index 5e0ebc8dd..e5fe50d9b 100644 --- a/pkgs/testing/nixos_test_lib/nix_setup.py +++ b/pkgs/testing/nixos_test_lib/nix_setup.py @@ -5,7 +5,7 @@ import subprocess from pathlib import Path # These paths will be substituted during package build -CP_BIN = "@cp@" +XCP_BIN = "@xcp@" NIX_STORE_BIN = "@nix-store@" XARGS_BIN = "@xargs@" @@ -52,7 +52,7 @@ def setup_nix_in_nix(closure_info: str | None) -> None: subprocess.run( # noqa: S603 [ XARGS_BIN, - CP_BIN, + XCP_BIN, "--recursive", "--target-directory", f"{tmpdir}/store/nix/store",