Extract failIfErrored() to android/testing.go
Bug: 74506774
Test: lunch aosp_walleye-userdebug && make # runs unit tests
Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
diff --git a/android/testing.go b/android/testing.go
index ae012b0..6e80c53 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -18,6 +18,7 @@
"fmt"
"path/filepath"
"strings"
+ "testing"
"github.com/google/blueprint"
)
@@ -152,3 +153,13 @@
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()
+ }
+}