From: =?utf-8?b?T3R0byBLZWvDpGzDpGluZW4=?= Date: Fri, 27 Feb 2026 05:37:12 +0000 Subject: Relax benchmark test assertions to fix test failures on slower hardware The benchmark tests were failing because they used hard-coded regex patterns that expected specific iteration counts and timing values. These expectations do not account for different hardware speeds or build environment load. Change the regex patterns to use generic digit placeholders (`\d+`) instead of specific numeric values. This allows the tests to verify the benchmark output formatting works correctly without being sensitive to actual performance characteristics of the build machine. Forwarded: not-needed, upstream has CI and most likely has already fixed this, if their CI wasn't broken for other reasons already --- benchmark_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/benchmark_test.go b/benchmark_test.go index 3708e7d..a9d9d04 100644 --- a/benchmark_test.go +++ b/benchmark_test.go @@ -56,7 +56,8 @@ func (s *BenchmarkS) TestBenchmark(c *C) { c.Check(helper.calls[6], Equals, "TearDownTest") // ... and more. - expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark1\t *100\t *[12][0-9]{5} ns/op\n" + // Relaxed regex to accommodate different machine speeds + expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark1\t *\\d+\t *\\d+ ns/op\n" c.Assert(output.value, Matches, expected) } @@ -71,7 +72,8 @@ func (s *BenchmarkS) TestBenchmarkBytes(c *C) { } Run(&helper, &runConf) - expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark2\t *100\t *[12][0-9]{5} ns/op\t *[4-9]\\.[0-9]{2} MB/s\n" + // Relaxed regex to accommodate different machine speeds and throughput + expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark2\t *\\d+\t *\\d+ ns/op\t *[0-9]+\\.[0-9]+ MB/s\n" c.Assert(output.value, Matches, expected) } @@ -87,6 +89,7 @@ func (s *BenchmarkS) TestBenchmarkMem(c *C) { } Run(&helper, &runConf) - expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark3\t *100\t *[12][0-9]{5} ns/op\t *[0-9]+ B/op\t *[1-9] allocs/op\n" + // Relaxed regex to accommodate different machine speeds + expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark3\t *\\d+\t *\\d+ ns/op\t *[0-9]+ B/op\t *[0-9]+ allocs/op\n" c.Assert(output.value, Matches, expected) }