From 0027cf47031822a93ef48fe8506853da0680033b Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 2 May 2022 21:55:51 -0700 Subject: [PATCH] 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 --- googletest/src/gtest.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 1740e931..73312d4c 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -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