Disable findRuntimeRoots on darwin when running tests because lsof is slow

See: https://github.com/NixOS/nix/issues/3011
This commit is contained in:
Bas van Dijk 2019-07-30 11:29:03 +02:00
parent 41a5246685
commit ee1e3132ca
2 changed files with 16 additions and 10 deletions

View file

@ -444,6 +444,10 @@ void LocalStore::findRuntimeRoots(Roots & roots, bool censor)
} }
#if !defined(__linux__) #if !defined(__linux__)
// lsof is really slow on OS X. This actually causes the gc-concurrent.sh test to fail.
// See: https://github.com/NixOS/nix/issues/3011
// Because of this we disable lsof when running the tests.
if (getEnv("_NIX_TEST_NO_LSOF") == "") {
try { try {
std::regex lsofRegex(R"(^n(/.*)$)"); std::regex lsofRegex(R"(^n(/.*)$)");
auto lsofLines = auto lsofLines =
@ -456,6 +460,7 @@ void LocalStore::findRuntimeRoots(Roots & roots, bool censor)
} catch (ExecError & e) { } catch (ExecError & e) {
/* lsof not installed, lsof failed */ /* lsof not installed, lsof failed */
} }
}
#endif #endif
#if defined(__linux__) #if defined(__linux__)

View file

@ -16,6 +16,7 @@ if [[ -n $NIX_STORE ]]; then
export _NIX_TEST_NO_SANDBOX=1 export _NIX_TEST_NO_SANDBOX=1
fi fi
export _NIX_IN_TEST=$TEST_ROOT/shared export _NIX_IN_TEST=$TEST_ROOT/shared
export _NIX_TEST_NO_LSOF=1
export NIX_REMOTE=$NIX_REMOTE_ export NIX_REMOTE=$NIX_REMOTE_
unset NIX_PATH unset NIX_PATH
export TEST_HOME=$TEST_ROOT/test-home export TEST_HOME=$TEST_ROOT/test-home