Skip to content

Commit

Permalink
Merge pull request NixOS#9096 from NixOS/dont-rebuild-twice-on-ci
Browse files Browse the repository at this point in the history
 Don't run the tests that require building if we're not building

(cherry picked from commit 8cfa582)
Change-Id: I6085ca6107349669407340d7a5e52639a2febc90
  • Loading branch information
eldritch horrors committed Mar 4, 2024
1 parent 7e96681 commit c36ba79
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,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
Expand All @@ -272,9 +273,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
'';
Expand Down
13 changes: 10 additions & 3 deletions tests/functional/local.mk
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -118,7 +122,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
Expand All @@ -127,8 +130,12 @@ ifeq ($(HAVE_LIBCPUID), 1)
nix_tests += compute-levels.sh
endif

ifeq ($(BUILD_SHARED_LIBS), 1)
nix_tests += plugins.sh
ifeq ($(HAVE_LOCAL_NIX_BUILD), 1)
nix_tests += test-libstoreconsumer.sh

ifeq ($(BUILD_SHARED_LIBS), 1)
nix_tests += plugins.sh
endif
endif

$(d)/test-libstoreconsumer.sh.test $(d)/test-libstoreconsumer.sh.test-debug: \
Expand Down

0 comments on commit c36ba79

Please sign in to comment.