fixed some macos flakiness

This commit is contained in:
matlabbe
2026-05-28 21:27:05 -07:00
parent 10a3949b6a
commit 8551e69f4f
2 changed files with 18 additions and 10 deletions
+3 -2
View File
@@ -643,11 +643,12 @@ TEST_F(RtabmapIntegrationFixture, PR2_Scan2D_RGBD)
EXPECT_EQ(21, result.finalGlobalGraphSize); EXPECT_EQ(21, result.finalGlobalGraphSize);
EXPECT_GE(result.proximityDetections, 1) EXPECT_GE(result.proximityDetections, 1)
<< "PR2 2D-scan dataset should produce proximity detections"; << "PR2 2D-scan dataset should produce proximity detections";
// Observed across 5 runs: empty 2900-3001, obstacle 4574-4698. // Observed: empty 2863-3001, obstacle 4574-4937. Wide bounds absorb
// platform-level FP differences in the visual loop-closure path.
EXPECT_GE(result.gridEmptyCells, 2700); EXPECT_GE(result.gridEmptyCells, 2700);
EXPECT_LE(result.gridEmptyCells, 3200); EXPECT_LE(result.gridEmptyCells, 3200);
EXPECT_GE(result.gridObstacleCells, 4400); EXPECT_GE(result.gridObstacleCells, 4400);
EXPECT_LE(result.gridObstacleCells, 4900); EXPECT_LE(result.gridObstacleCells, 5100);
#ifdef RTABMAP_OCTOMAP #ifdef RTABMAP_OCTOMAP
// Observed: empty 6072-8037, obstacle 39924-42883. Bounds are wide // Observed: empty 6072-8037, obstacle 39924-42883. Bounds are wide
// because without g2o (OdomF2M/BundleAdjustment disabled) visual // because without g2o (OdomF2M/BundleAdjustment disabled) visual
+15 -8
View File
@@ -130,15 +130,22 @@ TEST(UThreadTest, Start)
EXPECT_TRUE(thread.isRunning() || thread.isCreating()); EXPECT_TRUE(thread.isRunning() || thread.isCreating());
std::this_thread::sleep_for(std::chrono::milliseconds(5)); // Wait up to 500 ms for mainLoop to actually execute. We can't reliably
EXPECT_TRUE(thread.isRunning()); // assert isRunning() at a fixed offset: SimpleThread sleeps ~10 ms then
// self-kills, so on a slow CI VM the thread can already be in kSKilled
// Give thread time to stop // by the time we poll. hasStarted() flips to true on first entry to
std::this_thread::sleep_for(std::chrono::milliseconds(10)); // mainLoop and stays true, so it's race-free.
UTimer waitForStart;
// Thread should be running or killed (if it finished quickly) while(!thread.hasStarted() && waitForStart.ticks() < 0.5)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
EXPECT_TRUE(thread.hasStarted());
// Give the thread time to finish its single iteration + cleanup.
std::this_thread::sleep_for(std::chrono::milliseconds(50));
EXPECT_TRUE(thread.isKilled() || thread.isIdle()); EXPECT_TRUE(thread.isKilled() || thread.isIdle());
thread.join(); thread.join();
} }