mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 14:51:41 +01:00
Test stability improvements
This commit is contained in:
parent
b2e946d18f
commit
4a261e2c58
@ -349,7 +349,7 @@ namespace Capnp.Net.Runtime.Tests
|
||||
{
|
||||
AssertOutput(stdout, "ReleaseOnCancel test start");
|
||||
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,42 +773,44 @@ namespace Capnp.Net.Runtime.Tests
|
||||
}
|
||||
|
||||
var cap = new TestCallOrderImpl();
|
||||
|
||||
var earlyCall = main.GetCallSequence(0, default);
|
||||
|
||||
var echo = main.Echo(cap, default);
|
||||
|
||||
using (var pipeline = echo.Eager())
|
||||
using (Skeleton.Claim(cap))
|
||||
{
|
||||
var call0 = pipeline.GetCallSequence(0, default);
|
||||
var call1 = pipeline.GetCallSequence(1, default);
|
||||
var earlyCall = main.GetCallSequence(0, default);
|
||||
|
||||
Assert.IsTrue(earlyCall.Wait(MediumNonDbgTimeout), "early call returns");
|
||||
var echo = main.Echo(cap, default);
|
||||
|
||||
var call2 = pipeline.GetCallSequence(2, default);
|
||||
|
||||
Assert.IsTrue(echo.Wait(MediumNonDbgTimeout));
|
||||
using (var resolved = echo.Result)
|
||||
using (var pipeline = echo.Eager())
|
||||
{
|
||||
var call3 = pipeline.GetCallSequence(3, default);
|
||||
var call4 = pipeline.GetCallSequence(4, default);
|
||||
var call5 = pipeline.GetCallSequence(5, default);
|
||||
var call0 = pipeline.GetCallSequence(0, default);
|
||||
var call1 = pipeline.GetCallSequence(1, default);
|
||||
|
||||
Assert.IsTrue(call0.Wait(MediumNonDbgTimeout), "call 0 returns");
|
||||
Assert.IsTrue(call1.Wait(MediumNonDbgTimeout), "call 1 returns");
|
||||
Assert.IsTrue(call2.Wait(MediumNonDbgTimeout), "call 2 returns");
|
||||
Assert.IsTrue(call3.Wait(MediumNonDbgTimeout), "call 3 returns");
|
||||
Assert.IsTrue(call4.Wait(MediumNonDbgTimeout), "call 4 returns");
|
||||
Assert.IsTrue(call5.Wait(MediumNonDbgTimeout), "call 5 returns");
|
||||
Assert.IsTrue(earlyCall.Wait(MediumNonDbgTimeout), "early call returns");
|
||||
|
||||
var call2 = pipeline.GetCallSequence(2, default);
|
||||
|
||||
Assert.IsTrue(echo.Wait(MediumNonDbgTimeout));
|
||||
using (var resolved = echo.Result)
|
||||
{
|
||||
var call3 = pipeline.GetCallSequence(3, default);
|
||||
var call4 = pipeline.GetCallSequence(4, default);
|
||||
var call5 = pipeline.GetCallSequence(5, default);
|
||||
|
||||
Assert.IsTrue(call0.Wait(MediumNonDbgTimeout), "call 0 returns");
|
||||
Assert.IsTrue(call1.Wait(MediumNonDbgTimeout), "call 1 returns");
|
||||
Assert.IsTrue(call2.Wait(MediumNonDbgTimeout), "call 2 returns");
|
||||
Assert.IsTrue(call3.Wait(MediumNonDbgTimeout), "call 3 returns");
|
||||
Assert.IsTrue(call4.Wait(MediumNonDbgTimeout), "call 4 returns");
|
||||
Assert.IsTrue(call5.Wait(MediumNonDbgTimeout), "call 5 returns");
|
||||
|
||||
Assert.AreEqual(0u, call0.Result);
|
||||
Assert.AreEqual(1u, call1.Result);
|
||||
Assert.AreEqual(2u, call2.Result);
|
||||
Assert.AreEqual(3u, call3.Result);
|
||||
Assert.AreEqual(4u, call4.Result);
|
||||
Assert.AreEqual(5u, call5.Result);
|
||||
}
|
||||
|
||||
Assert.AreEqual(0u, call0.Result);
|
||||
Assert.AreEqual(1u, call1.Result);
|
||||
Assert.AreEqual(2u, call2.Result);
|
||||
Assert.AreEqual(3u, call3.Result);
|
||||
Assert.AreEqual(4u, call4.Result);
|
||||
Assert.AreEqual(5u, call5.Result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,18 @@ namespace Capnp.Rpc
|
||||
}
|
||||
|
||||
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);
|
||||
#else
|
||||
_taskTable.AddOrUpdate(rtask, promise);
|
||||
#endif
|
||||
|
||||
return rtask;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
// of scaffolding.
|
||||
kj::evalLater([]() {}).wait(waitScope);
|
||||
kj::evalLater([]() {}).wait(waitScope);
|
||||
waitScope.poll();
|
||||
//kj::evalLater([]() {}).wait(waitScope);
|
||||
//kj::evalLater([]() {}).wait(waitScope);
|
||||
//waitScope.poll();
|
||||
|
||||
promise.wait(waitScope);
|
||||
}
|
||||
|
||||
for (uint i = 0; i < 16; i++) kj::evalLater([]() {}).wait(waitScope);
|
||||
|
@ -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
|
||||
on_finish :
|
||||
# any cleanup in here
|
||||
deploy: off
|
||||
deploy:
|
||||
- provider: Environment
|
||||
name: GitHub
|
||||
on:
|
||||
APPVEYOR_REPO_TAG: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user