prevent false positives due to timeout

This commit is contained in:
Christian Köllner 2020-04-15 22:19:45 +02:00
parent 8b88b5c5dd
commit 5d0f24cdab
4 changed files with 14 additions and 9 deletions

View File

@ -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);
}
}
}

View File

@ -263,7 +263,7 @@ namespace Capnp.Net.Runtime.Tests
Assert.IsTrue(echoTask.Wait(MediumNonDbgTimeout));
using (var echo = echoTask.Result)
{
var list = new Task<uint>[1000];
var list = new Task<uint>[200];
for (uint i = 0; i < list.Length; i++)
{
list[i] = echo.GetCallSequence(i);

View File

@ -795,7 +795,7 @@ namespace Capnp.Net.Runtime.Tests
using (var callee = Proxy.Share<ITestTailCallee>(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));

View File

@ -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" `