Skip to content

testing: TestBenchmarkBLoopIterationCorrect fails under GOMAXPROCS=1 #70627

Closed

Description

@dmitshur

At tip (commit c5adb82), TestBenchmarkBLoopIterationCorrect succeeds under most conditions.

Details
$ go test -run=^TestBenchmarkBLoopIterationCorrect$ -count=1 -v testing 
=== RUN   TestBenchmarkBLoopIterationCorrect
    testing_test.go:978: /var/folders/yn/rz8r25f10z5fmwdg34tz6z1c0000gn/T/go-build514388636/b001/testing.test -test.run=^BenchmarkBLoopPrint$ -test.bench=BenchmarkBLoopPrint -test.v -test.parallel=2 -test.benchtime=2x: <nil>
        goos: darwin
        goarch: arm64
        pkg: testing
        cpu: Apple M4 Pro
        BenchmarkBLoopPrint
            testing_test.go:1020: Ramping up from BenchmarkBLoopPrint
            testing_test.go:1022: Printing from BenchmarkBLoopPrint
            testing_test.go:1022: Printing from BenchmarkBLoopPrint
        BenchmarkBLoopPrint-14    	       2	      4146 ns/op
        PASS
--- PASS: TestBenchmarkBLoopIterationCorrect (0.01s)
PASS
ok  	testing	0.161s

But it fails consistently when run in an environment where GOMAXPROCS is 1:

$ GOMAXPROCS=1 go test -run=^TestBenchmarkBLoopIterationCorrect$ -count=1 -v testing
=== RUN   TestBenchmarkBLoopIterationCorrect
    testing_test.go:978: /var/folders/yn/rz8r25f10z5fmwdg34tz6z1c0000gn/T/go-build2068115649/b001/testing.test -test.run=^BenchmarkBLoopPrint$ -test.bench=BenchmarkBLoopPrint -test.v -test.parallel=2 -test.benchtime=2x: <nil>
        goos: darwin
        goarch: arm64
        pkg: testing
        cpu: Apple M4 Pro
        BenchmarkBLoopPrint
            testing_test.go:1020: Ramping up from BenchmarkBLoopPrint
            testing_test.go:1022: Printing from BenchmarkBLoopPrint
            testing_test.go:1022: Printing from BenchmarkBLoopPrint
        BenchmarkBLoopPrint 	       2	      4729 ns/op
        PASS
    testing_test.go:995: Missing benchmark output
--- FAIL: TestBenchmarkBLoopIterationCorrect (0.01s)
FAIL
FAIL	testing	0.164s
FAIL

Also see https://ci.chromium.org/b/8729873930854023953/test-results as an example where a builder is running into this. (CC @golang/plan9.)


The regexp added in CL 630455 (CC @JunyangShao) seems to require a -n suffix after the benchmark name, but that suffix isn't included when n is 1.

Activity

  1. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Dec 1, 2024
  2. added this to the Backlog milestone on Dec 1, 2024
  3. gopherbot commented on Dec 1, 2024

    @gopherbot
    Contributor

    Change https://go.dev/cl/632655 mentions this issue: testing: consider -N suffix after benchmark name optional

  4. self-assigned this
    on Dec 1, 2024
  5. modified the milestones: Backlog, Go1.24 on Dec 2, 2024
  6. added
    FixPendingIssues that have a fix which has not yet been reviewed or submitted.
    on Dec 2, 2024
  7. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    and removed
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Dec 2, 2024
  8. added a commit that references this issue on Dec 2, 2024
    3374abe
  9. locked and limited conversation to collaborators on Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions