Make multiproduct_kati return error

Test: insert error, run build/soong/build_test.sh and check $?
Change-Id: I3462defd1ff04247a8b729e22988cbe002b0ce69
This commit is contained in:
Dan Willemsen 2018-07-19 22:57:18 -07:00
parent 23be383843
commit 34218ece56

View file

@ -135,7 +135,7 @@ func main() {
writer := terminal.NewWriter(terminal.StdioImpl{})
defer writer.Finish()
log := logger.New(os.Stderr)
log := logger.New(writer)
defer log.Cleanup()
flag.Parse()
@ -150,6 +150,9 @@ func main() {
defer stat.Finish()
stat.AddOutput(terminal.NewStatusOutput(writer, ""))
var failures failureCount
stat.AddOutput(&failures)
build.SetupSignals(log, cancel, func() {
trace.Close()
log.Cleanup()
@ -386,4 +389,30 @@ func main() {
}
s.Finish()
if failures == 1 {
log.Fatal("1 failure")
} else if failures > 1 {
log.Fatalf("%d failures", failures)
} else {
writer.Print("Success")
}
}
type failureCount int
func (f *failureCount) StartAction(action *status.Action, counts status.Counts) {}
func (f *failureCount) FinishAction(result status.ActionResult, counts status.Counts) {
if result.Error != nil {
*f += 1
}
}
func (f *failureCount) Message(level status.MsgLevel, message string) {
if level >= status.ErrorLvl {
*f += 1
}
}
func (f *failureCount) Flush() {}