Skip to content

Commit

Permalink
Merge pull request #1 from elupus/issue/1372
Browse files Browse the repository at this point in the history
Corrections for use within embedded systems
  • Loading branch information
hefloryd committed Aug 29, 2023
2 parents 2580865 + 1b5efe8 commit d492b0f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion googletest/src/gtest-filepath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ bool FilePath::CreateDirectoriesRecursively() const {
return false;
}

if (pathname_.length() == 0 || this->DirectoryExists()) {
if (pathname_.length() == 0 || pathname_ == kCurrentDirectoryString || this->DirectoryExists()) {
return true;
}

Expand Down
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
5 changes: 3 additions & 2 deletions googletest/src/gtest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ static FILE* OpenFileForWriting(const std::string& output_file) {
FilePath output_file_path(output_file);
FilePath output_dir(output_file_path.RemoveFileName());

if (output_dir.CreateDirectoriesRecursively()) {
fileout = posix::FOpen(output_file.c_str(), "w");
if (!output_dir.CreateDirectoriesRecursively()) {
GTEST_LOG_(WARNING) << "Unable to create path to file \"" << output_file << "\"";
}
fileout = posix::FOpen(output_file.c_str(), "w");
if (fileout == nullptr) {
GTEST_LOG_(FATAL) << "Unable to open file \"" << output_file << "\"";
}
Expand Down

0 comments on commit d492b0f

Please sign in to comment.