]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/par: fix TestWorkParallel retries
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 27 Jul 2018 10:24:00 +0000 (11:24 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 27 Jul 2018 16:29:52 +0000 (16:29 +0000)
commitb39fb9ec85c95cd760b8916eb85c92a185ca7a48
treed46e0f3a1a4d5ea6644559341d6419537b33daec
parent6732633bc6ba81b2fb7e8db0601be0186c8d8565
cmd/go/internal/par: fix TestWorkParallel retries

When the test retried multiple times, it reused the same Work variable,
causing in the builders being flaky due to panics. I was able to
immediately reproduce the failure with stress and -race:

$ go test -race -c && stress -p 32 ./par.test -test.run=TestWorkParallel$

/tmp/go-stress909062277
--- FAIL: TestWorkParallel (0.07s)
panic: par.Work.Do: already called Do [recovered]
panic: par.Work.Do: already called Do

Instead, use a new Work variable at each retry. Now, the line above
seems to never fail. Of course, much higher 'stress -p' values will
still result in "does not seem to be parallel" test failures since the
machine lacks resources. But those are test failures, not panics.

Fixes #26642.

Change-Id: I5e962eca7602cf413d911ff5669f56d4f52da5a7
Reviewed-on: https://go-review.googlesource.com/126355
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/par/work_test.go