Test stability improvements

This commit is contained in:
Christian Köllner 2019-08-19 22:46:58 +02:00
parent b2e946d18f
commit 4a261e2c58
4 changed files with 53 additions and 34 deletions

View File

@ -349,7 +349,7 @@ namespace Capnp.Net.Runtime.Tests
{ {
AssertOutput(stdout, "ReleaseOnCancel test start"); AssertOutput(stdout, "ReleaseOnCancel test start");
AssertOutput(stdout, "ReleaseOnCancel test end"); AssertOutput(stdout, "ReleaseOnCancel test end");
Assert.IsTrue(SpinWait.SpinUntil(() => counters.HandleCount == 0, MediumNonDbgTimeout)); Assert.IsTrue(SpinWait.SpinUntil(() => counters.HandleCount == 0, MediumNonDbgTimeout), $"Handle count stuck at {counters.HandleCount}");
}); });
} }
} }
@ -773,7 +773,8 @@ namespace Capnp.Net.Runtime.Tests
} }
var cap = new TestCallOrderImpl(); var cap = new TestCallOrderImpl();
using (Skeleton.Claim(cap))
{
var earlyCall = main.GetCallSequence(0, default); var earlyCall = main.GetCallSequence(0, default);
var echo = main.Echo(cap, default); var echo = main.Echo(cap, default);
@ -812,6 +813,7 @@ namespace Capnp.Net.Runtime.Tests
} }
} }
} }
}
}); });
} }

View File

@ -30,7 +30,18 @@ namespace Capnp.Rpc
} }
var rtask = AwaitAnswer(); var rtask = AwaitAnswer();
// Really weird: We'd expect AwaitAnswer() to initialize a new Task instance upon each invocation.
// However, this does not seem to be always true (as indicated by CI test suite). An explanation might be
// that the underlying implementation recycles Task instances. Let's work around it.
#if NETSTANDARD2_0
_taskTable.Remove(rtask);
_taskTable.Add(rtask, promise); _taskTable.Add(rtask, promise);
#else
_taskTable.AddOrUpdate(rtask, promise);
#endif
return rtask; return rtask;
} }

View File

@ -821,9 +821,11 @@ void ReleaseOnCancelTest(capnp::EzRpcClient& rpc)
// //
// TODO(cleanup): This is fragile, but I'm not sure how else to write it without a ton // TODO(cleanup): This is fragile, but I'm not sure how else to write it without a ton
// of scaffolding. // of scaffolding.
kj::evalLater([]() {}).wait(waitScope); //kj::evalLater([]() {}).wait(waitScope);
kj::evalLater([]() {}).wait(waitScope); //kj::evalLater([]() {}).wait(waitScope);
waitScope.poll(); //waitScope.poll();
promise.wait(waitScope);
} }
for (uint i = 0; i < 16; i++) kj::evalLater([]() {}).wait(waitScope); for (uint i = 0; i < 16; i++) kj::evalLater([]() {}).wait(waitScope);

View File

@ -48,4 +48,8 @@ test_script:
- cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Release\netcoreapp2.2\Capnp.Net.Runtime.Tests.Core21.dll - cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Release\netcoreapp2.2\Capnp.Net.Runtime.Tests.Core21.dll
on_finish : on_finish :
# any cleanup in here # any cleanup in here
deploy: off deploy:
- provider: Environment
name: GitHub
on:
APPVEYOR_REPO_TAG: true