Commit 711b3fdc authored by Nathan Bronson's avatar Nathan Bronson Committed by Facebook Github Bot

make F14MapTest robust to <random> details

Summary:
F14MapTest's random test checks afterward that some events
happened, but this is not assured on different platforms.  This diff
inverts the checks so that the loop is continued until all necessary
events have triggered.  Hypothetical failures of the condition checked
by the removed EXPECT_GE checks will be visible after this diff as
test timeouts.

Reviewed By: andreazevedo

Differential Revision: D8226301

fbshipit-source-id: 2ec295b0f5f47e0726cdf1eb64b81c0c23eedae2
parent 3ebc5866
......@@ -259,7 +259,9 @@ void runRandom() {
std::size_t resizingSmallRollbacks = 0;
std::size_t resizingLargeRollbacks = 0;
for (std::size_t reps = 0; reps < 100000; ++reps) {
for (std::size_t reps = 0; reps < 100000 || rollbacks < 10 ||
resizingSmallRollbacks < 1 || resizingLargeRollbacks < 1;
++reps) {
if (pctDist(gen) < 20) {
// 10% chance allocator will fail after 0 to 3 more allocations
limitTestAllocations(gen() & 3);
......@@ -495,10 +497,6 @@ void runRandom() {
}
}
}
EXPECT_GE(rollbacks, 10);
EXPECT_GE(resizingSmallRollbacks, 1);
EXPECT_GE(resizingLargeRollbacks, 1);
}
EXPECT_EQ(testAllocatedMemorySize, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment