From 5d0f24cdab2bd7924992fe669b4a06fd7fe4fb2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Wed, 15 Apr 2020 22:19:45 +0200 Subject: [PATCH] prevent false positives due to timeout --- Capnp.Net.Runtime.Tests/General.cs | 15 ++++++++++----- Capnp.Net.Runtime.Tests/TcpRpcAdvancedStuff.cs | 2 +- Capnp.Net.Runtime.Tests/Testsuite.cs | 2 +- scripts/measure-coverage.ps1 | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Capnp.Net.Runtime.Tests/General.cs b/Capnp.Net.Runtime.Tests/General.cs index 686033b..3ca548b 100644 --- a/Capnp.Net.Runtime.Tests/General.cs +++ b/Capnp.Net.Runtime.Tests/General.cs @@ -95,16 +95,18 @@ namespace Capnp.Net.Runtime.Tests } [TestMethod] + [TestCategory("Coverage")] public void SafeJoinCompletedThread() { var thread = new Thread(() => { }); thread.Start(); - thread.SafeJoin(null, 1000); + thread.SafeJoin(null, 200); } [TestMethod] + [TestCategory("Coverage")] public void SafeJoinBusyThread() { var thread = new Thread(() => @@ -123,10 +125,11 @@ namespace Capnp.Net.Runtime.Tests } }); thread.Start(); - thread.SafeJoin(null, 1000); + thread.SafeJoin(null, 5); } [TestMethod] + [TestCategory("Coverage")] public void SafeJoinSleepingThread() { var thread = new Thread(() => @@ -146,10 +149,11 @@ namespace Capnp.Net.Runtime.Tests }); thread.Start(); - thread.SafeJoin(null, 1000); + thread.SafeJoin(null, 5); } [TestMethod] + [TestCategory("Coverage")] public void SafeJoinDeadlockedThread() { var lk = new object(); @@ -175,11 +179,12 @@ namespace Capnp.Net.Runtime.Tests }); thread.Start(); - thread.SafeJoin(null, 1000); + thread.SafeJoin(null, 5); } } [TestMethod] + [TestCategory("Coverage")] public void SafeJoinDefensiveThread() { var thread = new Thread(() => @@ -201,7 +206,7 @@ namespace Capnp.Net.Runtime.Tests } }); thread.Start(); - thread.SafeJoin(null, 1000); + thread.SafeJoin(null, 5); } } } diff --git a/Capnp.Net.Runtime.Tests/TcpRpcAdvancedStuff.cs b/Capnp.Net.Runtime.Tests/TcpRpcAdvancedStuff.cs index 3f55e24..e016ad5 100644 --- a/Capnp.Net.Runtime.Tests/TcpRpcAdvancedStuff.cs +++ b/Capnp.Net.Runtime.Tests/TcpRpcAdvancedStuff.cs @@ -263,7 +263,7 @@ namespace Capnp.Net.Runtime.Tests Assert.IsTrue(echoTask.Wait(MediumNonDbgTimeout)); using (var echo = echoTask.Result) { - var list = new Task[1000]; + var list = new Task[200]; for (uint i = 0; i < list.Length; i++) { list[i] = echo.GetCallSequence(i); diff --git a/Capnp.Net.Runtime.Tests/Testsuite.cs b/Capnp.Net.Runtime.Tests/Testsuite.cs index 07719f5..c912b11 100644 --- a/Capnp.Net.Runtime.Tests/Testsuite.cs +++ b/Capnp.Net.Runtime.Tests/Testsuite.cs @@ -795,7 +795,7 @@ namespace Capnp.Net.Runtime.Tests using (var callee = Proxy.Share(new TestTailCalleeImpl(new Counters()))) { var tasks = ParallelEnumerable - .Range(0, 1000) + .Range(0, 200) .Select(async i => { var r = await main.Foo(i, Proxy.Share(callee)); diff --git a/scripts/measure-coverage.ps1 b/scripts/measure-coverage.ps1 index 4a7dda5..d06dfdb 100644 --- a/scripts/measure-coverage.ps1 +++ b/scripts/measure-coverage.ps1 @@ -20,14 +20,14 @@ If(!(test-path $coverageReportDir)) } & $openCover -target:"$vsTestConsole" ` - -targetArgs:"/inIsolation $runtimeTests /TestCaseFilter:`"TestCategory=Coverage`" /Framework:.NETCoreApp,Version=v2.1" ` + -targetArgs:"/inIsolation $runtimeTests /TestCaseFilter:`"TestCategory=Coverage`" /Framework:.NETCoreApp,Version=v2.1 /logger:trx;LogFileName=runtime.trx" ` -filter:"+[Capnp.Net.Runtime]Capnp.*" ` -excludebyattribute:"System.CodeDom.Compiler.GeneratedCodeAttribute" ` -output:"$coverageOutput" ` -mergebyhash -register:user -oldStyle & $openCover -target:"$vsTestConsole" ` - -targetArgs:"/inIsolation $generatorTests" ` + -targetArgs:"/inIsolation $generatorTests /logger:trx;LogFileName=generator.trx" ` -filter:"+[CapnpC.CSharp.Generator]CapnpC.CSharp.Generator.* -[CapnpC.CSharp.Generator]CapnpC.CSharp.Generator.Schema.*" ` -excludebyattribute:"System.CodeDom.Compiler.GeneratedCodeAttribute" ` -output:"$coverageOutput" `