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 {
NIX_DAEMON_PACKAGE = daemon;
NIX_CLIENT_PACKAGE = client;
HAVE_LOCAL_NIX_BUILD = false;
name =
"nix-tests"
+ optionalString
@ -279,9 +280,13 @@
enableParallelBuilding = true;
configureFlags = testConfigureFlags; # otherwise configure fails
dontBuild = true;
doInstallCheck = true;
buildPhase = ''
# Remove the source files to make sure that we're not accidentally rebuilding Nix
rm src/**/*.cc
'';
installPhase = ''
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 = \
test-infra.sh \
init.sh \
@ -104,7 +108,6 @@ nix_tests = \
case-hack.sh \
placeholders.sh \
ssh-relay.sh \
plugins.sh \
build.sh \
build-delete.sh \
output-normalization.sh \
@ -120,7 +123,6 @@ nix_tests = \
flakes/show.sh \
impure-derivations.sh \
path-from-hash-part.sh \
test-libstoreconsumer.sh \
toString-path.sh \
read-only-store.sh \
nested-sandboxing.sh
@ -129,6 +131,17 @@ ifeq ($(HAVE_LIBCPUID), 1)
nix_tests += compute-levels.sh
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))
clean-files += \
@ -137,9 +150,4 @@ clean-files += \
test-deps += \
tests/common/vars-and-functions.sh \
tests/config.nix \
tests/test-libstoreconsumer/test-libstoreconsumer
ifeq ($(BUILD_SHARED_LIBS), 1)
test-deps += tests/plugins/libplugintest.$(SO_EXT)
endif
tests/config.nix