Extract failIfErrored() to android/testing.go

Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests
Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 19e4703..6329605 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -147,9 +147,9 @@
 	ctx := createTestContext(t, config, bp)
 
 	_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
-	failIfErrored(t, errs)
+	android.FailIfErrored(t, errs)
 	_, errs = ctx.PrepareBuildActions(config)
-	failIfErrored(t, errs)
+	android.FailIfErrored(t, errs)
 
 	return ctx
 }
@@ -1064,15 +1064,6 @@
 	}
 }
 
-func failIfErrored(t *testing.T, errs []error) {
-	if len(errs) > 0 {
-		for _, err := range errs {
-			t.Error(err)
-		}
-		t.FailNow()
-	}
-}
-
 func failIfNoMatchingErrors(t *testing.T, pattern string, errs []error) {
 	matcher, err := regexp.Compile(pattern)
 	if err != nil {