Merge pull request #9096 from NixOS/dont-rebuild-twice-on-ci

Don't run the tests that require building if we're not building

(cherry picked from commit 8cfa582f436db8066eff74cb084990367e014ce6)
Change-Id: I6085ca6107349669407340d7a5e52639a2febc90
This commit is contained in:
eldritch horrors 2024-03-04 03:52:05 +01:00
parent 7e966819b5
commit c36ba796dd
2 changed files with 16 additions and 4 deletions

View file

@ -253,6 +253,7 @@
testNixVersions = pkgs: client: daemon: with commonDeps { inherit pkgs; }; with pkgs.lib; pkgs.stdenv.mkDerivation { testNixVersions = pkgs: client: daemon: with commonDeps { inherit pkgs; }; with pkgs.lib; pkgs.stdenv.mkDerivation {
NIX_DAEMON_PACKAGE = daemon; NIX_DAEMON_PACKAGE = daemon;
NIX_CLIENT_PACKAGE = client; NIX_CLIENT_PACKAGE = client;
HAVE_LOCAL_NIX_BUILD = false;
name = name =
"nix-tests" "nix-tests"
+ optionalString + optionalString
@ -272,9 +273,13 @@
enableParallelBuilding = true; enableParallelBuilding = true;
configureFlags = testConfigureFlags; # otherwise configure fails configureFlags = testConfigureFlags; # otherwise configure fails
dontBuild = true;
doInstallCheck = true; doInstallCheck = true;
buildPhase = ''
# Remove the source files to make sure that we're not accidentally rebuilding Nix
rm src/**/*.cc
'';
installPhase = '' installPhase = ''
mkdir -p $out mkdir -p $out
''; '';

View file

@ -1,3 +1,7 @@
# whether to run the tests that assume that we have a local build of
# Nix
HAVE_LOCAL_NIX_BUILD ?= 1
nix_tests = \ nix_tests = \
test-infra.sh \ test-infra.sh \
init.sh \ init.sh \
@ -118,7 +122,6 @@ nix_tests = \
flakes/show.sh \ flakes/show.sh \
impure-derivations.sh \ impure-derivations.sh \
path-from-hash-part.sh \ path-from-hash-part.sh \
test-libstoreconsumer.sh \
toString-path.sh \ toString-path.sh \
read-only-store.sh \ read-only-store.sh \
nested-sandboxing.sh nested-sandboxing.sh
@ -127,8 +130,12 @@ ifeq ($(HAVE_LIBCPUID), 1)
nix_tests += compute-levels.sh nix_tests += compute-levels.sh
endif endif
ifeq ($(BUILD_SHARED_LIBS), 1) ifeq ($(HAVE_LOCAL_NIX_BUILD), 1)
nix_tests += plugins.sh nix_tests += test-libstoreconsumer.sh
ifeq ($(BUILD_SHARED_LIBS), 1)
nix_tests += plugins.sh
endif
endif endif
$(d)/test-libstoreconsumer.sh.test $(d)/test-libstoreconsumer.sh.test-debug: \ $(d)/test-libstoreconsumer.sh.test $(d)/test-libstoreconsumer.sh.test-debug: \