Extract failIfErrored() to android/testing.go

Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests

Merged-In: I1c09412d5988dca2cc1c5f041893b313ab1c163a
Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
This commit is contained in:
Logan Chien
2018-03-12 16:29:17 +08:00
parent 3985402d74
commit d44aa3b5c8
7 changed files with 22 additions and 66 deletions

View File

@@ -18,6 +18,7 @@ import (
"fmt"
"path/filepath"
"strings"
"testing"
"github.com/google/blueprint"
)
@@ -152,3 +153,13 @@ func (m TestingModule) Output(file string) BuildParams {
panic(fmt.Errorf("couldn't find output %q.\nall outputs: %v",
file, searchedOutputs))
}
func FailIfErrored(t *testing.T, errs []error) {
t.Helper()
if len(errs) > 0 {
for _, err := range errs {
t.Error(err)
}
t.FailNow()
}
}