Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abseil-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
abseil-cpp
Commits
9686b7be
Commit
9686b7be
authored
Apr 20, 2023
by
Evan Brown
Committed by
Copybara-Service
Apr 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix flaky test failures.
PiperOrigin-RevId: 525808747 Change-Id: I01aeef6b8558673bf1fc38a948dcecf00300b641
parent
bc65499d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
absl/synchronization/internal/waiter_test.cc
+6
-6
No files found.
absl/synchronization/internal/waiter_test.cc
View file @
9686b7be
...
...
@@ -72,7 +72,7 @@ class WaiterTest : public ::testing::Test {
TYPED_TEST_SUITE_P
(
WaiterTest
);
constexpr
absl
::
Duration
slop
=
absl
::
Milliseconds
(
10
);
absl
::
Duration
WithTolerance
(
absl
::
Duration
d
)
{
return
d
*
0.95
;
}
TYPED_TEST_P
(
WaiterTest
,
WaitNoTimeout
)
{
absl
::
synchronization_internal
::
ThreadPool
tp
(
1
);
...
...
@@ -90,7 +90,7 @@ TYPED_TEST_P(WaiterTest, WaitNoTimeout) {
EXPECT_TRUE
(
waiter
.
Wait
(
absl
::
synchronization_internal
::
KernelTimeout
::
Never
()));
absl
::
Duration
waited
=
absl
::
Now
()
-
start
;
EXPECT_GE
(
waited
,
absl
::
Seconds
(
2
)
-
slop
);
EXPECT_GE
(
waited
,
WithTolerance
(
absl
::
Seconds
(
2
))
);
}
TYPED_TEST_P
(
WaiterTest
,
WaitDurationWoken
)
{
...
...
@@ -107,7 +107,7 @@ TYPED_TEST_P(WaiterTest, WaitDurationWoken) {
EXPECT_TRUE
(
waiter
.
Wait
(
absl
::
synchronization_internal
::
KernelTimeout
(
absl
::
Seconds
(
10
))));
absl
::
Duration
waited
=
absl
::
Now
()
-
start
;
EXPECT_GE
(
waited
,
absl
::
Milliseconds
(
500
)
-
slop
);
EXPECT_GE
(
waited
,
WithTolerance
(
absl
::
Milliseconds
(
500
))
);
EXPECT_LT
(
waited
,
absl
::
Seconds
(
2
));
}
...
...
@@ -125,7 +125,7 @@ TYPED_TEST_P(WaiterTest, WaitTimeWoken) {
EXPECT_TRUE
(
waiter
.
Wait
(
absl
::
synchronization_internal
::
KernelTimeout
(
start
+
absl
::
Seconds
(
10
))));
absl
::
Duration
waited
=
absl
::
Now
()
-
start
;
EXPECT_GE
(
waited
,
absl
::
Milliseconds
(
500
)
-
slop
);
EXPECT_GE
(
waited
,
WithTolerance
(
absl
::
Milliseconds
(
500
))
);
EXPECT_LT
(
waited
,
absl
::
Seconds
(
2
));
}
...
...
@@ -135,7 +135,7 @@ TYPED_TEST_P(WaiterTest, WaitDurationReached) {
EXPECT_FALSE
(
waiter
.
Wait
(
absl
::
synchronization_internal
::
KernelTimeout
(
absl
::
Milliseconds
(
500
))));
absl
::
Duration
waited
=
absl
::
Now
()
-
start
;
EXPECT_GE
(
waited
,
absl
::
Milliseconds
(
500
)
-
slop
);
EXPECT_GE
(
waited
,
WithTolerance
(
absl
::
Milliseconds
(
500
))
);
EXPECT_LT
(
waited
,
absl
::
Seconds
(
1
));
}
...
...
@@ -145,7 +145,7 @@ TYPED_TEST_P(WaiterTest, WaitTimeReached) {
EXPECT_FALSE
(
waiter
.
Wait
(
absl
::
synchronization_internal
::
KernelTimeout
(
start
+
absl
::
Milliseconds
(
500
))));
absl
::
Duration
waited
=
absl
::
Now
()
-
start
;
EXPECT_GE
(
waited
,
absl
::
Milliseconds
(
500
)
-
slop
);
EXPECT_GE
(
waited
,
WithTolerance
(
absl
::
Milliseconds
(
500
))
);
EXPECT_LT
(
waited
,
absl
::
Seconds
(
1
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment