summaryrefslogtreecommitdiff
path: root/java/app_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/app_test.go')
-rw-r--r--java/app_test.go132
1 files changed, 66 insertions, 66 deletions
diff --git a/java/app_test.go b/java/app_test.go
index 701fc3594..4f23f61a4 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -72,14 +72,14 @@ func TestApp(t *testing.T) {
}
`)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
var expectedLinkImplicits []string
manifestFixer := foo.Output("manifest_fixer/AndroidManifest.xml")
expectedLinkImplicits = append(expectedLinkImplicits, manifestFixer.Output.String())
- frameworkRes := result.ModuleForTests("framework-res", "android_common")
+ frameworkRes := result.ModuleForTests(t, "framework-res", "android_common")
expectedLinkImplicits = append(expectedLinkImplicits,
frameworkRes.Output("package-res.apk").Output.String())
@@ -96,7 +96,7 @@ func TestApp(t *testing.T) {
expectedLinkImplicits = append(expectedLinkImplicits, list.Output.String())
// Check that the link rule uses
- res := result.ModuleForTests("foo", "android_common").Output("package-res.apk")
+ res := result.ModuleForTests(t, "foo", "android_common").Output("package-res.apk")
android.AssertDeepEquals(t, "aapt2 link implicits", expectedLinkImplicits, res.Implicits.Strings())
})
}
@@ -112,7 +112,7 @@ func TestAppSplits(t *testing.T) {
sdk_version: "current"
}`)
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
expectedOutputs := []string{
"out/soong/.intermediates/foo/android_common/foo.apk",
@@ -448,11 +448,11 @@ func TestUpdatableApps_JniLibShouldBeBuiltAgainstMinSdkVersion(t *testing.T) {
ctx, _ := testJavaWithFS(t, bp, fs)
- inputs := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_sdk_shared").Description("link").Implicits
+ inputs := ctx.ModuleForTests(t, "libjni", "android_arm64_armv8-a_sdk_shared").Description("link").Implicits
var crtbeginFound, crtendFound bool
- expectedCrtBegin := ctx.ModuleForTests("crtbegin_so",
+ expectedCrtBegin := ctx.ModuleForTests(t, "crtbegin_so",
"android_arm64_armv8-a_sdk_29").Rule("noAddrSig").Output
- expectedCrtEnd := ctx.ModuleForTests("crtend_so",
+ expectedCrtEnd := ctx.ModuleForTests(t, "crtend_so",
"android_arm64_armv8-a_sdk_29").Rule("noAddrSig").Output
implicits := []string{}
for _, input := range inputs {
@@ -542,7 +542,7 @@ func TestUpdatableApps_ApplyDefaultUpdatableModuleVersion(t *testing.T) {
updatable: true,
}
`)
- foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ foo := result.ModuleForTests(t, "com.android.foo", "android_common").Rule("manifestFixer")
android.AssertStringDoesContain(t,
"com.android.foo: expected manifest fixer to set override-placeholder-version to RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION",
foo.BuildParams.Args["args"],
@@ -566,7 +566,7 @@ func TestUpdatableApps_ApplyOverrideApexManifestDefaultVersion(t *testing.T) {
updatable: true,
}
`)
- foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ foo := result.ModuleForTests(t, "com.android.foo", "android_common").Rule("manifestFixer")
android.AssertStringDoesContain(t,
"com.android.foo: expected manifest fixer to set override-placeholder-version to 1234",
foo.BuildParams.Args["args"],
@@ -618,7 +618,7 @@ func TestResourceDirs(t *testing.T) {
fs.AddToFixture(),
).RunTestWithBp(t, fmt.Sprintf(bp, testCase.prop))
- module := result.ModuleForTests("foo", "android_common")
+ module := result.ModuleForTests(t, "foo", "android_common")
resourceList := module.MaybeOutput("aapt2/res.list")
var resources []string
@@ -730,7 +730,7 @@ func TestLibraryAssets(t *testing.T) {
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
- m := ctx.ModuleForTests(test.name, "android_common")
+ m := ctx.ModuleForTests(t, test.name, "android_common")
// Check asset flag in aapt2 link flags
var aapt2link android.TestingBuildParams
@@ -783,7 +783,7 @@ func TestAppJavaResources(t *testing.T) {
ctx := testApp(t, bp)
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
fooResources := foo.Output("res/foo.jar")
fooDexJar := foo.Output("dex-withres/foo.jar")
fooDexJarAligned := foo.Output("dex-withres-aligned/foo.jar")
@@ -801,7 +801,7 @@ func TestAppJavaResources(t *testing.T) {
t.Errorf("expected aligned dex jar %q in foo apk inputs %q", w, g)
}
- bar := ctx.ModuleForTests("bar", "android_common")
+ bar := ctx.ModuleForTests(t, "bar", "android_common")
barResources := bar.Output("res/bar.jar")
barApk := bar.Rule("combineApk")
@@ -1352,7 +1352,7 @@ func TestAndroidResourceProcessor(t *testing.T) {
}
getAaptInfo := func(moduleName string) (aaptInfo aaptInfo) {
- mod := result.ModuleForTests(moduleName, "android_common")
+ mod := result.ModuleForTests(t, moduleName, "android_common")
resourceListRule := mod.MaybeOutput("aapt2/res.list")
overlayListRule := mod.MaybeOutput("aapt2/overlay.list")
aaptRule := mod.Rule("aapt2Link")
@@ -1670,7 +1670,7 @@ func TestAndroidResourceOverlays(t *testing.T) {
}
getResources := func(moduleName, variantName string) (resourceFiles, overlayFiles, rroDirs []string) {
- module := result.ModuleForTests(moduleName, variantName)
+ module := result.ModuleForTests(t, moduleName, variantName)
resourceList := module.MaybeOutput("aapt2/res.list")
if resourceList.Rule != nil {
resourceFiles = resourceListToFiles(module, android.PathsRelativeToTop(resourceList.Inputs))
@@ -1729,7 +1729,7 @@ func TestAndroidResourceOverlays(t *testing.T) {
}
func checkSdkVersion(t *testing.T, result *android.TestResult, expectedSdkVersion string) {
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
link := foo.Output("package-res.apk")
linkFlags := strings.Split(link.Args["flags"], " ")
min := android.IndexList("--min-sdk-version", linkFlags)
@@ -1986,7 +1986,7 @@ func TestJNIABI(t *testing.T) {
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
- app := ctx.ModuleForTests(test.name, "android_common")
+ app := ctx.ModuleForTests(t, test.name, "android_common")
jniLibZip := app.Output("jnilibs.zip")
var abis []string
args := strings.Fields(jniLibZip.Args["jarArgs"])
@@ -2122,7 +2122,7 @@ func TestJNIPackaging(t *testing.T) {
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
- app := ctx.ModuleForTests(test.name, "android_common")
+ app := ctx.ModuleForTests(t, test.name, "android_common")
jniLibZip := app.MaybeOutput("jnilibs.zip")
if g, w := (jniLibZip.Rule != nil), test.packaged; g != w {
t.Errorf("expected jni packaged %v, got %v", w, g)
@@ -2204,17 +2204,17 @@ func TestJNISDK(t *testing.T) {
{name: "app_vendor", vendorJNI: true},
}
- platformJNI := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_shared").
+ platformJNI := ctx.ModuleForTests(t, "libjni", "android_arm64_armv8-a_shared").
Output("libjni.so").Output.String()
- sdkJNI := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_sdk_shared").
+ sdkJNI := ctx.ModuleForTests(t, "libjni", "android_arm64_armv8-a_sdk_shared").
Output("libjni.so").Output.String()
- vendorJNI := ctx.ModuleForTests("libvendorjni", "android_vendor_arm64_armv8-a_shared").
+ vendorJNI := ctx.ModuleForTests(t, "libvendorjni", "android_vendor_arm64_armv8-a_shared").
Output("libvendorjni.so").Output.String()
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
- app := ctx.ModuleForTests(test.name, "android_common")
+ app := ctx.ModuleForTests(t, test.name, "android_common")
jniLibZip := app.MaybeOutput("jnilibs.zip")
if len(jniLibZip.Implicits) != 1 {
@@ -2417,7 +2417,7 @@ func TestCertificates(t *testing.T) {
}),
).RunTestWithBp(t, test.bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
certificate := foo.Module().(*AndroidApp).certificate
android.AssertPathRelativeToTopEquals(t, "certificates key", test.expectedCertificate+".pk8", certificate.Key)
@@ -2489,7 +2489,7 @@ func TestRequestV4SigningFlag(t *testing.T) {
PrepareForTestWithJavaDefaultModules,
).RunTestWithBp(t, test.bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
signapk := foo.Output("foo.apk")
signFlags := signapk.Args["flags"]
@@ -2567,7 +2567,7 @@ func TestPackageNameOverride(t *testing.T) {
}),
).RunTestWithBp(t, test.bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
outSoongDir := result.Config.SoongOutDir()
@@ -2608,7 +2608,7 @@ func TestInstrumentationTargetOverridden(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- bar := result.ModuleForTests("bar", "android_common")
+ bar := result.ModuleForTests(t, "bar", "android_common")
res := bar.Output("package-res.apk")
aapt2Flags := res.Args["flags"]
e := "--rename-instrumentation-target-package org.dandroid.bp"
@@ -2766,7 +2766,7 @@ func TestOverrideAndroidApp(t *testing.T) {
},
}
for _, expected := range expectedVariants {
- variant := result.ModuleForTests(expected.name, expected.variantName)
+ variant := result.ModuleForTests(t, expected.name, expected.variantName)
// Check the final apk name
variant.Output(expected.apkPath)
@@ -2851,7 +2851,7 @@ func TestOverrideAndroidAppOverrides(t *testing.T) {
},
}
for _, expected := range expectedVariants {
- variant := ctx.ModuleForTests(expected.name, expected.variantName)
+ variant := ctx.ModuleForTests(t, expected.name, expected.variantName)
// Check if the overrides field values are correctly aggregated.
mod := variant.Module().(*AndroidApp)
@@ -2883,13 +2883,13 @@ func TestOverrideAndroidAppWithPrebuilt(t *testing.T) {
`)
// An app that has an override that also has a prebuilt should not be hidden.
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
if foo.Module().IsHideFromMake() {
t.Errorf("expected foo to have HideFromMake false")
}
// An override that also has a prebuilt should be hidden.
- barOverride := result.ModuleForTests("foo", "android_common_bar")
+ barOverride := result.ModuleForTests(t, "foo", "android_common_bar")
if !barOverride.Module().IsHideFromMake() {
t.Errorf("expected bar override variant of foo to have HideFromMake true")
}
@@ -2965,7 +2965,7 @@ func TestOverrideAndroidAppStem(t *testing.T) {
apkPath: "out/target/product/test_device/system/app/baz2_stem/baz2_stem.apk",
},
} {
- variant := ctx.ModuleForTests(expected.moduleName, expected.variantName)
+ variant := ctx.ModuleForTests(t, expected.moduleName, expected.variantName)
variant.Output(expected.apkPath)
}
}
@@ -2999,14 +2999,14 @@ func TestOverrideAndroidAppDependency(t *testing.T) {
`)
// Verify baz, which depends on the overridden module foo, has the correct classpath javac arg.
- javac := ctx.ModuleForTests("baz", "android_common").Rule("javac")
+ javac := ctx.ModuleForTests(t, "baz", "android_common").Rule("javac")
fooTurbine := "out/soong/.intermediates/foo/android_common/turbine-combined/foo.jar"
if !strings.Contains(javac.Args["classpath"], fooTurbine) {
t.Errorf("baz classpath %v does not contain %q", javac.Args["classpath"], fooTurbine)
}
// Verify qux, which depends on the overriding module bar, has the correct classpath javac arg.
- javac = ctx.ModuleForTests("qux", "android_common").Rule("javac")
+ javac = ctx.ModuleForTests(t, "qux", "android_common").Rule("javac")
barTurbine := "out/soong/.intermediates/foo/android_common_bar/turbine-combined/foo.jar"
if !strings.Contains(javac.Args["classpath"], barTurbine) {
t.Errorf("qux classpath %v does not contain %q", javac.Args["classpath"], barTurbine)
@@ -3070,7 +3070,7 @@ func TestOverrideAndroidTest(t *testing.T) {
},
}
for _, expected := range expectedVariants {
- variant := ctx.ModuleForTests("foo_test", expected.variantName)
+ variant := ctx.ModuleForTests(t, "foo_test", expected.variantName)
// Check the final apk name
variant.Output("out" + expected.apkPath)
@@ -3161,7 +3161,7 @@ func TestAndroidTest_FixTestConfig(t *testing.T) {
}
for _, test := range testCases {
- variant := ctx.ModuleForTests(test.moduleName, test.variantName)
+ variant := ctx.ModuleForTests(t, test.moduleName, test.variantName)
params := variant.MaybeOutput("test_config_fixer/AndroidTest.xml")
if len(test.expectedFlags) > 0 {
@@ -3251,7 +3251,7 @@ func TestStl(t *testing.T) {
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
- app := ctx.ModuleForTests(test.name, "android_common")
+ app := ctx.ModuleForTests(t, test.name, "android_common")
jniLibZip := app.Output("jnilibs.zip")
var jnis []string
args := strings.Fields(jniLibZip.Args["jarArgs"])
@@ -3428,8 +3428,8 @@ func TestUsesLibraries(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- app := result.ModuleForTests("app", "android_common")
- prebuilt := result.ModuleForTests("prebuilt", "android_common")
+ app := result.ModuleForTests(t, "app", "android_common")
+ prebuilt := result.ModuleForTests(t, "prebuilt", "android_common")
// Test that implicit dependencies on java_sdk_library instances are passed to the manifest.
// These also include explicit `uses_libs`/`optional_uses_libs` entries, as they may be
@@ -3534,7 +3534,7 @@ func TestDexpreoptBcp(t *testing.T) {
dexpreopt.FixtureSetPreoptWithUpdatableBcp(test.with),
).RunTestWithBp(t, bp)
- app := result.ModuleForTests("app", "android_common")
+ app := result.ModuleForTests(t, "app", "android_common")
cmd := app.Rule("dexpreopt").RuleParams.Command
bcp := " -Xbootclasspath-locations:" + test.expect + " " // space at the end matters
android.AssertStringDoesContain(t, "dexpreopt app bcp", cmd, bcp)
@@ -3611,7 +3611,7 @@ func TestCodelessApp(t *testing.T) {
t.Parallel()
ctx := testApp(t, test.bp)
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
manifestFixerArgs := foo.Output("manifest_fixer/AndroidManifest.xml").Args["args"]
if strings.Contains(manifestFixerArgs, "--has-no-code") != test.noCode {
t.Errorf("unexpected manifest_fixer args: %q", manifestFixerArgs)
@@ -3709,7 +3709,7 @@ func TestUncompressDex(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
dex := foo.Rule("r8")
uncompressedInDexJar := strings.Contains(dex.Args["zipFlags"], "-L 0")
aligned := foo.MaybeRule("zipalign").Rule != nil
@@ -3795,7 +3795,7 @@ func TestExportedProguardFlagFiles(t *testing.T) {
`)
- m := ctx.ModuleForTests("foo", "android_common")
+ m := ctx.ModuleForTests(t, "foo", "android_common")
r8 := m.Rule("java.r8")
implicits := r8.Implicits.RelativeToTop().Strings()
android.AssertStringListContains(t, "r8 implicits", implicits, "lib1proguard.cfg")
@@ -3895,7 +3895,7 @@ func TestTargetSdkVersionManifestFixer(t *testing.T) {
)
result := fixture.RunTestWithBp(t, bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
manifestFixerArgs := foo.Output("manifest_fixer/AndroidManifest.xml").Args["args"]
android.AssertStringDoesContain(t, testCase.name, manifestFixerArgs, "--targetSdkVersion "+testCase.targetSdkVersionExpected)
@@ -3993,7 +3993,7 @@ func TestDefaultAppTargetSdkVersionForUpdatableModules(t *testing.T) {
)
result := fixture.RunTestWithBp(t, bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
manifestFixerArgs := foo.Output("manifest_fixer/AndroidManifest.xml").Args["args"]
android.AssertStringDoesContain(t, testCase.name, manifestFixerArgs, "--targetSdkVersion "+*testCase.targetSdkVersionExpected)
@@ -4082,7 +4082,7 @@ func TestEnforceDefaultAppTargetSdkVersionFlag(t *testing.T) {
result := fixture.ExtendWithErrorHandler(errorHandler).RunTestWithBp(t, bp)
if !errExpected {
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
manifestFixerArgs := foo.Output("manifest_fixer/AndroidManifest.xml").Args["args"]
android.AssertStringDoesContain(t, testCase.name, manifestFixerArgs, "--targetSdkVersion "+testCase.targetSdkVersionExpected)
}
@@ -4157,7 +4157,7 @@ func TestEnforceDefaultAppTargetSdkVersionFlagForTests(t *testing.T) {
result := fixture.ExtendWithErrorHandler(errorHandler).RunTestWithBp(t, bp)
if !errExpected {
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
manifestFixerArgs := foo.Output("manifest_fixer/AndroidManifest.xml").Args["args"]
android.AssertStringDoesContain(t, testCase.name, manifestFixerArgs, "--targetSdkVersion "+testCase.targetSdkVersionExpected)
}
@@ -4187,7 +4187,7 @@ func TestAppMissingCertificateAllowMissingDependencies(t *testing.T) {
sdk_version: "current",
}`)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
fooApk := foo.Output("foo.apk")
if fooApk.Rule != android.ErrorRule {
t.Fatalf("expected ErrorRule for foo.apk, got %s", fooApk.Rule.String())
@@ -4260,7 +4260,7 @@ func TestAppIncludesJniPackages(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
- app := ctx.ModuleForTests(tc.name, "android_common")
+ app := ctx.ModuleForTests(t, tc.name, "android_common")
outputFile := "jnilibs.zip"
jniOutputLibZip := app.MaybeOutput(outputFile)
@@ -4343,7 +4343,7 @@ func TestTargetSdkVersionMtsTests(t *testing.T) {
t.Run(testCase.desc, func(t *testing.T) {
t.Parallel()
result := fixture.RunTestWithBp(t, fmt.Sprintf(bpTemplate, testCase.moduleType, testCase.targetSdkVersionInBp, testCase.testSuites))
- mytest := result.ModuleForTests("mytest", "android_common")
+ mytest := result.ModuleForTests(t, "mytest", "android_common")
manifestFixerArgs := mytest.Output("manifest_fixer/AndroidManifest.xml").Args["args"]
android.AssertStringDoesContain(t, testCase.desc, manifestFixerArgs, "--targetSdkVersion "+testCase.targetSdkVersionExpected)
})
@@ -4377,8 +4377,8 @@ func TestPrivappAllowlist(t *testing.T) {
}
`,
)
- app := result.ModuleForTests("foo", "android_common")
- overrideApp := result.ModuleForTests("foo", "android_common_bar")
+ app := result.ModuleForTests(t, "foo", "android_common")
+ overrideApp := result.ModuleForTests(t, "foo", "android_common_bar")
// verify that privapp allowlist is created for override apps
overrideApp.Output("out/soong/.intermediates/foo/android_common_bar/privapp_allowlist_com.google.android.foo.xml")
@@ -4415,8 +4415,8 @@ func TestPrivappAllowlistAndroidMk(t *testing.T) {
}
`,
)
- baseApp := result.ModuleForTests("foo", "android_common")
- overrideApp := result.ModuleForTests("foo", "android_common_bar")
+ baseApp := result.ModuleForTests(t, "foo", "android_common")
+ overrideApp := result.ModuleForTests(t, "foo", "android_common_bar")
baseAndroidApp := baseApp.Module().(*AndroidApp)
baseEntries := android.AndroidMkEntriesForTest(t, result.TestContext, baseAndroidApp)[0]
@@ -4512,7 +4512,7 @@ func TestAppFlagsPackages(t *testing.T) {
}
`)
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
// android_app module depends on aconfig_declarations listed in flags_packages
android.AssertBoolEquals(t, "foo expected to depend on bar", true,
@@ -4597,7 +4597,7 @@ func TestAppFlagsPackagesPropagation(t *testing.T) {
}
`)
- bazApp := ctx.ModuleForTests("baz_app", "android_common")
+ bazApp := ctx.ModuleForTests(t, "baz_app", "android_common")
// android_app module depends on aconfig_declarations listed in flags_packages
// and that of static libs, but not libs
@@ -4635,7 +4635,7 @@ func TestNoDexpreoptOptionalUsesLibDoesNotHaveImpl(t *testing.T) {
}
`
result := prepareForJavaTest.RunTestWithBp(t, bp)
- dexpreopt := result.ModuleForTests("app", "android_common").MaybeRule("dexpreopt").Rule
+ dexpreopt := result.ModuleForTests(t, "app", "android_common").MaybeRule("dexpreopt").Rule
android.AssertBoolEquals(t, "dexpreopt should be disabled if optional_uses_libs does not have an implementation", true, dexpreopt == nil)
}
@@ -4731,7 +4731,7 @@ func TestTestConfigTemplate(t *testing.T) {
}
return ret
}
- rule := ctx.ModuleForTests("android-test", "android_common").Rule("autogenInstrumentationTest")
+ rule := ctx.ModuleForTests(t, "android-test", "android_common").Rule("autogenInstrumentationTest")
android.AssertSameArray(t, "extraConfigs mismatch",
[]option{
{"name1", "key1", "value1"},
@@ -4756,7 +4756,7 @@ func TestAppStem(t *testing.T) {
sdk_version: "current",
}`)
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
outputs := fmt.Sprint(foo.AllOutputs())
if !strings.Contains(outputs, "foo-new.apk") {
@@ -4782,8 +4782,8 @@ func TestAppMinSdkVersionOverride(t *testing.T) {
min_sdk_version: "33",
}
`)
- foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
- fooOverride := result.ModuleForTests("com.android.foo", "android_common_com.android.go.foo").Rule("manifestFixer")
+ foo := result.ModuleForTests(t, "com.android.foo", "android_common").Rule("manifestFixer")
+ fooOverride := result.ModuleForTests(t, "com.android.foo", "android_common_com.android.go.foo").Rule("manifestFixer")
android.AssertStringDoesContain(t,
"com.android.foo: expected manifest fixer to set minSdkVersion to T",
@@ -4810,7 +4810,7 @@ func TestNotApplyDefaultUpdatableModuleVersion(t *testing.T) {
min_sdk_version: "31",
}
`)
- foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ foo := result.ModuleForTests(t, "com.android.foo", "android_common").Rule("manifestFixer")
android.AssertStringDoesNotContain(t,
"com.android.foo: expected manifest fixer to not set override-placeholder-version",
foo.BuildParams.Args["args"],
@@ -4833,7 +4833,7 @@ func TestNotApplyOverrideApexManifestDefaultVersion(t *testing.T) {
min_sdk_version: "31",
}
`)
- foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ foo := result.ModuleForTests(t, "com.android.foo", "android_common").Rule("manifestFixer")
android.AssertStringDoesNotContain(t,
"com.android.foo: expected manifest fixer to not set override-placeholder-version",
foo.BuildParams.Args["args"],
@@ -4861,7 +4861,7 @@ func TestResourcesWithFlagDirectories(t *testing.T) {
],
}
`)
- fooModule := result.ModuleForTests("foo", "android_common")
+ fooModule := result.ModuleForTests(t, "foo", "android_common")
compileOutputPaths := fooModule.Rule("aapt2Compile").Outputs.Strings()
android.AssertStringListContains(
@@ -4956,9 +4956,9 @@ override_android_app {
}),
android.OptionalFixturePreparer(tc.preparer),
).RunTestWithBp(t, bp)
- vendorOverlayApk := result.ModuleForTests("foo__test_product__auto_generated_rro_vendor", "android_arm64_armv8-a").MaybeOutput("foo__test_product__auto_generated_rro_vendor.apk")
+ vendorOverlayApk := result.ModuleForTests(t, "foo__test_product__auto_generated_rro_vendor", "android_arm64_armv8-a").MaybeOutput("foo__test_product__auto_generated_rro_vendor.apk")
android.AssertBoolEquals(t, tc.desc, tc.overlayApkExpected, vendorOverlayApk.Rule != nil)
- overrideVendorOverlayApk := result.ModuleForTests("override_foo__test_product__auto_generated_rro_vendor", "android_arm64_armv8-a").MaybeOutput("override_foo__test_product__auto_generated_rro_vendor.apk")
+ overrideVendorOverlayApk := result.ModuleForTests(t, "override_foo__test_product__auto_generated_rro_vendor", "android_arm64_armv8-a").MaybeOutput("override_foo__test_product__auto_generated_rro_vendor.apk")
android.AssertBoolEquals(t, tc.desc, tc.overlayApkExpected, overrideVendorOverlayApk.Rule != nil)
})
}
@@ -5034,7 +5034,7 @@ my_custom_override_android_app {
}.AddToFixture(),
android.OptionalFixturePreparer(tc.preparer),
).RunTestWithBp(t, bp)
- overrideVendorOverlayApk := result.ModuleForTests("override_foo__test_product__auto_generated_rro_vendor", "android_arm64_armv8-a").Module().(*AutogenRuntimeResourceOverlay)
+ overrideVendorOverlayApk := result.ModuleForTests(t, "override_foo__test_product__auto_generated_rro_vendor", "android_arm64_armv8-a").Module().(*AutogenRuntimeResourceOverlay)
android.AssertBoolEquals(t, tc.desc, tc.overlayApkExpected, overrideVendorOverlayApk.exportPackage != nil)
})
}