Skip to content

Commit 8a72940

Browse files
committed
cmd/coordinator: use 'go tool dist test -k' on release branches
Right now, on release branches, testing is stopped very soon after encountering the first package with a failing test. For example: [...] FAIL cmd/go/internal/modfetch 17.181s ok cmd/go/internal/modfetch/codehost 5.474s FAIL 2019/11/07 02:35:34 Failed: exit status 1 Ideally we should not have failing tests on release branches for long, but that is not the current state. Until we reach that state, make coordinator run 'go tool dist test' with -k flag so that it keeps testing all remaining packages even if one fails, and report complete test results in the log. That way, a package that fails early doesn't make it completely impossible to see if other package tests pass or fail. Updates golang/go#14305 Updates golang/go#36181 Change-Id: Ia674005ae45c6b9dbffa6f5b56d60b7ed38f6b34 Reviewed-on: https://go-review.googlesource.com/c/build/+/211678 Run-TryBot: Dmitri Shuralyov <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Alexander Rakoczy <[email protected]>
1 parent 0bd04bf commit 8a72940

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

cmd/coordinator/coordinator.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,6 +2059,19 @@ func (st *buildStatus) build() error {
20592059

20602060
func (st *buildStatus) HasBuildlet() bool { return atomic.LoadInt32(&st.hasBuildlet) != 0 }
20612061

2062+
// useKeepGoingFlag reports whether this build should use -k flag of 'go tool
2063+
// dist test', which makes it keep going even when some tests have failed.
2064+
func (st *buildStatus) useKeepGoingFlag() bool {
2065+
// For now, keep going for post-submit builders on release branches,
2066+
// because we prioritize seeing more complete test results over failing fast.
2067+
// Later on, we may start doing this all post-submit builders on all branches.
2068+
// See golang.org/issue/14305.
2069+
//
2070+
// TODO(golang.org/issue/36181): A more ideal long term solution is one that reports
2071+
// a failure fast, but still keeps going to make all other test results available.
2072+
return !st.isTry() && strings.HasPrefix(st.branch, "release-branch.go")
2073+
}
2074+
20622075
func (st *buildStatus) isTry() bool { return st.trySet != nil }
20632076

20642077
func (st *buildStatus) isSlowBot() bool {
@@ -3236,6 +3249,9 @@ func (st *buildStatus) runTestsOnBuildlet(bc *buildlet.Client, tis []*testItem,
32363249
if st.conf.CompileOnly {
32373250
args = append(args, "--compile-only")
32383251
}
3252+
if st.useKeepGoingFlag() {
3253+
args = append(args, "-k")
3254+
}
32393255
args = append(args, names...)
32403256
var buf bytes.Buffer
32413257
t0 := time.Now()

0 commit comments

Comments
 (0)