Skip to content

Commit

Permalink
original_working_dir is needed even when death tests are disabled
Browse files Browse the repository at this point in the history
UnitTest::GetInstance()->original_working_dir() is documented public API:
https://github.com/google/googletest/blob/main/docs/reference/testing.md#original_working_dir-unittestoriginal_working_dir

and is used for things like UnitTestOptions::GetAbsolutePathToOutputFile.
So stubbing it to just return an empty string breaks many other unit tests
unnecessarily if you have a filesystem but not death tests

If there's a need to do something special for diskless systems,
seems like they should have a distinct check.

reverts e5686bb
google#3090
  • Loading branch information
puetzk committed Mar 7, 2022
1 parent f726097 commit 72ae297
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions googletest/src/gtest-internal-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,6 @@ class GTEST_API_ UnitTestImpl {
void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc,
internal::TearDownTestSuiteFunc tear_down_tc,
TestInfo* test_info) {
#if GTEST_HAS_DEATH_TEST
// In order to support thread-safe death tests, we need to
// remember the original working directory when the test program
// was first invoked. We cannot do this in RUN_ALL_TESTS(), as
Expand All @@ -688,7 +687,6 @@ class GTEST_API_ UnitTestImpl {
GTEST_CHECK_(!original_working_dir_.IsEmpty())
<< "Failed to get the current working directory.";
}
#endif // GTEST_HAS_DEATH_TEST

GetTestSuite(test_info->test_suite_name(), test_info->type_param(),
set_up_tc, tear_down_tc)
Expand Down

0 comments on commit 72ae297

Please sign in to comment.