Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/generate-coverage-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ jobs:

- name: Collect Code Coverage
run: |
dotnet coverage connect bdn_coverage "dotnet test tests/BenchmarkDotNet.Tests -c Release --no-build --framework net462"
dotnet coverage connect bdn_coverage "dotnet test tests/BenchmarkDotNet.Analyzers.Tests -c Release --no-build --framework net462"
dotnet coverage connect bdn_coverage "dotnet test tests/BenchmarkDotNet.Tests -c Release --no-build --framework net472"
dotnet coverage connect bdn_coverage "dotnet test tests/BenchmarkDotNet.Analyzers.Tests -c Release --no-build --framework net472"

- name: Collect Code Coverage for BenchmarkDotNet.IntegrationTests
if: ${{ github.event.inputs.skip_integration_tests == 'false'}}
run: |
dotnet coverage connect bdn_coverage 'dotnet test tests/BenchmarkDotNet.IntegrationTests -c Release --no-build --framework net462 --filter "(FullyQualifiedName!~DotMemoryTests) & (FullyQualifiedName!~DotTraceTests) & (FullyQualifiedName!~WasmIsSupported) & (FullyQualifiedName!~WasmSupportsInProcessDiagnosers)"'
dotnet coverage connect bdn_coverage 'dotnet test tests/BenchmarkDotNet.IntegrationTests -c Release --no-build --framework net472 --filter "(FullyQualifiedName!~DotMemoryTests) & (FullyQualifiedName!~DotTraceTests) & (FullyQualifiedName!~WasmIsSupported) & (FullyQualifiedName!~WasmSupportsInProcessDiagnosers)"'

- name: Shutdown dotnet-coverage server.
run: dotnet coverage shutdown bdn_coverage --timeout 60000
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests-selected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ on:
required: true
options:
- net8.0
- net462
- net472
filter:
type: string
description: Test filter text (It's used for `dotnet test --filter`) Use default value when running all tests
Expand Down
4 changes: 2 additions & 2 deletions build/BenchmarkDotNet.Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ public HelpInfo GetHelp()
}

[TaskName(Name)]
[TaskDescription("Run integration tests using .NET Framework 4.6.2+ (slow)")]
[TaskDescription("Run integration tests using .NET Framework 4.7.2 (slow)")]
[IsDependentOn(typeof(BuildTask))]
public class InTestsFullTask : FrostingTask<BuildContext>, IHelpProvider
{
private const string Name = "in-tests-full";

public override bool ShouldRun(BuildContext context) => context.IsRunningOnWindows();

public override void Run(BuildContext context) => context.UnitTestRunner.RunInTests("net462");
public override void Run(BuildContext context) => context.UnitTestRunner.RunInTests("net472");

public HelpInfo GetHelp() => new();
}
Expand Down
4 changes: 2 additions & 2 deletions build/BenchmarkDotNet.Build/Runners/UnitTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ private void RunUnitTests(string tfm)

public void RunUnitTests()
{
string[] targetFrameworks = context.IsRunningOnWindows() ? ["net462", "net8.0"] : ["net8.0"];
string[] targetFrameworks = context.IsRunningOnWindows() ? ["net472", "net8.0"] : ["net8.0"];
foreach (var targetFramework in targetFrameworks)
RunUnitTests(targetFramework);
}

public void RunAnalyzerTests()
{
string[] targetFrameworks = context.IsRunningOnWindows() ? ["net462", "net8.0"] : ["net8.0"];
string[] targetFrameworks = context.IsRunningOnWindows() ? ["net472", "net8.0"] : ["net8.0"];
foreach (var targetFramework in targetFrameworks)
RunTests(AnalyzerTestsProjectFile, "analyzer", targetFramework);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/contributing/running-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To run all tests just run the following command in the repo root:
dotnet test -c Release BenchmarkDotNet.slnx
```

Most of the tests projects target `net462` and `net8.0`. If the change that you want to test is not specific to any particular runtime, you can run the tests for one of them.
Most of the tests projects target `net472` and `net8.0`. If the change that you want to test is not specific to any particular runtime, you can run the tests for one of them.

```cmd
dotnet test -c Release -f net8.0 BenchmarkDotNet.slnx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<AssemblyName>BenchmarkDotNet.Analyzers.Tests</AssemblyName>
<TargetFrameworks>net462;net8.0;net10.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0;net10.0</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net472</TargetFrameworks>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<AssemblyTitle>BenchmarkDotNet.IntegrationTests.ConfigPerAssembly</AssemblyTitle>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>BenchmarkDotNet.IntegrationTests.ConfigPerAssembly</AssemblyName>
<PackageId>BenchmarkDotNet.IntegrationTests.ConfigPerAssembly</PackageId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<AssemblyTitle>BenchmarkDotNet.IntegrationTests.CustomPaths</AssemblyTitle>
<TargetFramework>net462</TargetFramework>
<TargetFramework>net472</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>BenchmarkDotNet.IntegrationTests.CustomPaths</AssemblyName>
<PackageId>BenchmarkDotNet.IntegrationTests.CustomPaths</PackageId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<AssemblyTitle>BenchmarkDotNet.IntegrationTests.DisabledOptimizations</AssemblyTitle>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>BenchmarkDotNet.IntegrationTests.DisabledOptimizations</AssemblyName>
<PackageId>BenchmarkDotNet.IntegrationTests.DisabledOptimizations</PackageId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<AssemblyTitle>BenchmarkDotNet.IntegrationTests.EnabledOptimizations</AssemblyTitle>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>BenchmarkDotNet.IntegrationTests.EnabledOptimizations</AssemblyName>
<PackageId>BenchmarkDotNet.IntegrationTests.EnabledOptimizations</PackageId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<PublicSign>false</PublicSign>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<AssemblyTitle>BenchmarkDotNet.IntegrationTests.ManualRunning</AssemblyTitle>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>BenchmarkDotNet.IntegrationTests.ManualRunning</AssemblyName>
<PackageId>BenchmarkDotNet.IntegrationTests.ManualRunning</PackageId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<AssemblyTitle>BenchmarkDotNet.IntegrationTests.Static</AssemblyTitle>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>BenchmarkDotNet.IntegrationTests.Static</AssemblyName>
<PackageId>BenchmarkDotNet.IntegrationTests.Static</PackageId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\BenchmarkDotNet\BenchmarkDotNet.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<AssemblyTitle>BenchmarkDotNet.IntegrationTests</AssemblyTitle>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net462;net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net472;net8.0</TargetFrameworks>
<TargetFramework Condition="'$(OS)' != 'Windows_NT'">net8.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>BenchmarkDotNet.IntegrationTests</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public static IEnumerable<object[]> GetAllJits()

if (RuntimeInformation.IsFullFramework)
{
yield return [Jit.LegacyJit, Platform.X86, CsProjClassicNetToolchain.Net462]; // 32bit LegacyJit for desktop .NET
yield return [Jit.LegacyJit, Platform.X64, CsProjClassicNetToolchain.Net462]; // 64bit LegacyJit for desktop .NET
yield return [Jit.RyuJit, Platform.X64, CsProjClassicNetToolchain.Net462]; // RyuJit for desktop .NET
yield return [Jit.LegacyJit, Platform.X86, CsProjClassicNetToolchain.Net472]; // 32bit LegacyJit for desktop .NET
yield return [Jit.LegacyJit, Platform.X64, CsProjClassicNetToolchain.Net472]; // 64bit LegacyJit for desktop .NET
yield return [Jit.RyuJit, Platform.X64, CsProjClassicNetToolchain.Net472]; // RyuJit for desktop .NET
}
else if (RuntimeInformation.IsNetCore)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public JitRuntimeValidationTest(ITestOutputHelper output) : base(output) { }
[InlineData(Jit.RyuJit, Platform.X64, null)]
public void CheckClrOnWindows(Jit jit, Platform platform, string? errorMessage)
{
Verify(ClrRuntime.Net462, jit, platform, errorMessage);
Verify(ClrRuntime.Net472, jit, platform, errorMessage);
}

// [TheoryWindowsOnly("CLR is a valid job only on Windows")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void BenchmarkCanAllocateMoreThan2Gb_Framework()
if (platform == Platform.X64)
{
++jobCount;
config.AddJob(Job.Dry.WithRuntime(ClrRuntime.Net462).WithPlatform(Platform.X86).WithGcServer(false).WithLargeAddressAware().WithId("X86"));
config.AddJob(Job.Dry.WithRuntime(ClrRuntime.Net472).WithPlatform(Platform.X86).WithGcServer(false).WithLargeAddressAware().WithId("X86"));
}
config.AddColumnProvider(DefaultColumnProviders.Instance)
.AddLogger(new OutputLogger(output));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void SingleBenchmarkCanBeExecutedForMultipleRuntimes()
.Run<C>(
ManualConfig.CreateEmpty()
.AddJob(Job.Dry.WithRuntime(CoreRuntime.Core80).WithId("Core"))
.AddJob(Job.Dry.WithRuntime(ClrRuntime.Net462).WithId("Framework"))
.AddJob(Job.Dry.WithRuntime(ClrRuntime.Net472).WithId("Framework"))
.AddColumnProvider(DefaultColumnProviders.Instance)
.AddLogger(new OutputLogger(output)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public TailCallDiagnoserTests(ITestOutputHelper outputHelper) : base(outputHelpe
public static IEnumerable<object[]> GetJits()
=>
[
[Jit.LegacyJit, Platform.X64, ClrRuntime.Net462], // 64bit LegacyJit for desktop .NET
[Jit.RyuJit, Platform.X64, ClrRuntime.Net462], // RyuJit for desktop .NET
[Jit.LegacyJit, Platform.X64, ClrRuntime.Net472], // 64bit LegacyJit for desktop .NET
[Jit.RyuJit, Platform.X64, ClrRuntime.Net472], // RyuJit for desktop .NET
];

public class TailCallBenchmarks
Expand Down
2 changes: 1 addition & 1 deletion tests/BenchmarkDotNet.Tests/AppConfigGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public async Task LeavsStartupSettingsIntactForNonPrivateBuildsOfClr()
using var source = new StringReader(input);
using var destination = new Utf8StringWriter();

await AppConfigGenerator.GenerateAsync(new Job { Environment = { Runtime = ClrRuntime.Net462 } }.Freeze(), source, destination, Resolver, CancellationToken.None);
await AppConfigGenerator.GenerateAsync(new Job { Environment = { Runtime = ClrRuntime.Net472 } }.Freeze(), source, destination, Resolver, CancellationToken.None);

AssertAreEqualIgnoringWhitespacesAndCase(withoutStartup, destination.ToString());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/BenchmarkDotNet.Tests/BenchmarkDotNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<AssemblyTitle>BenchmarkDotNet.Tests</AssemblyTitle>
<TargetFrameworks>net8.0;net10.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net10.0;net472</TargetFrameworks>
<AssemblyName>BenchmarkDotNet.Tests</AssemblyName>
<PackageId>BenchmarkDotNet.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand Down
1 change: 1 addition & 0 deletions tests/BenchmarkDotNet.Tests/ConfigParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ public void IlCompilerPathParsedCorrectly()
[InlineData("net8.0", true)]
[InlineData("net9.0", true)]
[InlineData("net462", false)]
[InlineData("net472", false)]
[InlineData("net48", false)]
public void DotNetCliParsedCorrectly(string tfm, bool isCore)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public void WhenTwoConfigsAreAddedTheMutatorJobsAreAppliedToAllOtherJobs()
const int warmupCount = 2;
var configWithMutatorJob = CreateConfigFromJobs(Job.Default.WithWarmupCount(warmupCount).AsMutator());
var configWithTwoStandardJobs = CreateConfigFromJobs(
Job.Default.WithRuntime(ClrRuntime.Net462),
Job.Default.WithRuntime(ClrRuntime.Net472),
Job.Default.WithRuntime(CoreRuntime.Core80));

foreach (var added in AddLeftToTheRightAndRightToTheLef(configWithTwoStandardJobs, configWithMutatorJob))
Expand Down
2 changes: 1 addition & 1 deletion tests/BenchmarkDotNet.Tests/Configs/JobTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public static void Test06CharacteristicHacks()

a = InfrastructureMode.ToolchainCharacteristic;
// will not throw:
a[j] = CsProjClassicNetToolchain.Net462;
a[j] = CsProjClassicNetToolchain.Net472;
a[j] = null;
a[j] = Characteristic.EmptyValue;
Assert.Throws<ArgumentException>(() => a[j] = new EnvironmentMode()); // not assignable;
Expand Down
2 changes: 1 addition & 1 deletion tests/BenchmarkDotNet.Tests/Reports/SummaryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private static IConfig CreateConfig()
{
// We use runtime as selector later. It is chosen as selector just to be close to initial issue. Nothing particularly special about it.
Job coreJob = new Job(Job.Default).WithRuntime(CoreRuntime.Core80).ApplyAndFreeze(RunMode.Dry);
Job clrJob = new Job(Job.Default).WithRuntime(ClrRuntime.Net462).ApplyAndFreeze(RunMode.Dry);
Job clrJob = new Job(Job.Default).WithRuntime(ClrRuntime.Net472).ApplyAndFreeze(RunMode.Dry);
return ManualConfig.Create(DefaultConfig.Instance).AddJob(coreJob).AddJob(clrJob);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void JobMutatorsApplySettingsToAllNonMutatorJobs()
var info = BenchmarkConverter.TypeToBenchmarks(
typeof(WithMutator),
DefaultConfig.Instance
.AddJob(Job.Default.WithRuntime(ClrRuntime.Net462))
.AddJob(Job.Default.WithRuntime(ClrRuntime.Net472))
.AddJob(Job.Default.WithRuntime(CoreRuntime.Core80)));

Assert.Equal(2, info.BenchmarksCases.Length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void BenchmarksAreGroupedByJob()
Assert.Equal(2, grouping.Count()); // M1 + M2
}

[SimpleJob(runtimeMoniker: RuntimeMoniker.Net462)]
[SimpleJob(runtimeMoniker: RuntimeMoniker.Net472)]
[SimpleJob(runtimeMoniker: RuntimeMoniker.Mono)]
[SimpleJob(runtimeMoniker: RuntimeMoniker.Net50)]
public class AllRuntimes
Expand Down
2 changes: 1 addition & 1 deletion tests/BenchmarkDotNet.Tests/XUnit/EnvRequirementChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class EnvRequirementChecker

private static bool IsPrivilegedProcess()
{
#if NET462
#if NETFRAMEWORK
using WindowsIdentity currentUser = WindowsIdentity.GetCurrent();
return new WindowsPrincipal(currentUser).IsInRole(WindowsBuiltInRole.Administrator);
#else
Expand Down
Loading