Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/helpers/EnvTestFixture.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class InternalFixture : public TestType
// Documentation inherited
protected: void TearDown() override
{
// Clean up fake home directory so that subsequent tests run on a clean slate.
common::removeAll(this->kFakeHome);
// Restore $HOME
EXPECT_TRUE(common::setenv(IGN_HOMEDIR, this->realHome.c_str()));
}
Expand Down
17 changes: 17 additions & 0 deletions test/integration/log_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,15 @@ TEST_F(LogSystemTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(LogDefaults))
std::string(PROJECT_SOURCE_PATH), "test", "worlds",
"log_record_dbl_pendulum.sdf");

<<<<<<< HEAD
// Change environment variable so that test files aren't written to $HOME
std::string homeOrig;
common::env(IGN_HOMEDIR, homeOrig);
std::string homeFake = common::joinPaths(this->logsDir, "default");
EXPECT_TRUE(common::setenv(IGN_HOMEDIR, homeFake.c_str()));

=======
>>>>>>> 83a6331a (Clean up temporary home directory to make tests more robust (#3146))
// Test case 1:
// No path specified on command line. This does not go through
// gz.cc, recording should take place in the `.ignition` directory
Expand All @@ -354,12 +357,19 @@ TEST_F(LogSystemTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(LogDefaults))
recordServer.Run(true, 200, false);
}

<<<<<<< HEAD
// We should expect to see "auto_default.log" and "state.tlog"
EXPECT_FALSE(ignLogDirectory().empty());
EXPECT_TRUE(common::exists(
common::joinPaths(ignLogDirectory(), "auto_default.log")));
EXPECT_TRUE(common::exists(
common::joinPaths(ignLogDirectory(), "state.tlog")));
=======
// We should expect to see "state.tlog"
EXPECT_FALSE(gzLogDirectory().empty());
EXPECT_TRUE(common::exists(
common::joinPaths(gzLogDirectory(), "state.tlog")));
>>>>>>> 83a6331a (Clean up temporary home directory to make tests more robust (#3146))

// Remove artifacts. Recreate new directory
this->RemoveLogsDir();
Expand All @@ -375,7 +385,11 @@ TEST_F(LogSystemTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(LogDefaults))
// should be recorded here.

// Store number of files before running
<<<<<<< HEAD
auto logPath = common::joinPaths(homeFake.c_str(), ".ignition", "gazebo",
=======
auto logPath = common::joinPaths(this->kFakeHome, ".gz", "sim",
>>>>>>> 83a6331a (Clean up temporary home directory to make tests more robust (#3146))
"log");
int nEntries = entryCount(logPath);
std::vector<std::string> entriesBefore;
Expand Down Expand Up @@ -415,9 +429,12 @@ TEST_F(LogSystemTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(LogDefaults))
// Remove artifacts. Recreate new directory
this->RemoveLogsDir();
#endif
<<<<<<< HEAD

// Revert environment variable after test is done
EXPECT_TRUE(common::setenv(IGN_HOMEDIR, homeOrig.c_str()));
=======
>>>>>>> 83a6331a (Clean up temporary home directory to make tests more robust (#3146))
}

/////////////////////////////////////////////////
Expand Down
Loading