Remove varargs from RunTest(t *testing.T)
Use GroupFixturePreparers instead.
Bug: 182885307
Test: m nothing
Change-Id: Iaedb0ddc9d6a704f4d41363e705f3025a1291dc8
diff --git a/android/fixture.go b/android/fixture.go
index 8d62958..1eb53a2 100644
--- a/android/fixture.go
+++ b/android/fixture.go
@@ -466,12 +466,13 @@
// 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) 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 {
diff --git a/java/java_test.go b/java/java_test.go
index d1d26ba..3aafdda 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -845,7 +845,12 @@
if expectedErrorPattern != "" {
errorHandler = android.FixtureExpectsAtLeastOneErrorMatchingPattern(expectedErrorPattern)
}
- prepareForJavaTest.ExtendWithErrorHandler(errorHandler).RunTest(t, createPreparer(info))
+ android.GroupFixturePreparers(
+ prepareForJavaTest,
+ createPreparer(info),
+ ).
+ ExtendWithErrorHandler(errorHandler).
+ RunTest(t)
})
}
diff --git a/java/system_modules_test.go b/java/system_modules_test.go
index 120bbf7..7b5a386 100644
--- a/java/system_modules_test.go
+++ b/java/system_modules_test.go
@@ -50,7 +50,7 @@
`)
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 @@
`)
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 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")
diff --git a/sdk/testing.go b/sdk/testing.go
index 44970f7..9465e13 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -95,7 +95,10 @@
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) {