diff --git a/Capnp.Net.Runtime.Tests/TcpRpcInterop.cs b/Capnp.Net.Runtime.Tests/TcpRpcInterop.cs index a83f2ae..d509f8f 100644 --- a/Capnp.Net.Runtime.Tests/TcpRpcInterop.cs +++ b/Capnp.Net.Runtime.Tests/TcpRpcInterop.cs @@ -821,6 +821,89 @@ namespace Capnp.Net.Runtime.Tests }); } + [TestMethod, Timeout(10000)] + public void EmbargoServer2() + { + LaunchCompatTestProcess("server:MoreStuff", stdout => + { + int retry = 0; + + label: + using (var client = new TcpRpcClient("localhost", TcpPort)) + { + Assert.IsTrue(client.WhenConnected.Wait(MediumNonDbgTimeout), "client connect"); + + using (var main = client.GetMain()) + { + var resolving = main as IResolvingCapability; + + bool success; + + try + { + success = resolving.WhenResolved.Wait(MediumNonDbgTimeout); + } + catch + { + success = false; + } + + if (!success) + { + if (++retry == 5) + { + Assert.Fail("Attempting to obtain bootstrap interface failed. Bailing out."); + } + goto label; + } + + var cap = new TestCallOrderImpl(); + cap.CountToDispose = 6; +#if DEBUG_DISPOSE + Skeleton.BeginAssertNotDisposed(cap); +#endif + var earlyCall = main.GetCallSequence(0, default); + + var echo = main.Echo(cap, default); + + using (var pipeline = echo.Result) + { + var call0 = pipeline.GetCallSequence(0, default); + var call1 = pipeline.GetCallSequence(1, default); + + Assert.IsTrue(earlyCall.Wait(MediumNonDbgTimeout), "early call returns"); + + var call2 = pipeline.GetCallSequence(2, default); + + Assert.IsTrue(echo.Wait(MediumNonDbgTimeout)); + + 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); + +#if DEBUG_DISPOSE + Skeleton.EndAssertNotDisposed(cap); +#endif + } + } + } + }); + } + [TestMethod, Timeout(10000)] public void EmbargoClient() { @@ -897,7 +980,7 @@ namespace Capnp.Net.Runtime.Tests LaunchCompatTestProcess("server:MoreStuff", EmbargoErrorImpl); } - [TestMethod, Timeout(10000)] + [TestMethod, Timeout(30000)] public void RepeatedEmbargoError() { LaunchCompatTestProcess("server:MoreStuff", stdout => diff --git a/CapnpCompatTest/CapnpCompatTest.cpp b/CapnpCompatTest/CapnpCompatTest.cpp index a3bc50b..352d28c 100644 --- a/CapnpCompatTest/CapnpCompatTest.cpp +++ b/CapnpCompatTest/CapnpCompatTest.cpp @@ -4,6 +4,7 @@ // > vcpkg install capnproto #include +#include #include #include #include "test.capnp.h" @@ -636,7 +637,20 @@ public: return kj::READY_NOW; } - kj::Promise echo(EchoContext context) + kj::Promise simpleLoop(int rem) + { + if (rem <= 0) { + return kj::READY_NOW; + } + else { + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + return kj::evalLater([this, rem]() mutable { + return simpleLoop(rem - 1); + }); + } + } + + kj::Promise echo(EchoContext context) { ++callCount; cout << "echo" << endl; @@ -644,7 +658,7 @@ public: auto params = context.getParams(); auto result = context.getResults(); result.setCap(params.getCap()); - return kj::READY_NOW; + return simpleLoop(100); // Loop a little to provoke real promise pipelining } kj::Promise expectCancel(ExpectCancelContext context) diff --git a/appveyor.yml b/appveyor.yml index 281315e..7ebf098 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,6 +11,14 @@ install: - vcpkg integrate install - vcpkg install capnproto - cd %APPVEYOR_BUILD_FOLDER% +dotnet_csproj: + patch: true + file: '**\*.csproj;**\*.props;**\*.fsproj;**\*.xml;**\*.nuspec' + version: '{version}' + package_version: '{version}' + assembly_version: '{version}' + file_version: '{version}' + informational_version: '{version}' before_build: - cmd: dotnet --version - cmd: msbuild -ver @@ -28,17 +36,17 @@ build_script: after_build: # For once the build has completed artifacts: - - path: Capnp.Net.Runtime\bin\Debug\Capnp.Net.Runtime.1.0.0.nupkg - name: Capnp.Net.Runtime.1.0.0_debug + - path: Capnp.Net.Runtime\bin\Debug + name: Capnp.Net.Runtime_debug type: NuGetPackage - - path: Capnp.Net.Runtime\bin\Release\Capnp.Net.Runtime.1.0.0.nupkg - name: Capnp.Net.Runtime.1.0.0 + - path: Capnp.Net.Runtime\bin\Release + name: Capnp.Net.Runtime type: NuGetPackage - - path: chocolatey\install\capnpc-csharp-win-x86.1.0.0.nupkg - name: capnpc-csharp-win-x86.1.0.0 + - path: chocolatey\install\capnpc-csharp-win-x86.{version}.nupkg + name: capnpc-csharp-win-x86 type: NuGetPackage - - path: chocolatey\install\capnpc-csharp.1.0.0.nupkg - name: capnpc-csharp.1.0.0 + - path: chocolatey\install\capnpc-csharp.{version}.nupkg + name: capnpc-csharp type: NuGetPackage clone_depth: 1 test_script: