From 5101ed18bca509a8cf43668b0701afad90c5c9c4 Mon Sep 17 00:00:00 2001 From: regnat Date: Thu, 2 Jul 2020 17:15:02 +0200 Subject: [PATCH 1/2] Fix the test dependencies Reuse the pre-existing list rather than the one written as part of #3777 --- mk/tests.mk | 5 ++++- tests/local.mk | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mk/tests.mk b/mk/tests.mk index e2258ede6..e6bd1ad79 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -1,10 +1,13 @@ # Run program $1 as part of ‘make installcheck’. + +test-deps = + define run-install-test installcheck: $1.test .PHONY: $1.test - $1.test: $1 tests/common.sh tests/init.sh + $1.test: $1 $(test-deps) @env TEST_NAME=$1 TESTS_ENVIRONMENT="$(tests-environment)" mk/run_test.sh $1 endef diff --git a/tests/local.mk b/tests/local.mk index 536661af8..f3ac330d8 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -40,4 +40,4 @@ tests-environment = NIX_REMOTE= $(bash) -e clean-files += $(d)/common.sh -installcheck: $(d)/common.sh $(d)/config.nix $(d)/plugins/libplugintest.$(SO_EXT) +test-deps += tests/common.sh tests/config.nix tests/plugins/libplugintest.$(SO_EXT) From 223fbe644a4cde45269c01e971331d9414971d46 Mon Sep 17 00:00:00 2001 From: regnat Date: Thu, 2 Jul 2020 17:18:03 +0200 Subject: [PATCH 2/2] Shorten the path to the test root Fix a socket length failure on the OSX builders --- mk/tests.mk | 2 +- src/libstore/globals.cc | 2 +- tests/common.sh.in | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mk/tests.mk b/mk/tests.mk index e6bd1ad79..2e39bb694 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -8,7 +8,7 @@ define run-install-test .PHONY: $1.test $1.test: $1 $(test-deps) - @env TEST_NAME=$1 TESTS_ENVIRONMENT="$(tests-environment)" mk/run_test.sh $1 + @env TEST_NAME=$(notdir $(basename $1)) TESTS_ENVIRONMENT="$(tests-environment)" mk/run_test.sh $1 endef diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index bee94cbd8..683fa5196 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -35,7 +35,7 @@ Settings::Settings() , nixLibexecDir(canonPath(getEnv("NIX_LIBEXEC_DIR").value_or(NIX_LIBEXEC_DIR))) , nixBinDir(canonPath(getEnv("NIX_BIN_DIR").value_or(NIX_BIN_DIR))) , nixManDir(canonPath(NIX_MAN_DIR)) - , nixDaemonSocketFile(canonPath(nixStateDir + DEFAULT_SOCKET_PATH)) + , nixDaemonSocketFile(canonPath(getEnv("NIX_DAEMON_SOCKET_PATH").value_or(nixStateDir + DEFAULT_SOCKET_PATH))) { buildUsersGroup = getuid() == 0 ? "nixbld" : ""; lockCPU = getEnv("NIX_AFFINITY_HACK") == "1"; diff --git a/tests/common.sh.in b/tests/common.sh.in index c00ee58a1..308126094 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -11,6 +11,7 @@ export NIX_LOCALSTATE_DIR=$TEST_ROOT/var export NIX_LOG_DIR=$TEST_ROOT/var/log/nix export NIX_STATE_DIR=$TEST_ROOT/var/nix export NIX_CONF_DIR=$TEST_ROOT/etc +export NIX_DAEMON_SOCKET_PATH=$TEST_ROOT/daemon-socket unset NIX_USER_CONF_FILES export _NIX_TEST_SHARED=$TEST_ROOT/shared if [[ -n $NIX_STORE ]]; then @@ -76,7 +77,7 @@ startDaemon() { rm -f $NIX_STATE_DIR/daemon-socket/socket nix-daemon & for ((i = 0; i < 30; i++)); do - if [ -e $NIX_STATE_DIR/daemon-socket/socket ]; then break; fi + if [ -e $NIX_DAEMON_SOCKET_PATH ]; then break; fi sleep 1 done pidDaemon=$!