Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
d9f844a9
Commit
d9f844a9
authored
Dec 01, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work around Mac OSX timing flakiness.
parent
214e25ff
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
async-unix-test.c++
c++/src/kj/async-unix-test.c++
+11
-2
No files found.
c++/src/kj/async-unix-test.c++
View file @
d9f844a9
...
...
@@ -589,10 +589,19 @@ TEST(AsyncUnixTest, InterruptedTimer) {
EventLoop
loop
(
port
);
WaitScope
waitScope
(
loop
);
#if __linux__
// Linux timeslices are 1ms.
constexpr
auto
OS_SLOWNESS_FACTOR
=
1
;
#else
// OSX timeslices are 10ms, so we need longer timeouts to avoid flakiness.
// To be safe we'll assume other OS's are similar.
constexpr
auto
OS_SLOWNESS_FACTOR
=
10
;
#endif
// Schedule a timer event in 10ms.
auto
&
timer
=
port
.
getTimer
();
auto
start
=
timer
.
now
();
constexpr
auto
timeout
=
10
*
MILLISECONDS
;
constexpr
auto
timeout
=
10
*
MILLISECONDS
*
OS_SLOWNESS_FACTOR
;
// Arrange SIGALRM to be delivered in 5ms, handled in an empty signal handler. This will cause
// our wait to be interrupted with EINTR. We should nevertheless continue waiting for the right
...
...
@@ -603,7 +612,7 @@ TEST(AsyncUnixTest, InterruptedTimer) {
}
struct
itimerval
itv
;
memset
(
&
itv
,
0
,
sizeof
(
itv
));
itv
.
it_value
.
tv_usec
=
5000
;
// signal after 5ms
itv
.
it_value
.
tv_usec
=
5000
*
OS_SLOWNESS_FACTOR
;
// signal after 5ms
setitimer
(
ITIMER_REAL
,
&
itv
,
nullptr
);
timer
.
afterDelay
(
timeout
).
wait
(
waitScope
);
...
...
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