fixing flaky tests in mac and windows

This commit is contained in:
matlabbe
2026-05-30 21:28:53 -07:00
parent e8eabc1538
commit 3ecddfb583
6 changed files with 77 additions and 19 deletions
+11 -2
View File
@@ -827,8 +827,17 @@ TEST_F(RtabmapFixture, ParseParametersUpdatesSettings)
TEST_F(RtabmapFixture, SetWorkingDirectoryReflectsInGetter)
{
rtabmap_->setWorkingDirectory("/tmp");
EXPECT_EQ(rtabmap_->getWorkingDir(), std::string("/tmp"));
// setWorkingDirectory() silently no-ops if the path doesn't exist on disk,
// so use the platform's temp dir (which exists) instead of a hardcoded
// POSIX-only "/tmp". tempPath("") returns "<tempdir>/"; strip the trailing
// separator so the assertion compares the dir itself.
std::string wd = test::tempPath("");
if(!wd.empty() && (wd.back() == '/' || wd.back() == '\\'))
{
wd.pop_back();
}
rtabmap_->setWorkingDirectory(wd);
EXPECT_EQ(rtabmap_->getWorkingDir(), wd);
}
// ---------------------------------------------------------------------------