Extract failIfErrored() to android/testing.go

Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests
Change-Id: I1c09412d5988dca2cc1c5f041893b313ab1c163a
This commit is contained in:
Logan Chien
2018-03-12 16:29:17 +08:00
parent 9c6bc37da1
commit 4203971351
7 changed files with 22 additions and 66 deletions

View File

@@ -342,7 +342,7 @@ func TestPythonModule(t *testing.T) {
ctx.Register()
ctx.MockFileSystem(d.mockFiles)
_, testErrs := ctx.ParseBlueprintsFiles(bpFile)
fail(t, testErrs)
android.FailIfErrored(t, testErrs)
_, actErrs := ctx.PrepareBuildActions(config)
if len(actErrs) > 0 {
testErrs = append(testErrs, expectErrors(t, actErrs, d.errors)...)
@@ -356,7 +356,7 @@ func TestPythonModule(t *testing.T) {
e.depsSrcsZips)...)
}
}
fail(t, testErrs)
android.FailIfErrored(t, testErrs)
})
}
}
@@ -442,12 +442,3 @@ func setupBuildEnv(t *testing.T) (config android.Config, buildDir string) {
func tearDownBuildEnv(buildDir string) {
os.RemoveAll(buildDir)
}
func fail(t *testing.T, errs []error) {
if len(errs) > 0 {
for _, err := range errs {
t.Error(err)
}
t.FailNow()
}
}