Skip to content

Commit

Permalink
Merge pull request NixOS#3778 from tweag/parallel-tests
Browse files Browse the repository at this point in the history
Parallel tests fixes
  • Loading branch information
edolstra authored Jul 3, 2020
2 parents 017efae + 223fbe6 commit dfaad37
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions mk/tests.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# 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
@env TEST_NAME=$1 TESTS_ENVIRONMENT="$(tests-environment)" mk/run_test.sh $1
$1.test: $1 $(test-deps)
@env TEST_NAME=$(notdir $(basename $1)) TESTS_ENVIRONMENT="$(tests-environment)" mk/run_test.sh $1

endef

Expand Down
2 changes: 1 addition & 1 deletion src/libstore/globals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion tests/common.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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=$!
Expand Down
2 changes: 1 addition & 1 deletion tests/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit dfaad37

Please sign in to comment.