From c36ba796dd53ee21e54fe1b0af756850e6d201af Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Mon, 4 Mar 2024 03:52:05 +0100 Subject: [PATCH] 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 --- flake.nix | 7 ++++++- tests/functional/local.mk | 13 ++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index ac1d0606a..1d03f1a1f 100644 --- a/flake.nix +++ b/flake.nix @@ -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 @@ -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 ''; diff --git a/tests/functional/local.mk b/tests/functional/local.mk index d60f1e08e..5eec6df9e 100644 --- a/tests/functional/local.mk +++ b/tests/functional/local.mk @@ -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 \ @@ -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 @@ -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: \