aboutsummaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorLogan Chien <loganchien@google.com>2018-03-12 16:29:17 +0800
committerLogan Chien <loganchien@google.com>2018-03-16 17:45:42 +0800
commitd44aa3b5c8afbfeb66e39668bab3ec0fac63f1e6 (patch)
treef9bd69ac0212653911565c8491d42616b1467bcd /cc
parent3985402d74c7743724daecfc68dc10388cb870d9 (diff)
downloadbuild_soong-d44aa3b5c8afbfeb66e39668bab3ec0fac63f1e6.tar.gz
build_soong-d44aa3b5c8afbfeb66e39668bab3ec0fac63f1e6.tar.bz2
build_soong-d44aa3b5c8afbfeb66e39668bab3ec0fac63f1e6.zip
Extract failIfErrored() to android/testing.go
Bug: 74506774 Test: lunch aosp_walleye-userdebug && make # runs unit tests Merged-In: I1c09412d5988dca2cc1c5f041893b313ab1c163a Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
Diffstat (limited to 'cc')
-rw-r--r--cc/cc_test.go13
-rw-r--r--cc/test_data_test.go13
2 files changed, 4 insertions, 22 deletions
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 19e4703b..63296056 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -147,9 +147,9 @@ func testCcWithConfig(t *testing.T, bp string, config android.Config) *android.T
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 TestLinkReordering(t *testing.T) {
}
}
-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 {
diff --git a/cc/test_data_test.go b/cc/test_data_test.go
index 434edcdf..4a7b0f75 100644
--- a/cc/test_data_test.go
+++ b/cc/test_data_test.go
@@ -135,9 +135,9 @@ func TestDataTests(t *testing.T) {
ctx.Register()
_, errs := ctx.ParseBlueprintsFiles("Blueprints")
- fail(t, errs)
+ android.FailIfErrored(t, errs)
_, errs = ctx.PrepareBuildActions(config)
- fail(t, errs)
+ android.FailIfErrored(t, errs)
foo := ctx.ModuleForTests("foo", "")
@@ -186,12 +186,3 @@ func (test *testDataTest) DepsMutator(ctx android.BottomUpMutatorContext) {
func (test *testDataTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
test.data = ctx.ExpandSources(test.Properties.Data, nil)
}
-
-func fail(t *testing.T, errs []error) {
- if len(errs) > 0 {
- for _, err := range errs {
- t.Error(err)
- }
- t.FailNow()
- }
-}