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

Don't run the tests that require building if we're not building
This commit is contained in:
Eelco Dolstra 2023-10-06 14:17:05 +02:00 committed by GitHub
commit 8cfa582f43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 9 deletions

View File

@ -260,6 +260,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
@ -279,9 +280,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 \
@ -104,7 +108,6 @@ nix_tests = \
case-hack.sh \ case-hack.sh \
placeholders.sh \ placeholders.sh \
ssh-relay.sh \ ssh-relay.sh \
plugins.sh \
build.sh \ build.sh \
build-delete.sh \ build-delete.sh \
output-normalization.sh \ output-normalization.sh \
@ -120,7 +123,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
@ -129,6 +131,17 @@ ifeq ($(HAVE_LIBCPUID), 1)
nix_tests += compute-levels.sh nix_tests += compute-levels.sh
endif endif
ifeq ($(HAVE_LOCAL_NIX_BUILD), 1)
nix_tests += test-libstoreconsumer.sh
ifeq ($(BUILD_SHARED_LIBS), 1)
nix_tests += plugins.sh
endif
endif
tests/test-libstoreconsumer.sh.test: tests/test-libstoreconsumer/test-libstoreconsumer
tests/plugins.sh: tests/plugins/libplugintest.$(SO_EXT)
install-tests += $(foreach x, $(nix_tests), $(d)/$(x)) install-tests += $(foreach x, $(nix_tests), $(d)/$(x))
clean-files += \ clean-files += \
@ -137,9 +150,4 @@ clean-files += \
test-deps += \ test-deps += \
tests/common/vars-and-functions.sh \ tests/common/vars-and-functions.sh \
tests/config.nix \ tests/config.nix
tests/test-libstoreconsumer/test-libstoreconsumer
ifeq ($(BUILD_SHARED_LIBS), 1)
test-deps += tests/plugins/libplugintest.$(SO_EXT)
endif