Skip to content

Commit 31de77d

Browse files
authored
the CI must run net6.0, not net5.0 tests (#1986)
* the CI must run net6.0, not net5.0 tests * fix Microsoft.NET.Test.Sdk reference (one, existing version for all test projects) * fix the platform-specific API warning * Task.FromResult(0) is cached in .NET 6 and does not report allocations ;)
1 parent bbe6abc commit 31de77d

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

build/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ public override bool ShouldRun(BuildContext context)
293293
public override void Run(BuildContext context)
294294
{
295295
var targetFrameworks = context.IsRunningOnWindows()
296-
? new[] { "net461", "net5.0" }
297-
: new[] { "net5.0" };
296+
? new[] { "net461", "net6.0" }
297+
: new[] { "net6.0" };
298298

299299
foreach (var targetFramework in targetFrameworks)
300300
context.RunTests(context.UnitTestsProjectFile, "UnitTests", targetFramework);
@@ -327,7 +327,7 @@ public override bool ShouldRun(BuildContext context)
327327

328328
public override void Run(BuildContext context)
329329
{
330-
context.RunTests(context.IntegrationTestsProjectFile, "IntegrationTests", "net5.0");
330+
context.RunTests(context.IntegrationTestsProjectFile, "IntegrationTests", "net6.0");
331331
}
332332
}
333333

tests/BenchmarkDotNet.IntegrationTests.ManualRunning/BenchmarkDotNet.IntegrationTests.ManualRunning.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<ProjectReference Include="..\..\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj" />
2828
</ItemGroup>
2929
<ItemGroup>
30-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
30+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
3131
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
3232
<PackageReference Include="xunit" Version="2.4.1" />
3333
</ItemGroup>

tests/BenchmarkDotNet.IntegrationTests/BenchmarkDotNet.IntegrationTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<ProjectReference Include="..\..\src\BenchmarkDotNet\BenchmarkDotNet.csproj" />
3131
</ItemGroup>
3232
<ItemGroup>
33-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.0" />
33+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
3434
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
3535
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
3636
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />

tests/BenchmarkDotNet.IntegrationTests/MemoryDiagnoserTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class AccurateAllocations
5757
[Benchmark] public byte[] EightBytesArray() => new byte[8];
5858
[Benchmark] public byte[] SixtyFourBytesArray() => new byte[64];
5959

60-
[Benchmark] public Task<int> AllocateTask() => Task.FromResult(default(int));
60+
[Benchmark] public Task<int> AllocateTask() => Task.FromResult<int>(-12345);
6161
}
6262

6363
[Theory, MemberData(nameof(GetToolchains))]

tests/BenchmarkDotNet.IntegrationTests/ProcessPropertiesTests.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ public class CustomAffinity
5454
[Benchmark]
5555
public void Ensure()
5656
{
57-
if (Process.GetCurrentProcess().ProcessorAffinity != Value)
57+
#if NET6_0_OR_GREATER
58+
if (OperatingSystem.IsWindows())
59+
#endif
5860
{
59-
throw new InvalidOperationException("Did not set custom affinity");
61+
if (Process.GetCurrentProcess().ProcessorAffinity != Value)
62+
{
63+
throw new InvalidOperationException("Did not set custom affinity");
64+
}
6065
}
6166
}
6267
}

tests/BenchmarkDotNet.Tests/BenchmarkDotNet.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</ItemGroup>
1717
<ItemGroup>
1818
<PackageReference Include="System.Memory" Version="4.5.3" />
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
2020
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
2121
<PackageReference Include="xunit" Version="2.4.1" />
2222
<PackageReference Include="ApprovalTests" Version="3.1.0" />

0 commit comments

Comments
 (0)