Commit cff03dec authored by Kenton Varda's avatar Kenton Varda

De-flake timing-dependent test.

parent ff0f1535
......@@ -244,13 +244,14 @@ TEST(TwoPartyNetwork, Release) {
// no reply). Here we are explicitly trying to catch this bug. This proves tricky, because when
// we drop a reference on the client side, there's no particular way to wait for the release
// message to reach the server except to make a subsequent call and wait for the return -- but
// that would mask the bug. So we wait 10ms...
//
// (We skip this test on Android because the Android emulator is slow enough that it sometimes
// fails.)
// that would mask the bug. So, we wait spin waiting for handleCount to change.
#if !__ANDROID__
ioContext.provider->getTimer().afterDelay(10 * kj::MILLISECONDS).wait(ioContext.waitScope);
uint maxSpins = 1000;
while (handleCount > 1) {
ioContext.provider->getTimer().afterDelay(10 * kj::MILLISECONDS).wait(ioContext.waitScope);
KJ_ASSERT(--maxSpins > 0);
}
EXPECT_EQ(1, handleCount);
handle2 = nullptr;
......@@ -260,9 +261,11 @@ TEST(TwoPartyNetwork, Release) {
promise = nullptr;
ioContext.provider->getTimer().afterDelay(10 * kj::MILLISECONDS).wait(ioContext.waitScope);
while (handleCount > 0) {
ioContext.provider->getTimer().afterDelay(10 * kj::MILLISECONDS).wait(ioContext.waitScope);
KJ_ASSERT(--maxSpins > 0);
}
EXPECT_EQ(0, handleCount);
#endif
}
TEST(TwoPartyNetwork, Abort) {
......
linux-gcc-4.9 5952 ./super-test.sh tmpdir capnp-gcc-4.9 gcc-4.9
linux-gcc-4.8 5246 ./super-test.sh tmpdir capnp-gcc-4.8 gcc-4.8
linux-clang 6039 ./super-test.sh tmpdir capnp-clang clang
mac 6422 ./super-test.sh remote beat caffeinate
cygwin 6770 ./super-test.sh remote Kenton@flashman
exotic 4192 ./super-test.sh tmpdir exotic exotic
linux-gcc-4.9 9081 ./super-test.sh tmpdir capnp-gcc-4.9 gcc-4.9
linux-gcc-4.8 8358 ./super-test.sh tmpdir capnp-gcc-4.8 gcc-4.8
linux-clang 9165 ./super-test.sh tmpdir capnp-clang clang
mac 6421 ./super-test.sh remote beat caffeinate
cygwin 9770 ./super-test.sh remote Kenton@flashman
exotic 4216 ./super-test.sh tmpdir exotic exotic
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