Skip to content

Commit 237a7d5

Browse files
authored
Merge pull request #85234 from al45tair/eng/PR-163661576
[Tests][Threading] Allow 1‰ error in wait times.
2 parents 91ee1c4 + 7206dfa commit 237a7d5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

unittests/Threading/ConditionVariable.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,23 @@ TEST(ConditionVariableTest, Timeout) {
6767
ASSERT_FALSE(ret);
6868
});
6969

70-
ASSERT_GE(duration.count(), 0.01);
70+
ASSERT_GE(duration.count(), 0.01 * 0.999);
7171

7272
duration = measureDuration([&] {
7373
ConditionVariable::ScopedLock lock(cond);
7474
bool ret = cond.wait(0.1s);
7575
ASSERT_FALSE(ret);
7676
});
7777

78-
ASSERT_GE(duration.count(), 0.1);
78+
ASSERT_GE(duration.count(), 0.1 * 0.999);
7979

8080
duration = measureDuration([&] {
8181
ConditionVariable::ScopedLock lock(cond);
8282
bool ret = cond.wait(1s);
8383
ASSERT_FALSE(ret);
8484
});
8585

86-
ASSERT_GE(duration.count(), 1.0);
86+
ASSERT_GE(duration.count(), 1.0 * 0.999);
8787

8888
auto deadline = std::chrono::system_clock::now() + 0.5s;
8989

@@ -93,7 +93,7 @@ TEST(ConditionVariableTest, Timeout) {
9393
ASSERT_FALSE(ret);
9494
});
9595

96-
ASSERT_GE(duration.count(), 0.5);
96+
ASSERT_GE(duration.count(), 0.5 * 0.999);
9797
}
9898

9999
// Check that signal() wakes exactly one waiter

0 commit comments

Comments
 (0)