mirror of
https://github.com/golang/go
synced 2024-11-18 08:54:45 -07:00
cmd/dist: add -k to "dist test" to keep going after error
Fixes #10336. Change-Id: Idc3f60851aea590575dc293165d4d6f85ae001bc Reviewed-on: https://go-review.googlesource.com/9645 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
6e8bcbbe89
commit
ab4e7988bb
15
src/cmd/dist/test.go
vendored
15
src/cmd/dist/test.go
vendored
@ -24,6 +24,7 @@ func cmdtest() {
|
||||
var t tester
|
||||
flag.BoolVar(&t.listMode, "list", false, "list available tests")
|
||||
flag.BoolVar(&t.noRebuild, "no-rebuild", false, "don't rebuild std and cmd packages")
|
||||
flag.BoolVar(&t.keepGoing, "k", false, "keep going even when error occurred")
|
||||
flag.StringVar(&t.banner, "banner", "##### ", "banner prefix; blank means no section banners")
|
||||
flag.StringVar(&t.runRxStr, "run", os.Getenv("GOTESTONLY"),
|
||||
"run only those tests matching the regular expression; empty means to run all. "+
|
||||
@ -36,6 +37,7 @@ func cmdtest() {
|
||||
type tester struct {
|
||||
listMode bool
|
||||
noRebuild bool
|
||||
keepGoing bool
|
||||
runRxStr string
|
||||
runRx *regexp.Regexp
|
||||
runRxWant bool
|
||||
@ -163,6 +165,7 @@ func (t *tester) run() {
|
||||
os.Unsetenv("GOROOT_FINAL")
|
||||
|
||||
var lastHeading string
|
||||
ok := true
|
||||
for _, dt := range t.tests {
|
||||
if t.runRx != nil && (t.runRx.MatchString(dt.name) != t.runRxWant) {
|
||||
t.partial = true
|
||||
@ -176,10 +179,18 @@ func (t *tester) run() {
|
||||
fmt.Printf("# go tool dist test -run=^%s$\n", dt.name)
|
||||
}
|
||||
if err := dt.fn(); err != nil {
|
||||
log.Fatalf("Failed: %v", err)
|
||||
ok = false
|
||||
if t.keepGoing {
|
||||
log.Printf("Failed: %v", err)
|
||||
} else {
|
||||
log.Fatalf("Failed: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if t.partial {
|
||||
if !ok {
|
||||
fmt.Println("\nFAILED")
|
||||
os.Exit(1)
|
||||
} else if t.partial {
|
||||
fmt.Println("\nALL TESTS PASSED (some were excluded)")
|
||||
} else {
|
||||
fmt.Println("\nALL TESTS PASSED")
|
||||
|
Loading…
Reference in New Issue
Block a user