Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: TestBenchmarkBLoopIterationCorrect fails under GOMAXPROCS=1 #70627

Closed
dmitshur opened this issue Dec 1, 2024 · 2 comments
Closed

testing: TestBenchmarkBLoopIterationCorrect fails under GOMAXPROCS=1 #70627

dmitshur opened this issue Dec 1, 2024 · 2 comments
Assignees
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dmitshur
Copy link
Contributor

dmitshur commented Dec 1, 2024

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


$ 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.

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 1, 2024
@dmitshur dmitshur added this to the Backlog milestone Dec 1, 2024
@gopherbot
Copy link
Contributor

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

@JunyangShao JunyangShao self-assigned this Dec 1, 2024
@dmitshur dmitshur modified the milestones: Backlog, Go1.24 Dec 2, 2024
@dmitshur dmitshur added the FixPending Issues that have a fix which has not yet been reviewed or submitted. label Dec 2, 2024
@JunyangShao JunyangShao assigned dmitshur and unassigned JunyangShao Dec 2, 2024
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants