Commit 0027cf47 authored by Abseil Team's avatar Abseil Team Committed by Copybara-Service
Browse files

Use TEST_TMPDIR on MacOS as well if available.

Currently MacOS falls back to generic /tmp, but
for all intents and purposes it should behave like
other Unixes using the TEST_TMPDIR environment variable
if available (this environment variable is set in bazel,
which sets up a unique temp directory for the test
process).

While at it, remove an incorrect #endif comment, that
looks like a leftover from some older implementation.

PiperOrigin-RevId: 446108391
Change-Id: I118eacf6e86a41d26cb81a130f7c54cccc0c5665
parent 42ca3da5
......@@ -6766,7 +6766,7 @@ std::string TempDir() {
} else {
return temp_dir;
}
#elif GTEST_OS_LINUX
#elif GTEST_OS_LINUX || GTEST_OS_MAC
const char* temp_dir = internal::posix::GetEnv("TEST_TMPDIR");
if (temp_dir == nullptr || temp_dir[0] == '\0') {
return "/tmp/";
......@@ -6775,7 +6775,7 @@ std::string TempDir() {
}
#else
return "/tmp/";
#endif // GTEST_OS_WINDOWS_MOBILE
#endif
}
// Class ScopedTrace
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment