You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
testing: tests after a data race are marked as failed (1.9rc2) #21338
Maybe I missed this behavior until now, still it seems a bug. Opposed to Go 1.8.3 (#21338 (comment)), running a racey test suite with Go 1.9rc2 results in all tests after the racey one being marked as failed:
package main
import (
"testing"
)
funcTestPreRace(t*testing.T) {
// Nothing to do, must succeed
}
funcTestRace(t*testing.T) {
// Blow it upvarnintwait:=make(chanstruct{})
gofunc() {
deferclose(wait)
n++
}()
n++<-wait
}
funcTestPostRace(t*testing.T) {
// Nothing to do, must succeed
}
$ go test -v --race
=== RUN TestPreRace
--- PASS: TestPreRace (0.00s)
=== RUN TestRace
==================
WARNING: DATA RACE
[...]
==================
--- FAIL: TestRace (1.00s)
testing.go:700: race detected during execution of test
=== RUN TestPostRace
--- FAIL: TestPostRace (0.00s)
On Tue, Aug 8, 2017 at 6:26 PM, Péter Szilágyi ***@***.***> wrote:
Maybe I missed this behavior until now, still it seems a bug. Running a
racey test suite with Go 1.9rc2 results in all tests after the racey one
being marked as failed:
package main
import (
"testing"
)
func TestPreRace(t *testing.T) {
// Nothing to do, must succeed
}
func TestRace(t *testing.T) {
// Blow it up
var n int
wait := make(chan struct{})
go func() {
defer close(wait)
n++
}()
n++
<-wait
}
func TestPostRace(t *testing.T) {
// Nothing to do, must succeed
}
$ go test -v --race
=== RUN TestPreRace
--- PASS: TestPreRace (0.00s)
=== RUN TestRace
==================
WARNING: DATA RACE
[...]
==================
--- FAIL: TestRace (1.00s)
testing.go:700: race detected during execution of test
=== RUN TestPostRace
--- FAIL: TestPostRace (0.00s)
FAIL
exit status 1
FAIL github.com/ethereum/go-ethereum/racetest 1.005s
Note, TestPostRace is marked as failed.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#21338>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA2RTSJDilA_u6q_0QcoEEUmsqlQDks5sWBu5gaJpZM4OwZ5d>
.
@dominikh Tests always failed if a data race was detected.
@davecheney Go 1.8.3 only marks the racey test failed, not the others.
$ GOROOT=/tmp/go1.8.3 /tmp/go1.8.3/bin/go test -v --race
=== RUN TestPreRace
--- PASS: TestPreRace (0.00s)
=== RUN TestRace
==================
WARNING: DATA RACE
[...]
==================
--- FAIL: TestRace (0.00s)
testing.go:610: race detected during execution of test
=== RUN TestPostRace
--- PASS: TestPostRace (0.00s)
I also saw this recently and was puzzled, but I assumed it was somehow on purpose to highlight the data race. If it was on purpose, this should be documented in the release notes. Either way, something to do for 1.9.
We could probably just revert for 1.9, since #19851 doesn't seem too serious, and fix it properly later. But I'll check right now to see whether the real fix is trivial.
Activity
davecheney commentedon Aug 8, 2017
dominikh commentedon Aug 8, 2017
Failing tests due to races is new in 1.9 – that it flags all following tests as failed might be a bug.
karalabe commentedon Aug 8, 2017
@dominikh Tests always failed if a data race was detected.
@davecheney Go 1.8.3 only marks the racey test failed, not the others.
dominikh commentedon Aug 8, 2017
@karalabe The commit I was thinking of is 221541e
davecheney commentedon Aug 8, 2017
This may be a regression /cc @ianlancetaylor @broady
mvdan commentedon Aug 8, 2017
I also saw this recently and was puzzled, but I assumed it was somehow on purpose to highlight the data race. If it was on purpose, this should be documented in the release notes. Either way, something to do for 1.9.
ianlancetaylor commentedon Aug 8, 2017
CC @cespare
cespare commentedon Aug 8, 2017
Yeah, unintended consequence of 221541e.
We could probably just revert for 1.9, since #19851 doesn't seem too serious, and fix it properly later. But I'll check right now to see whether the real fix is trivial.
ianlancetaylor commentedon Aug 8, 2017
I'm testing a fix.
gopherbot commentedon Aug 8, 2017
Change https://golang.org/cl/54050 mentions this issue:
testing: don't fail all tests after racy test failureianlancetaylor commentedon Aug 15, 2017
Reopening for 1.9 backport.
gopherbot commentedon Aug 18, 2017
Change https://golang.org/cl/57151 mentions this issue:
[release-branch.go1.9] testing: don't fail all tests after racy test failure[release-branch.go1.9] testing: don't fail all tests after racy test …
aclements commentedon Aug 19, 2017
Fixed on 1.9 by fbf7e1f