From 129bc16b5687d043c36a9cb4cba789791fb9e35d Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 2 Feb 2021 10:08:56 -0600 Subject: [PATCH] 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 --- infra/bots/task_drivers/fm_driver/fm_driver.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/infra/bots/task_drivers/fm_driver/fm_driver.go b/infra/bots/task_drivers/fm_driver/fm_driver.go index 2b5fe404ea..647ddb12c2 100644 --- a/infra/bots/task_drivers/fm_driver/fm_driver.go +++ b/infra/bots/task_drivers/fm_driver/fm_driver.go @@ -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 }