From c7d7766de751a2696fafd66af0096b396dbfb831 Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Sat, 17 Oct 2026 12:07:26 +0900 Subject: [PATCH] chore: add logging for issue 3285 --- .../Detectors/CpuDetectorTests.cs | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/tests/BenchmarkDotNet.IntegrationTests/Detectors/CpuDetectorTests.cs b/tests/BenchmarkDotNet.IntegrationTests/Detectors/CpuDetectorTests.cs index 58e3ed5158..f29fc65196 100644 --- a/tests/BenchmarkDotNet.IntegrationTests/Detectors/CpuDetectorTests.cs +++ b/tests/BenchmarkDotNet.IntegrationTests/Detectors/CpuDetectorTests.cs @@ -1,6 +1,7 @@ using AwesomeAssertions; using BenchmarkDotNet.Detectors; using BenchmarkDotNet.Detectors.Cpu.Windows; +using BenchmarkDotNet.Helpers; using BenchmarkDotNet.Tests.XUnit; using Perfolizer.Helpers; using Perfolizer.Models; @@ -50,19 +51,32 @@ public void DetectCpuInfoOnWindowsAndCompareValues() cpuInfo1.Should().NotBeNull(); cpuInfo2.Should().NotBeNull(); - cpuInfo1.Should().BeEquivalentTo(cpuInfo2, options => options - .Using(ctx => - { - if (ctx.Expectation is null) + try + { + cpuInfo1.Should().BeEquivalentTo(cpuInfo2, options => options + .Using(ctx => { - ctx.Subject.Should().BeNull(); - return; - } + if (ctx.Expectation is null) + { + ctx.Subject.Should().BeNull(); + return; + } - var expected = (double)ctx.Expectation!.Value; - var actual = (double)ctx.Subject!.Value; - var tolerance = Math.Abs(expected) * 0.02d; // Accept 2% difference - actual.Should().BeApproximately(expected, tolerance); - }).WhenTypeIs()); + var expected = (double)ctx.Expectation!.Value; + var actual = (double)ctx.Subject!.Value; + var tolerance = Math.Abs(expected) * 0.02d; // Accept 2% difference + actual.Should().BeApproximately(expected, tolerance); + }).WhenTypeIs()); + } + catch + { + // Print CPU frequency information that is recognized by Windows. + // See: https://github.com/dotnet/BenchmarkDotNet/issues/3285 + var result = ProcessHelper.RunAndReadOutput("systeminfo"); + Output.WriteLine(result); + + // TODO: Suppress throw exception on specific environment. (`Cobalt 100 2.85GHz` on `windows(arm64)`) + throw; + } } }