1
0
mirror of https://github.com/golang/go synced 2024-10-02 10:28:34 -06:00

cmd/go: do not let test vet failures stop reporting of later test results

(This only manifested in test vet failures for packages without tests,
or else we'd probably have seen this sooner.)

Fixes #23047.

Change-Id: I41d09a7780999bbe1951377ffcc811ba86ea5000
Reviewed-on: https://go-review.googlesource.com/83955
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Russ Cox 2017-12-13 21:11:47 -05:00
parent c4da610197
commit c7b7c43363
5 changed files with 36 additions and 10 deletions

View File

@ -5275,6 +5275,10 @@ func TestTestVet(t *testing.T) {
tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
tg.run("test", "vetcycle") // must not fail; #22890
tg.runFail("test", "vetfail/...")
tg.grepStderr(`Printf format %d`, "did not diagnose bad Printf")
tg.grepStdout(`ok\s+vetfail/p2`, "did not run vetfail/p2")
}
func TestInstallDeps(t *testing.T) {

View File

@ -1087,7 +1087,7 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
Func: c.builderRunTest,
Deps: []*work.Action{buildAction},
Package: p,
IgnoreFail: true,
IgnoreFail: true, // run (prepare output) even if build failed
TryCache: c.tryCache,
Objdir: testDir,
}
@ -1098,17 +1098,19 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
addTestVet(b, pxtest, runAction, installAction)
}
cleanAction = &work.Action{
Mode: "test clean",
Func: builderCleanTest,
Deps: []*work.Action{runAction},
Package: p,
Objdir: testDir,
Mode: "test clean",
Func: builderCleanTest,
Deps: []*work.Action{runAction},
Package: p,
IgnoreFail: true, // clean even if test failed
Objdir: testDir,
}
printAction = &work.Action{
Mode: "test print",
Func: builderPrintTest,
Deps: []*work.Action{cleanAction},
Package: p,
Mode: "test print",
Func: builderPrintTest,
Deps: []*work.Action{cleanAction},
Package: p,
IgnoreFail: true, // print even if test failed
}
}
if installAction != nil {

View File

@ -0,0 +1,7 @@
package p1
import "fmt"
func F() {
fmt.Printf("%d", "hello") // causes vet error
}

View File

@ -0,0 +1,6 @@
package p2
import _ "vetfail/p1"
func F() {
}

View File

@ -0,0 +1,7 @@
package p2
import "testing"
func TestF(t *testing.T) {
F()
}