Merge pull request #3013 from basvandijk/disable-lsof-for-darwin-tests
Disable findRuntimeRoots on darwin when running tests because lsof is slow
This commit is contained in:
commit
219d645987
2 changed files with 16 additions and 10 deletions
|
@ -444,17 +444,22 @@ void LocalStore::findRuntimeRoots(Roots & roots, bool censor)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__linux__)
|
#if !defined(__linux__)
|
||||||
try {
|
// lsof is really slow on OS X. This actually causes the gc-concurrent.sh test to fail.
|
||||||
std::regex lsofRegex(R"(^n(/.*)$)");
|
// See: https://github.com/NixOS/nix/issues/3011
|
||||||
auto lsofLines =
|
// Because of this we disable lsof when running the tests.
|
||||||
tokenizeString<std::vector<string>>(runProgram(LSOF, true, { "-n", "-w", "-F", "n" }), "\n");
|
if (getEnv("_NIX_TEST_NO_LSOF") == "") {
|
||||||
for (const auto & line : lsofLines) {
|
try {
|
||||||
std::smatch match;
|
std::regex lsofRegex(R"(^n(/.*)$)");
|
||||||
if (std::regex_match(line, match, lsofRegex))
|
auto lsofLines =
|
||||||
unchecked[match[1]].emplace("{lsof}");
|
tokenizeString<std::vector<string>>(runProgram(LSOF, true, { "-n", "-w", "-F", "n" }), "\n");
|
||||||
|
for (const auto & line : lsofLines) {
|
||||||
|
std::smatch match;
|
||||||
|
if (std::regex_match(line, match, lsofRegex))
|
||||||
|
unchecked[match[1]].emplace("{lsof}");
|
||||||
|
}
|
||||||
|
} catch (ExecError & e) {
|
||||||
|
/* lsof not installed, lsof failed */
|
||||||
}
|
}
|
||||||
} catch (ExecError & e) {
|
|
||||||
/* lsof not installed, lsof failed */
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue