Remove varargs from RunTest(t *testing.T)
Use GroupFixturePreparers instead. Bug: 182885307 Test: m nothing Change-Id: Iaedb0ddc9d6a704f4d41363e705f3025a1291dc8
This commit is contained in:
parent
4f6d15465b
commit
55e740e9a6
4 changed files with 22 additions and 12 deletions
|
@ -466,12 +466,13 @@ type FixturePreparer interface {
|
|||
|
||||
// Run the test, checking any errors reported and returning a TestResult instance.
|
||||
//
|
||||
// Shorthand for Fixture(t, preparers...).RunTest()
|
||||
RunTest(t *testing.T, preparers ...FixturePreparer) *TestResult
|
||||
// Shorthand for Fixture(t).RunTest()
|
||||
RunTest(t *testing.T) *TestResult
|
||||
|
||||
// Run the test with the supplied Android.bp file.
|
||||
//
|
||||
// Shorthand for RunTest(t, android.FixtureWithRootAndroidBp(bp))
|
||||
// preparer.RunTestWithBp(t, bp) is shorthand for
|
||||
// android.GroupFixturePreparers(preparer, android.FixtureWithRootAndroidBp(bp)).RunTest(t)
|
||||
RunTestWithBp(t *testing.T, bp string) *TestResult
|
||||
|
||||
// RunTestWithConfig is a temporary method added to help ease the migration of existing tests to
|
||||
|
@ -750,15 +751,15 @@ func (b *baseFixturePreparer) ExtendWithErrorHandler(errorHandler FixtureErrorHa
|
|||
}))
|
||||
}
|
||||
|
||||
func (b *baseFixturePreparer) RunTest(t *testing.T, preparers ...FixturePreparer) *TestResult {
|
||||
func (b *baseFixturePreparer) RunTest(t *testing.T) *TestResult {
|
||||
t.Helper()
|
||||
fixture := b.self.Fixture(t, preparers...)
|
||||
fixture := b.self.Fixture(t)
|
||||
return fixture.RunTest()
|
||||
}
|
||||
|
||||
func (b *baseFixturePreparer) RunTestWithBp(t *testing.T, bp string) *TestResult {
|
||||
t.Helper()
|
||||
return b.RunTest(t, FixtureWithRootAndroidBp(bp))
|
||||
return GroupFixturePreparers(b.self, FixtureWithRootAndroidBp(bp)).RunTest(t)
|
||||
}
|
||||
|
||||
func (b *baseFixturePreparer) RunTestWithConfig(t *testing.T, config Config) *TestResult {
|
||||
|
|
|
@ -845,7 +845,12 @@ func TestJavaSdkLibraryEnforce(t *testing.T) {
|
|||
if expectedErrorPattern != "" {
|
||||
errorHandler = android.FixtureExpectsAtLeastOneErrorMatchingPattern(expectedErrorPattern)
|
||||
}
|
||||
prepareForJavaTest.ExtendWithErrorHandler(errorHandler).RunTest(t, createPreparer(info))
|
||||
android.GroupFixturePreparers(
|
||||
prepareForJavaTest,
|
||||
createPreparer(info),
|
||||
).
|
||||
ExtendWithErrorHandler(errorHandler).
|
||||
RunTest(t)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ var addSourceSystemModules = android.FixtureAddTextFile("source/Android.bp", `
|
|||
`)
|
||||
|
||||
func TestJavaSystemModules(t *testing.T) {
|
||||
result := prepareForJavaTest.RunTest(t, addSourceSystemModules)
|
||||
result := android.GroupFixturePreparers(prepareForJavaTest, addSourceSystemModules).RunTest(t)
|
||||
|
||||
// check the existence of the source module
|
||||
sourceSystemModules := result.ModuleForTests("system-modules", "android_common")
|
||||
|
@ -77,7 +77,7 @@ var addPrebuiltSystemModules = android.FixtureAddTextFile("prebuilts/Android.bp"
|
|||
`)
|
||||
|
||||
func TestJavaSystemModulesImport(t *testing.T) {
|
||||
result := prepareForJavaTest.RunTest(t, addPrebuiltSystemModules)
|
||||
result := android.GroupFixturePreparers(prepareForJavaTest, addPrebuiltSystemModules).RunTest(t)
|
||||
|
||||
// check the existence of the renamed prebuilt module
|
||||
prebuiltSystemModules := result.ModuleForTests("system-modules", "android_common")
|
||||
|
@ -89,10 +89,11 @@ func TestJavaSystemModulesImport(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestJavaSystemModulesMixSourceAndPrebuilt(t *testing.T) {
|
||||
result := prepareForJavaTest.RunTest(t,
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForJavaTest,
|
||||
addSourceSystemModules,
|
||||
addPrebuiltSystemModules,
|
||||
)
|
||||
).RunTest(t)
|
||||
|
||||
// check the existence of the source module
|
||||
sourceSystemModules := result.ModuleForTests("system-modules", "android_common")
|
||||
|
|
|
@ -95,7 +95,10 @@ var PrepareForTestWithSdkBuildComponents = android.GroupFixturePreparers(
|
|||
|
||||
func testSdkWithFs(t *testing.T, bp string, fs android.MockFS) *android.TestResult {
|
||||
t.Helper()
|
||||
return prepareForSdkTest.RunTest(t, fs.AddToFixture(), android.FixtureWithRootAndroidBp(bp))
|
||||
return android.GroupFixturePreparers(
|
||||
prepareForSdkTest,
|
||||
fs.AddToFixture(),
|
||||
).RunTestWithBp(t, bp)
|
||||
}
|
||||
|
||||
func testSdkError(t *testing.T, pattern, bp string) {
|
||||
|
|
Loading…
Reference in a new issue