fixup, fail on bots

td.FailStep() isn't enough to fail the bot,
so go back to a call to td.Fatal() when failures>0.

Change-Id: Ib2be7b15200376ab8a16e4a1b69d98fde0630673
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364471
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2021-02-02 10:08:56 -06:00
parent 5d1b5a238e
commit 129bc16b56

View File

@ -37,9 +37,7 @@ func main() {
)
flag.Parse()
var failures int32 = 0
ctx := context.Background()
fail := func(_ error) { atomic.AddInt32(&failures, 1) }
fatal := func(err error) {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
@ -47,9 +45,8 @@ func main() {
if !*local {
ctx = td.StartRun(projectId, taskId, bot, output, local)
fail = func(err error) { td.FailStep(ctx, err) }
fatal = func(err error) { td.Fatal(ctx, err) }
defer td.EndRun(ctx)
fatal = func(err error) { td.Fatal(ctx, err) }
}
if flag.NArg() < 1 {
@ -112,6 +109,7 @@ func main() {
queue := make(chan Work, 1<<20) // Arbitrarily huge buffer to avoid ever blocking.
wg := &sync.WaitGroup{}
var failures int32 = 0
var worker func([]string, []string)
worker = func(sources, flags []string) {
@ -158,7 +156,7 @@ func main() {
// If an individual run failed, nothing more to do but fail.
if err != nil {
fail(err)
atomic.AddInt32(&failures, 1)
if *local {
lines := []string{}
scanner := bufio.NewScanner(stderr)
@ -172,6 +170,8 @@ func main() {
cmd.Name,
strings.Join(cmd.Args, " "),
strings.Join(lines, "\n\t"))
} else {
td.FailStep(ctx, err)
}
return
}