summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2025-02-12 22:42:20 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-02-12 22:42:20 -0800
commita17496cb5d6effeb341f6b95acd5a4d4735642bf (patch)
tree051c99c1fae6383de4b5d2785dbb7a00dd3571c3
parent852f109a206ccc5fdd869de833a97e0d1b9a09a2 (diff)
parent8ea2abcb0ff0f2e23391dbde621d62c0980138e7 (diff)
Merge "Don't panic in ModuleForTests and friends" into main am: 4a80748e09 am: 8ea2abcb0f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3490133 Change-Id: If401bc7e4ed94f982391e49aa059015cbaecca5f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--aconfig/aconfig_declarations_test.go8
-rw-r--r--aconfig/aconfig_value_set_test.go4
-rw-r--r--aconfig/aconfig_values_test.go2
-rw-r--r--aconfig/all_aconfig_declarations_extension_test.go2
-rw-r--r--aconfig/codegen/aconfig_declarations_group_test.go2
-rw-r--r--aconfig/codegen/cc_aconfig_library_test.go6
-rw-r--r--aconfig/codegen/java_aconfig_library_test.go6
-rw-r--r--aconfig/codegen/rust_aconfig_library_test.go10
-rw-r--r--aidl_library/aidl_library_test.go4
-rw-r--r--android/all_teams_test.go2
-rw-r--r--android/androidmk_test.go2
-rw-r--r--android/arch_test.go8
-rw-r--r--android/build_prop_test.go2
-rw-r--r--android/csuite_config_test.go3
-rw-r--r--android/defaults_test.go4
-rw-r--r--android/deptag_test.go16
-rw-r--r--android/fixture.go2
-rw-r--r--android/makevars_test.go2
-rw-r--r--android/module_test.go9
-rw-r--r--android/mutator_test.go2
-rw-r--r--android/namespace_test.go4
-rw-r--r--android/paths_test.go6
-rw-r--r--android/prebuilt_test.go2
-rw-r--r--android/rule_builder_test.go12
-rw-r--r--android/selects_test.go2
-rw-r--r--android/singleton_module_test.go4
-rw-r--r--android/soong_config_modules_test.go8
-rw-r--r--android/team_test.go4
-rw-r--r--android/test_suites_test.go2
-rw-r--r--android/testing.go67
-rw-r--r--android/variable_test.go4
-rw-r--r--android/vintf_fragment_test.go2
-rw-r--r--android_sdk/sdk_repo_host_test.go2
-rw-r--r--apex/apex_test.go440
-rw-r--r--apex/bootclasspath_fragment_test.go18
-rw-r--r--apex/container_test.go6
-rw-r--r--apex/dexpreopt_bootjars_test.go4
-rw-r--r--apex/systemserver_classpath_fragment_test.go4
-rw-r--r--cc/afdo_test.go50
-rw-r--r--cc/binary_test.go2
-rw-r--r--cc/cc_preprocess_no_configuration_test.go2
-rw-r--r--cc/cc_test.go154
-rw-r--r--cc/cc_test_only_property_test.go2
-rw-r--r--cc/cmake_snapshot_test.go6
-rw-r--r--cc/gen_test.go12
-rw-r--r--cc/genrule_test.go12
-rw-r--r--cc/library_headers_test.go10
-rw-r--r--cc/library_test.go42
-rw-r--r--cc/lto_test.go28
-rw-r--r--cc/ndk_test.go4
-rw-r--r--cc/object_test.go10
-rw-r--r--cc/orderfile_test.go36
-rw-r--r--cc/prebuilt_test.go78
-rw-r--r--cc/proto_test.go10
-rw-r--r--cc/sabi_test.go8
-rw-r--r--cc/sanitize_test.go456
-rw-r--r--cc/sdk_test.go20
-rw-r--r--cc/test_data_test.go2
-rw-r--r--cc/testing.go7
-rw-r--r--cc/tidy_test.go8
-rw-r--r--cc/vendor_public_library_test.go14
-rw-r--r--dexpreopt/dexpreopt_test.go4
-rw-r--r--etc/install_symlink_test.go6
-rw-r--r--etc/prebuilt_etc_test.go2
-rw-r--r--filesystem/filesystem_test.go36
-rw-r--r--fsgen/filesystem_creator_test.go24
-rw-r--r--genrule/genrule_test.go12
-rw-r--r--golang/golang_test.go2
-rw-r--r--java/aar_test.go10
-rw-r--r--java/android_manifest_test.go4
-rw-r--r--java/androidmk_test.go18
-rw-r--r--java/app_import_test.go44
-rw-r--r--java/app_set_test.go4
-rw-r--r--java/app_test.go132
-rw-r--r--java/bootclasspath_fragment_test.go4
-rw-r--r--java/container_test.go2
-rw-r--r--java/device_host_converter_test.go12
-rw-r--r--java/dex_test.go40
-rw-r--r--java/dexpreopt_config_testing.go4
-rw-r--r--java/dexpreopt_test.go8
-rw-r--r--java/droiddoc_test.go4
-rw-r--r--java/droidstubs_test.go18
-rw-r--r--java/fuzz_test.go8
-rw-r--r--java/generated_java_library_test.go2
-rw-r--r--java/genrule_combiner_test.go20
-rw-r--r--java/genrule_test.go12
-rw-r--r--java/hiddenapi_singleton_test.go16
-rw-r--r--java/jarjar_test.go2
-rw-r--r--java/java_test.go180
-rw-r--r--java/jdeps_test.go16
-rw-r--r--java/kotlin_test.go34
-rw-r--r--java/lint_test.go12
-rw-r--r--java/platform_bootclasspath_test.go4
-rw-r--r--java/plugin_test.go16
-rw-r--r--java/prebuilt_apis_test.go12
-rw-r--r--java/proto_test.go2
-rw-r--r--java/ravenwood_test.go8
-rw-r--r--java/robolectric_test.go2
-rw-r--r--java/rro_test.go14
-rw-r--r--java/sdk_library_test.go82
-rw-r--r--java/sdk_test.go6
-rw-r--r--java/sdk_version_test.go2
-rw-r--r--java/system_modules_test.go8
-rw-r--r--java/testing.go8
-rw-r--r--kernel/prebuilt_kernel_modules_test.go2
-rw-r--r--linkerconfig/linkerconfig_test.go4
-rw-r--r--provenance/provenance_singleton_test.go4
-rw-r--r--python/python_test.go2
-rw-r--r--rust/afdo_test.go6
-rw-r--r--rust/benchmark_test.go4
-rw-r--r--rust/binary_test.go26
-rw-r--r--rust/bindgen_test.go18
-rw-r--r--rust/builder_test.go2
-rw-r--r--rust/clippy_test.go6
-rw-r--r--rust/compiler_test.go28
-rw-r--r--rust/coverage_test.go10
-rw-r--r--rust/fuzz_test.go16
-rw-r--r--rust/image_test.go12
-rw-r--r--rust/library_test.go60
-rw-r--r--rust/proc_macro_test.go2
-rw-r--r--rust/protobuf_test.go16
-rw-r--r--rust/rust_test.go54
-rw-r--r--rust/sanitize_test.go352
-rw-r--r--rust/test_test.go8
-rw-r--r--sdk/bootclasspath_fragment_sdk_test.go8
-rw-r--r--sdk/sdk_test.go2
-rw-r--r--sh/sh_binary_test.go24
-rw-r--r--sysprop/sysprop_test.go42
-rw-r--r--systemfeatures/system_features_test.go2
-rw-r--r--tradefed_modules/test_module_config_test.go16
-rw-r--r--tradefed_modules/test_suite_test.go4
-rw-r--r--xml/xml_test.go4
132 files changed, 1631 insertions, 1619 deletions
diff --git a/aconfig/aconfig_declarations_test.go b/aconfig/aconfig_declarations_test.go
index e89cd316f..c39008b74 100644
--- a/aconfig/aconfig_declarations_test.go
+++ b/aconfig/aconfig_declarations_test.go
@@ -37,7 +37,7 @@ func TestAconfigDeclarations(t *testing.T) {
`
result := runTest(t, android.FixtureExpectsNoErrors, bp)
- module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
+ module := result.ModuleForTests(t, "module_name", "").Module().(*DeclarationsModule)
// Check that the provider has the right contents
depData, _ := android.OtherModuleProvider(result, module, android.AconfigDeclarationsProviderKey)
@@ -66,7 +66,7 @@ func TestAconfigDeclarationsWithExportableUnset(t *testing.T) {
`
result := runTest(t, android.FixtureExpectsNoErrors, bp)
- module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
+ module := result.ModuleForTests(t, "module_name", "").Module().(*DeclarationsModule)
depData, _ := android.OtherModuleProvider(result, module, android.AconfigDeclarationsProviderKey)
android.AssertBoolEquals(t, "exportable", depData.Exportable, false)
}
@@ -84,7 +84,7 @@ func TestAconfigDeclarationsWithContainer(t *testing.T) {
`
result := runTest(t, android.FixtureExpectsNoErrors, bp)
- module := result.ModuleForTests("module_name", "")
+ module := result.ModuleForTests(t, "module_name", "")
rule := module.Rule("aconfig")
android.AssertStringEquals(t, "rule must contain container", rule.Args["container"], "--container com.android.foo")
}
@@ -204,7 +204,7 @@ func TestGenerateAndroidBuildActions(t *testing.T) {
fixture = fixture.ExtendWithErrorHandler(test.errorHandler)
}
result := fixture.RunTestWithBp(t, test.bp)
- module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
+ module := result.ModuleForTests(t, "module_name", "").Module().(*DeclarationsModule)
depData, _ := android.OtherModuleProvider(result, module, android.AconfigReleaseDeclarationsProviderKey)
expectedKeys := []string{""}
for _, rc := range strings.Split(test.buildFlags["RELEASE_ACONFIG_EXTRA_RELEASE_CONFIGS"], " ") {
diff --git a/aconfig/aconfig_value_set_test.go b/aconfig/aconfig_value_set_test.go
index 3b7281ec9..1f042442c 100644
--- a/aconfig/aconfig_value_set_test.go
+++ b/aconfig/aconfig_value_set_test.go
@@ -37,7 +37,7 @@ func TestAconfigValueSet(t *testing.T) {
`
result := runTest(t, android.FixtureExpectsNoErrors, bp)
- module := result.ModuleForTests("module_name", "").Module().(*ValueSetModule)
+ module := result.ModuleForTests(t, "module_name", "").Module().(*ValueSetModule)
// Check that the provider has the right contents
depData, _ := android.OtherModuleProvider(result, module, valueSetProviderKey)
@@ -88,7 +88,7 @@ func TestAconfigValueSetBpGlob(t *testing.T) {
checkModuleHasDependency := func(name, variant, dep string) bool {
t.Helper()
- module := result.ModuleForTests(name, variant).Module()
+ module := result.ModuleForTests(t, name, variant).Module()
depFound := false
result.VisitDirectDeps(module, func(m blueprint.Module) {
if m.Name() == dep {
diff --git a/aconfig/aconfig_values_test.go b/aconfig/aconfig_values_test.go
index ddbea57a8..0bec14b4a 100644
--- a/aconfig/aconfig_values_test.go
+++ b/aconfig/aconfig_values_test.go
@@ -30,7 +30,7 @@ func TestAconfigValues(t *testing.T) {
`
result := runTest(t, android.FixtureExpectsNoErrors, bp)
- module := result.ModuleForTests("module_name", "").Module().(*ValuesModule)
+ module := result.ModuleForTests(t, "module_name", "").Module().(*ValuesModule)
// Check that the provider has the right contents
depData, _ := android.OtherModuleProvider(result, module, valuesProviderKey)
diff --git a/aconfig/all_aconfig_declarations_extension_test.go b/aconfig/all_aconfig_declarations_extension_test.go
index 120709693..5bd99d0c9 100644
--- a/aconfig/all_aconfig_declarations_extension_test.go
+++ b/aconfig/all_aconfig_declarations_extension_test.go
@@ -45,6 +45,6 @@ func TestAllAconfigDeclarationsExtension(t *testing.T) {
}
`)
- finalizedFlags := result.ModuleForTests("custom_aconfig_declarations", "").Output("finalized-flags.txt")
+ finalizedFlags := result.ModuleForTests(t, "custom_aconfig_declarations", "").Output("finalized-flags.txt")
android.AssertStringContainsEquals(t, "must depend on all_aconfig_declarations", strings.Join(finalizedFlags.Inputs.Strings(), " "), "all_aconfig_declarations.pb", true)
}
diff --git a/aconfig/codegen/aconfig_declarations_group_test.go b/aconfig/codegen/aconfig_declarations_group_test.go
index ef954ce24..c822ef8a9 100644
--- a/aconfig/codegen/aconfig_declarations_group_test.go
+++ b/aconfig/codegen/aconfig_declarations_group_test.go
@@ -74,7 +74,7 @@ func TestAconfigDeclarationsGroup(t *testing.T) {
// Check if srcjar files are correctly passed to the reverse dependency of
// aconfig_declarations_group module
- bazModule := result.ModuleForTests("baz", "android_common")
+ bazModule := result.ModuleForTests(t, "baz", "android_common")
bazJavacSrcjars := bazModule.Rule("javac").Args["srcJars"]
errorMessage := "baz javac argument expected to contain srcjar provided by aconfig_declrations_group"
android.AssertStringDoesContain(t, errorMessage, bazJavacSrcjars, "foo-java.srcjar")
diff --git a/aconfig/codegen/cc_aconfig_library_test.go b/aconfig/codegen/cc_aconfig_library_test.go
index 7c7037a6a..5cb3f8b33 100644
--- a/aconfig/codegen/cc_aconfig_library_test.go
+++ b/aconfig/codegen/cc_aconfig_library_test.go
@@ -81,7 +81,7 @@ func testCCCodegenModeHelper(t *testing.T, bpMode string, ruleMode string) {
}
`, bpMode))
- module := result.ModuleForTests("my_cc_aconfig_library", "android_arm64_armv8-a_shared")
+ module := result.ModuleForTests(t, "my_cc_aconfig_library", "android_arm64_armv8-a_shared")
rule := module.Rule("cc_aconfig_library")
android.AssertStringEquals(t, "rule must contain test mode", rule.Args["mode"], ruleMode)
}
@@ -209,7 +209,7 @@ func TestAndroidMkCcLibrary(t *testing.T) {
cc.PrepareForTestWithCcDefaultModules).
ExtendWithErrorHandler(android.FixtureExpectsNoErrors).RunTestWithBp(t, bp)
- module := result.ModuleForTests("my_cc_library", "android_vendor_arm64_armv8-a_shared").Module()
+ module := result.ModuleForTests(t, "my_cc_library", "android_vendor_arm64_armv8-a_shared").Module()
entry := android.AndroidMkInfoForTest(t, result.TestContext, module).PrimaryInfo
@@ -254,7 +254,7 @@ func TestForceReadOnly(t *testing.T) {
}
`))
- module := result.ModuleForTests("my_cc_aconfig_library", "android_arm64_armv8-a_shared").Module()
+ module := result.ModuleForTests(t, "my_cc_aconfig_library", "android_arm64_armv8-a_shared").Module()
dependOnReadLib := false
result.VisitDirectDeps(module, func(dep blueprint.Module) {
if dep.Name() == libAconfigStorageReadApiCcDep {
diff --git a/aconfig/codegen/java_aconfig_library_test.go b/aconfig/codegen/java_aconfig_library_test.go
index d8372f3c9..8854369e2 100644
--- a/aconfig/codegen/java_aconfig_library_test.go
+++ b/aconfig/codegen/java_aconfig_library_test.go
@@ -57,7 +57,7 @@ func runJavaAndroidMkTest(t *testing.T, bp string) {
}
`)
- module := result.ModuleForTests("my_module", "android_common").Module()
+ module := result.ModuleForTests(t, "my_module", "android_common").Module()
entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0]
@@ -189,7 +189,7 @@ func testCodegenMode(t *testing.T, bpMode string, ruleMode string) {
}
`, bpMode))
- module := result.ModuleForTests("my_java_aconfig_library", "android_common")
+ module := result.ModuleForTests(t, "my_java_aconfig_library", "android_common")
rule := module.Rule("java_aconfig_library")
android.AssertStringEquals(t, "rule must contain test mode", rule.Args["mode"], ruleMode)
}
@@ -282,7 +282,7 @@ func TestMkEntriesMatchedContainer(t *testing.T) {
}
`)
- module := result.ModuleForTests("my_module", "android_common").Module()
+ module := result.ModuleForTests(t, "my_module", "android_common").Module()
entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0]
makeVar := entry.EntryMap["LOCAL_ACONFIG_FILES"]
android.EnsureListContainsSuffix(t, makeVar, "my_aconfig_declarations_foo/intermediate.pb")
diff --git a/aconfig/codegen/rust_aconfig_library_test.go b/aconfig/codegen/rust_aconfig_library_test.go
index 523b464c0..670102128 100644
--- a/aconfig/codegen/rust_aconfig_library_test.go
+++ b/aconfig/codegen/rust_aconfig_library_test.go
@@ -57,13 +57,13 @@ func TestRustAconfigLibrary(t *testing.T) {
}
`))
- sourceVariant := result.ModuleForTests("libmy_rust_aconfig_library", "android_arm64_armv8-a_source")
+ sourceVariant := result.ModuleForTests(t, "libmy_rust_aconfig_library", "android_arm64_armv8-a_source")
rule := sourceVariant.Rule("rust_aconfig_library")
android.AssertStringEquals(t, "rule must contain production mode", rule.Args["mode"], "production")
- dylibVariant := result.ModuleForTests("libmy_rust_aconfig_library", "android_arm64_armv8-a_dylib")
- rlibRlibStdVariant := result.ModuleForTests("libmy_rust_aconfig_library", "android_arm64_armv8-a_rlib_rlib-std")
- rlibDylibStdVariant := result.ModuleForTests("libmy_rust_aconfig_library", "android_arm64_armv8-a_rlib_dylib-std")
+ dylibVariant := result.ModuleForTests(t, "libmy_rust_aconfig_library", "android_arm64_armv8-a_dylib")
+ rlibRlibStdVariant := result.ModuleForTests(t, "libmy_rust_aconfig_library", "android_arm64_armv8-a_rlib_rlib-std")
+ rlibDylibStdVariant := result.ModuleForTests(t, "libmy_rust_aconfig_library", "android_arm64_armv8-a_rlib_dylib-std")
variants := []android.TestingModule{
dylibVariant,
@@ -143,7 +143,7 @@ func testRustCodegenModeHelper(t *testing.T, bpMode string, ruleMode string) {
}
`, bpMode))
- module := result.ModuleForTests("libmy_rust_aconfig_library", "android_arm64_armv8-a_source")
+ module := result.ModuleForTests(t, "libmy_rust_aconfig_library", "android_arm64_armv8-a_source")
rule := module.Rule("rust_aconfig_library")
android.AssertStringEquals(t, "rule must contain test mode", rule.Args["mode"], ruleMode)
}
diff --git a/aidl_library/aidl_library_test.go b/aidl_library/aidl_library_test.go
index 166045635..63a08b9b1 100644
--- a/aidl_library/aidl_library_test.go
+++ b/aidl_library/aidl_library_test.go
@@ -46,7 +46,7 @@ func TestAidlLibrary(t *testing.T) {
}.AddToFixture(),
).RunTest(t).TestContext
- foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
+ foo := ctx.ModuleForTests(t, "foo", "").Module().(*AidlLibrary)
actualInfo, _ := android.OtherModuleProvider(ctx, foo, AidlLibraryProvider)
android.AssertArrayString(
@@ -95,7 +95,7 @@ func TestAidlLibraryWithoutStripImportPrefix(t *testing.T) {
}.AddToFixture(),
).RunTest(t).TestContext
- foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
+ foo := ctx.ModuleForTests(t, "foo", "").Module().(*AidlLibrary)
actualInfo, _ := android.OtherModuleProvider(ctx, foo, AidlLibraryProvider)
android.AssertArrayString(
diff --git a/android/all_teams_test.go b/android/all_teams_test.go
index fa8c048d0..3b200f60d 100644
--- a/android/all_teams_test.go
+++ b/android/all_teams_test.go
@@ -131,7 +131,7 @@ func TestAllTeams(t *testing.T) {
func getTeamProtoOutput(t *testing.T, ctx *TestResult) *team_proto.AllTeams {
teams := new(team_proto.AllTeams)
- config := ctx.SingletonForTests("all_teams")
+ config := ctx.SingletonForTests(t, "all_teams")
allOutputs := config.AllOutputs()
protoPath := allOutputs[0]
diff --git a/android/androidmk_test.go b/android/androidmk_test.go
index f63b227eb..0a81fb8bf 100644
--- a/android/androidmk_test.go
+++ b/android/androidmk_test.go
@@ -144,7 +144,7 @@ func buildContextAndCustomModuleFoo(t *testing.T, bp string) (*TestContext, *cus
FixtureWithRootAndroidBp(bp),
).RunTest(t)
- module := result.ModuleForTests("foo", "").Module().(*customModule)
+ module := result.ModuleForTests(t, "foo", "").Module().(*customModule)
return result.TestContext, module
}
diff --git a/android/arch_test.go b/android/arch_test.go
index 7914884bb..adb655f68 100644
--- a/android/arch_test.go
+++ b/android/arch_test.go
@@ -432,7 +432,7 @@ func TestArchMutator(t *testing.T) {
var ret []string
variants := ctx.ModuleVariantsForTests(name)
for _, variant := range variants {
- m := ctx.ModuleForTests(name, variant)
+ m := ctx.ModuleForTests(t, name, variant)
if m.Module().Enabled(PanickingConfigAndErrorContext(ctx)) {
ret = append(ret, variant)
}
@@ -442,7 +442,7 @@ func TestArchMutator(t *testing.T) {
moduleMultiTargets := func(ctx *TestContext, name string, variant string) []string {
var ret []string
- targets := ctx.ModuleForTests(name, variant).Module().MultiTargets()
+ targets := ctx.ModuleForTests(t, name, variant).Module().MultiTargets()
for _, t := range targets {
ret = append(ret, t.String())
}
@@ -546,7 +546,7 @@ func TestArchMutatorNativeBridge(t *testing.T) {
var ret []string
variants := ctx.ModuleVariantsForTests(name)
for _, variant := range variants {
- m := ctx.ModuleForTests(name, variant)
+ m := ctx.ModuleForTests(t, name, variant)
if m.Module().Enabled(PanickingConfigAndErrorContext(ctx)) {
ret = append(ret, variant)
}
@@ -758,7 +758,7 @@ func TestArchProperties(t *testing.T) {
for _, want := range tt.results {
t.Run(want.module+"_"+want.variant, func(t *testing.T) {
- got := result.ModuleForTests(want.module, want.variant).Module().(*testArchPropertiesModule).properties.A
+ got := result.ModuleForTests(t, want.module, want.variant).Module().(*testArchPropertiesModule).properties.A
AssertArrayString(t, "arch mutator property", want.property, got)
})
}
diff --git a/android/build_prop_test.go b/android/build_prop_test.go
index e75975a0a..e136a1a44 100644
--- a/android/build_prop_test.go
+++ b/android/build_prop_test.go
@@ -36,6 +36,6 @@ android_info {
res := GroupFixturePreparers(
FixtureRegisterWithContext(registerBuildPropComponents),
).RunTestWithBp(t, bp)
- buildPropCmd := res.ModuleForTests("vendor-build.prop", "").Rule("vendor-build.prop_.vendor-build.prop").RuleParams.Command
+ buildPropCmd := res.ModuleForTests(t, "vendor-build.prop", "").Rule("vendor-build.prop_.vendor-build.prop").RuleParams.Command
AssertStringDoesContain(t, "Could not find android-info in prop files of vendor build.prop", buildPropCmd, "--prop-files=out/soong/.intermediates/board-info/android-info.prop")
}
diff --git a/android/csuite_config_test.go b/android/csuite_config_test.go
index b8a176eb3..7e25aac3c 100644
--- a/android/csuite_config_test.go
+++ b/android/csuite_config_test.go
@@ -32,7 +32,6 @@ func TestCSuiteConfig(t *testing.T) {
if len(variants) > 1 {
t.Errorf("expected 1, got %d", len(variants))
}
- outputFilename := result.ModuleForTests(
- "plain", variants[0]).Module().(*CSuiteConfig).OutputFilePath.Base()
+ outputFilename := result.ModuleForTests(t, "plain", variants[0]).Module().(*CSuiteConfig).OutputFilePath.Base()
AssertStringEquals(t, "output file name", "plain", outputFilename)
}
diff --git a/android/defaults_test.go b/android/defaults_test.go
index 0ad0fb859..24f14617a 100644
--- a/android/defaults_test.go
+++ b/android/defaults_test.go
@@ -123,8 +123,8 @@ func TestDefaultsAllowMissingDependencies(t *testing.T) {
FixtureWithRootAndroidBp(bp),
).RunTest(t)
- missingDefaults := result.ModuleForTests("missing_defaults", "").Output("out")
- missingTransitiveDefaults := result.ModuleForTests("missing_transitive_defaults", "").Output("out")
+ missingDefaults := result.ModuleForTests(t, "missing_defaults", "").Output("out")
+ missingTransitiveDefaults := result.ModuleForTests(t, "missing_transitive_defaults", "").Output("out")
AssertSame(t, "missing_defaults rule", ErrorRule, missingDefaults.Rule)
diff --git a/android/deptag_test.go b/android/deptag_test.go
index eb4fa89a6..903787107 100644
--- a/android/deptag_test.go
+++ b/android/deptag_test.go
@@ -90,10 +90,10 @@ func TestInstallDependencyTag(t *testing.T) {
config := result.Config
- hostFoo := result.ModuleForTests("foo", config.BuildOSCommonTarget.String()).Description("install")
- hostInstallDep := result.ModuleForTests("install_dep", config.BuildOSCommonTarget.String()).Description("install")
- hostTransitive := result.ModuleForTests("transitive", config.BuildOSCommonTarget.String()).Description("install")
- hostDep := result.ModuleForTests("dep", config.BuildOSCommonTarget.String()).Description("install")
+ hostFoo := result.ModuleForTests(t, "foo", config.BuildOSCommonTarget.String()).Description("install")
+ hostInstallDep := result.ModuleForTests(t, "install_dep", config.BuildOSCommonTarget.String()).Description("install")
+ hostTransitive := result.ModuleForTests(t, "transitive", config.BuildOSCommonTarget.String()).Description("install")
+ hostDep := result.ModuleForTests(t, "dep", config.BuildOSCommonTarget.String()).Description("install")
if g, w := hostFoo.Implicits.Strings(), hostInstallDep.Output.String(); !InList(w, g) {
t.Errorf("expected host dependency %q, got %q", w, g)
@@ -111,10 +111,10 @@ func TestInstallDependencyTag(t *testing.T) {
t.Errorf("expected no host dependency %q, got %q", w, g)
}
- deviceFoo := result.ModuleForTests("foo", "android_common").Description("install")
- deviceInstallDep := result.ModuleForTests("install_dep", "android_common").Description("install")
- deviceTransitive := result.ModuleForTests("transitive", "android_common").Description("install")
- deviceDep := result.ModuleForTests("dep", "android_common").Description("install")
+ deviceFoo := result.ModuleForTests(t, "foo", "android_common").Description("install")
+ deviceInstallDep := result.ModuleForTests(t, "install_dep", "android_common").Description("install")
+ deviceTransitive := result.ModuleForTests(t, "transitive", "android_common").Description("install")
+ deviceDep := result.ModuleForTests(t, "dep", "android_common").Description("install")
if g, w := deviceFoo.OrderOnly.Strings(), deviceInstallDep.Output.String(); !InList(w, g) {
t.Errorf("expected device dependency %q, got %q", w, g)
diff --git a/android/fixture.go b/android/fixture.go
index 5ad47e8c9..ea52b95f5 100644
--- a/android/fixture.go
+++ b/android/fixture.go
@@ -1048,7 +1048,7 @@ func (r *TestResult) Preparer() FixturePreparer {
// Module returns the module with the specific name and of the specified variant.
func (r *TestResult) Module(name string, variant string) Module {
- return r.ModuleForTests(name, variant).Module()
+ return r.ModuleForTests(r.fixture.t, name, variant).Module()
}
// CollateErrs adds additional errors to the result and returns true if there is more than one
diff --git a/android/makevars_test.go b/android/makevars_test.go
index 95e4b59c2..387d45759 100644
--- a/android/makevars_test.go
+++ b/android/makevars_test.go
@@ -23,7 +23,7 @@ func TestDistFilesInGenerateAndroidBuildActions(t *testing.T) {
}
`)
- lateContents := string(result.SingletonForTests("makevars").Singleton().(*makeVarsSingleton).lateForTesting)
+ lateContents := string(result.SingletonForTests(t, "makevars").Singleton().(*makeVarsSingleton).lateForTesting)
matched, err := regexp.MatchString(`call dist-for-goals,my_goal,.*/my_file.txt:my_file.txt\)`, lateContents)
if err != nil || !matched {
t.Fatalf("Expected a dist of my_file.txt, but got: %s", lateContents)
diff --git a/android/module_test.go b/android/module_test.go
index 3b81dedc7..5331e4970 100644
--- a/android/module_test.go
+++ b/android/module_test.go
@@ -321,7 +321,7 @@ func TestInstall(t *testing.T) {
if host {
variant = result.Config.BuildOSCommonTarget.String()
}
- return result.ModuleForTests(name, variant)
+ return result.ModuleForTests(t, name, variant)
}
outputRule := func(name string) TestingBuildParams { return module(name, false).Output(name) }
@@ -434,11 +434,12 @@ func TestInstallKatiEnabled(t *testing.T) {
rules := result.InstallMakeRulesForTesting(t)
module := func(name string, host bool) TestingModule {
+ t.Helper()
variant := "android_common"
if host {
variant = result.Config.BuildOSCommonTarget.String()
}
- return result.ModuleForTests(name, variant)
+ return result.ModuleForTests(t, name, variant)
}
outputRule := func(name string) TestingBuildParams { return module(name, false).Output(name) }
@@ -743,7 +744,7 @@ test {
FixtureWithRootAndroidBp(tc.bp),
).RunTest(t)
- foo := result.ModuleForTests("foo", "").Module().base()
+ foo := result.ModuleForTests(t, "foo", "").Module().base()
AssertDeepEquals(t, "foo ", tc.expectedProps, foo.propertiesWithValues())
})
@@ -1078,7 +1079,7 @@ func TestOutputFileForModule(t *testing.T) {
PathContext: PathContextForTesting(config),
OtherModuleProviderContext: result.TestContext.OtherModuleProviderAdaptor(),
}
- got := OutputFileForModule(ctx, result.ModuleForTests("test_module", "").Module(), tt.tag)
+ got := OutputFileForModule(ctx, result.ModuleForTests(t, "test_module", "").Module(), tt.tag)
AssertPathRelativeToTopEquals(t, "expected output path", tt.expected, got)
AssertArrayString(t, "expected missing deps", tt.missingDeps, ctx.missingDeps)
})
diff --git a/android/mutator_test.go b/android/mutator_test.go
index 123c6b203..f7ee7d857 100644
--- a/android/mutator_test.go
+++ b/android/mutator_test.go
@@ -78,7 +78,7 @@ func TestMutatorAddMissingDependencies(t *testing.T) {
FixtureWithRootAndroidBp(bp),
).RunTest(t)
- foo := result.ModuleForTests("foo", "").Module().(*mutatorTestModule)
+ foo := result.ModuleForTests(t, "foo", "").Module().(*mutatorTestModule)
AssertDeepEquals(t, "foo missing deps", []string{"added_missing_dep", "regular_missing_dep"}, foo.missingDeps)
}
diff --git a/android/namespace_test.go b/android/namespace_test.go
index 0327e7824..a183bbf0d 100644
--- a/android/namespace_test.go
+++ b/android/namespace_test.go
@@ -683,7 +683,7 @@ func numDeps(result *TestResult, module TestingModule) int {
}
func getModule(result *TestResult, moduleName string) TestingModule {
- return result.ModuleForTests(moduleName, "")
+ return result.ModuleForTests(result.fixture.t, moduleName, "")
}
func findModuleById(result *TestResult, id string) (module TestingModule) {
@@ -691,7 +691,7 @@ func findModuleById(result *TestResult, id string) (module TestingModule) {
testModule, ok := candidate.(*testModule)
if ok {
if testModule.properties.Id == id {
- module = newTestingModule(result.config, testModule)
+ module = newTestingModule(result.fixture.t, result.config, testModule)
}
}
}
diff --git a/android/paths_test.go b/android/paths_test.go
index 20beecc35..b125c4e73 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -1269,7 +1269,7 @@ func testPathForModuleSrc(t *testing.T, tests []pathForModuleSrcTestCase) {
ExtendWithErrorHandler(errorHandler).
RunTest(t)
- m := result.ModuleForTests("foo", "").Module().(*pathForModuleSrcTestModule)
+ m := result.ModuleForTests(t, "foo", "").Module().(*pathForModuleSrcTestModule)
AssertStringPathsRelativeToTopEquals(t, "srcs", result.Config, test.srcs, m.srcs)
AssertStringPathsRelativeToTopEquals(t, "rels", result.Config, test.rels, m.rels)
@@ -1533,13 +1533,13 @@ func TestPathsForModuleSrc_AllowMissingDependencies(t *testing.T) {
FixtureWithRootAndroidBp(bp),
).RunTest(t)
- foo := result.ModuleForTests("foo", "").Module().(*pathForModuleSrcTestModule)
+ foo := result.ModuleForTests(t, "foo", "").Module().(*pathForModuleSrcTestModule)
AssertArrayString(t, "foo missing deps", []string{"a", "b", "c"}, foo.missingDeps)
AssertArrayString(t, "foo srcs", []string{}, foo.srcs)
AssertStringEquals(t, "foo src", "", foo.src)
- bar := result.ModuleForTests("bar", "").Module().(*pathForModuleSrcTestModule)
+ bar := result.ModuleForTests(t, "bar", "").Module().(*pathForModuleSrcTestModule)
AssertArrayString(t, "bar missing deps", []string{"d", "e"}, bar.missingDeps)
AssertArrayString(t, "bar srcs", []string{}, bar.srcs)
diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go
index b90ef3b1c..27a68fbe5 100644
--- a/android/prebuilt_test.go
+++ b/android/prebuilt_test.go
@@ -335,7 +335,7 @@ func TestPrebuilts(t *testing.T) {
).RunTestWithBp(t, bp)
for _, variant := range result.ModuleVariantsForTests("foo") {
- foo := result.ModuleForTests("foo", variant)
+ foo := result.ModuleForTests(t, "foo", variant)
t.Run(foo.Module().Target().Os.String(), func(t *testing.T) {
var dependsOnSourceModule, dependsOnPrebuiltModule bool
result.VisitDirectDeps(foo.Module(), func(m blueprint.Module) {
diff --git a/android/rule_builder_test.go b/android/rule_builder_test.go
index 566bafa06..5f3b9bee4 100644
--- a/android/rule_builder_test.go
+++ b/android/rule_builder_test.go
@@ -651,7 +651,7 @@ func TestRuleBuilder_Build(t *testing.T) {
outFile := "out/soong/.intermediates/foo/gen/foo"
rspFile := "out/soong/.intermediates/foo/rsp"
rspFile2 := "out/soong/.intermediates/foo/rsp2"
- module := result.ModuleForTests("foo", "")
+ module := result.ModuleForTests(t, "foo", "")
check(t, module.Rule("rule"), module.Output(rspFile2),
"cp in "+outFile+" @"+rspFile+" @"+rspFile2,
outFile, outFile+".d", rspFile, rspFile2, true, nil, nil)
@@ -668,7 +668,7 @@ func TestRuleBuilder_Build(t *testing.T) {
sandboxPath := shared.TempDirForOutDir("out/soong")
cmd := sbox + ` --sandbox-path ` + sandboxPath + ` --output-dir ` + sboxOutDir + ` --manifest ` + manifest
- module := result.ModuleForTests("foo_sbox", "")
+ module := result.ModuleForTests(t, "foo_sbox", "")
check(t, module.Output("gen/foo_sbox"), module.Output(rspFile2),
cmd, outFile, depFile, rspFile, rspFile2, false, []string{manifest}, []string{sbox})
})
@@ -685,7 +685,7 @@ func TestRuleBuilder_Build(t *testing.T) {
cmd := sbox + ` --sandbox-path ` + sandboxPath + ` --output-dir ` + sboxOutDir + ` --manifest ` + manifest
- module := result.ModuleForTests("foo_sbox_inputs", "")
+ module := result.ModuleForTests(t, "foo_sbox_inputs", "")
check(t, module.Output("gen/foo_sbox_inputs"), module.Output(rspFile2),
cmd, outFile, depFile, rspFile, rspFile2, false, []string{manifest}, []string{sbox})
})
@@ -693,7 +693,7 @@ func TestRuleBuilder_Build(t *testing.T) {
outFile := filepath.Join("out/soong/singleton/gen/baz")
rspFile := filepath.Join("out/soong/singleton/rsp")
rspFile2 := filepath.Join("out/soong/singleton/rsp2")
- singleton := result.SingletonForTests("rule_builder_test")
+ singleton := result.SingletonForTests(t, "rule_builder_test")
check(t, singleton.Rule("rule"), singleton.Output(rspFile2),
"cp in "+outFile+" @"+rspFile+" @"+rspFile2,
outFile, outFile+".d", rspFile, rspFile2, true, nil, nil)
@@ -756,14 +756,14 @@ func TestRuleBuilderHashInputs(t *testing.T) {
for _, test := range testcases {
t.Run(test.name, func(t *testing.T) {
t.Run("sbox", func(t *testing.T) {
- gen := result.ModuleForTests(test.name+"_sbox", "")
+ gen := result.ModuleForTests(t, test.name+"_sbox", "")
manifest := RuleBuilderSboxProtoForTests(t, result.TestContext, gen.Output("sbox.textproto"))
hash := manifest.Commands[0].GetInputHash()
AssertStringEquals(t, "hash", test.expectedHash, hash)
})
t.Run("", func(t *testing.T) {
- gen := result.ModuleForTests(test.name+"", "")
+ gen := result.ModuleForTests(t, test.name+"", "")
command := gen.Output("gen/" + test.name).RuleParams.Command
if g, w := command, " # hash of input list: "+test.expectedHash; !strings.HasSuffix(g, w) {
t.Errorf("Expected command line to end with %q, got %q", w, g)
diff --git a/android/selects_test.go b/android/selects_test.go
index 1397ed8b7..7f20a3d66 100644
--- a/android/selects_test.go
+++ b/android/selects_test.go
@@ -1118,7 +1118,7 @@ my_module_type {
for moduleName := range tc.providers {
expected := tc.providers[moduleName]
- m := result.ModuleForTests(moduleName, "android_arm64_armv8-a")
+ m := result.ModuleForTests(t, moduleName, "android_arm64_armv8-a")
p, _ := OtherModuleProvider(result.testContext.OtherModuleProviderAdaptor(), m.Module(), selectsTestProviderKey)
if !reflect.DeepEqual(p, expected) {
t.Errorf("Expected:\n %q\ngot:\n %q", expected.String(), p.String())
diff --git a/android/singleton_module_test.go b/android/singleton_module_test.go
index 3b8c6b213..6f61a3b48 100644
--- a/android/singleton_module_test.go
+++ b/android/singleton_module_test.go
@@ -61,7 +61,7 @@ func TestSingletonModule(t *testing.T) {
FixtureWithRootAndroidBp(bp),
).RunTest(t)
- ops := result.ModuleForTests("test_singleton_module", "").Module().(*testSingletonModule).ops
+ ops := result.ModuleForTests(t, "test_singleton_module", "").Module().(*testSingletonModule).ops
wantOps := []string{"GenerateAndroidBuildActions", "GenerateSingletonBuildActions", "MakeVars"}
AssertDeepEquals(t, "operations", wantOps, ops)
}
@@ -88,7 +88,7 @@ func TestUnusedSingletonModule(t *testing.T) {
prepareForSingletonModuleTest,
).RunTest(t)
- singleton := result.SingletonForTests("test_singleton_module").Singleton()
+ singleton := result.SingletonForTests(t, "test_singleton_module").Singleton()
sm := singleton.(*singletonModuleSingletonAdaptor).sm
ops := sm.(*testSingletonModule).ops
if ops != nil {
diff --git a/android/soong_config_modules_test.go b/android/soong_config_modules_test.go
index 04aafdeee..f98e02b0c 100644
--- a/android/soong_config_modules_test.go
+++ b/android/soong_config_modules_test.go
@@ -321,10 +321,10 @@ func TestSoongConfigModule(t *testing.T) {
FixtureWithRootAndroidBp(bp),
).RunTest(t)
- foo := result.ModuleForTests("foo", "").Module().(*soongConfigTestModule)
+ foo := result.ModuleForTests(t, "foo", "").Module().(*soongConfigTestModule)
AssertDeepEquals(t, "foo cflags", tc.fooExpectedFlags, foo.props.Cflags)
- fooDefaults := result.ModuleForTests("foo_with_defaults", "").Module().(*soongConfigTestModule)
+ fooDefaults := result.ModuleForTests(t, "foo_with_defaults", "").Module().(*soongConfigTestModule)
AssertDeepEquals(t, "foo_with_defaults cflags", tc.fooDefaultsExpectedFlags, fooDefaults.props.Cflags)
})
}
@@ -499,8 +499,8 @@ func TestSoongConfigModuleSingletonModule(t *testing.T) {
).RunTest(t)
// Make sure that the singleton was created.
- result.SingletonForTests("test_singleton")
- m := result.ModuleForTests("wiley", "").module.(*soongConfigTestSingletonModule)
+ result.SingletonForTests(t, "test_singleton")
+ m := result.ModuleForTests(t, "wiley", "").module.(*soongConfigTestSingletonModule)
AssertStringEquals(t, "fragments", test.expectedFragments, fmt.Sprintf("%+v", m.props.Fragments))
})
}
diff --git a/android/team_test.go b/android/team_test.go
index ccfcaaa66..dcc1c99cc 100644
--- a/android/team_test.go
+++ b/android/team_test.go
@@ -61,9 +61,9 @@ func TestTeam(t *testing.T) {
`)
// Assert the rule from GenerateAndroidBuildActions exists.
- m := ctx.ModuleForTests("main_test", "")
+ m := ctx.ModuleForTests(t, "main_test", "")
AssertStringEquals(t, "msg", m.Module().base().Team(), "someteam")
- m = ctx.ModuleForTests("tool", "")
+ m = ctx.ModuleForTests(t, "tool", "")
AssertStringEquals(t, "msg", m.Module().base().Team(), "team2")
}
diff --git a/android/test_suites_test.go b/android/test_suites_test.go
index db9a34d11..bf4de197e 100644
--- a/android/test_suites_test.go
+++ b/android/test_suites_test.go
@@ -52,7 +52,7 @@ func TestBuildTestList(t *testing.T) {
}
`)
- config := ctx.SingletonForTests("testsuites")
+ config := ctx.SingletonForTests(t, "testsuites")
allOutputs := config.AllOutputs()
wantContents := map[string]string{
diff --git a/android/testing.go b/android/testing.go
index 6c4f4f8de..8e38b3b1c 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -530,7 +530,8 @@ func (ctx *TestContext) RegisterParallelSingletonType(name string, factory Singl
// both have the same value. Both the module and the map are allowed to have
// extra variations that the other doesn't have. Panics if not exactly one
// module variant matches.
-func (ctx *TestContext) ModuleVariantForTests(name string, matchVariations map[string]string) TestingModule {
+func (ctx *TestContext) ModuleVariantForTests(t *testing.T, name string, matchVariations map[string]string) TestingModule {
+ t.Helper()
modules := []Module{}
ctx.VisitAllModules(func(m blueprint.Module) {
if ctx.ModuleName(m) == name {
@@ -562,12 +563,12 @@ func (ctx *TestContext) ModuleVariantForTests(name string, matchVariations map[s
})
if len(allVariants) == 0 {
- panic(fmt.Errorf("failed to find module %q. All modules:\n %s",
- name, strings.Join(SortedUniqueStrings(allModuleNames), "\n ")))
+ t.Fatalf("failed to find module %q. All modules:\n %s",
+ name, strings.Join(SortedUniqueStrings(allModuleNames), "\n "))
} else {
sort.Strings(allVariants)
- panic(fmt.Errorf("failed to find module %q matching %v. All variants:\n %s",
- name, matchVariations, strings.Join(allVariants, "\n ")))
+ t.Fatalf("failed to find module %q matching %v. All variants:\n %s",
+ name, matchVariations, strings.Join(allVariants, "\n "))
}
}
@@ -577,14 +578,15 @@ func (ctx *TestContext) ModuleVariantForTests(name string, matchVariations map[s
moduleStrings = append(moduleStrings, m.String())
}
sort.Strings(moduleStrings)
- panic(fmt.Errorf("module %q has more than one variant that match %v:\n %s",
- name, matchVariations, strings.Join(moduleStrings, "\n ")))
+ t.Fatalf("module %q has more than one variant that match %v:\n %s",
+ name, matchVariations, strings.Join(moduleStrings, "\n "))
}
- return newTestingModule(ctx.config, modules[0])
+ return newTestingModule(t, ctx.config, modules[0])
}
-func (ctx *TestContext) ModuleForTests(name, variant string) TestingModule {
+func (ctx *TestContext) ModuleForTests(t *testing.T, name, variant string) TestingModule {
+ t.Helper()
var module Module
ctx.VisitAllModules(func(m blueprint.Module) {
if ctx.ModuleName(m) == name && ctx.ModuleSubDir(m) == variant {
@@ -605,15 +607,15 @@ func (ctx *TestContext) ModuleForTests(name, variant string) TestingModule {
sort.Strings(allVariants)
if len(allVariants) == 0 {
- panic(fmt.Errorf("failed to find module %q. All modules:\n %s",
- name, strings.Join(SortedUniqueStrings(allModuleNames), "\n ")))
+ t.Fatalf("failed to find module %q. All modules:\n %s",
+ name, strings.Join(SortedUniqueStrings(allModuleNames), "\n "))
} else {
- panic(fmt.Errorf("failed to find module %q variant %q. All variants:\n %s",
- name, variant, strings.Join(allVariants, "\n ")))
+ t.Fatalf("failed to find module %q variant %q. All variants:\n %s",
+ name, variant, strings.Join(allVariants, "\n "))
}
}
- return newTestingModule(ctx.config, module)
+ return newTestingModule(t, ctx.config, module)
}
func (ctx *TestContext) ModuleVariantsForTests(name string) []string {
@@ -627,21 +629,24 @@ func (ctx *TestContext) ModuleVariantsForTests(name string) []string {
}
// SingletonForTests returns a TestingSingleton for the singleton registered with the given name.
-func (ctx *TestContext) SingletonForTests(name string) TestingSingleton {
+func (ctx *TestContext) SingletonForTests(t *testing.T, name string) TestingSingleton {
+ t.Helper()
allSingletonNames := []string{}
for _, s := range ctx.Singletons() {
n := ctx.SingletonName(s)
if n == name {
return TestingSingleton{
- baseTestingComponent: newBaseTestingComponent(ctx.config, s.(testBuildProvider)),
+ baseTestingComponent: newBaseTestingComponent(t, ctx.config, s.(testBuildProvider)),
singleton: s.(*singletonAdaptor).Singleton,
}
}
allSingletonNames = append(allSingletonNames, n)
}
- panic(fmt.Errorf("failed to find singleton %q."+
- "\nall singletons: %v", name, allSingletonNames))
+ t.Fatalf("failed to find singleton %q."+
+ "\nall singletons: %v", name, allSingletonNames)
+
+ return TestingSingleton{}
}
type InstallMakeRule struct {
@@ -651,6 +656,7 @@ type InstallMakeRule struct {
}
func parseMkRules(t *testing.T, config Config, nodes []mkparser.Node) []InstallMakeRule {
+ t.Helper()
var rules []InstallMakeRule
for _, node := range nodes {
if mkParserRule, ok := node.(*mkparser.Rule); ok {
@@ -688,7 +694,8 @@ func parseMkRules(t *testing.T, config Config, nodes []mkparser.Node) []InstallM
}
func (ctx *TestContext) InstallMakeRulesForTesting(t *testing.T) []InstallMakeRule {
- installs := ctx.SingletonForTests("makevars").Singleton().(*makeVarsSingleton).installsForTesting
+ t.Helper()
+ installs := ctx.SingletonForTests(t, "makevars").Singleton().(*makeVarsSingleton).installsForTesting
buf := bytes.NewBuffer(append([]byte(nil), installs...))
parser := mkparser.NewParser("makevars", buf)
@@ -728,8 +735,9 @@ var PrepareForTestAccessingMakeVars = GroupFixturePreparers(
//
// It is necessary to use PrepareForTestAccessingMakeVars in tests that want to call this function.
// Along with any other preparers needed to add the make vars.
-func (ctx *TestContext) MakeVarsForTesting(filter func(variable MakeVarVariable) bool) []MakeVarVariable {
- vars := ctx.SingletonForTests("makevars").Singleton().(*makeVarsSingleton).varsForTesting
+func (ctx *TestContext) MakeVarsForTesting(t *testing.T, filter func(variable MakeVarVariable) bool) []MakeVarVariable {
+ t.Helper()
+ vars := ctx.SingletonForTests(t, "makevars").Singleton().(*makeVarsSingleton).varsForTesting
result := make([]MakeVarVariable, 0, len(vars))
for _, v := range vars {
if filter(v) {
@@ -846,12 +854,13 @@ func (p TestingBuildParams) AllOutputs() []string {
// baseTestingComponent provides functionality common to both TestingModule and TestingSingleton.
type baseTestingComponent struct {
+ t *testing.T
config Config
provider testBuildProvider
}
-func newBaseTestingComponent(config Config, provider testBuildProvider) baseTestingComponent {
- return baseTestingComponent{config, provider}
+func newBaseTestingComponent(t *testing.T, config Config, provider testBuildProvider) baseTestingComponent {
+ return baseTestingComponent{t, config, provider}
}
// A function that will normalize a string containing paths, e.g. ninja command, by replacing
@@ -924,7 +933,7 @@ func (b baseTestingComponent) maybeBuildParamsFromRule(rule string) (TestingBuil
func (b baseTestingComponent) buildParamsFromRule(rule string) TestingBuildParams {
p, searchRules := b.maybeBuildParamsFromRule(rule)
if p.Rule == nil {
- panic(fmt.Errorf("couldn't find rule %q.\nall rules:\n%s", rule, strings.Join(searchRules, "\n")))
+ b.t.Fatalf("couldn't find rule %q.\nall rules:\n%s", rule, strings.Join(searchRules, "\n"))
}
return p
}
@@ -943,7 +952,7 @@ func (b baseTestingComponent) maybeBuildParamsFromDescription(desc string) (Test
func (b baseTestingComponent) buildParamsFromDescription(desc string) TestingBuildParams {
p, searchedDescriptions := b.maybeBuildParamsFromDescription(desc)
if p.Rule == nil {
- panic(fmt.Errorf("couldn't find description %q\nall descriptions:\n%s", desc, strings.Join(searchedDescriptions, "\n")))
+ b.t.Fatalf("couldn't find description %q\nall descriptions:\n%s", desc, strings.Join(searchedDescriptions, "\n"))
}
return p
}
@@ -976,8 +985,8 @@ func (b baseTestingComponent) maybeBuildParamsFromOutput(file string) (TestingBu
func (b baseTestingComponent) buildParamsFromOutput(file string) TestingBuildParams {
p, searchedOutputs := b.maybeBuildParamsFromOutput(file)
if p.Rule == nil {
- panic(fmt.Errorf("couldn't find output %q.\nall outputs:\n %s\n",
- file, strings.Join(searchedOutputs, "\n ")))
+ b.t.Fatalf("couldn't find output %q.\nall outputs:\n %s\n",
+ file, strings.Join(searchedOutputs, "\n "))
}
return p
}
@@ -1040,9 +1049,9 @@ type TestingModule struct {
module Module
}
-func newTestingModule(config Config, module Module) TestingModule {
+func newTestingModule(t *testing.T, config Config, module Module) TestingModule {
return TestingModule{
- newBaseTestingComponent(config, module),
+ newBaseTestingComponent(t, config, module),
module,
}
}
diff --git a/android/variable_test.go b/android/variable_test.go
index 73dc052d5..1d928f2c8 100644
--- a/android/variable_test.go
+++ b/android/variable_test.go
@@ -299,7 +299,7 @@ func TestProductVariablesDefaults(t *testing.T) {
FixtureWithRootAndroidBp(bp),
).RunTest(t)
- foo := result.ModuleForTests("foo", "").Module().(*productVariablesDefaultsTestModule)
+ foo := result.ModuleForTests(t, "foo", "").Module().(*productVariablesDefaultsTestModule)
want := []string{"defaults", "module", "product_variable_defaults", "product_variable_module"}
AssertDeepEquals(t, "foo", want, foo.properties.Foo)
@@ -360,7 +360,7 @@ func TestProductVariablesArch(t *testing.T) {
FixtureWithRootAndroidBp(bp),
).RunTest(t)
- foo := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*productVariablesDefaultsTestModule)
+ foo := result.ModuleForTests(t, "foo", "android_arm64_armv8-a").Module().(*productVariablesDefaultsTestModule)
want := []string{"module", "arm64"}
AssertDeepEquals(t, "foo", want, foo.properties.Foo)
diff --git a/android/vintf_fragment_test.go b/android/vintf_fragment_test.go
index cb038f5ad..7f0078caf 100644
--- a/android/vintf_fragment_test.go
+++ b/android/vintf_fragment_test.go
@@ -29,7 +29,7 @@ func TestVintfManifestBuildAction(t *testing.T) {
testResult := PrepareForTestWithAndroidBuildComponents.RunTestWithBp(t, bp)
- vintfFragmentBuild := testResult.TestContext.ModuleForTests("test_vintf_fragment", "android_common").Rule("assemble_vintf")
+ vintfFragmentBuild := testResult.TestContext.ModuleForTests(t, "test_vintf_fragment", "android_common").Rule("assemble_vintf")
if !strings.Contains(vintfFragmentBuild.RuleParams.Command, "assemble_vintf") {
t.Error("Vintf_manifest build command does not process with assemble_vintf : " + vintfFragmentBuild.RuleParams.Command)
}
diff --git a/android_sdk/sdk_repo_host_test.go b/android_sdk/sdk_repo_host_test.go
index 0688921f4..ce8420408 100644
--- a/android_sdk/sdk_repo_host_test.go
+++ b/android_sdk/sdk_repo_host_test.go
@@ -44,7 +44,7 @@ func TestSdkRepoHostDeps(t *testing.T) {
`)
// produces "sdk-repo-{OS}-platform-tools.zip"
- result.ModuleForTests("platform-tools", "linux_glibc_common").Output("sdk-repo-linux-platform-tools.zip")
+ result.ModuleForTests(t, "platform-tools", "linux_glibc_common").Output("sdk-repo-linux-platform-tools.zip")
}
func TestRemapPackageSpecs(t *testing.T) {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 6c1a2d66b..5519bd2fd 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -505,10 +505,10 @@ func TestBasicApex(t *testing.T) {
}
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
// Make sure that Android.mk is created
- ab := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ ab := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
@@ -585,14 +585,14 @@ func TestBasicApex(t *testing.T) {
}
fullDepsInfo := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
- ctx.ModuleForTests("myapex", "android_common_myapex").Output("depsinfo/fulllist.txt")), "\n")
+ ctx.ModuleForTests(t, "myapex", "android_common_myapex").Output("depsinfo/fulllist.txt")), "\n")
ensureListContains(t, fullDepsInfo, " myjar(minSdkVersion:(no version)) <- myapex")
ensureListContains(t, fullDepsInfo, " mylib2(minSdkVersion:(no version)) <- mylib")
ensureListContains(t, fullDepsInfo, " myotherjar(minSdkVersion:(no version)) <- myjar")
ensureListContains(t, fullDepsInfo, " mysharedjar(minSdkVersion:(no version)) (external) <- myjar")
flatDepsInfo := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
- ctx.ModuleForTests("myapex", "android_common_myapex").Output("depsinfo/flatlist.txt")), "\n")
+ ctx.ModuleForTests(t, "myapex", "android_common_myapex").Output("depsinfo/flatlist.txt")), "\n")
ensureListContains(t, flatDepsInfo, "myjar(minSdkVersion:(no version))")
ensureListContains(t, flatDepsInfo, "mylib2(minSdkVersion:(no version))")
ensureListContains(t, flatDepsInfo, "myotherjar(minSdkVersion:(no version))")
@@ -699,7 +699,7 @@ func TestApexManifest(t *testing.T) {
}
`)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
args := module.Rule("apexRule").Args
if manifest := args["manifest"]; manifest != module.Output("apex_manifest.pb").Output.String() {
t.Error("manifest should be apex_manifest.pb, but " + manifest)
@@ -771,7 +771,7 @@ func TestApexManifestMinSdkVersion(t *testing.T) {
},
}
for _, tc := range testCases {
- module := ctx.ModuleForTests(tc.module, "android_common_"+tc.module)
+ module := ctx.ModuleForTests(t, tc.module, "android_common_"+tc.module)
args := module.Rule("apexRule").Args
optFlags := args["opt_flags"]
if !strings.Contains(optFlags, "--min_sdk_version "+tc.minSdkVersion) {
@@ -845,7 +845,7 @@ func TestApexWithDessertSha(t *testing.T) {
},
}
for _, tc := range testCases {
- module := ctx.ModuleForTests(tc.module, "android_common_"+tc.module)
+ module := ctx.ModuleForTests(t, tc.module, "android_common_"+tc.module)
args := module.Rule("apexRule").Args
optFlags := args["opt_flags"]
if !strings.Contains(optFlags, "--min_sdk_version "+tc.minSdkVersion) {
@@ -876,7 +876,7 @@ func TestFileContexts(t *testing.T) {
}
`)
- rule := ctx.ModuleForTests("myapex", "android_common_myapex").Output("file_contexts")
+ rule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Output("file_contexts")
if vendor {
android.AssertStringDoesContain(t, "should force-label as vendor_apex_metadata_file",
rule.RuleParams.Command,
@@ -1039,7 +1039,7 @@ func TestApexWithStubs(t *testing.T) {
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@@ -1053,7 +1053,7 @@ func TestApexWithStubs(t *testing.T) {
ensureContains(t, copyCmds, "image.apex/lib64/mylib3.so")
ensureContains(t, copyCmds, "image.apex/lib64/libmylib3_rs.so")
- mylibLdFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
+ mylibLdFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
// Ensure that mylib is linking with the latest version of stubs for mylib2
ensureContains(t, mylibLdFlags, "mylib2/android_arm64_armv8-a_shared_current/mylib2.so")
@@ -1078,15 +1078,15 @@ func TestApexWithStubs(t *testing.T) {
// including the original cflags's "-include mylib.h".
//
// Ensure that stubs libs are built without -include flags
- // mylib2Cflags := ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ // mylib2Cflags := ctx.ModuleForTests(t, "mylib2", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
// ensureNotContains(t, mylib2Cflags, "-include ")
// Ensure that genstub for platform-provided lib is invoked with --systemapi
- ensureContains(t, ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_shared_3").Rule("genStubSrc").Args["flags"], "--systemapi")
- ensureContains(t, ctx.ModuleForTests("libmylib2_rs", "android_arm64_armv8-a_shared_3").Rule("genStubSrc").Args["flags"], "--systemapi")
+ ensureContains(t, ctx.ModuleForTests(t, "mylib2", "android_arm64_armv8-a_shared_3").Rule("genStubSrc").Args["flags"], "--systemapi")
+ ensureContains(t, ctx.ModuleForTests(t, "libmylib2_rs", "android_arm64_armv8-a_shared_3").Rule("genStubSrc").Args["flags"], "--systemapi")
// Ensure that genstub for apex-provided lib is invoked with --apex
- ensureContains(t, ctx.ModuleForTests("mylib3", "android_arm64_armv8-a_shared_12").Rule("genStubSrc").Args["flags"], "--apex")
- ensureContains(t, ctx.ModuleForTests("libmylib3_rs", "android_arm64_armv8-a_shared_12").Rule("genStubSrc").Args["flags"], "--apex")
+ ensureContains(t, ctx.ModuleForTests(t, "mylib3", "android_arm64_armv8-a_shared_12").Rule("genStubSrc").Args["flags"], "--apex")
+ ensureContains(t, ctx.ModuleForTests(t, "libmylib3_rs", "android_arm64_armv8-a_shared_12").Rule("genStubSrc").Args["flags"], "--apex")
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"lib64/mylib.so",
@@ -1103,13 +1103,13 @@ func TestApexWithStubs(t *testing.T) {
ensureNotContains(t, copyCmds, "image.apex/lib64/libfoo.shared_from_rust.so")
ensureNotContains(t, copyCmds, "image.apex/lib64/libfoo_rs.shared_from_rust.so")
// The rust module is linked to the stub cc library
- rustDeps := ctx.ModuleForTests("foo.rust", "android_arm64_armv8-a_apex10000").Rule("rustc").Args["linkFlags"]
+ rustDeps := ctx.ModuleForTests(t, "foo.rust", "android_arm64_armv8-a_apex10000").Rule("rustc").Args["linkFlags"]
ensureContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared_current/libfoo.shared_from_rust.so")
ensureContains(t, rustDeps, "libfoo_rs.shared_from_rust/android_arm64_armv8-a_shared_current/unstripped/libfoo_rs.shared_from_rust.so")
ensureNotContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared/libfoo.shared_from_rust.so")
ensureNotContains(t, rustDeps, "libfoo_rs.shared_from_rust/android_arm64_armv8-a_shared/unstripped/libfoo_rs.shared_from_rust.so")
- apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
+ apexManifestRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexManifestRule")
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo.shared_from_rust.so")
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo_rs.shared_from_rust.so")
@@ -1118,14 +1118,14 @@ func TestApexWithStubs(t *testing.T) {
// ... and not linking to the non-stub (impl) variant of my_prebuilt_platform_lib
ensureNotContains(t, mylibLdFlags, "my_prebuilt_platform_lib/android_arm64_armv8-a_shared/my_prebuilt_platform_lib.so")
// Ensure that genstub for platform-provided lib is invoked with --systemapi
- ensureContains(t, ctx.ModuleForTests("my_prebuilt_platform_lib", "android_arm64_armv8-a_shared_3").Rule("genStubSrc").Args["flags"], "--systemapi")
+ ensureContains(t, ctx.ModuleForTests(t, "my_prebuilt_platform_lib", "android_arm64_armv8-a_shared_3").Rule("genStubSrc").Args["flags"], "--systemapi")
// Ensure that mylib is linking with the latest version of stubs for my_prebuilt_platform_lib
ensureContains(t, mylibLdFlags, "my_prebuilt_platform_stub_only_lib/android_arm64_armv8-a_shared_current/my_prebuilt_platform_stub_only_lib.so")
// ... and not linking to the non-stub (impl) variant of my_prebuilt_platform_lib
ensureNotContains(t, mylibLdFlags, "my_prebuilt_platform_stub_only_lib/android_arm64_armv8-a_shared/my_prebuilt_platform_stub_only_lib.so")
// Ensure that genstub for platform-provided lib is invoked with --systemapi
- ensureContains(t, ctx.ModuleForTests("my_prebuilt_platform_stub_only_lib", "android_arm64_armv8-a_shared_3").Rule("genStubSrc").Args["flags"], "--systemapi")
+ ensureContains(t, ctx.ModuleForTests(t, "my_prebuilt_platform_stub_only_lib", "android_arm64_armv8-a_shared_3").Rule("genStubSrc").Args["flags"], "--systemapi")
}
func TestApexShouldNotEmbedStubVariant(t *testing.T) {
@@ -1236,7 +1236,7 @@ func TestApexCanUsePrivateApis(t *testing.T) {
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that indirect stubs dep is not included
@@ -1247,12 +1247,12 @@ func TestApexCanUsePrivateApis(t *testing.T) {
// Ensure that we are using non-stub variants of mylib2 and libfoo.shared_from_rust (because
// of the platform_apis: true)
- mylibLdFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_apex10000_p").Rule("ld").Args["libFlags"]
+ mylibLdFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_shared_apex10000_p").Rule("ld").Args["libFlags"]
ensureNotContains(t, mylibLdFlags, "mylib2/android_arm64_armv8-a_shared_current/mylib2.so")
ensureContains(t, mylibLdFlags, "mylib2/android_arm64_armv8-a_shared/mylib2.so")
ensureNotContains(t, mylibLdFlags, "libmylib2_rust/android_arm64_armv8-a_shared_current/unstripped/libmylib2_rust.so")
ensureContains(t, mylibLdFlags, "libmylib2_rust/android_arm64_armv8-a_shared/unstripped/libmylib2_rust.so")
- rustDeps := ctx.ModuleForTests("foo.rust", "android_arm64_armv8-a_apex10000_p").Rule("rustc").Args["linkFlags"]
+ rustDeps := ctx.ModuleForTests(t, "foo.rust", "android_arm64_armv8-a_apex10000_p").Rule("rustc").Args["linkFlags"]
ensureNotContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared_current/libfoo.shared_from_rust.so")
ensureContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared/libfoo.shared_from_rust.so")
ensureNotContains(t, rustDeps, "libmylib_rust.shared_from_rust/android_arm64_armv8-a_shared_current/unstripped/libmylib_rust.shared_from_rust.so")
@@ -1363,7 +1363,7 @@ func TestApexWithStubsWithMinSdkVersion(t *testing.T) {
}
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@@ -1378,7 +1378,7 @@ func TestApexWithStubsWithMinSdkVersion(t *testing.T) {
// Ensure that direct stubs dep is included
ensureContains(t, copyCmds, "image.apex/lib64/mylib3.so")
- mylibLdFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_apex29").Rule("ld").Args["libFlags"]
+ mylibLdFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_shared_apex29").Rule("ld").Args["libFlags"]
// Ensure that mylib is linking with the latest version of stub for mylib2
ensureContains(t, mylibLdFlags, "mylib2/android_arm64_armv8-a_shared_current/mylib2.so")
@@ -1395,12 +1395,12 @@ func TestApexWithStubsWithMinSdkVersion(t *testing.T) {
ensureNotContains(t, mylibLdFlags, "libmylib3_rust/android_arm64_armv8-a_shared_29/unstripped/libmylib3_rust.so")
// Ensure that stubs libs are built without -include flags
- mylib2Cflags := ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_shared_29").Rule("cc").Args["cFlags"]
+ mylib2Cflags := ctx.ModuleForTests(t, "mylib2", "android_arm64_armv8-a_shared_29").Rule("cc").Args["cFlags"]
ensureNotContains(t, mylib2Cflags, "-include ")
// Ensure that genstub is invoked with --systemapi
- ensureContains(t, ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_shared_29").Rule("genStubSrc").Args["flags"], "--systemapi")
- ensureContains(t, ctx.ModuleForTests("libmylib2_rust", "android_arm64_armv8-a_shared_29").Rule("cc.genStubSrc").Args["flags"], "--systemapi")
+ ensureContains(t, ctx.ModuleForTests(t, "mylib2", "android_arm64_armv8-a_shared_29").Rule("genStubSrc").Args["flags"], "--systemapi")
+ ensureContains(t, ctx.ModuleForTests(t, "libmylib2_rust", "android_arm64_armv8-a_shared_29").Rule("cc.genStubSrc").Args["flags"], "--systemapi")
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"lib64/mylib.so",
@@ -1497,20 +1497,20 @@ func TestApex_PlatformUsesLatestStubFromApex(t *testing.T) {
)
// Ensure that mylib from myapex is built against the latest stub (current)
- mylibCflags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static_apex10000").Rule("cc").Args["cFlags"]
+ mylibCflags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_static_apex10000").Rule("cc").Args["cFlags"]
ensureContains(t, mylibCflags, "-D__LIBSTUB_API__=10000 ")
// rust stubs do not emit -D__LIBFOO_API__ flags as this is deprecated behavior for cc stubs
- mylibLdflags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
+ mylibLdflags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
ensureContains(t, mylibLdflags, "libstub/android_arm64_armv8-a_shared_current/libstub.so ")
ensureContains(t, mylibLdflags, "libstub_rust/android_arm64_armv8-a_shared_current/unstripped/libstub_rust.so ")
// Ensure that libplatform is built against latest stub ("current") of mylib3 from the apex
- libplatformCflags := ctx.ModuleForTests("libplatform", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ libplatformCflags := ctx.ModuleForTests(t, "libplatform", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
ensureContains(t, libplatformCflags, "-D__LIBSTUB_API__=10000 ") // "current" maps to 10000
// rust stubs do not emit -D__LIBFOO_API__ flags as this is deprecated behavior for cc stubs
- libplatformLdflags := ctx.ModuleForTests("libplatform", "android_arm64_armv8-a_shared").Rule("ld").Args["libFlags"]
+ libplatformLdflags := ctx.ModuleForTests(t, "libplatform", "android_arm64_armv8-a_shared").Rule("ld").Args["libFlags"]
ensureContains(t, libplatformLdflags, "libstub/android_arm64_armv8-a_shared_current/libstub.so ")
ensureContains(t, libplatformLdflags, "libstub_rust/android_arm64_armv8-a_shared_current/unstripped/libstub_rust.so ")
}
@@ -1589,7 +1589,7 @@ func TestApexWithExplicitStubsDependency(t *testing.T) {
`)
- apexRule := ctx.ModuleForTests("myapex2", "android_common_myapex2").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex2", "android_common_myapex2").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@@ -1603,7 +1603,7 @@ func TestApexWithExplicitStubsDependency(t *testing.T) {
ensureNotContains(t, copyCmds, "image.apex/lib64/libbar.so")
ensureNotContains(t, copyCmds, "image.apex/lib64/libbar.from_rust.so")
- mylibLdFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
+ mylibLdFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
// Ensure that mylib is linking with version 10 of libfoo
ensureContains(t, mylibLdFlags, "libfoo/android_arm64_armv8-a_shared_10/libfoo.so")
@@ -1612,19 +1612,19 @@ func TestApexWithExplicitStubsDependency(t *testing.T) {
ensureNotContains(t, mylibLdFlags, "libfoo/android_arm64_armv8-a_shared/libfoo.so")
ensureNotContains(t, mylibLdFlags, "libfoo_rust/android_arm64_armv8-a_shared/unstripped/libfoo_rust.so")
- libFooStubsLdFlags := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared_10").Rule("ld").Args["libFlags"]
- libFooRustStubsLdFlags := ctx.ModuleForTests("libfoo_rust", "android_arm64_armv8-a_shared_10").Rule("ld").Args["libFlags"]
+ libFooStubsLdFlags := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared_10").Rule("ld").Args["libFlags"]
+ libFooRustStubsLdFlags := ctx.ModuleForTests(t, "libfoo_rust", "android_arm64_armv8-a_shared_10").Rule("ld").Args["libFlags"]
// Ensure that libfoo stubs is not linking to libbar (since it is a stubs)
ensureNotContains(t, libFooStubsLdFlags, "libbar.so")
ensureNotContains(t, libFooRustStubsLdFlags, "libbar.from_rust.so")
fullDepsInfo := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
- ctx.ModuleForTests("myapex2", "android_common_myapex2").Output("depsinfo/fulllist.txt")), "\n")
+ ctx.ModuleForTests(t, "myapex2", "android_common_myapex2").Output("depsinfo/fulllist.txt")), "\n")
ensureListContains(t, fullDepsInfo, " libfoo(minSdkVersion:(no version)) (external) <- mylib")
flatDepsInfo := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
- ctx.ModuleForTests("myapex2", "android_common_myapex2").Output("depsinfo/flatlist.txt")), "\n")
+ ctx.ModuleForTests(t, "myapex2", "android_common_myapex2").Output("depsinfo/flatlist.txt")), "\n")
ensureListContains(t, flatDepsInfo, "libfoo(minSdkVersion:(no version)) (external)")
}
@@ -1729,7 +1729,7 @@ func TestApexWithRuntimeLibsDependency(t *testing.T) {
}
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@@ -1746,7 +1746,7 @@ func TestApexWithRuntimeLibsDependency(t *testing.T) {
ensureNotContains(t, copyCmds, "image.apex/lib64/libstatic_to_runtime.so")
- apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
+ apexManifestRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexManifestRule")
ensureListEmpty(t, names(apexManifestRule.Args["provideNativeLibs"]))
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo.so")
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo_rs.so")
@@ -1816,7 +1816,7 @@ func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
"lib64/bionic/libclang_rt.hwasan-aarch64-android.so",
})
- hwasan := ctx.ModuleForTests("libclang_rt.hwasan", "android_arm64_armv8-a_shared")
+ hwasan := ctx.ModuleForTests(t, "libclang_rt.hwasan", "android_arm64_armv8-a_shared")
installed := hwasan.Description("install libclang_rt.hwasan")
ensureContains(t, installed.Output.String(), "/system/lib64/bootstrap/libclang_rt.hwasan-aarch64-android.so")
@@ -1872,7 +1872,7 @@ func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
"lib64/bionic/libclang_rt.hwasan-aarch64-android.so",
})
- hwasan := ctx.ModuleForTests("libclang_rt.hwasan", "android_arm64_armv8-a_shared")
+ hwasan := ctx.ModuleForTests(t, "libclang_rt.hwasan", "android_arm64_armv8-a_shared")
installed := hwasan.Description("install libclang_rt.hwasan")
ensureContains(t, installed.Output.String(), "/system/lib64/bootstrap/libclang_rt.hwasan-aarch64-android.so")
@@ -1955,17 +1955,17 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
})
// Ensure that LLNDK dep is required
- apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
+ apexManifestRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexManifestRule")
ensureListEmpty(t, names(apexManifestRule.Args["provideNativeLibs"]))
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libbar.so")
- mylibLdFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_"+tc.apexVariant).Rule("ld").Args["libFlags"]
+ mylibLdFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_shared_"+tc.apexVariant).Rule("ld").Args["libFlags"]
ensureContains(t, mylibLdFlags, "libbar/android_arm64_armv8-a_shared_"+tc.shouldLink+"/libbar.so")
for _, ver := range tc.shouldNotLink {
ensureNotContains(t, mylibLdFlags, "libbar/android_arm64_armv8-a_shared_"+ver+"/libbar.so")
}
- mylibCFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static_"+tc.apexVariant).Rule("cc").Args["cFlags"]
+ mylibCFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_static_"+tc.apexVariant).Rule("cc").Args["cFlags"]
ver := tc.shouldLink
if tc.shouldLink == "current" {
ver = strconv.Itoa(android.FutureApiLevelInt)
@@ -2038,7 +2038,7 @@ func TestApexWithSystemLibsStubs(t *testing.T) {
}
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that mylib, libmylib_rs, libm, libdl, libstd.dylib.so (from Rust) are included.
@@ -2052,10 +2052,10 @@ func TestApexWithSystemLibsStubs(t *testing.T) {
ensureNotContains(t, copyCmds, "image.apex/lib64/bionic/libc.so")
ensureNotContains(t, copyCmds, "image.apex/lib64/liblog.so")
- mylibLdFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
- mylibRsFlags := ctx.ModuleForTests("libmylib_rs", "android_arm64_armv8-a_shared_apex10000").Rule("rustc").Args["linkFlags"]
- mylibCFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static_apex10000").Rule("cc").Args["cFlags"]
- mylibSharedCFlags := ctx.ModuleForTests("mylib_shared", "android_arm64_armv8-a_shared_apex10000").Rule("cc").Args["cFlags"]
+ mylibLdFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
+ mylibRsFlags := ctx.ModuleForTests(t, "libmylib_rs", "android_arm64_armv8-a_shared_apex10000").Rule("rustc").Args["linkFlags"]
+ mylibCFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_static_apex10000").Rule("cc").Args["cFlags"]
+ mylibSharedCFlags := ctx.ModuleForTests(t, "mylib_shared", "android_arm64_armv8-a_shared_apex10000").Rule("cc").Args["cFlags"]
// For dependency to libc
// Ensure that mylib is linking with the latest version of stubs
@@ -2113,13 +2113,13 @@ func TestApexWithSystemLibsStubs(t *testing.T) {
ensureNotContains(t, mylibRsFlags, "libvers/android_arm64_armv8-a_shared_apex10000/libvers.so")
// Ensure that libBootstrap is depending on the platform variant of bionic libs
- libFlags := ctx.ModuleForTests("libBootstrap", "android_arm64_armv8-a_shared").Rule("ld").Args["libFlags"]
+ libFlags := ctx.ModuleForTests(t, "libBootstrap", "android_arm64_armv8-a_shared").Rule("ld").Args["libFlags"]
ensureContains(t, libFlags, "libc/android_arm64_armv8-a_shared/libc.so")
ensureContains(t, libFlags, "libm/android_arm64_armv8-a_shared/libm.so")
ensureContains(t, libFlags, "libdl/android_arm64_armv8-a_shared/libdl.so")
// Ensure that libbootstrap_rs is depending on the platform variant of bionic libs
- libRsFlags := ctx.ModuleForTests("libbootstrap_rs", "android_arm64_armv8-a_shared").Rule("rustc").Args["linkFlags"]
+ libRsFlags := ctx.ModuleForTests(t, "libbootstrap_rs", "android_arm64_armv8-a_shared").Rule("rustc").Args["linkFlags"]
ensureContains(t, libRsFlags, "libc/android_arm64_armv8-a_shared/libc.so")
ensureContains(t, libRsFlags, "libm/android_arm64_armv8-a_shared/libm.so")
ensureContains(t, libRsFlags, "libdl/android_arm64_armv8-a_shared/libdl.so")
@@ -2202,11 +2202,11 @@ func TestApexMinSdkVersion_NativeModulesShouldBeBuiltAgainstStubs(t *testing.T)
`)
expectLink := func(from, from_variant, to, to_variant string) {
- ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
+ ldArgs := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
expectNoLink := func(from, from_variant, to, to_variant string) {
- ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
+ ldArgs := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureNotContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
// platform liba is linked to non-stub version
@@ -2272,11 +2272,11 @@ func TestApexMinSdkVersion_SupportsCodeNames(t *testing.T) {
)
expectLink := func(from, from_variant, to, to_variant string) {
- ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
+ ldArgs := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
expectNoLink := func(from, from_variant, to, to_variant string) {
- ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
+ ldArgs := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureNotContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
expectLink("libx", "shared_apex10000", "libz", "shared_current")
@@ -2352,11 +2352,11 @@ func TestApexMinSdkVersion_DefaultsToLatest(t *testing.T) {
`)
expectLink := func(from, from_variant, to, to_variant string) {
- ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
+ ldArgs := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
expectNoLink := func(from, from_variant, to, to_variant string) {
- ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
+ ldArgs := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureNotContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
expectLink("libx", "shared_apex10000", "libz", "shared_current")
@@ -2400,14 +2400,14 @@ func TestApexMinSdkVersion_InVendorApex(t *testing.T) {
vendorVariant := "android_vendor_arm64_armv8-a"
- mylib := ctx.ModuleForTests("mylib", vendorVariant+"_shared_apex29")
+ mylib := ctx.ModuleForTests(t, "mylib", vendorVariant+"_shared_apex29")
// Ensure that mylib links with "current" LLNDK
libFlags := names(mylib.Rule("ld").Args["libFlags"])
ensureListContains(t, libFlags, "out/soong/.intermediates/libbar/"+vendorVariant+"_shared/libbar.so")
// Ensure that mylib is targeting 29
- ccRule := ctx.ModuleForTests("mylib", vendorVariant+"_static_apex29").Output("obj/mylib.o")
+ ccRule := ctx.ModuleForTests(t, "mylib", vendorVariant+"_static_apex29").Output("obj/mylib.o")
ensureContains(t, ccRule.Args["cFlags"], "-target aarch64-linux-android29")
// Ensure that the correct variant of crtbegin_so is used.
@@ -2415,7 +2415,7 @@ func TestApexMinSdkVersion_InVendorApex(t *testing.T) {
ensureContains(t, crtBegin, "out/soong/.intermediates/"+cc.DefaultCcCommonTestModulesDir+"crtbegin_so/"+vendorVariant+"_apex29/crtbegin_so.o")
// Ensure that the crtbegin_so used by the APEX is targeting 29
- cflags := ctx.ModuleForTests("crtbegin_so", vendorVariant+"_apex29").Rule("cc").Args["cFlags"]
+ cflags := ctx.ModuleForTests(t, "crtbegin_so", vendorVariant+"_apex29").Rule("cc").Args["cFlags"]
android.AssertStringDoesContain(t, "cflags", cflags, "-target aarch64-linux-android29")
}
@@ -2479,14 +2479,14 @@ func TestTrackAllowedDepsForAndroidApex(t *testing.T) {
"system/sepolicy/apex/com.android.myapex-file_contexts": nil,
}))
- depsinfo := ctx.SingletonForTests("apex_depsinfo_singleton")
+ depsinfo := ctx.SingletonForTests(t, "apex_depsinfo_singleton")
inputs := depsinfo.Rule("generateApexDepsInfoFilesRule").BuildParams.Inputs.Strings()
android.AssertStringListContains(t, "updatable com.android.myapex should generate depsinfo file", inputs,
"out/soong/.intermediates/com.android.myapex/android_common_com.android.myapex/depsinfo/flatlist.txt")
android.AssertStringListDoesNotContain(t, "non-updatable myapex2 should not generate depsinfo file", inputs,
"out/soong/.intermediates/myapex2/android_common_myapex2/depsinfo/flatlist.txt")
- myapex := ctx.ModuleForTests("com.android.myapex", "android_common_com.android.myapex")
+ myapex := ctx.ModuleForTests(t, "com.android.myapex", "android_common_com.android.myapex")
flatlist := strings.Split(android.ContentFromFileRuleForTests(t, ctx,
myapex.Output("depsinfo/flatlist.txt")), "\n")
android.AssertStringListContains(t, "deps with stubs should be tracked in depsinfo as external dep",
@@ -2549,7 +2549,7 @@ func TestNotTrackAllowedDepsForNonAndroidApex(t *testing.T) {
"packages/modules/common/build/allowed_deps.txt": nil,
}))
- depsinfo := ctx.SingletonForTests("apex_depsinfo_singleton")
+ depsinfo := ctx.SingletonForTests(t, "apex_depsinfo_singleton")
inputs := depsinfo.Rule("generateApexDepsInfoFilesRule").BuildParams.Inputs.Strings()
android.AssertStringListDoesNotContain(t, "updatable myapex should generate depsinfo file", inputs,
"out/soong/.intermediates/myapex/android_common_myapex/depsinfo/flatlist.txt")
@@ -2576,7 +2576,7 @@ func TestTrackAllowedDeps_SkipWithoutAllowedDepsTxt(t *testing.T) {
android.FixtureMergeMockFs(android.MockFS{
"system/sepolicy/apex/com.android.myapex-file_contexts": nil,
}))
- depsinfo := ctx.SingletonForTests("apex_depsinfo_singleton")
+ depsinfo := ctx.SingletonForTests(t, "apex_depsinfo_singleton")
if nil != depsinfo.MaybeRule("generateApexDepsInfoFilesRule").Output {
t.Error("apex_depsinfo_singleton shouldn't run when allowed_deps.txt doesn't exist")
}
@@ -2628,12 +2628,12 @@ func TestPlatformUsesLatestStubsFromApexes(t *testing.T) {
expectLink := func(from, from_variant, to, to_variant string) {
t.Helper()
- ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
+ ldArgs := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
expectNoLink := func(from, from_variant, to, to_variant string) {
t.Helper()
- ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
+ ldArgs := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
ensureNotContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
expectLink("libz", "shared", "libx", "shared_current")
@@ -2690,7 +2690,7 @@ func TestQApexesUseLatestStubsInBundledBuildsAndHWASAN(t *testing.T) {
prepareForTestWithSantitizeHwaddress,
)
expectLink := func(from, from_variant, to, to_variant string) {
- ld := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld")
+ ld := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld")
libFlags := ld.Args["libFlags"]
ensureContains(t, libFlags, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
@@ -2722,10 +2722,10 @@ func TestQTargetApexUsesStaticUnwinder(t *testing.T) {
`)
// ensure apex variant of c++ is linked with static unwinder
- cm := ctx.ModuleForTests("libc++", "android_arm64_armv8-a_shared_apex29").Module().(*cc.Module)
+ cm := ctx.ModuleForTests(t, "libc++", "android_arm64_armv8-a_shared_apex29").Module().(*cc.Module)
ensureListContains(t, cm.Properties.AndroidMkStaticLibs, "libunwind")
// note that platform variant is not.
- cm = ctx.ModuleForTests("libc++", "android_arm64_armv8-a_shared").Module().(*cc.Module)
+ cm = ctx.ModuleForTests(t, "libc++", "android_arm64_armv8-a_shared").Module().(*cc.Module)
ensureListNotContains(t, cm.Properties.AndroidMkStaticLibs, "libunwind")
}
@@ -3218,7 +3218,7 @@ func TestApexMinSdkVersion_OkayEvenWhenDepIsNewer_IfItSatisfiesApexMinSdkVersion
}
`)
expectLink := func(from, from_variant, to, to_variant string) {
- ld := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld")
+ ld := ctx.ModuleForTests(t, from, "android_arm64_armv8-a_"+from_variant).Rule("ld")
libFlags := ld.Args["libFlags"]
ensureContains(t, libFlags, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
}
@@ -3293,7 +3293,7 @@ func TestApexMinSdkVersion_WorksWithActiveCodenames(t *testing.T) {
`, withSAsActiveCodeNames)
// ensure libfoo is linked with current version of libbar stub
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared_apex10000")
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared_apex10000")
libFlags := libfoo.Rule("ld").Args["libFlags"]
ensureContains(t, libFlags, "android_arm64_armv8-a_shared_current/libbar.so")
}
@@ -3349,7 +3349,7 @@ func TestFilesInSubDir(t *testing.T) {
}
`)
- generateFsRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("generateFsConfig")
+ generateFsRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("generateFsConfig")
cmd := generateFsRule.RuleParams.Command
// Ensure that the subdirectories are all listed
@@ -3463,7 +3463,7 @@ func TestVendorApex(t *testing.T) {
"lib64/libc++.so",
})
- apexBundle := result.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ apexBundle := result.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, result.TestContext, apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
@@ -3473,7 +3473,7 @@ func TestVendorApex(t *testing.T) {
installPath := "out/target/product/test_device/vendor/apex"
ensureContains(t, androidMk, "LOCAL_MODULE_PATH := "+installPath)
- apexManifestRule := result.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
+ apexManifestRule := result.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexManifestRule")
requireNativeLibs := names(apexManifestRule.Args["requireNativeLibs"])
ensureListNotContains(t, requireNativeLibs, ":vndk")
}
@@ -3504,7 +3504,7 @@ func TestProductVariant(t *testing.T) {
`)
cflags := strings.Fields(
- ctx.ModuleForTests("foo", "android_product_arm64_armv8-a_apex10000").Rule("cc").Args["cFlags"])
+ ctx.ModuleForTests(t, "foo", "android_product_arm64_armv8-a_apex10000").Rule("cc").Args["cFlags"])
ensureListContains(t, cflags, "-D__ANDROID_VNDK__")
ensureListContains(t, cflags, "-D__ANDROID_APEX__")
ensureListContains(t, cflags, "-D__ANDROID_PRODUCT__")
@@ -3573,7 +3573,7 @@ func TestAndroidMk_VendorApexRequired(t *testing.T) {
}
`)
- apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ apexBundle := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
@@ -3602,7 +3602,7 @@ func TestAndroidMkWritesCommonProperties(t *testing.T) {
}
`)
- apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ apexBundle := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
@@ -3660,7 +3660,7 @@ func TestStaticLinking(t *testing.T) {
}
`)
- ldFlags := ctx.ModuleForTests("not_in_apex", "android_arm64_armv8-a").Rule("ld").Args["libFlags"]
+ ldFlags := ctx.ModuleForTests(t, "not_in_apex", "android_arm64_armv8-a").Rule("ld").Args["libFlags"]
// Ensure that not_in_apex is linking with the static variant of mylib
ensureContains(t, ldFlags, "mylib/android_arm64_armv8-a_static/mylib.a")
@@ -3706,7 +3706,7 @@ func TestKeys(t *testing.T) {
`)
// check the APEX keys
- keys := ctx.ModuleForTests("myapex.key", "android_common").Module().(*apexKey)
+ keys := ctx.ModuleForTests(t, "myapex.key", "android_common").Module().(*apexKey)
if keys.publicKeyFile.String() != "vendor/foo/devkeys/testkey.avbpubkey" {
t.Errorf("public key %q is not %q", keys.publicKeyFile.String(),
@@ -3718,7 +3718,7 @@ func TestKeys(t *testing.T) {
}
// check the APK certs. It should be overridden to myapex.certificate.override
- certs := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest").Rule("signapk").Args["certificates"]
+ certs := ctx.ModuleForTests(t, "myapex_keytest", "android_common_myapex_keytest").Rule("signapk").Args["certificates"]
if certs != "testkey.override.x509.pem testkey.override.pk8" {
t.Errorf("cert and private key %q are not %q", certs,
"testkey.override.509.pem testkey.override.pk8")
@@ -3740,7 +3740,7 @@ func TestCertificate(t *testing.T) {
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}`)
- rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk")
+ rule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("signapk")
expected := "vendor/foo/devkeys/test.x509.pem vendor/foo/devkeys/test.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@@ -3764,7 +3764,7 @@ func TestCertificate(t *testing.T) {
name: "myapex.certificate.override",
certificate: "testkey.override",
}`)
- rule := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest").Rule("signapk")
+ rule := ctx.ModuleForTests(t, "myapex_keytest", "android_common_myapex_keytest").Rule("signapk")
expected := "testkey.override.x509.pem testkey.override.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@@ -3788,7 +3788,7 @@ func TestCertificate(t *testing.T) {
name: "myapex.certificate",
certificate: "testkey",
}`)
- rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk")
+ rule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("signapk")
expected := "testkey.x509.pem testkey.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@@ -3813,7 +3813,7 @@ func TestCertificate(t *testing.T) {
name: "myapex.certificate.override",
certificate: "testkey.override",
}`)
- rule := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest").Rule("signapk")
+ rule := ctx.ModuleForTests(t, "myapex_keytest", "android_common_myapex_keytest").Rule("signapk")
expected := "testkey.override.x509.pem testkey.override.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@@ -3837,7 +3837,7 @@ func TestCertificate(t *testing.T) {
"vendor/foo/devkeys/testkey.x509.pem": nil,
}.AddToFixture(),
)
- rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk")
+ rule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("signapk")
expected := "vendor/foo/devkeys/testkey.x509.pem vendor/foo/devkeys/testkey.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@@ -3862,7 +3862,7 @@ func TestCertificate(t *testing.T) {
name: "myapex.certificate.override",
certificate: "testkey.override",
}`)
- rule := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest").Rule("signapk")
+ rule := ctx.ModuleForTests(t, "myapex_keytest", "android_common_myapex_keytest").Rule("signapk")
expected := "testkey.override.x509.pem testkey.override.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@@ -3933,34 +3933,34 @@ func TestMacro(t *testing.T) {
`)
// non-APEX variant does not have __ANDROID_APEX__ defined
- mylibCFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ mylibCFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__")
// APEX variant has __ANDROID_APEX__ and __ANDROID_APEX__ defined
- mylibCFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static_apex10000").Rule("cc").Args["cFlags"]
+ mylibCFlags = ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_static_apex10000").Rule("cc").Args["cFlags"]
ensureContains(t, mylibCFlags, "-D__ANDROID_APEX__")
// APEX variant has __ANDROID_APEX__ and __ANDROID_APEX__ defined
- mylibCFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static_apex29").Rule("cc").Args["cFlags"]
+ mylibCFlags = ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_static_apex29").Rule("cc").Args["cFlags"]
ensureContains(t, mylibCFlags, "-D__ANDROID_APEX__")
// When a cc_library sets use_apex_name_macro: true each apex gets a unique variant and
// each variant defines additional macros to distinguish which apex variant it is built for
// non-APEX variant does not have __ANDROID_APEX__ defined
- mylibCFlags = ctx.ModuleForTests("mylib3", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ mylibCFlags = ctx.ModuleForTests(t, "mylib3", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__")
// recovery variant does not set __ANDROID_APEX__
- mylibCFlags = ctx.ModuleForTests("mylib3", "android_recovery_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ mylibCFlags = ctx.ModuleForTests(t, "mylib3", "android_recovery_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__")
// non-APEX variant does not have __ANDROID_APEX__ defined
- mylibCFlags = ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ mylibCFlags = ctx.ModuleForTests(t, "mylib2", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__")
// recovery variant does not set __ANDROID_APEX__
- mylibCFlags = ctx.ModuleForTests("mylib2", "android_recovery_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ mylibCFlags = ctx.ModuleForTests(t, "mylib2", "android_recovery_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__")
}
@@ -4010,7 +4010,7 @@ func TestHeaderLibsDependency(t *testing.T) {
}
`)
- cFlags := ctx.ModuleForTests("otherlib", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ cFlags := ctx.ModuleForTests(t, "otherlib", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
// Ensure that the include path of the header lib is exported to 'otherlib'
ensureContains(t, cFlags, "-Imy_include")
@@ -4042,7 +4042,7 @@ func (f fileInApex) match(expectation string) bool {
func getFiles(t *testing.T, ctx *android.TestContext, moduleName, variant string) []fileInApex {
t.Helper()
- module := ctx.ModuleForTests(moduleName, variant)
+ module := ctx.ModuleForTests(t, moduleName, variant)
apexRule := module.MaybeRule("apexRule")
apexDir := "/image.apex/"
copyCmds := apexRule.Args["copy_commands"]
@@ -4133,7 +4133,7 @@ func ensureExactContents(t *testing.T, ctx *android.TestContext, moduleName, var
}
func ensureExactDeapexedContents(t *testing.T, ctx *android.TestContext, moduleName string, variant string, files []string) {
- deapexer := ctx.ModuleForTests(moduleName, variant).Description("deapex")
+ deapexer := ctx.ModuleForTests(t, moduleName, variant).Description("deapex")
outputs := make([]string, 0, len(deapexer.ImplicitOutputs)+1)
if deapexer.Output != nil {
outputs = append(outputs, deapexer.Output.String())
@@ -4262,7 +4262,7 @@ func TestVndkApexNameRule(t *testing.T) {
}`+vndkLibrariesTxtFiles("28", "29"))
assertApexName := func(expected, moduleName string) {
- module := ctx.ModuleForTests(moduleName, "android_common")
+ module := ctx.ModuleForTests(t, moduleName, "android_common")
apexManifestRule := module.Rule("apexManifestRule")
ensureContains(t, apexManifestRule.Args["opt"], "-v name "+expected)
}
@@ -4490,25 +4490,25 @@ func TestDependenciesInApexManifest(t *testing.T) {
var apexManifestRule android.TestingBuildParams
var provideNativeLibs, requireNativeLibs []string
- apexManifestRule = ctx.ModuleForTests("myapex_nodep", "android_common_myapex_nodep").Rule("apexManifestRule")
+ apexManifestRule = ctx.ModuleForTests(t, "myapex_nodep", "android_common_myapex_nodep").Rule("apexManifestRule")
provideNativeLibs = names(apexManifestRule.Args["provideNativeLibs"])
requireNativeLibs = names(apexManifestRule.Args["requireNativeLibs"])
ensureListEmpty(t, provideNativeLibs)
ensureListEmpty(t, requireNativeLibs)
- apexManifestRule = ctx.ModuleForTests("myapex_dep", "android_common_myapex_dep").Rule("apexManifestRule")
+ apexManifestRule = ctx.ModuleForTests(t, "myapex_dep", "android_common_myapex_dep").Rule("apexManifestRule")
provideNativeLibs = names(apexManifestRule.Args["provideNativeLibs"])
requireNativeLibs = names(apexManifestRule.Args["requireNativeLibs"])
ensureListEmpty(t, provideNativeLibs)
ensureListContains(t, requireNativeLibs, "libfoo.so")
- apexManifestRule = ctx.ModuleForTests("myapex_provider", "android_common_myapex_provider").Rule("apexManifestRule")
+ apexManifestRule = ctx.ModuleForTests(t, "myapex_provider", "android_common_myapex_provider").Rule("apexManifestRule")
provideNativeLibs = names(apexManifestRule.Args["provideNativeLibs"])
requireNativeLibs = names(apexManifestRule.Args["requireNativeLibs"])
ensureListContains(t, provideNativeLibs, "libfoo.so")
ensureListEmpty(t, requireNativeLibs)
- apexManifestRule = ctx.ModuleForTests("myapex_selfcontained", "android_common_myapex_selfcontained").Rule("apexManifestRule")
+ apexManifestRule = ctx.ModuleForTests(t, "myapex_selfcontained", "android_common_myapex_selfcontained").Rule("apexManifestRule")
provideNativeLibs = names(apexManifestRule.Args["provideNativeLibs"])
requireNativeLibs = names(apexManifestRule.Args["requireNativeLibs"])
ensureListContains(t, provideNativeLibs, "libbar.so")
@@ -4545,7 +4545,7 @@ func TestOverrideApexManifestDefaultVersion(t *testing.T) {
"OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION": "1234",
}))
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
apexManifestRule := module.Rule("apexManifestRule")
ensureContains(t, apexManifestRule.Args["default_version"], "1234")
}
@@ -4609,7 +4609,7 @@ func TestCompileMultilibProp(t *testing.T) {
}
`, testCase.compileMultiLibProp),
)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
for _, containedLib := range testCase.containedLibs {
@@ -4649,7 +4649,7 @@ func TestNonTestApex(t *testing.T) {
}
`)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@@ -4669,7 +4669,7 @@ func TestNonTestApex(t *testing.T) {
// Ensure that the platform variant ends with _shared
ensureListContains(t, ctx.ModuleVariantsForTests("mylib_common"), "android_arm64_armv8-a_shared")
- if !ctx.ModuleForTests("mylib_common", "android_arm64_armv8-a_shared_apex10000").Module().(*cc.Module).InAnyApex() {
+ if !ctx.ModuleForTests(t, "mylib_common", "android_arm64_armv8-a_shared_apex10000").Module().(*cc.Module).InAnyApex() {
t.Log("Found mylib_common not in any apex!")
t.Fail()
}
@@ -4704,7 +4704,7 @@ func TestTestApex(t *testing.T) {
}
`)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@@ -4778,7 +4778,7 @@ func TestLibzVendorIsntStable(t *testing.T) {
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"bin/mybin",
})
- apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
+ apexManifestRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexManifestRule")
android.AssertStringEquals(t, "should require libz", apexManifestRule.Args["requireNativeLibs"], "libz.so")
}
// libz doesn't provide stubs for vendor variant.
@@ -4787,7 +4787,7 @@ func TestLibzVendorIsntStable(t *testing.T) {
"bin/mybin",
"lib64/libz.so",
})
- apexManifestRule := ctx.ModuleForTests("myvendorapex", "android_common_myvendorapex").Rule("apexManifestRule")
+ apexManifestRule := ctx.ModuleForTests(t, "myvendorapex", "android_common_myvendorapex").Rule("apexManifestRule")
android.AssertStringEquals(t, "should not require libz", apexManifestRule.Args["requireNativeLibs"], "")
}
}
@@ -4862,7 +4862,7 @@ func TestApexWithTarget(t *testing.T) {
}
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that main rule creates an output
@@ -4947,7 +4947,7 @@ func TestApexWithArch(t *testing.T) {
}
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that apex variant is created for the direct dep
@@ -4985,7 +4985,7 @@ func TestApexWithShBinary(t *testing.T) {
}
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
ensureContains(t, copyCmds, "image.apex/bin/script/myscript.sh")
@@ -5021,7 +5021,7 @@ func TestApexInVariousPartition(t *testing.T) {
}
`)
- apex := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ apex := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
expected := "out/target/product/test_device/" + tc.partition + "/apex"
actual := apex.installDir.RelativeToTop().String()
if actual != expected {
@@ -5046,7 +5046,7 @@ func TestFileContexts_FindInDefaultLocationIfNotSet(t *testing.T) {
private_key: "testkey.pem",
}
`)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
rule := module.Output("file_contexts")
ensureContains(t, rule.RuleParams.Command, "cat system/sepolicy/apex/myapex-file_contexts")
}
@@ -5106,7 +5106,7 @@ func TestFileContexts_ProductSpecificApexes(t *testing.T) {
`, withFiles(map[string][]byte{
"product_specific_file_contexts": nil,
}))
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
rule := module.Output("file_contexts")
ensureContains(t, rule.RuleParams.Command, "cat product_specific_file_contexts")
}
@@ -5135,7 +5135,7 @@ func TestFileContexts_SetViaFileGroup(t *testing.T) {
`, withFiles(map[string][]byte{
"product_specific_file_contexts": nil,
}))
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
rule := module.Output("file_contexts")
ensureContains(t, rule.RuleParams.Command, "cat product_specific_file_contexts")
}
@@ -5161,7 +5161,7 @@ func TestApexKeyFromOtherModule(t *testing.T) {
}
`)
- apex_key := ctx.ModuleForTests("myapex.key", "android_common").Module().(*apexKey)
+ apex_key := ctx.ModuleForTests(t, "myapex.key", "android_common").Module().(*apexKey)
expected_pubkey := "testkey2.avbpubkey"
actual_pubkey := apex_key.publicKeyFile.String()
if actual_pubkey != expected_pubkey {
@@ -5190,7 +5190,7 @@ func TestPrebuilt(t *testing.T) {
}
`)
- testingModule := ctx.ModuleForTests("myapex", "android_common_prebuilt_myapex")
+ testingModule := ctx.ModuleForTests(t, "myapex", "android_common_prebuilt_myapex")
prebuilt := testingModule.Module().(*Prebuilt)
expectedInput := "myapex-arm64.apex"
@@ -5228,7 +5228,7 @@ func TestPrebuiltFilenameOverride(t *testing.T) {
}
`)
- testingModule := ctx.ModuleForTests("myapex", "android_common_prebuilt_myapex")
+ testingModule := ctx.ModuleForTests(t, "myapex", "android_common_prebuilt_myapex")
p := testingModule.Module().(*Prebuilt)
expected := "notmyapex.apex"
@@ -5251,7 +5251,7 @@ func TestApexSetFilenameOverride(t *testing.T) {
set: "company-myapex.apks",
filename: "com.company.android.myapex.apex"
}
- `).ModuleForTests("com.company.android.myapex", "android_common_prebuilt_com.android.myapex")
+ `).ModuleForTests(t, "com.company.android.myapex", "android_common_prebuilt_com.android.myapex")
testApex(t, `
apex_set {
@@ -5260,7 +5260,7 @@ func TestApexSetFilenameOverride(t *testing.T) {
set: "company-myapex.apks",
filename: "com.company.android.myapex.capex"
}
- `).ModuleForTests("com.company.android.myapex", "android_common_prebuilt_com.android.myapex")
+ `).ModuleForTests(t, "com.company.android.myapex", "android_common_prebuilt_com.android.myapex")
testApexError(t, `filename should end in .apex or .capex for apex_set`, `
apex_set {
@@ -5284,7 +5284,7 @@ func TestPrebuiltOverrides(t *testing.T) {
}
`)
- testingModule := ctx.ModuleForTests("myapex.prebuilt", "android_common_prebuilt_myapex.prebuilt")
+ testingModule := ctx.ModuleForTests(t, "myapex.prebuilt", "android_common_prebuilt_myapex.prebuilt")
p := testingModule.Module().(*Prebuilt)
expected := []string{"myapex"}
@@ -5307,7 +5307,7 @@ func TestPrebuiltApexName(t *testing.T) {
apex_name: "com.android.myapex",
src: "company-myapex-arm.apex",
}
- `).ModuleForTests("com.company.android.myapex", "android_common_prebuilt_com.android.myapex")
+ `).ModuleForTests(t, "com.company.android.myapex", "android_common_prebuilt_com.android.myapex")
testApex(t, `
apex_set {
@@ -5315,7 +5315,7 @@ func TestPrebuiltApexName(t *testing.T) {
apex_name: "com.android.myapex",
set: "company-myapex.apks",
}
- `).ModuleForTests("com.company.android.myapex", "android_common_prebuilt_com.android.myapex")
+ `).ModuleForTests(t, "com.company.android.myapex", "android_common_prebuilt_com.android.myapex")
}
func TestPrebuiltApexNameWithPlatformBootclasspath(t *testing.T) {
@@ -5400,7 +5400,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
checkHiddenAPIIndexFromClassesInputs := func(t *testing.T, ctx *android.TestContext, expectedIntermediateInputs string) {
t.Helper()
- platformBootclasspath := ctx.ModuleForTests("platform-bootclasspath", "android_common")
+ platformBootclasspath := ctx.ModuleForTests(t, "platform-bootclasspath", "android_common")
var rule android.TestingBuildParams
rule = platformBootclasspath.Output("hiddenapi-monolithic/index-from-classes.csv")
@@ -5409,7 +5409,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
checkHiddenAPIIndexFromFlagsInputs := func(t *testing.T, ctx *android.TestContext, expectedIntermediateInputs string) {
t.Helper()
- platformBootclasspath := ctx.ModuleForTests("platform-bootclasspath", "android_common")
+ platformBootclasspath := ctx.ModuleForTests(t, "platform-bootclasspath", "android_common")
var rule android.TestingBuildParams
rule = platformBootclasspath.Output("hiddenapi-index.csv")
@@ -5555,7 +5555,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_com.android.art/modular-hiddenapi/index.csv
`)
- myApex := ctx.ModuleForTests("myapex", "android_common_prebuilt_myapex").Module()
+ myApex := ctx.ModuleForTests(t, "myapex", "android_common_prebuilt_myapex").Module()
overrideNames := []string{
"",
@@ -6095,7 +6095,7 @@ func TestApexWithTests(t *testing.T) {
}
`)
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that test dep (and their transitive dependencies) are copied into apex.
@@ -6107,7 +6107,7 @@ func TestApexWithTests(t *testing.T) {
ensureContains(t, copyCmds, "image.apex/bin/test/bar/baz")
// Ensure the module is correctly translated.
- bundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ bundle := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, bundle)
name := bundle.BaseModuleName()
prefix := "TARGET_"
@@ -6189,7 +6189,7 @@ func TestApexWithJavaImport(t *testing.T) {
}
`)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
ensureContains(t, copyCmds, "image.apex/javalib/myjavaimport.jar")
@@ -6255,7 +6255,7 @@ func TestApexWithApps(t *testing.T) {
}
`)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@@ -6263,14 +6263,14 @@ func TestApexWithApps(t *testing.T) {
ensureContains(t, copyCmds, "image.apex/priv-app/AppFooPriv@TEST.BUILD_ID/AppFooPriv.apk")
ensureContains(t, copyCmds, "image.apex/etc/permissions/privapp_allowlist_com.android.AppFooPriv.xml")
- appZipRule := ctx.ModuleForTests("AppFoo", "android_common_apex10000").Description("zip jni libs")
+ appZipRule := ctx.ModuleForTests(t, "AppFoo", "android_common_apex10000").Description("zip jni libs")
// JNI libraries are uncompressed
if args := appZipRule.Args["jarArgs"]; !strings.Contains(args, "-L 0") {
t.Errorf("jni libs are not uncompressed for AppFoo")
}
// JNI libraries including transitive deps are
for _, jni := range []string{"libjni", "libfoo"} {
- jniOutput := ctx.ModuleForTests(jni, "android_arm64_armv8-a_sdk_shared_apex10000").Module().(*cc.Module).OutputFile().RelativeToTop()
+ jniOutput := ctx.ModuleForTests(t, jni, "android_arm64_armv8-a_sdk_shared_apex10000").Module().(*cc.Module).OutputFile().RelativeToTop()
// ... embedded inside APK (jnilibs.zip)
ensureListContains(t, appZipRule.Implicits.Strings(), jniOutput.String())
// ... and not directly inside the APEX
@@ -6363,7 +6363,7 @@ func TestApexWithAppImports(t *testing.T) {
}
`)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@@ -6441,7 +6441,7 @@ func TestApexWithTestHelperApp(t *testing.T) {
`)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@@ -6939,14 +6939,14 @@ func TestApexAvailable_ApexAvailableNameWithVersionCode(t *testing.T) {
}
`)
- fooManifestRule := result.ModuleForTests("foo", "android_common_foo").Rule("apexManifestRule")
+ fooManifestRule := result.ModuleForTests(t, "foo", "android_common_foo").Rule("apexManifestRule")
fooExpectedDefaultVersion := testDefaultUpdatableModuleVersion
fooActualDefaultVersion := fooManifestRule.Args["default_version"]
if fooActualDefaultVersion != fooExpectedDefaultVersion {
t.Errorf("expected to find defaultVersion %q; got %q", fooExpectedDefaultVersion, fooActualDefaultVersion)
}
- barManifestRule := result.ModuleForTests("bar", "android_common_bar").Rule("apexManifestRule")
+ barManifestRule := result.ModuleForTests(t, "bar", "android_common_bar").Rule("apexManifestRule")
defaultVersionInt, _ := strconv.Atoi(testDefaultUpdatableModuleVersion)
barExpectedDefaultVersion := fmt.Sprint(defaultVersionInt + 3)
barActualDefaultVersion := barManifestRule.Args["default_version"]
@@ -6954,7 +6954,7 @@ func TestApexAvailable_ApexAvailableNameWithVersionCode(t *testing.T) {
t.Errorf("expected to find defaultVersion %q; got %q", barExpectedDefaultVersion, barActualDefaultVersion)
}
- overrideBarManifestRule := result.ModuleForTests("bar", "android_common_myoverrideapex_myoverrideapex").Rule("apexManifestRule")
+ overrideBarManifestRule := result.ModuleForTests(t, "bar", "android_common_myoverrideapex_myoverrideapex").Rule("apexManifestRule")
overrideBarActualDefaultVersion := overrideBarManifestRule.Args["default_version"]
if overrideBarActualDefaultVersion != barExpectedDefaultVersion {
t.Errorf("expected to find defaultVersion %q; got %q", barExpectedDefaultVersion, barActualDefaultVersion)
@@ -7194,14 +7194,14 @@ func TestApexAvailable_CheckForPlatform(t *testing.T) {
// libfoo shouldn't be available to platform even though it has "//apex_available:platform",
// because it depends on libbar which isn't available to platform
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module().(*cc.Module)
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module().(*cc.Module)
if libfoo.NotAvailableForPlatform() != true {
t.Errorf("%q shouldn't be available to platform", libfoo.String())
}
// libfoo2 however can be available to platform because it depends on libbaz which provides
// stubs
- libfoo2 := ctx.ModuleForTests("libfoo2", "android_arm64_armv8-a_shared").Module().(*cc.Module)
+ libfoo2 := ctx.ModuleForTests(t, "libfoo2", "android_arm64_armv8-a_shared").Module().(*cc.Module)
if libfoo2.NotAvailableForPlatform() == true {
t.Errorf("%q should be available to platform", libfoo2.String())
}
@@ -7233,11 +7233,11 @@ func TestApexAvailable_CreatedForApex(t *testing.T) {
},
}`)
- libfooShared := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module().(*cc.Module)
+ libfooShared := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module().(*cc.Module)
if libfooShared.NotAvailableForPlatform() != true {
t.Errorf("%q shouldn't be available to platform", libfooShared.String())
}
- libfooStatic := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_static").Module().(*cc.Module)
+ libfooStatic := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_static").Module().(*cc.Module)
if libfooStatic.NotAvailableForPlatform() != false {
t.Errorf("%q should be available to platform", libfooStatic.String())
}
@@ -7357,7 +7357,7 @@ func TestApexValidation_UsesProperPartitionTag(t *testing.T) {
variables.VendorPath = proptools.StringPtr("system/vendor")
}))
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
android.AssertStringEquals(t, "partition tag for host_apex_verifier",
"vendor",
module.Output("host_apex_verifier.timestamp").Args["partition_tag"])
@@ -7384,7 +7384,7 @@ func TestApexValidation_TestApexCanSkipInitRcCheck(t *testing.T) {
}
`)
- validations := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk").Validations.Strings()
+ validations := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("signapk").Validations.Strings()
if android.SuffixInList(validations, "host_apex_verifier.timestamp") {
t.Error("should not run host_apex_verifier")
}
@@ -7405,7 +7405,7 @@ func TestApexValidation_TestApexCheckInitRc(t *testing.T) {
}
`)
- validations := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk").Validations.Strings()
+ validations := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("signapk").Validations.Strings()
if !android.SuffixInList(validations, "host_apex_verifier.timestamp") {
t.Error("should run host_apex_verifier")
}
@@ -7509,8 +7509,8 @@ func TestOverrideApex(t *testing.T) {
}
`, withManifestPackageNameOverrides([]string{"myapex:com.android.myapex"}))
- originalVariant := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(android.OverridableModule)
- overriddenVariant := ctx.ModuleForTests("myapex", "android_common_override_myapex_override_myapex").Module().(android.OverridableModule)
+ originalVariant := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(android.OverridableModule)
+ overriddenVariant := ctx.ModuleForTests(t, "myapex", "android_common_override_myapex_override_myapex").Module().(android.OverridableModule)
if originalVariant.GetOverriddenBy() != "" {
t.Errorf("GetOverriddenBy should be empty, but was %q", originalVariant.GetOverriddenBy())
}
@@ -7518,7 +7518,7 @@ func TestOverrideApex(t *testing.T) {
t.Errorf("GetOverriddenBy should be \"override_myapex\", but was %q", overriddenVariant.GetOverriddenBy())
}
- module := ctx.ModuleForTests("myapex", "android_common_override_myapex_override_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_override_myapex_override_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@@ -7609,7 +7609,7 @@ func TestMinSdkVersionOverride(t *testing.T) {
`, withApexGlobalMinSdkVersionOverride(&minSdkOverride31))
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@@ -7669,7 +7669,7 @@ func TestMinSdkVersionOverrideToLowerVersionNoOp(t *testing.T) {
`, withApexGlobalMinSdkVersionOverride(&minSdkOverride29))
- apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
+ apexRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@@ -7708,7 +7708,7 @@ func TestLegacyAndroid10Support(t *testing.T) {
}
`, withUnbundledBuild)
- module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ module := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
args := module.Rule("apexRule").Args
ensureContains(t, args["opt_flags"], "--manifest_json "+module.Output("apex_manifest.json").Output.String())
@@ -7717,8 +7717,8 @@ func TestLegacyAndroid10Support(t *testing.T) {
// the dependency names directly here but for some reason the names are blank in
// this test.
for _, lib := range []string{"libc++", "mylib"} {
- apexImplicits := ctx.ModuleForTests(lib, "android_arm64_armv8-a_shared_apex29").Rule("ld").Implicits
- nonApexImplicits := ctx.ModuleForTests(lib, "android_arm64_armv8-a_shared").Rule("ld").Implicits
+ apexImplicits := ctx.ModuleForTests(t, lib, "android_arm64_armv8-a_shared_apex29").Rule("ld").Implicits
+ nonApexImplicits := ctx.ModuleForTests(t, lib, "android_arm64_armv8-a_shared").Rule("ld").Implicits
if len(apexImplicits) != len(nonApexImplicits)+1 {
t.Errorf("%q missing unwinder dep", lib)
}
@@ -7777,7 +7777,7 @@ func TestJavaSDKLibrary(t *testing.T) {
"etc/permissions/foo.xml",
})
// Permission XML should point to the activated path of impl jar of java_sdk_library
- sdkLibrary := ctx.ModuleForTests("foo.xml", "android_common_myapex").Output("foo.xml")
+ sdkLibrary := ctx.ModuleForTests(t, "foo.xml", "android_common_myapex").Output("foo.xml")
contents := android.ContentFromFileRuleForTests(t, ctx, sdkLibrary)
ensureMatches(t, contents, "<library\\n\\s+name=\\\"foo\\\"\\n\\s+file=\\\"/apex/myapex/javalib/foo.jar\\\"")
}
@@ -7818,7 +7818,7 @@ func TestJavaSDKLibraryOverrideApexes(t *testing.T) {
// Permission XML should point to the activated path of impl jar of java_sdk_library.
// Since override variants (com.mycompany.android.foo) are installed in the same package as the overridden variant
// (com.android.foo), the filepath should not contain override apex name.
- sdkLibrary := ctx.ModuleForTests("foo.xml", "android_common_mycompanyapex").Output("foo.xml")
+ sdkLibrary := ctx.ModuleForTests(t, "foo.xml", "android_common_mycompanyapex").Output("foo.xml")
contents := android.ContentFromFileRuleForTests(t, ctx, sdkLibrary)
ensureMatches(t, contents, "<library\\n\\s+name=\\\"foo\\\"\\n\\s+file=\\\"/apex/myapex/javalib/foo.jar\\\"")
}
@@ -7873,7 +7873,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) {
})
// The bar library should depend on the implementation jar.
- barLibrary := ctx.ModuleForTests("bar", "android_common_apex10000").Rule("javac")
+ barLibrary := ctx.ModuleForTests(t, "bar", "android_common_apex10000").Rule("javac")
if expected, actual := `^-classpath [^:]*/turbine-combined/foo\.jar$`, barLibrary.Args["classpath"]; !regexp.MustCompile(expected).MatchString(actual) {
t.Errorf("expected %q, found %#q", expected, actual)
}
@@ -7925,7 +7925,7 @@ func TestJavaSDKLibrary_CrossBoundary(t *testing.T) {
})
// The bar library should depend on the stubs jar.
- barLibrary := ctx.ModuleForTests("bar", "android_common").Rule("javac")
+ barLibrary := ctx.ModuleForTests(t, "bar", "android_common").Rule("javac")
if expected, actual := `^-classpath [^:]*/turbine-combined/foo\.stubs\.jar$`, barLibrary.Args["classpath"]; !regexp.MustCompile(expected).MatchString(actual) {
t.Errorf("expected %q, found %#q", expected, actual)
}
@@ -8019,7 +8019,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) {
})
// The bar library should depend on the implementation jar.
- barLibrary := ctx.ModuleForTests("bar", "android_common_apex10000").Rule("javac")
+ barLibrary := ctx.ModuleForTests(t, "bar", "android_common_apex10000").Rule("javac")
if expected, actual := `^-classpath [^:]*/turbine-combined/foo\.jar$`, barLibrary.Args["classpath"]; !regexp.MustCompile(expected).MatchString(actual) {
t.Errorf("expected %q, found %#q", expected, actual)
}
@@ -8398,7 +8398,7 @@ func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
}
`)
- apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ apexBundle := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
var builder strings.Builder
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
@@ -8484,7 +8484,7 @@ func TestApexWithJniLibs(t *testing.T) {
`)
- rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
+ rule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexManifestRule")
// Notice mylib2.so (transitive dep) is not added as a jni_lib
ensureEquals(t, rule.Args["opt"], "-a jniLibs libfoo.rust.so mylib.so mylib3.so")
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
@@ -8524,7 +8524,7 @@ func TestAppBundle(t *testing.T) {
}
`, withManifestPackageNameOverrides([]string{"AppFoo:com.android.foo"}))
- bundleConfigRule := ctx.ModuleForTests("myapex", "android_common_myapex").Output("bundle_config.json")
+ bundleConfigRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Output("bundle_config.json")
content := android.ContentFromFileRuleForTests(t, ctx, bundleConfigRule)
ensureContains(t, content, `"compression":{"uncompressed_glob":["apex_payload.img","apex_manifest.*"]}`)
@@ -8551,7 +8551,7 @@ func TestAppSetBundle(t *testing.T) {
name: "AppSet",
set: "AppSet.apks",
}`)
- mod := ctx.ModuleForTests("myapex", "android_common_myapex")
+ mod := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
bundleConfigRule := mod.Output("bundle_config.json")
content := android.ContentFromFileRuleForTests(t, ctx, bundleConfigRule)
ensureContains(t, content, `"compression":{"uncompressed_glob":["apex_payload.img","apex_manifest.*"]}`)
@@ -8587,13 +8587,13 @@ func TestAppSetBundlePrebuilt(t *testing.T) {
// Check that the extractor produces the correct output file from the correct input file.
extractorOutput := "out/soong/.intermediates/myapex/android_common_prebuilt_myapex/extracted/myapex.hwasan.apks"
- m := ctx.ModuleForTests("myapex", "android_common_prebuilt_myapex")
+ m := ctx.ModuleForTests(t, "myapex", "android_common_prebuilt_myapex")
extractedApex := m.Output(extractorOutput)
android.AssertArrayString(t, "extractor input", []string{"myapex.hwasan.apks"}, extractedApex.Inputs.Strings())
// Ditto for the apex.
- m = ctx.ModuleForTests("myapex", "android_common_prebuilt_myapex")
+ m = ctx.ModuleForTests(t, "myapex", "android_common_prebuilt_myapex")
copiedApex := m.Output("out/soong/.intermediates/myapex/android_common_prebuilt_myapex/foo_v2.apex")
android.AssertStringEquals(t, "myapex input", extractorOutput, copiedApex.Input.String())
@@ -8613,7 +8613,7 @@ func TestApexSetApksModuleAssignment(t *testing.T) {
}
`)
- m := ctx.ModuleForTests("myapex", "android_common_prebuilt_myapex")
+ m := ctx.ModuleForTests(t, "myapex", "android_common_prebuilt_myapex")
// Check that the extractor produces the correct apks file from the input module
extractorOutput := "out/soong/.intermediates/myapex/android_common_prebuilt_myapex/extracted/myapex.apks"
@@ -9005,7 +9005,7 @@ func TestApexSet(t *testing.T) {
}),
)
- m := ctx.ModuleForTests("myapex", "android_common_prebuilt_myapex")
+ m := ctx.ModuleForTests(t, "myapex", "android_common_prebuilt_myapex")
// Check extract_apks tool parameters.
extractedApex := m.Output("extracted/myapex.apks")
@@ -9020,7 +9020,7 @@ func TestApexSet(t *testing.T) {
t.Errorf("Unexpected abis parameter - expected %q vs actual %q", expected, actual)
}
- m = ctx.ModuleForTests("myapex", "android_common_prebuilt_myapex")
+ m = ctx.ModuleForTests(t, "myapex", "android_common_prebuilt_myapex")
a := m.Module().(*ApexSet)
expectedOverrides := []string{"foo"}
actualOverrides := android.AndroidMkEntriesForTest(t, ctx, a)[0].EntryMap["LOCAL_OVERRIDES_MODULES"]
@@ -9047,7 +9047,7 @@ func TestApexSet_NativeBridge(t *testing.T) {
}),
)
- m := ctx.ModuleForTests("myapex", "android_common_prebuilt_myapex")
+ m := ctx.ModuleForTests(t, "myapex", "android_common_prebuilt_myapex")
// Check extract_apks tool parameters. No native bridge arch expected
extractedApex := m.Output("extracted/myapex.apks")
@@ -9109,7 +9109,7 @@ func TestApexKeysTxt(t *testing.T) {
}
`)
- myapex := ctx.ModuleForTests("myapex", "android_common_myapex")
+ myapex := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
content := android.ContentFromFileRuleForTests(t, ctx, myapex.Output("apexkeys.txt"))
ensureContains(t, content, `name="myapex.apex" public_key="vendor/foo/devkeys/testkey.avbpubkey" private_key="vendor/foo/devkeys/testkey.pem" container_certificate="vendor/foo/devkeys/test.x509.pem" container_private_key="vendor/foo/devkeys/test.pk8" partition="system" sign_tool="sign_myapex"`)
}
@@ -9152,10 +9152,10 @@ func TestApexKeysTxtOverrides(t *testing.T) {
`)
content := android.ContentFromFileRuleForTests(t, ctx,
- ctx.ModuleForTests("myapex", "android_common_myapex").Output("apexkeys.txt"))
+ ctx.ModuleForTests(t, "myapex", "android_common_myapex").Output("apexkeys.txt"))
ensureContains(t, content, `name="myapex.apex" public_key="vendor/foo/devkeys/testkey.avbpubkey" private_key="vendor/foo/devkeys/testkey.pem" container_certificate="vendor/foo/devkeys/test.x509.pem" container_private_key="vendor/foo/devkeys/test.pk8" partition="system" sign_tool="sign_myapex"`)
content = android.ContentFromFileRuleForTests(t, ctx,
- ctx.ModuleForTests("myapex_set", "android_common_prebuilt_myapex_set").Output("apexkeys.txt"))
+ ctx.ModuleForTests(t, "myapex_set", "android_common_prebuilt_myapex_set").Output("apexkeys.txt"))
ensureContains(t, content, `name="myapex_set.apex" public_key="PRESIGNED" private_key="PRESIGNED" container_certificate="PRESIGNED" container_private_key="PRESIGNED" partition="system"`)
}
@@ -9205,12 +9205,12 @@ func TestAllowedFiles(t *testing.T) {
`),
}))
- rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("diffApexContentRule")
+ rule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("diffApexContentRule")
if expected, actual := "allowed.txt", rule.Args["allowed_files_file"]; expected != actual {
t.Errorf("allowed_files_file: expected %q but got %q", expected, actual)
}
- rule2 := ctx.ModuleForTests("myapex", "android_common_override_myapex_override_myapex").Rule("diffApexContentRule")
+ rule2 := ctx.ModuleForTests(t, "myapex", "android_common_override_myapex_override_myapex").Rule("diffApexContentRule")
if expected, actual := "sub/allowed.txt", rule2.Args["allowed_files_file"]; expected != actual {
t.Errorf("allowed_files_file: expected %q but got %q", expected, actual)
}
@@ -9273,14 +9273,14 @@ func TestCompressedApex(t *testing.T) {
}),
)
- compressRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("compressRule")
+ compressRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("compressRule")
ensureContains(t, compressRule.Output.String(), "myapex.capex.unsigned")
- signApkRule := ctx.ModuleForTests("myapex", "android_common_myapex").Description("sign compressedApex")
+ signApkRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Description("sign compressedApex")
ensureEquals(t, signApkRule.Input.String(), compressRule.Output.String())
// Make sure output of bundle is .capex
- ab := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ ab := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
ensureContains(t, ab.outputFile.String(), "myapex.capex")
// Verify android.mk rules
@@ -9312,7 +9312,7 @@ func TestCompressedApexIsDisabledWhenUsingErofs(t *testing.T) {
}),
)
- compressRule := ctx.ModuleForTests("myapex", "android_common_myapex").MaybeRule("compressRule")
+ compressRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").MaybeRule("compressRule")
if compressRule.Rule != nil {
t.Error("erofs apex should not be compressed")
}
@@ -9334,7 +9334,7 @@ func TestApexSet_ShouldRespectCompressedApexFlag(t *testing.T) {
}),
)
- build := ctx.ModuleForTests("com.company.android.myapex", "android_common_prebuilt_com.android.myapex").Output("com.company.android.myapex.apex")
+ build := ctx.ModuleForTests(t, "com.company.android.myapex", "android_common_prebuilt_com.android.myapex").Output("com.company.android.myapex.apex")
if compressionEnabled {
ensureEquals(t, build.Rule.String(), "android/soong/android.Cp")
} else {
@@ -9386,7 +9386,7 @@ func TestPreferredPrebuiltSharedLibDep(t *testing.T) {
}
`)
- ab := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ ab := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
@@ -9436,15 +9436,15 @@ func TestExcludeDependency(t *testing.T) {
`)
// Check if mylib is linked to mylib2 for the non-apex target
- ldFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared").Rule("ld").Args["libFlags"]
+ ldFlags := ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_shared").Rule("ld").Args["libFlags"]
ensureContains(t, ldFlags, "mylib2/android_arm64_armv8-a_shared/mylib2.so")
// Make sure that the link doesn't occur for the apex target
- ldFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
+ ldFlags = ctx.ModuleForTests(t, "mylib", "android_arm64_armv8-a_shared_apex10000").Rule("ld").Args["libFlags"]
ensureNotContains(t, ldFlags, "mylib2/android_arm64_armv8-a_shared_apex10000/mylib2.so")
// It shouldn't appear in the copy cmd as well.
- copyCmds := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule").Args["copy_commands"]
+ copyCmds := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("apexRule").Args["copy_commands"]
ensureNotContains(t, copyCmds, "image.apex/lib64/mylib2.so")
}
@@ -9560,7 +9560,7 @@ func TestPrebuiltStubLibDep(t *testing.T) {
if !strings.HasPrefix(variant, "android_arm64_armv8-a_shared") {
continue
}
- mod := ctx.ModuleForTests(modName, variant).Module().(*cc.Module)
+ mod := ctx.ModuleForTests(t, modName, variant).Module().(*cc.Module)
if !mod.Enabled(android.PanickingConfigAndErrorContext(ctx)) || mod.IsHideFromMake() {
continue
}
@@ -9683,13 +9683,13 @@ func TestApexJavaCoverage(t *testing.T) {
).RunTest(t)
// Make sure jacoco ran on both mylib and mybootclasspathlib
- if result.ModuleForTests("mylib", "android_common_apex10000").MaybeRule("jacoco").Rule == nil {
+ if result.ModuleForTests(t, "mylib", "android_common_apex10000").MaybeRule("jacoco").Rule == nil {
t.Errorf("Failed to find jacoco rule for mylib")
}
- if result.ModuleForTests("mybootclasspathlib", "android_common_apex10000").MaybeRule("jacoco").Rule == nil {
+ if result.ModuleForTests(t, "mybootclasspathlib", "android_common_apex10000").MaybeRule("jacoco").Rule == nil {
t.Errorf("Failed to find jacoco rule for mybootclasspathlib")
}
- if result.ModuleForTests("mysystemserverclasspathlib", "android_common_apex10000").MaybeRule("jacoco").Rule == nil {
+ if result.ModuleForTests(t, "mysystemserverclasspathlib", "android_common_apex10000").MaybeRule("jacoco").Rule == nil {
t.Errorf("Failed to find jacoco rule for mysystemserverclasspathlib")
}
}
@@ -9772,7 +9772,7 @@ func TestAndroidMk_DexpreoptBuiltInstalledForApex(t *testing.T) {
dexpreopt.FixtureSetApexSystemServerJars("myapex:foo"),
)
- apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ apexBundle := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
var builder strings.Builder
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
@@ -9821,7 +9821,7 @@ func TestAndroidMk_RequiredModules(t *testing.T) {
}
`)
- apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ apexBundle := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
var builder strings.Builder
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
@@ -9845,7 +9845,7 @@ func TestAndroidMk_RequiredDeps(t *testing.T) {
}
`)
- bundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ bundle := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
bundle.makeModulesToInstall = append(bundle.makeModulesToInstall, "foo")
data := android.AndroidMkDataForTest(t, ctx, bundle)
var builder strings.Builder
@@ -9897,7 +9897,7 @@ func TestApexOutputFileProducer(t *testing.T) {
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.CompressedApex = proptools.BoolPtr(true)
}))
- javaTest := ctx.ModuleForTests(tc.name, "android_common").Module().(*java.Test)
+ javaTest := ctx.ModuleForTests(t, tc.name, "android_common").Module().(*java.Test)
data := android.AndroidMkEntriesForTest(t, ctx, javaTest)[0].EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"]
android.AssertStringPathsRelativeToTopEquals(t, "data", ctx.Config(), tc.expected_data, data)
})
@@ -10100,7 +10100,7 @@ func TestSdkLibraryCanHaveHigherMinSdkVersion(t *testing.T) {
// Verifies that the APEX depends on all the Make modules in the list.
func ensureContainsRequiredDeps(t *testing.T, ctx *android.TestContext, moduleName, variant string, deps []string) {
- a := ctx.ModuleForTests(moduleName, variant).Module().(*apexBundle)
+ a := ctx.ModuleForTests(t, moduleName, variant).Module().(*apexBundle)
for _, dep := range deps {
android.AssertStringListContains(t, "", a.makeModulesToInstall, dep)
}
@@ -10108,7 +10108,7 @@ func ensureContainsRequiredDeps(t *testing.T, ctx *android.TestContext, moduleNa
// Verifies that the APEX does not depend on any of the Make modules in the list.
func ensureDoesNotContainRequiredDeps(t *testing.T, ctx *android.TestContext, moduleName, variant string, deps []string) {
- a := ctx.ModuleForTests(moduleName, variant).Module().(*apexBundle)
+ a := ctx.ModuleForTests(t, moduleName, variant).Module().(*apexBundle)
for _, dep := range deps {
android.AssertStringListDoesNotContain(t, "", a.makeModulesToInstall, dep)
}
@@ -10216,8 +10216,8 @@ func TestApexStrictUpdtabilityLint(t *testing.T) {
}
}
- myjavalib := result.ModuleForTests("myjavalib", "android_common_apex29")
- apex := result.ModuleForTests("myapex", "android_common_myapex")
+ myjavalib := result.ModuleForTests(t, "myjavalib", "android_common_apex29")
+ apex := result.ModuleForTests(t, "myapex", "android_common_myapex")
apexStrictUpdatabilityCheck := apex.MaybeOutput("lint_strict_updatability_check.stamp")
javalibStrictUpdatabilityCheck := myjavalib.MaybeOutput("lint_strict_updatability_check.stamp")
@@ -10266,7 +10266,7 @@ func TestApexStrictUpdtabilityLintBcpFragmentDeps(t *testing.T) {
}
result := testApex(t, bp, dexpreopt.FixtureSetApexBootJars("myapex:myjavalib"), fs.AddToFixture())
- apex := result.ModuleForTests("myapex", "android_common_myapex")
+ apex := result.ModuleForTests(t, "myapex", "android_common_myapex")
apexStrictUpdatabilityCheck := apex.Output("lint_strict_updatability_check.stamp")
android.AssertStringDoesContain(t, "strict updatability check rule for myapex",
apexStrictUpdatabilityCheck.RuleParams.Command, "--disallowed_issues NewApi")
@@ -10318,7 +10318,7 @@ func TestApexLintBcpFragmentSdkLibDeps(t *testing.T) {
android.FixtureMergeMockFs(fs),
).RunTestWithBp(t, bp)
- myapex := result.ModuleForTests("myapex", "android_common_myapex")
+ myapex := result.ModuleForTests(t, "myapex", "android_common_myapex")
lintReportInputs := strings.Join(myapex.Output("lint-report-xml.zip").Inputs.Strings(), " ")
android.AssertStringDoesContain(t,
"myapex lint report expected to contain that of the sdk library impl lib as an input",
@@ -10370,7 +10370,7 @@ func TestCannedFsConfig(t *testing.T) {
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}`)
- mod := ctx.ModuleForTests("myapex", "android_common_myapex")
+ mod := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
generateFsRule := mod.Rule("generateFsConfig")
cmd := generateFsRule.RuleParams.Command
@@ -10392,7 +10392,7 @@ func TestCannedFsConfig_HasCustomConfig(t *testing.T) {
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}`)
- mod := ctx.ModuleForTests("myapex", "android_common_myapex")
+ mod := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
generateFsRule := mod.Rule("generateFsConfig")
cmd := generateFsRule.RuleParams.Command
@@ -10527,7 +10527,7 @@ func TestFileSystemShouldSkipApexLibraries(t *testing.T) {
}
`)
- inputs := result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img").Implicits
+ inputs := result.ModuleForTests(t, "myfilesystem", "android_common").Output("myfilesystem.img").Implicits
android.AssertStringListDoesNotContain(t, "filesystem should not have libbar",
inputs.Strings(),
"out/soong/.intermediates/libbar/android_arm64_armv8-a_shared/libbar.so")
@@ -10621,7 +10621,7 @@ func TestAconfigFilesJavaDeps(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("myapex", "android_common_myapex")
+ mod := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
if len(copyCmds) != 14 {
@@ -10760,7 +10760,7 @@ func TestAconfigFilesJavaAndCcDeps(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("myapex", "android_common_myapex")
+ mod := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
if len(copyCmds) != 18 {
@@ -10922,7 +10922,7 @@ func TestAconfigFilesRustDeps(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("myapex", "android_common_myapex")
+ mod := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
if len(copyCmds) != 32 {
@@ -11038,7 +11038,7 @@ func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("myapex", "android_common_myapex")
+ mod := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
combineAconfigRule := mod.Rule("All_aconfig_declarations_dump")
s := " " + combineAconfigRule.Args["cache_files"]
aconfigArgs := regexp.MustCompile(" --cache ").Split(s, -1)[1:]
@@ -11118,7 +11118,7 @@ func TestAconfigFilesRemoveDuplicates(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("myapex", "android_common_myapex")
+ mod := ctx.ModuleForTests(t, "myapex", "android_common_myapex")
combineAconfigRule := mod.Rule("All_aconfig_declarations_dump")
s := " " + combineAconfigRule.Args["cache_files"]
aconfigArgs := regexp.MustCompile(" --cache ").Split(s, -1)[1:]
@@ -11141,7 +11141,7 @@ func TestBootDexJarsMultipleApexPrebuilts(t *testing.T) {
t.Parallel()
checkBootDexJarPath := func(t *testing.T, ctx *android.TestContext, stem string, bootDexJarPath string) {
t.Helper()
- s := ctx.ModuleForTests("dex_bootjars", "android_common")
+ s := ctx.ModuleForTests(t, "dex_bootjars", "android_common")
foundLibfooJar := false
base := stem + ".jar"
for _, output := range s.AllOutputs() {
@@ -11159,14 +11159,14 @@ func TestBootDexJarsMultipleApexPrebuilts(t *testing.T) {
// Check that the boot jars of the selected apex are run through boot_jars_package_check
// This validates that the jars on the bootclasspath do not contain packages outside an allowlist
checkBootJarsPackageCheck := func(t *testing.T, ctx *android.TestContext, expectedBootJar string) {
- platformBcp := ctx.ModuleForTests("platform-bootclasspath", "android_common")
+ platformBcp := ctx.ModuleForTests(t, "platform-bootclasspath", "android_common")
bootJarsCheckRule := platformBcp.Rule("boot_jars_package_check")
android.AssertStringMatches(t, "Could not find the correct boot dex jar in package check rule", bootJarsCheckRule.RuleParams.Command, "build/soong/scripts/check_boot_jars/package_allowed_list.txt.*"+expectedBootJar)
}
// Check that the boot jars used to generate the monolithic hiddenapi flags come from the selected apex
checkBootJarsForMonolithicHiddenapi := func(t *testing.T, ctx *android.TestContext, expectedBootJar string) {
- monolithicHiddenapiFlagsCmd := ctx.ModuleForTests("platform-bootclasspath", "android_common").Output("out/soong/hiddenapi/hiddenapi-stub-flags.txt").RuleParams.Command
+ monolithicHiddenapiFlagsCmd := ctx.ModuleForTests(t, "platform-bootclasspath", "android_common").Output("out/soong/hiddenapi/hiddenapi-stub-flags.txt").RuleParams.Command
android.AssertStringMatches(t, "Could not find the correct boot dex jar in monolithic hiddenapi flags generation command", monolithicHiddenapiFlagsCmd, "--boot-dex="+expectedBootJar)
}
@@ -11338,11 +11338,11 @@ func TestInstallationRulesForMultipleApexPrebuilts(t *testing.T) {
return ret
}
- visibleModule := ctx.ModuleForTests(visibleModuleName, variation(visibleModuleName)).Module()
+ visibleModule := ctx.ModuleForTests(t, visibleModuleName, variation(visibleModuleName)).Module()
android.AssertBoolEquals(t, "Apex "+visibleModuleName+" selected using apex_contributions should be visible to make", false, visibleModule.IsHideFromMake())
for _, hiddenModuleName := range hiddenModuleNames {
- hiddenModule := ctx.ModuleForTests(hiddenModuleName, variation(hiddenModuleName)).Module()
+ hiddenModule := ctx.ModuleForTests(t, hiddenModuleName, variation(hiddenModuleName)).Module()
android.AssertBoolEquals(t, "Apex "+hiddenModuleName+" not selected using apex_contributions should be hidden from make", true, hiddenModule.IsHideFromMake())
}
@@ -11485,12 +11485,12 @@ func TestInstallationRulesForMultipleApexPrebuiltsWithoutSource(t *testing.T) {
}
for _, visibleModuleName := range visibleModuleNames {
- visibleModule := ctx.ModuleForTests(visibleModuleName, variation(visibleModuleName)).Module()
+ visibleModule := ctx.ModuleForTests(t, visibleModuleName, variation(visibleModuleName)).Module()
android.AssertBoolEquals(t, "Apex "+visibleModuleName+" selected using apex_contributions should be visible to make", false, visibleModule.IsHideFromMake())
}
for _, hiddenModuleName := range hiddenModuleNames {
- hiddenModule := ctx.ModuleForTests(hiddenModuleName, variation(hiddenModuleName)).Module()
+ hiddenModule := ctx.ModuleForTests(t, hiddenModuleName, variation(hiddenModuleName)).Module()
android.AssertBoolEquals(t, "Apex "+hiddenModuleName+" not selected using apex_contributions should be hidden from make", true, hiddenModule.IsHideFromMake())
}
@@ -11662,7 +11662,7 @@ func TestAconfifDeclarationsValidation(t *testing.T) {
}
`+aconfigDeclarationLibraryString([]string{"bar", "baz", "qux", "quux"}))
- m := result.ModuleForTests("foo.stubs.source", "android_common")
+ m := result.ModuleForTests(t, "foo.stubs.source", "android_common")
outDir := "out/soong/.intermediates"
// Arguments passed to aconfig to retrieve the state of the flags defined in the
@@ -11727,7 +11727,7 @@ func TestMultiplePrebuiltsWithSameBase(t *testing.T) {
"packages/modules/common/build/allowed_deps.txt": nil,
}))
- ab := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ ab := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
@@ -11799,18 +11799,18 @@ func TestApexMinSdkVersionOverride(t *testing.T) {
}),
)
- baseModule := ctx.ModuleForTests("com.android.apex30", "android_common_com.android.apex30")
+ baseModule := ctx.ModuleForTests(t, "com.android.apex30", "android_common_com.android.apex30")
checkMinSdkVersion(t, baseModule, "30")
// Override module, but uses same min_sdk_version
- overridingModuleSameMinSdkVersion := ctx.ModuleForTests("com.android.apex30", "android_common_com.mycompany.android.apex30_com.mycompany.android.apex30")
- javalibApex30Variant := ctx.ModuleForTests("javalib", "android_common_apex30")
+ overridingModuleSameMinSdkVersion := ctx.ModuleForTests(t, "com.android.apex30", "android_common_com.mycompany.android.apex30_com.mycompany.android.apex30")
+ javalibApex30Variant := ctx.ModuleForTests(t, "javalib", "android_common_apex30")
checkMinSdkVersion(t, overridingModuleSameMinSdkVersion, "30")
checkHasDep(t, ctx, overridingModuleSameMinSdkVersion.Module(), javalibApex30Variant.Module())
// Override module, uses different min_sdk_version
- overridingModuleDifferentMinSdkVersion := ctx.ModuleForTests("com.android.apex30", "android_common_com.mycompany.android.apex31_com.mycompany.android.apex31")
- javalibApex31Variant := ctx.ModuleForTests("javalib", "android_common_apex31")
+ overridingModuleDifferentMinSdkVersion := ctx.ModuleForTests(t, "com.android.apex30", "android_common_com.mycompany.android.apex31_com.mycompany.android.apex31")
+ javalibApex31Variant := ctx.ModuleForTests(t, "javalib", "android_common_apex31")
checkMinSdkVersion(t, overridingModuleDifferentMinSdkVersion, "31")
checkHasDep(t, ctx, overridingModuleDifferentMinSdkVersion.Module(), javalibApex31Variant.Module())
}
@@ -11879,7 +11879,7 @@ func TestPrebuiltStubNoinstall(t *testing.T) {
android.FixtureMergeMockFs(fs),
).RunTest(t)
- ldRule := result.ModuleForTests("installedlib", "android_arm64_armv8-a_shared").Rule("ld")
+ ldRule := result.ModuleForTests(t, "installedlib", "android_arm64_armv8-a_shared").Rule("ld")
android.AssertStringDoesContain(t, "", ldRule.Args["libFlags"], "android_arm64_armv8-a_shared_current/libfoo.so")
installRules := result.InstallMakeRulesForTesting(t)
@@ -12180,7 +12180,7 @@ func TestFilesystemWithApexDeps(t *testing.T) {
}
`, filesystem.PrepareForTestWithFilesystemBuildComponents)
- partition := result.ModuleForTests("myfilesystem", "android_common")
+ partition := result.ModuleForTests(t, "myfilesystem", "android_common")
fileList := android.ContentFromFileRuleForTests(t, result, partition.Output("fileList"))
android.AssertDeepEquals(t, "filesystem with apex", "apex/myapex.apex\n", fileList)
}
@@ -12210,7 +12210,7 @@ func TestVintfFragmentInApex(t *testing.T) {
}
`)
- generateFsRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("generateFsConfig")
+ generateFsRule := ctx.ModuleForTests(t, "myapex", "android_common_myapex").Rule("generateFsConfig")
cmd := generateFsRule.RuleParams.Command
// Ensure that vintf fragment file is being installed
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index 60d111f67..97644e631 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -330,7 +330,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
// Make sure that the source bootclasspath_fragment copies its dex files to the predefined
// locations for the art image.
- module := result.ModuleForTests("dex_bootjars", "android_common")
+ module := result.ModuleForTests(t, "dex_bootjars", "android_common")
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
})
@@ -438,7 +438,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
// Make sure that the prebuilt bootclasspath_fragment copies its dex files to the predefined
// locations for the art image.
- module := result.ModuleForTests("dex_bootjars", "android_common")
+ module := result.ModuleForTests(t, "dex_bootjars", "android_common")
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
})
@@ -604,7 +604,7 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) {
`prebuilt_foo`,
})
- module := result.ModuleForTests("dex_bootjars", "android_common")
+ module := result.ModuleForTests(t, "dex_bootjars", "android_common")
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
})
}
@@ -709,7 +709,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) {
`mybootclasspathfragment`,
})
- apex := result.ModuleForTests("myapex", "android_common_myapex")
+ apex := result.ModuleForTests(t, "myapex", "android_common_myapex")
apexRule := apex.Rule("apexRule")
copyCommands := apexRule.Args["copy_commands"]
@@ -877,7 +877,7 @@ func TestBootclasspathFragment_HiddenAPIList(t *testing.T) {
quuzModuleLibStubs := getDexJarPath(result, "quuz.stubs.exportable.module_lib")
// Make sure that the fragment uses the quuz stub dex jars when generating the hidden API flags.
- fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex")
+ fragment := result.ModuleForTests(t, "mybootclasspathfragment", "android_common_myapex")
rule := fragment.Rule("modularHiddenAPIStubFlagsFile")
command := rule.RuleParams.Command
@@ -1054,7 +1054,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromSource(t *testing.T) {
// Make sure that the fragment uses the android-non-updatable modules when generating the hidden
// API flags.
- fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex")
+ fragment := result.ModuleForTests(t, "mybootclasspathfragment", "android_common_myapex")
rule := fragment.Rule("modularHiddenAPIStubFlagsFile")
command := rule.RuleParams.Command
@@ -1225,7 +1225,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromText(t *testing.T) {
// Make sure that the fragment uses the android-non-updatable modules when generating the hidden
// API flags.
- fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex")
+ fragment := result.ModuleForTests(t, "mybootclasspathfragment", "android_common_myapex")
rule := fragment.Rule("modularHiddenAPIStubFlagsFile")
command := rule.RuleParams.Command
@@ -1383,7 +1383,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *test
// Make sure that the fragment uses the android-non-updatable modules when generating the hidden
// API flags.
- fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex")
+ fragment := result.ModuleForTests(t, "mybootclasspathfragment", "android_common_myapex")
rule := fragment.Rule("modularHiddenAPIStubFlagsFile")
command := rule.RuleParams.Command
@@ -1466,7 +1466,7 @@ func TestBootclasspathFragmentProtoContainsMinSdkVersion(t *testing.T) {
}
`)
- fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex")
+ fragment := result.ModuleForTests(t, "mybootclasspathfragment", "android_common_myapex")
classPathProtoContent := android.ContentFromFileRuleForTests(t, result.TestContext, fragment.Output("bootclasspath.pb.textproto"))
// foo
ensureContains(t, classPathProtoContent, `jars {
diff --git a/apex/container_test.go b/apex/container_test.go
index bf9445b49..b19e0503f 100644
--- a/apex/container_test.go
+++ b/apex/container_test.go
@@ -157,7 +157,7 @@ func TestApexDepsContainers(t *testing.T) {
}
for _, c := range testcases {
- m := result.ModuleForTests(c.moduleName, c.variant)
+ m := result.ModuleForTests(t, c.moduleName, c.variant)
containers, _ := android.OtherModuleProvider(result.TestContext.OtherModuleProviderAdaptor(), m.Module(), android.ContainersInfoProvider)
belongingContainers := containers.BelongingContainers()
checkContainerMatch(t, c.moduleName, "system", c.isSystemContainer, android.InList(android.SystemContainer, belongingContainers))
@@ -273,7 +273,7 @@ func TestNonUpdatableApexDepsContainers(t *testing.T) {
}
for _, c := range testcases {
- m := result.ModuleForTests(c.moduleName, c.variant)
+ m := result.ModuleForTests(t, c.moduleName, c.variant)
containers, _ := android.OtherModuleProvider(result.TestContext.OtherModuleProviderAdaptor(), m.Module(), android.ContainersInfoProvider)
belongingContainers := containers.BelongingContainers()
checkContainerMatch(t, c.moduleName, "system", c.isSystemContainer, android.InList(android.SystemContainer, belongingContainers))
@@ -337,7 +337,7 @@ func TestUpdatableAndNonUpdatableApexesIdenticalMinSdkVersion(t *testing.T) {
}
`)
- fooApexVariant := result.ModuleForTests("foo", "android_common_apex30")
+ fooApexVariant := result.ModuleForTests(t, "foo", "android_common_apex30")
containers, _ := android.OtherModuleProvider(result.TestContext.OtherModuleProviderAdaptor(), fooApexVariant.Module(), android.ContainersInfoProvider)
belongingContainers := containers.BelongingContainers()
checkContainerMatch(t, "foo", "system", true, android.InList(android.SystemContainer, belongingContainers))
diff --git a/apex/dexpreopt_bootjars_test.go b/apex/dexpreopt_bootjars_test.go
index 5abad81fc..2c7c4598a 100644
--- a/apex/dexpreopt_bootjars_test.go
+++ b/apex/dexpreopt_bootjars_test.go
@@ -151,7 +151,7 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu
}
result := fixture.RunTestWithBp(t, fmt.Sprintf(bp, preferPrebuilt))
- dexBootJars := result.ModuleForTests("dex_bootjars", "android_common")
+ dexBootJars := result.ModuleForTests(t, "dex_bootjars", "android_common")
rule := dexBootJars.Output(ruleFile)
inputs := rule.Implicits.Strings()
@@ -419,7 +419,7 @@ func TestDexpreoptProfileWithMultiplePrebuiltArtApexes(t *testing.T) {
android.PrepareForTestWithBuildFlag("RELEASE_APEX_CONTRIBUTIONS_ART", tc.selectedArtApexContributions),
).RunTestWithBp(t, bp)
- dexBootJars := result.ModuleForTests("dex_bootjars", "android_common")
+ dexBootJars := result.ModuleForTests(t, "dex_bootjars", "android_common")
rule := dexBootJars.Output(ruleFile)
inputs := rule.Implicits.Strings()
diff --git a/apex/systemserver_classpath_fragment_test.go b/apex/systemserver_classpath_fragment_test.go
index 81f287fd6..cf7ea8af9 100644
--- a/apex/systemserver_classpath_fragment_test.go
+++ b/apex/systemserver_classpath_fragment_test.go
@@ -457,7 +457,7 @@ func TestPrebuiltStandaloneSystemserverclasspathFragmentContents(t *testing.T) {
}
func assertProfileGuided(t *testing.T, ctx *android.TestContext, moduleName string, variant string, expected bool) {
- dexpreopt := ctx.ModuleForTests(moduleName, variant).Rule("dexpreopt")
+ dexpreopt := ctx.ModuleForTests(t, moduleName, variant).Rule("dexpreopt")
actual := strings.Contains(dexpreopt.RuleParams.Command, "--profile-file=")
if expected != actual {
t.Fatalf("Expected profile-guided to be %v, got %v", expected, actual)
@@ -465,7 +465,7 @@ func assertProfileGuided(t *testing.T, ctx *android.TestContext, moduleName stri
}
func assertProfileGuidedPrebuilt(t *testing.T, ctx *android.TestContext, apexName string, moduleName string, expected bool) {
- dexpreopt := ctx.ModuleForTests(apexName, "android_common_prebuilt_"+apexName).Rule("dexpreopt." + moduleName)
+ dexpreopt := ctx.ModuleForTests(t, apexName, "android_common_prebuilt_"+apexName).Rule("dexpreopt." + moduleName)
actual := strings.Contains(dexpreopt.RuleParams.Command, "--profile-file=")
if expected != actual {
t.Fatalf("Expected profile-guided to be %v, got %v", expected, actual)
diff --git a/cc/afdo_test.go b/cc/afdo_test.go
index 0679d1386..d2d5584ff 100644
--- a/cc/afdo_test.go
+++ b/cc/afdo_test.go
@@ -94,9 +94,9 @@ func TestAfdoDeps(t *testing.T) {
afdoLtoLdFlag := "-Wl,-plugin-opt,-import-instr-limit=40"
noAfdoLtoLdFlag := "-Wl,-plugin-opt,-import-instr-limit=5"
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
- libFooAfdoVariant := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libTest")
- libBarAfdoVariant := result.ModuleForTests("libBar", "android_arm64_armv8-a_static_afdo-libTest")
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_shared")
+ libFooAfdoVariant := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static_afdo-libTest")
+ libBarAfdoVariant := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static_afdo-libTest")
// Check cFlags of afdo-enabled module and the afdo-variant of its static deps
cFlags := libTest.Rule("cc").Args["cFlags"]
@@ -138,8 +138,8 @@ func TestAfdoDeps(t *testing.T) {
}
// Verify non-afdo variant exists and doesn't contain afdo
- libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
- libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static")
+ libFoo := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static")
+ libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static")
cFlags = libFoo.Rule("cc").Args["cFlags"]
if strings.Contains(cFlags, profileSampleCFlag) {
@@ -166,9 +166,9 @@ func TestAfdoDeps(t *testing.T) {
}
// Verify that the arm variant does not have FDO since the fdo_profile module only has a profile for arm64
- libTest32 := result.ModuleForTests("libTest", "android_arm_armv7-a-neon_shared")
- libFooAfdoVariant32 := result.ModuleForTests("libFoo", "android_arm_armv7-a-neon_static_afdo-libTest_lto-thin")
- libBarAfdoVariant32 := result.ModuleForTests("libBar", "android_arm_armv7-a-neon_static_afdo-libTest_lto-thin")
+ libTest32 := result.ModuleForTests(t, "libTest", "android_arm_armv7-a-neon_shared")
+ libFooAfdoVariant32 := result.ModuleForTests(t, "libFoo", "android_arm_armv7-a-neon_static_afdo-libTest_lto-thin")
+ libBarAfdoVariant32 := result.ModuleForTests(t, "libBar", "android_arm_armv7-a-neon_static_afdo-libTest_lto-thin")
cFlags = libTest32.Rule("cc").Args["cFlags"]
if strings.Contains(cFlags, profileSampleCFlag) {
@@ -215,9 +215,9 @@ func TestAfdoDeps(t *testing.T) {
}
// Verify that the host variants don't enable afdo
- libTestHost := result.ModuleForTests("libTest", result.Config.BuildOSTarget.String()+"_shared")
- libFooHost := result.ModuleForTests("libFoo", result.Config.BuildOSTarget.String()+"_static_lto-thin")
- libBarHost := result.ModuleForTests("libBar", result.Config.BuildOSTarget.String()+"_static_lto-thin")
+ libTestHost := result.ModuleForTests(t, "libTest", result.Config.BuildOSTarget.String()+"_shared")
+ libFooHost := result.ModuleForTests(t, "libFoo", result.Config.BuildOSTarget.String()+"_static_lto-thin")
+ libBarHost := result.ModuleForTests(t, "libBar", result.Config.BuildOSTarget.String()+"_static_lto-thin")
cFlags = libTestHost.Rule("cc").Args["cFlags"]
if strings.Contains(cFlags, profileSampleCFlag) {
@@ -301,9 +301,9 @@ func TestAfdoEnabledOnStaticDepNoAfdo(t *testing.T) {
}.AddToFixture(),
).RunTestWithBp(t, bp)
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared").Module()
- libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
- libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static").Module()
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_shared").Module()
+ libFoo := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static")
+ libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static").Module()
if !hasDirectDep(result, libTest, libFoo.Module()) {
t.Errorf("libTest missing dependency on non-afdo variant of libFoo")
@@ -412,13 +412,13 @@ func TestAfdoEnabledWithMultiArchs(t *testing.T) {
}.AddToFixture(),
).RunTestWithBp(t, bp)
- fooArm := result.ModuleForTests("foo", "android_arm_armv7-a-neon_shared")
+ fooArm := result.ModuleForTests(t, "foo", "android_arm_armv7-a-neon_shared")
fooArmCFlags := fooArm.Rule("cc").Args["cFlags"]
if w := "-fprofile-sample-use=afdo_profiles_package/foo_arm.afdo"; !strings.Contains(fooArmCFlags, w) {
t.Errorf("Expected 'foo' to enable afdo, but did not find %q in cflags %q", w, fooArmCFlags)
}
- fooArm64 := result.ModuleForTests("foo", "android_arm64_armv8-a_shared")
+ fooArm64 := result.ModuleForTests(t, "foo", "android_arm64_armv8-a_shared")
fooArm64CFlags := fooArm64.Rule("cc").Args["cFlags"]
if w := "-fprofile-sample-use=afdo_profiles_package/foo_arm64.afdo"; !strings.Contains(fooArm64CFlags, w) {
t.Errorf("Expected 'foo' to enable afdo, but did not find %q in cflags %q", w, fooArm64CFlags)
@@ -476,11 +476,11 @@ func TestMultipleAfdoRDeps(t *testing.T) {
expectedCFlagLibTest := "-fprofile-sample-use=afdo_profiles_package/libTest.afdo"
expectedCFlagLibBar := "-fprofile-sample-use=afdo_profiles_package/libBar.afdo"
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
- libFooAfdoVariantWithLibTest := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libTest")
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_shared")
+ libFooAfdoVariantWithLibTest := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static_afdo-libTest")
- libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_shared")
- libFooAfdoVariantWithLibBar := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libBar")
+ libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_shared")
+ libFooAfdoVariantWithLibBar := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static_afdo-libBar")
// Check cFlags of afdo-enabled module and the afdo-variant of its static deps
cFlags := libTest.Rule("cc").Args["cFlags"]
@@ -543,9 +543,9 @@ func TestAfdoDepsWithoutProfile(t *testing.T) {
// -funique-internal-linkage-names.
expectedCFlag := "-funique-internal-linkage-names"
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
- libFooAfdoVariant := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libTest")
- libBarAfdoVariant := result.ModuleForTests("libBar", "android_arm64_armv8-a_static_afdo-libTest")
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_shared")
+ libFooAfdoVariant := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static_afdo-libTest")
+ libBarAfdoVariant := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static_afdo-libTest")
// Check cFlags of afdo-enabled module and the afdo-variant of its static deps
cFlags := libTest.Rule("cc").Args["cFlags"]
@@ -572,8 +572,8 @@ func TestAfdoDepsWithoutProfile(t *testing.T) {
}
// Verify non-afdo variant exists and doesn't contain afdo
- libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
- libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static")
+ libFoo := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static")
+ libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static")
cFlags = libFoo.Rule("cc").Args["cFlags"]
if strings.Contains(cFlags, expectedCFlag) {
diff --git a/cc/binary_test.go b/cc/binary_test.go
index 3e18940fe..4f001d7c2 100644
--- a/cc/binary_test.go
+++ b/cc/binary_test.go
@@ -29,7 +29,7 @@ func TestBinaryLinkerScripts(t *testing.T) {
linker_scripts: ["foo.ld", "bar.ld"],
}`)
- binFoo := result.ModuleForTests("foo", "android_arm64_armv8-a").Rule("ld")
+ binFoo := result.ModuleForTests(t, "foo", "android_arm64_armv8-a").Rule("ld")
android.AssertStringListContains(t, "missing dependency on linker_scripts",
binFoo.Implicits.Strings(), "foo.ld")
diff --git a/cc/cc_preprocess_no_configuration_test.go b/cc/cc_preprocess_no_configuration_test.go
index c6eae4c3f..f09c44a46 100644
--- a/cc/cc_preprocess_no_configuration_test.go
+++ b/cc/cc_preprocess_no_configuration_test.go
@@ -36,7 +36,7 @@ func TestCcPreprocessNoConfiguration(t *testing.T) {
result := fixture.RunTest(t)
- foo := result.ModuleForTests("foo", "")
+ foo := result.ModuleForTests(t, "foo", "")
actual := foo.Rule("cc").Args["cFlags"]
expected := "-E -DANDROID -Ifoo/bar"
android.AssertStringEquals(t, "cflags should be correct", expected, actual)
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 98af7b655..2c06924ea 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -160,7 +160,7 @@ func TestVendorSrc(t *testing.T) {
}
`)
- ld := ctx.ModuleForTests("libTest", vendorVariant).Rule("ld")
+ ld := ctx.ModuleForTests(t, "libTest", vendorVariant).Rule("ld")
var objs []string
for _, o := range ld.Inputs {
objs = append(objs, o.Base())
@@ -171,7 +171,7 @@ func TestVendorSrc(t *testing.T) {
}
func checkInstallPartition(t *testing.T, ctx *android.TestContext, name, variant, expected string) {
- mod := ctx.ModuleForTests(name, variant).Module().(*Module)
+ mod := ctx.ModuleForTests(t, name, variant).Module().(*Module)
partitionDefined := false
checkPartition := func(specific bool, partition string) {
if specific {
@@ -311,7 +311,7 @@ func TestDataLibs(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
ctx := testCcWithConfig(t, config)
- testingModule := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon")
+ testingModule := ctx.ModuleForTests(t, "main_test", "android_arm_armv7-a-neon")
testBinary := testingModule.Module().(*Module).linker.(*testBinary)
outputFiles := testingModule.OutputFiles(ctx, t, "")
if len(outputFiles) != 1 {
@@ -363,7 +363,7 @@ func TestDataLibsRelativeInstallPath(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
ctx := testCcWithConfig(t, config)
- testingModule := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon")
+ testingModule := ctx.ModuleForTests(t, "main_test", "android_arm_armv7-a-neon")
module := testingModule.Module()
testBinary := module.(*Module).linker.(*testBinary)
outputFiles := testingModule.OutputFiles(ctx, t, "")
@@ -405,7 +405,7 @@ func TestTestBinaryTestSuites(t *testing.T) {
`
ctx := prepareForCcTest.RunTestWithBp(t, bp).TestContext
- module := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon").Module()
+ module := ctx.ModuleForTests(t, "main_test", "android_arm_armv7-a-neon").Module()
entries := android.AndroidMkInfoForTest(t, ctx, module).PrimaryInfo
compatEntries := entries.EntryMap["LOCAL_COMPATIBILITY_SUITE"]
@@ -437,7 +437,7 @@ func TestTestLibraryTestSuites(t *testing.T) {
`
ctx := prepareForCcTest.RunTestWithBp(t, bp).TestContext
- module := ctx.ModuleForTests("main_test_lib", "android_arm_armv7-a-neon_shared").Module()
+ module := ctx.ModuleForTests(t, "main_test_lib", "android_arm_armv7-a-neon_shared").Module()
entries := android.AndroidMkInfoForTest(t, ctx, module).PrimaryInfo
compatEntries := entries.EntryMap["LOCAL_COMPATIBILITY_SUITE"]
@@ -668,7 +668,7 @@ func TestMakeLinkType(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
- module := ctx.ModuleForTests(test.name, test.variant).Module().(*Module)
+ module := ctx.ModuleForTests(t, test.name, test.variant).Module().(*Module)
assertString(t, module.makeLinkType, test.expected)
})
}
@@ -861,10 +861,10 @@ func TestStaticLibDepReordering(t *testing.T) {
`)
variant := "android_arm64_armv8-a_static"
- moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
+ moduleA := ctx.ModuleForTests(t, "a", variant).Module().(*Module)
staticLibInfo, _ := android.OtherModuleProvider(ctx, moduleA, StaticLibraryInfoProvider)
actual := android.Paths(staticLibInfo.TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
- expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b", "d"})
+ expected := GetOutputPaths(t, ctx, variant, []string{"a", "c", "b", "d"})
if !reflect.DeepEqual(actual, expected) {
t.Errorf("staticDeps orderings were not propagated correctly"+
@@ -897,10 +897,10 @@ func TestStaticLibDepReorderingWithShared(t *testing.T) {
`)
variant := "android_arm64_armv8-a_static"
- moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
+ moduleA := ctx.ModuleForTests(t, "a", variant).Module().(*Module)
staticLibInfo, _ := android.OtherModuleProvider(ctx, moduleA, StaticLibraryInfoProvider)
actual := android.Paths(staticLibInfo.TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
- expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b"})
+ expected := GetOutputPaths(t, ctx, variant, []string{"a", "c", "b"})
if !reflect.DeepEqual(actual, expected) {
t.Errorf("staticDeps orderings did not account for shared libs"+
@@ -1004,12 +1004,12 @@ func TestLlndkLibrary(t *testing.T) {
}
android.AssertArrayString(t, "variants for llndk stubs", expected, actual)
- params := result.ModuleForTests("libllndk", "android_vendor_arm_armv7-a-neon_shared").Description("generate stub")
+ params := result.ModuleForTests(t, "libllndk", "android_vendor_arm_armv7-a-neon_shared").Description("generate stub")
android.AssertSame(t, "use Vendor API level for default stubs", "35", params.Args["apiLevel"])
checkExportedIncludeDirs := func(module, variant string, expectedSystemDirs []string, expectedDirs ...string) {
t.Helper()
- m := result.ModuleForTests(module, variant).Module()
+ m := result.ModuleForTests(t, module, variant).Module()
f, _ := android.OtherModuleProvider(result, m, FlagExporterInfoProvider)
android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]",
expectedDirs, f.IncludeDirs)
@@ -1030,14 +1030,14 @@ func TestLlndkLibrary(t *testing.T) {
checkAbiLinkerIncludeDirs := func(module string) {
t.Helper()
- coreModule := result.ModuleForTests(module, coreVariant)
+ coreModule := result.ModuleForTests(t, module, coreVariant)
abiCheckFlags := ""
for _, output := range coreModule.AllOutputs() {
if strings.HasSuffix(output, ".so.llndk.lsdump") {
abiCheckFlags = coreModule.Output(output).Args["exportedHeaderFlags"]
}
}
- vendorModule := result.ModuleForTests(module, vendorVariant).Module()
+ vendorModule := result.ModuleForTests(t, module, vendorVariant).Module()
vendorInfo, _ := android.OtherModuleProvider(result, vendorModule, FlagExporterInfoProvider)
vendorDirs := android.Concat(vendorInfo.IncludeDirs, vendorInfo.SystemIncludeDirs)
android.AssertStringEquals(t, module+" has different exported include dirs for vendor variant and ABI check",
@@ -1078,7 +1078,7 @@ func TestLlndkHeaders(t *testing.T) {
`)
// _static variant is used since _shared reuses *.o from the static variant
- cc := ctx.ModuleForTests("libvendor", "android_vendor_arm_armv7-a-neon_static").Rule("cc")
+ cc := ctx.ModuleForTests(t, "libvendor", "android_vendor_arm_armv7-a-neon_static").Rule("cc")
cflags := cc.Args["cFlags"]
if !strings.Contains(cflags, "-Imy_include") {
t.Errorf("cflags for libvendor must contain -Imy_include, but was %#v.", cflags)
@@ -1189,33 +1189,33 @@ func TestRuntimeLibs(t *testing.T) {
// runtime_libs for core variants use the module names without suffixes.
variant := "android_arm64_armv8-a_shared"
- module := ctx.ModuleForTests("libvendor_available1", variant).Module().(*Module)
+ module := ctx.ModuleForTests(t, "libvendor_available1", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available"}, module)
- module = ctx.ModuleForTests("libproduct_available1", variant).Module().(*Module)
+ module = ctx.ModuleForTests(t, "libproduct_available1", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available"}, module)
- module = ctx.ModuleForTests("libcore", variant).Module().(*Module)
+ module = ctx.ModuleForTests(t, "libcore", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available"}, module)
// runtime_libs for vendor variants have '.vendor' suffixes if the modules have both core
// and vendor variants.
variant = "android_vendor_arm64_armv8-a_shared"
- module = ctx.ModuleForTests("libvendor_available1", variant).Module().(*Module)
+ module = ctx.ModuleForTests(t, "libvendor_available1", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available.vendor"}, module)
- module = ctx.ModuleForTests("libvendor2", variant).Module().(*Module)
+ module = ctx.ModuleForTests(t, "libvendor2", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available.vendor", "libvendor1", "libproduct_vendor.vendor"}, module)
// runtime_libs for product variants have '.product' suffixes if the modules have both core
// and product variants.
variant = "android_product_arm64_armv8-a_shared"
- module = ctx.ModuleForTests("libproduct_available1", variant).Module().(*Module)
+ module = ctx.ModuleForTests(t, "libproduct_available1", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available.product"}, module)
- module = ctx.ModuleForTests("libproduct2", variant).Module().(*Module)
+ module = ctx.ModuleForTests(t, "libproduct2", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available.product", "libproduct1", "libproduct_vendor"}, module)
}
@@ -1224,11 +1224,11 @@ func TestExcludeRuntimeLibs(t *testing.T) {
ctx := testCc(t, runtimeLibAndroidBp)
variant := "android_arm64_armv8-a_shared"
- module := ctx.ModuleForTests("libvendor_available2", variant).Module().(*Module)
+ module := ctx.ModuleForTests(t, "libvendor_available2", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available"}, module)
variant = "android_vendor_arm64_armv8-a_shared"
- module = ctx.ModuleForTests("libvendor_available2", variant).Module().(*Module)
+ module = ctx.ModuleForTests(t, "libvendor_available2", variant).Module().(*Module)
checkRuntimeLibs(t, nil, module)
}
@@ -1261,12 +1261,12 @@ func TestStaticLibDepExport(t *testing.T) {
// Check the shared version of lib2.
variant := "android_arm64_armv8-a_shared"
- module := ctx.ModuleForTests("lib2", variant).Module().(*Module)
+ module := ctx.ModuleForTests(t, "lib2", variant).Module().(*Module)
checkStaticLibs(t, []string{"lib1", "libc++demangle", "libclang_rt.builtins"}, module)
// Check the static version of lib2.
variant = "android_arm64_armv8-a_static"
- module = ctx.ModuleForTests("lib2", variant).Module().(*Module)
+ module = ctx.ModuleForTests(t, "lib2", variant).Module().(*Module)
// libc++_static is linked additionally.
checkStaticLibs(t, []string{"lib1", "libc++_static", "libc++demangle", "libclang_rt.builtins"}, module)
}
@@ -1387,7 +1387,7 @@ func TestRecovery(t *testing.T) {
t.Errorf("multilib was set to 32 for librecovery32, but its variants has %s.", arm64)
}
- recoveryModule := ctx.ModuleForTests("libHalInRecovery", recoveryVariant).Module().(*Module)
+ recoveryModule := ctx.ModuleForTests(t, "libHalInRecovery", recoveryVariant).Module().(*Module)
if !recoveryModule.Platform() {
t.Errorf("recovery variant of libHalInRecovery must not specific to device, soc, or product")
}
@@ -1412,7 +1412,7 @@ func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
ctx := testCcWithConfig(t, config)
- testingModule := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon")
+ testingModule := ctx.ModuleForTests(t, "main_test", "android_arm_armv7-a-neon")
module := testingModule.Module()
testBinary := module.(*Module).linker.(*testBinary)
outputFiles := testingModule.OutputFiles(ctx, t, "")
@@ -1487,14 +1487,14 @@ func TestVersionedStubs(t *testing.T) {
}
}
- libBarLinkRule := ctx.ModuleForTests("libBar", "android_arm64_armv8-a_shared").Rule("ld")
+ libBarLinkRule := ctx.ModuleForTests(t, "libBar", "android_arm64_armv8-a_shared").Rule("ld")
libFlags := libBarLinkRule.Args["libFlags"]
libFoo1StubPath := "libFoo/android_arm64_armv8-a_shared_1/libFoo.so"
if !strings.Contains(libFlags, libFoo1StubPath) {
t.Errorf("%q is not found in %q", libFoo1StubPath, libFlags)
}
- libBarCompileRule := ctx.ModuleForTests("libBar", "android_arm64_armv8-a_shared").Rule("cc")
+ libBarCompileRule := ctx.ModuleForTests(t, "libBar", "android_arm64_armv8-a_shared").Rule("cc")
cFlags := libBarCompileRule.Args["cFlags"]
libFoo1VersioningMacro := "-D__LIBFOO_API__=1"
if !strings.Contains(cFlags, libFoo1VersioningMacro) {
@@ -1550,7 +1550,7 @@ func TestStaticLibArchiveArgs(t *testing.T) {
}`)
variant := "android_arm64_armv8-a_static"
- arRule := ctx.ModuleForTests("baz", variant).Rule("ar")
+ arRule := ctx.ModuleForTests(t, "baz", variant).Rule("ar")
// For static libraries, the object files of a whole static dep are included in the archive
// directly
@@ -1591,7 +1591,7 @@ func TestSharedLibLinkingArgs(t *testing.T) {
}`)
variant := "android_arm64_armv8-a_shared"
- linkRule := ctx.ModuleForTests("baz", variant).Rule("ld")
+ linkRule := ctx.ModuleForTests(t, "baz", variant).Rule("ld")
libFlags := linkRule.Args["libFlags"]
// When dynamically linking, we expect static dependencies to be found on the command line
if expected := "foo.a"; !strings.Contains(libFlags, expected) {
@@ -1623,7 +1623,7 @@ func TestStaticExecutable(t *testing.T) {
}`)
variant := "android_arm64_armv8-a"
- binModuleRule := ctx.ModuleForTests("static_test", variant).Rule("ld")
+ binModuleRule := ctx.ModuleForTests(t, "static_test", variant).Rule("ld")
libFlags := binModuleRule.Args["libFlags"]
systemStaticLibs := []string{"libc.a", "libm.a"}
for _, lib := range systemStaticLibs {
@@ -1666,9 +1666,9 @@ func TestStaticDepsOrderWithStubs(t *testing.T) {
},
}`)
- mybin := ctx.ModuleForTests("mybin", "android_arm64_armv8-a").Rule("ld")
+ mybin := ctx.ModuleForTests(t, "mybin", "android_arm64_armv8-a").Rule("ld")
actual := mybin.Implicits[:2]
- expected := GetOutputPaths(ctx, "android_arm64_armv8-a_static", []string{"libfooB", "libfooC"})
+ expected := GetOutputPaths(t, ctx, "android_arm64_armv8-a_static", []string{"libfooB", "libfooC"})
if !reflect.DeepEqual(actual, expected) {
t.Errorf("staticDeps orderings were not propagated correctly"+
@@ -1775,7 +1775,7 @@ func VerifyAFLFuzzTargetVariant(t *testing.T, variant string) {
checkPcGuardFlag := func(
modName string, variantName string, shouldHave bool) {
- cc := ctx.ModuleForTests(modName, variantName).Rule("cc")
+ cc := ctx.ModuleForTests(t, modName, variantName).Rule("cc")
cFlags, ok := cc.Args["cFlags"]
if !ok {
@@ -1802,9 +1802,9 @@ func VerifyAFLFuzzTargetVariant(t *testing.T, variant string) {
checkPcGuardFlag(moduleName, variant+"_static", false)
checkPcGuardFlag(moduleName, variant+"_static_fuzzer_afl", true)
- ctx.ModuleForTests("afl_fuzz_shared_lib",
+ ctx.ModuleForTests(t, "afl_fuzz_shared_lib",
"android_arm64_armv8-a_shared").Rule("cc")
- ctx.ModuleForTests("afl_fuzz_shared_lib",
+ ctx.ModuleForTests(t, "afl_fuzz_shared_lib",
"android_arm64_armv8-a_shared_fuzzer").Rule("cc")
}
@@ -1833,7 +1833,7 @@ func TestFuzzTarget(t *testing.T) {
}`)
variant := "android_arm64_armv8-a_fuzzer"
- ctx.ModuleForTests("fuzz_smoke_test", variant).Rule("cc")
+ ctx.ModuleForTests(t, "fuzz_smoke_test", variant).Rule("cc")
}
func assertString(t *testing.T, got, expected string) {
@@ -1897,24 +1897,24 @@ func TestDefaults(t *testing.T) {
defaults: ["defaults"],
}`)
- shared := ctx.ModuleForTests("libshared", "android_arm64_armv8-a_shared").Rule("ld")
+ shared := ctx.ModuleForTests(t, "libshared", "android_arm64_armv8-a_shared").Rule("ld")
if g, w := pathsToBase(shared.Inputs), []string{"foo.o", "baz.o"}; !reflect.DeepEqual(w, g) {
t.Errorf("libshared ld rule wanted %q, got %q", w, g)
}
- bothShared := ctx.ModuleForTests("libboth", "android_arm64_armv8-a_shared").Rule("ld")
+ bothShared := ctx.ModuleForTests(t, "libboth", "android_arm64_armv8-a_shared").Rule("ld")
if g, w := pathsToBase(bothShared.Inputs), []string{"foo.o", "baz.o"}; !reflect.DeepEqual(w, g) {
t.Errorf("libboth ld rule wanted %q, got %q", w, g)
}
- binary := ctx.ModuleForTests("binary", "android_arm64_armv8-a").Rule("ld")
+ binary := ctx.ModuleForTests(t, "binary", "android_arm64_armv8-a").Rule("ld")
if g, w := pathsToBase(binary.Inputs), []string{"foo.o"}; !reflect.DeepEqual(w, g) {
t.Errorf("binary ld rule wanted %q, got %q", w, g)
}
- static := ctx.ModuleForTests("libstatic", "android_arm64_armv8-a_static").Rule("ar")
+ static := ctx.ModuleForTests(t, "libstatic", "android_arm64_armv8-a_static").Rule("ar")
if g, w := pathsToBase(static.Inputs), []string{"foo.o", "bar.o"}; !reflect.DeepEqual(w, g) {
t.Errorf("libstatic ar rule wanted %q, got %q", w, g)
}
- bothStatic := ctx.ModuleForTests("libboth", "android_arm64_armv8-a_static").Rule("ar")
+ bothStatic := ctx.ModuleForTests(t, "libboth", "android_arm64_armv8-a_static").Rule("ar")
if g, w := pathsToBase(bothStatic.Inputs), []string{"foo.o", "bar.o"}; !reflect.DeepEqual(w, g) {
t.Errorf("libboth ar rule wanted %q, got %q", w, g)
}
@@ -1973,12 +1973,12 @@ func TestEmptyWholeStaticLibsAllowMissingDependencies(t *testing.T) {
android.PrepareForTestWithAllowMissingDependencies,
).RunTestWithBp(t, bp)
- libbar := result.ModuleForTests("libbar", "android_arm64_armv8-a_static").Output("libbar.a")
+ libbar := result.ModuleForTests(t, "libbar", "android_arm64_armv8-a_static").Output("libbar.a")
android.AssertDeepEquals(t, "libbar rule", android.ErrorRule, libbar.Rule)
android.AssertStringDoesContain(t, "libbar error", libbar.Args["error"], "missing dependencies: libmissing")
- libfoo := result.ModuleForTests("libfoo", "android_arm64_armv8-a_static").Output("libfoo.a")
+ libfoo := result.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_static").Output("libfoo.a")
android.AssertStringListContains(t, "libfoo.a dependencies", libfoo.Inputs.Strings(), libbar.Output.String())
}
@@ -2025,11 +2025,11 @@ func TestInstallSharedLibs(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
ctx := testCcWithConfig(t, config)
- hostBin := ctx.ModuleForTests("bin", config.BuildOSTarget.String()).Description("install")
- hostShared := ctx.ModuleForTests("libshared", config.BuildOSTarget.String()+"_shared").Description("install")
- hostRuntime := ctx.ModuleForTests("libruntime", config.BuildOSTarget.String()+"_shared").Description("install")
- hostTransitive := ctx.ModuleForTests("libtransitive", config.BuildOSTarget.String()+"_shared").Description("install")
- hostTool := ctx.ModuleForTests("tool", config.BuildOSTarget.String()).Description("install")
+ hostBin := ctx.ModuleForTests(t, "bin", config.BuildOSTarget.String()).Description("install")
+ hostShared := ctx.ModuleForTests(t, "libshared", config.BuildOSTarget.String()+"_shared").Description("install")
+ hostRuntime := ctx.ModuleForTests(t, "libruntime", config.BuildOSTarget.String()+"_shared").Description("install")
+ hostTransitive := ctx.ModuleForTests(t, "libtransitive", config.BuildOSTarget.String()+"_shared").Description("install")
+ hostTool := ctx.ModuleForTests(t, "tool", config.BuildOSTarget.String()).Description("install")
if g, w := hostBin.Implicits.Strings(), hostShared.Output.String(); !android.InList(w, g) {
t.Errorf("expected host bin dependency %q, got %q", w, g)
@@ -2051,10 +2051,10 @@ func TestInstallSharedLibs(t *testing.T) {
t.Errorf("expected no host bin dependency %q, got %q", w, g)
}
- deviceBin := ctx.ModuleForTests("bin", "android_arm64_armv8-a").Description("install")
- deviceShared := ctx.ModuleForTests("libshared", "android_arm64_armv8-a_shared").Description("install")
- deviceTransitive := ctx.ModuleForTests("libtransitive", "android_arm64_armv8-a_shared").Description("install")
- deviceRuntime := ctx.ModuleForTests("libruntime", "android_arm64_armv8-a_shared").Description("install")
+ deviceBin := ctx.ModuleForTests(t, "bin", "android_arm64_armv8-a").Description("install")
+ deviceShared := ctx.ModuleForTests(t, "libshared", "android_arm64_armv8-a_shared").Description("install")
+ deviceTransitive := ctx.ModuleForTests(t, "libtransitive", "android_arm64_armv8-a_shared").Description("install")
+ deviceRuntime := ctx.ModuleForTests(t, "libruntime", "android_arm64_armv8-a_shared").Description("install")
if g, w := deviceBin.OrderOnly.Strings(), deviceShared.Output.String(); !android.InList(w, g) {
t.Errorf("expected device bin dependency %q, got %q", w, g)
@@ -2104,7 +2104,7 @@ func TestStubsLibReexportsHeaders(t *testing.T) {
srcs: ["foo.c"],
}`)
- cFlags := ctx.ModuleForTests("libclient", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
+ cFlags := ctx.ModuleForTests(t, "libclient", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
if !strings.Contains(cFlags, "-Iinclude/libbar") {
t.Errorf("expected %q in cflags, got %q", "-Iinclude/libbar", cFlags)
@@ -2144,7 +2144,7 @@ func TestAidlLibraryWithHeaders(t *testing.T) {
}.AddToFixture(),
).RunTest(t).TestContext
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_static")
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_static")
android.AssertPathsRelativeToTopEquals(
t,
@@ -2192,7 +2192,7 @@ func TestAidlFlagsPassedToTheAidlCompiler(t *testing.T) {
}
`)
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_static")
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_static")
manifest := android.RuleBuilderSboxProtoForTests(t, ctx.TestContext, libfoo.Output("aidl.sbox.textproto"))
aidlCommand := manifest.Commands[0].GetCommand()
expectedAidlFlag := "-Werror"
@@ -2243,7 +2243,7 @@ func TestAidlFlagsWithMinSdkVersion(t *testing.T) {
`+tc.sdkVersion+`
}
`)
- libfoo := ctx.ModuleForTests("libfoo", tc.variant)
+ libfoo := ctx.ModuleForTests(t, "libfoo", tc.variant)
manifest := android.RuleBuilderSboxProtoForTests(t, ctx, libfoo.Output("aidl.sbox.textproto"))
aidlCommand := manifest.Commands[0].GetCommand()
expectedAidlFlag := "--min_sdk_version=" + tc.expected
@@ -2312,7 +2312,7 @@ func TestMinSdkVersionInClangTriple(t *testing.T) {
min_sdk_version: "29",
}`)
- cFlags := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
+ cFlags := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
android.AssertStringDoesContain(t, "min sdk version", cFlags, "-target aarch64-linux-android29")
}
@@ -2332,7 +2332,7 @@ func TestNonDigitMinSdkVersionInClangTriple(t *testing.T) {
}),
).RunTestWithBp(t, bp)
ctx := result.TestContext
- cFlags := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
+ cFlags := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
android.AssertStringDoesContain(t, "min sdk version", cFlags, "-target aarch64-linux-android31")
}
@@ -2439,7 +2439,7 @@ func TestIncludeDirsExporting(t *testing.T) {
export_generated_headers: ["genrule_bar"],
}
`)
- foo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
+ foo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
checkIncludeDirs(t, ctx, foo,
expectedIncludeDirs(`
foo/standard
@@ -2450,7 +2450,7 @@ func TestIncludeDirsExporting(t *testing.T) {
expectedOrderOnlyDeps(`.intermediates/genrule_foo/gen/generated_headers/foo/generated_header.h`),
)
- bar := ctx.ModuleForTests("libbar", "android_arm64_armv8-a_shared").Module()
+ bar := ctx.ModuleForTests(t, "libbar", "android_arm64_armv8-a_shared").Module()
checkIncludeDirs(t, ctx, bar,
expectedIncludeDirs(`
bar/standard
@@ -2483,7 +2483,7 @@ func TestIncludeDirsExporting(t *testing.T) {
export_generated_headers: ["genrule_bar"],
}
`)
- foo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
+ foo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
checkIncludeDirs(t, ctx, foo,
expectedIncludeDirs(`
foo/standard
@@ -2494,7 +2494,7 @@ func TestIncludeDirsExporting(t *testing.T) {
expectedOrderOnlyDeps(`.intermediates/genrule_foo/gen/generated_headers/foo/generated_header.h`),
)
- bar := ctx.ModuleForTests("libbar", "android_arm64_armv8-a_shared").Module()
+ bar := ctx.ModuleForTests(t, "libbar", "android_arm64_armv8-a_shared").Module()
checkIncludeDirs(t, ctx, bar,
expectedIncludeDirs(`
bar/standard
@@ -2540,7 +2540,7 @@ func TestIncludeDirsExporting(t *testing.T) {
}
}
`).TestContext
- foo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
+ foo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
checkIncludeDirs(t, ctx, foo,
expectedIncludeDirs(`
.intermediates/libfoo/android_arm64_armv8-a_shared/gen/aidl
@@ -2580,7 +2580,7 @@ func TestIncludeDirsExporting(t *testing.T) {
}
}
`)
- foo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
+ foo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
checkIncludeDirs(t, ctx, foo,
expectedIncludeDirs(`
.intermediates/libfoo/android_arm64_armv8-a_shared/gen/proto
@@ -2607,7 +2607,7 @@ func TestIncludeDirsExporting(t *testing.T) {
],
}
`)
- foo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
+ foo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
checkIncludeDirs(t, ctx, foo,
expectedIncludeDirs(`
.intermediates/libfoo/android_arm64_armv8-a_shared/gen/sysprop/include
@@ -2877,7 +2877,7 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
PrepareForIntegrationTestWithCc,
android.FixtureAddTextFile("external/foo/Android.bp", bp),
).RunTest(t)
- cflags := ctx.ModuleForTests("libfoo", variant).Output("obj/external/foo/foo.o").Args["cFlags"]
+ cflags := ctx.ModuleForTests(t, "libfoo", variant).Output("obj/external/foo/foo.o").Args["cFlags"]
var includes []string
flags := strings.Split(cflags, " ")
@@ -2931,7 +2931,7 @@ func TestAddnoOverride64GlobalCflags(t *testing.T) {
srcs: ["foo.c"],
}`)
- cFlags := ctx.ModuleForTests("libclient", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
+ cFlags := ctx.ModuleForTests(t, "libclient", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
if !strings.Contains(cFlags, "${config.NoOverride64GlobalCflags}") {
t.Errorf("expected %q in cflags, got %q", "${config.NoOverride64GlobalCflags}", cFlags)
@@ -3095,7 +3095,7 @@ func TestStrippedAllOutputFile(t *testing.T) {
`
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
ctx := testCcWithConfig(t, config)
- testingModule := ctx.ModuleForTests("test_lib", "android_arm_armv7-a-neon_shared")
+ testingModule := ctx.ModuleForTests(t, "test_lib", "android_arm_armv7-a-neon_shared")
outputFile := testingModule.OutputFiles(ctx, t, "stripped_all")
if !strings.HasSuffix(outputFile.Strings()[0], "/stripped_all/test_lib.so") {
t.Errorf("Unexpected output file: %s", outputFile.Strings()[0])
@@ -3140,8 +3140,8 @@ func TestImageVariants(t *testing.T) {
if imageVariant != "core" {
imageVariantStr = "_" + imageVariant
}
- binFooModule := ctx.ModuleForTests("binfoo", "android"+imageVariantStr+"_arm64_armv8-a").Module()
- libBarModule := ctx.ModuleForTests("libbar", "android"+imageVariantStr+"_arm64_armv8-a_shared").Module()
+ binFooModule := ctx.ModuleForTests(t, "binfoo", "android"+imageVariantStr+"_arm64_armv8-a").Module()
+ libBarModule := ctx.ModuleForTests(t, "libbar", "android"+imageVariantStr+"_arm64_armv8-a_shared").Module()
android.AssertBoolEquals(t, "binfoo should have dependency on libbar with image variant "+imageVariant, true, hasDep(binFooModule, libBarModule))
}
@@ -3172,7 +3172,7 @@ func TestVendorOrProductVariantUsesPlatformSdkVersionAsDefault(t *testing.T) {
ctx := prepareForCcTest.RunTestWithBp(t, bp)
testSdkVersionFlag := func(module, variant, version string) {
- flags := ctx.ModuleForTests(module, "android_"+variant+"_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ flags := ctx.ModuleForTests(t, module, "android_"+variant+"_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
android.AssertStringDoesContain(t, "target SDK version", flags, "-target aarch64-linux-android"+version)
}
@@ -3199,14 +3199,14 @@ func TestClangVerify(t *testing.T) {
}
`)
- module := ctx.ModuleForTests("lib_no_clang_verify", "android_arm64_armv8-a_shared")
+ module := ctx.ModuleForTests(t, "lib_no_clang_verify", "android_arm64_armv8-a_shared")
cFlags_no_cv := module.Rule("cc").Args["cFlags"]
if strings.Contains(cFlags_no_cv, "-Xclang") || strings.Contains(cFlags_no_cv, "-verify") {
t.Errorf("expected %q not in cflags, got %q", "-Xclang -verify", cFlags_no_cv)
}
- cFlags_cv := ctx.ModuleForTests("lib_clang_verify", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
+ cFlags_cv := ctx.ModuleForTests(t, "lib_clang_verify", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
if strings.Contains(cFlags_cv, "-Xclang") && strings.Contains(cFlags_cv, "-verify") {
t.Errorf("expected %q in cflags, got %q", "-Xclang -verify", cFlags_cv)
}
diff --git a/cc/cc_test_only_property_test.go b/cc/cc_test_only_property_test.go
index 972e86bc5..a178cad68 100644
--- a/cc/cc_test_only_property_test.go
+++ b/cc/cc_test_only_property_test.go
@@ -173,7 +173,7 @@ func TestInvalidTestOnlyTargets(t *testing.T) {
func getTeamProtoOutput(t *testing.T, ctx *android.TestResult) *team_proto.AllTeams {
teams := new(team_proto.AllTeams)
- config := ctx.SingletonForTests("all_teams")
+ config := ctx.SingletonForTests(t, "all_teams")
allOutputs := config.AllOutputs()
protoPath := allOutputs[0]
diff --git a/cc/cmake_snapshot_test.go b/cc/cmake_snapshot_test.go
index b6f4369b0..d08096a82 100644
--- a/cc/cmake_snapshot_test.go
+++ b/cc/cmake_snapshot_test.go
@@ -49,7 +49,7 @@ func TestEmptyCmakeSnapshot(t *testing.T) {
t.Skip("CMake snapshots are only supported on Linux")
}
- snapshotModule := result.ModuleForTests("foo", "linux_glibc_x86_64")
+ snapshotModule := result.ModuleForTests(t, "foo", "linux_glibc_x86_64")
wasGenerated(t, &snapshotModule, "CMakeLists.txt", "rawFileCopy")
wasGenerated(t, &snapshotModule, "foo.zip", "")
@@ -77,7 +77,7 @@ func TestCmakeSnapshotWithBinary(t *testing.T) {
t.Skip("CMake snapshots are only supported on Linux")
}
- snapshotModule := result.ModuleForTests("foo", "linux_glibc_x86_64")
+ snapshotModule := result.ModuleForTests(t, "foo", "linux_glibc_x86_64")
wasGenerated(t, &snapshotModule, "some/module/CMakeLists.txt", "rawFileCopy")
}
@@ -110,7 +110,7 @@ func TestCmakeSnapshotAsTestData(t *testing.T) {
t.Skip("CMake snapshots are only supported on Linux")
}
- snapshotModule := result.ModuleForTests("foo", "linux_glibc_x86_64")
+ snapshotModule := result.ModuleForTests(t, "foo", "linux_glibc_x86_64")
wasGenerated(t, &snapshotModule, "CMakeLists.txt", "rawFileCopy")
wasGenerated(t, &snapshotModule, "foo.zip", "")
diff --git a/cc/gen_test.go b/cc/gen_test.go
index 439f0a996..dde0dcfa0 100644
--- a/cc/gen_test.go
+++ b/cc/gen_test.go
@@ -33,8 +33,8 @@ func TestGen(t *testing.T) {
],
}`)
- aidl := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("aidl")
- libfoo := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Module().(*Module)
+ aidl := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("aidl")
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Module().(*Module)
expected := "-I" + filepath.Dir(aidl.Output.String())
actual := android.StringsRelativeToTop(ctx.Config(), libfoo.flags.Local.CommonFlags)
@@ -59,9 +59,9 @@ func TestGen(t *testing.T) {
],
}`)
- aidl := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("aidl")
- aidlManifest := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Output("aidl.sbox.textproto")
- libfoo := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Module().(*Module)
+ aidl := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("aidl")
+ aidlManifest := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Output("aidl.sbox.textproto")
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Module().(*Module)
if !inList("-I"+filepath.Dir(aidl.Output.String()), android.StringsRelativeToTop(ctx.Config(), libfoo.flags.Local.CommonFlags)) {
t.Errorf("missing aidl includes in global flags")
@@ -84,7 +84,7 @@ func TestGen(t *testing.T) {
}`)
outDir := "out/soong/.intermediates/libsysprop/android_arm64_armv8-a_static/gen"
- syspropBuildParams := ctx.ModuleForTests("libsysprop", "android_arm64_armv8-a_static").Rule("sysprop")
+ syspropBuildParams := ctx.ModuleForTests(t, "libsysprop", "android_arm64_armv8-a_static").Rule("sysprop")
android.AssertStringEquals(t, "header output directory does not match", outDir+"/sysprop/include/path/to", syspropBuildParams.Args["headerOutDir"])
android.AssertStringEquals(t, "public output directory does not match", outDir+"/sysprop/public/include/path/to", syspropBuildParams.Args["publicOutDir"])
diff --git a/cc/genrule_test.go b/cc/genrule_test.go
index 9a8049b2c..438eb9880 100644
--- a/cc/genrule_test.go
+++ b/cc/genrule_test.go
@@ -64,13 +64,13 @@ func TestArchGenruleCmd(t *testing.T) {
t.Fatal(errs)
}
- gen := ctx.ModuleForTests("gen", "android_arm_armv7-a-neon").Output("out_arm")
+ gen := ctx.ModuleForTests(t, "gen", "android_arm_armv7-a-neon").Output("out_arm")
expected := []string{"foo"}
if !reflect.DeepEqual(expected, gen.Implicits.Strings()[:len(expected)]) {
t.Errorf(`want arm inputs %v, got %v`, expected, gen.Implicits.Strings())
}
- gen = ctx.ModuleForTests("gen", "android_arm64_armv8-a").Output("out_arm")
+ gen = ctx.ModuleForTests(t, "gen", "android_arm64_armv8-a").Output("out_arm")
expected = []string{"bar"}
if !reflect.DeepEqual(expected, gen.Implicits.Strings()[:len(expected)]) {
t.Errorf(`want arm64 inputs %v, got %v`, expected, gen.Implicits.Strings())
@@ -105,7 +105,7 @@ func TestLibraryGenruleCmd(t *testing.T) {
`
ctx := testCc(t, bp)
- gen := ctx.ModuleForTests("gen", "android_arm_armv7-a-neon").Output("out")
+ gen := ctx.ModuleForTests(t, "gen", "android_arm_armv7-a-neon").Output("out")
expected := []string{"libboth.so", "libshared.so", "libstatic.a"}
var got []string
for _, input := range gen.Implicits {
@@ -178,7 +178,7 @@ func TestCmdPrefix(t *testing.T) {
PrepareForIntegrationTestWithCc,
android.OptionalFixturePreparer(tt.preparer),
).RunTestWithBp(t, bp)
- gen := result.ModuleForTests("gen", tt.variant)
+ gen := result.ModuleForTests(t, "gen", tt.variant)
sboxProto := android.RuleBuilderSboxProtoForTests(t, result.TestContext, gen.Output("genrule.sbox.textproto"))
cmd := *sboxProto.Commands[0].Command
android.AssertStringDoesContain(t, "incorrect CC_ARCH", cmd, "CC_ARCH="+tt.arch+" ")
@@ -236,7 +236,7 @@ func TestMultilibGenruleOut(t *testing.T) {
}
`
result := PrepareForIntegrationTestWithCc.RunTestWithBp(t, bp)
- gen_32bit := result.ModuleForTests("gen", "android_arm_armv7-a-neon").OutputFiles(result.TestContext, t, "")
+ gen_32bit := result.ModuleForTests(t, "gen", "android_arm_armv7-a-neon").OutputFiles(result.TestContext, t, "")
android.AssertPathsEndWith(t,
"genrule_out",
[]string{
@@ -245,7 +245,7 @@ func TestMultilibGenruleOut(t *testing.T) {
gen_32bit,
)
- gen_64bit := result.ModuleForTests("gen", "android_arm64_armv8-a").OutputFiles(result.TestContext, t, "")
+ gen_64bit := result.ModuleForTests(t, "gen", "android_arm64_armv8-a").OutputFiles(result.TestContext, t, "")
android.AssertPathsEndWith(t,
"genrule_out",
[]string{
diff --git a/cc/library_headers_test.go b/cc/library_headers_test.go
index 5a4576703..88ccd4303 100644
--- a/cc/library_headers_test.go
+++ b/cc/library_headers_test.go
@@ -41,11 +41,11 @@ func TestLibraryHeaders(t *testing.T) {
ctx := testCc(t, fmt.Sprintf(bp, headerModule))
// test if header search paths are correctly added
- cc := ctx.ModuleForTests("lib", "android_arm64_armv8-a_static").Rule("cc")
+ cc := ctx.ModuleForTests(t, "lib", "android_arm64_armv8-a_static").Rule("cc")
android.AssertStringDoesContain(t, "cFlags for lib module", cc.Args["cFlags"], " -Imy_include ")
// Test that there's a valid AndroidMk entry.
- headers := ctx.ModuleForTests("headers", "android_arm64_armv8-a").Module()
+ headers := ctx.ModuleForTests(t, "headers", "android_arm64_armv8-a").Module()
e := android.AndroidMkInfoForTest(t, ctx, headers).PrimaryInfo
// This duplicates the tests done in AndroidMkEntries.write. It would be
@@ -80,9 +80,9 @@ func TestPrebuiltLibraryHeadersPreferred(t *testing.T) {
for _, prebuiltPreferred := range []bool{false, true} {
t.Run(fmt.Sprintf("prebuilt prefer %t", prebuiltPreferred), func(t *testing.T) {
ctx := testCc(t, fmt.Sprintf(bp, prebuiltPreferred))
- lib := ctx.ModuleForTests("lib", "android_arm64_armv8-a_static")
- sourceDep := ctx.ModuleForTests("headers", "android_arm64_armv8-a")
- prebuiltDep := ctx.ModuleForTests("prebuilt_headers", "android_arm64_armv8-a")
+ lib := ctx.ModuleForTests(t, "lib", "android_arm64_armv8-a_static")
+ sourceDep := ctx.ModuleForTests(t, "headers", "android_arm64_armv8-a")
+ prebuiltDep := ctx.ModuleForTests(t, "prebuilt_headers", "android_arm64_armv8-a")
hasSourceDep := false
hasPrebuiltDep := false
ctx.VisitDirectDeps(lib.Module(), func(dep blueprint.Module) {
diff --git a/cc/library_test.go b/cc/library_test.go
index 2ed2d761c..8b7fed2dc 100644
--- a/cc/library_test.go
+++ b/cc/library_test.go
@@ -30,8 +30,8 @@ func TestLibraryReuse(t *testing.T) {
srcs: ["foo.c", "baz.o"],
}`)
- libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
- libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
+ libfooShared := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
+ libfooStatic := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
if len(libfooShared.Inputs) != 2 {
t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
@@ -59,8 +59,8 @@ func TestLibraryReuse(t *testing.T) {
},
}`)
- libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
- libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
+ libfooShared := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
+ libfooStatic := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
if len(libfooShared.Inputs) != 1 {
t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
@@ -85,8 +85,8 @@ func TestLibraryReuse(t *testing.T) {
},
}`)
- libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
- libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
+ libfooShared := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
+ libfooStatic := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
if len(libfooShared.Inputs) != 2 {
t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
@@ -111,8 +111,8 @@ func TestLibraryReuse(t *testing.T) {
},
}`)
- libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
- libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
+ libfooShared := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
+ libfooStatic := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
if len(libfooShared.Inputs) != 1 {
t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
@@ -137,8 +137,8 @@ func TestLibraryReuse(t *testing.T) {
},
}`)
- libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
- libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
+ libfooShared := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
+ libfooStatic := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
if len(libfooShared.Inputs) != 1 {
t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
@@ -168,8 +168,8 @@ func TestLibraryReuse(t *testing.T) {
},
}`)
- libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
- libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
+ libfooShared := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
+ libfooStatic := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
if len(libfooShared.Inputs) != 3 {
t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
@@ -183,7 +183,7 @@ func TestLibraryReuse(t *testing.T) {
t.Errorf("static objects not reused for shared library")
}
- libfoo := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Module().(*Module)
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Module().(*Module)
if !inList("-DGOOGLE_PROTOBUF_NO_RTTI", libfoo.flags.Local.CFlags) {
t.Errorf("missing protobuf cflags")
}
@@ -254,7 +254,7 @@ func TestLibraryVersionScript(t *testing.T) {
version_script: "foo.map.txt",
}`)
- libfoo := result.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("ld")
+ libfoo := result.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Rule("ld")
android.AssertStringListContains(t, "missing dependency on version_script",
libfoo.Implicits.Strings(), "foo.map.txt")
@@ -272,7 +272,7 @@ func TestLibraryDynamicList(t *testing.T) {
dynamic_list: "foo.dynamic.txt",
}`)
- libfoo := result.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("ld")
+ libfoo := result.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Rule("ld")
android.AssertStringListContains(t, "missing dependency on dynamic_list",
libfoo.Implicits.Strings(), "foo.dynamic.txt")
@@ -312,14 +312,14 @@ func TestWholeStaticLibPrebuilts(t *testing.T) {
}
`)
- libdirect := result.ModuleForTests("libdirect", "android_arm64_armv8-a_static").Rule("arWithLibs")
- libtransitive := result.ModuleForTests("libtransitive", "android_arm64_armv8-a_static").Rule("arWithLibs")
+ libdirect := result.ModuleForTests(t, "libdirect", "android_arm64_armv8-a_static").Rule("arWithLibs")
+ libtransitive := result.ModuleForTests(t, "libtransitive", "android_arm64_armv8-a_static").Rule("arWithLibs")
- libdirectWithSrcs := result.ModuleForTests("libdirect_with_srcs", "android_arm64_armv8-a_static").Rule("arWithLibs")
- libtransitiveWithSrcs := result.ModuleForTests("libtransitive_with_srcs", "android_arm64_armv8-a_static").Rule("arWithLibs")
+ libdirectWithSrcs := result.ModuleForTests(t, "libdirect_with_srcs", "android_arm64_armv8-a_static").Rule("arWithLibs")
+ libtransitiveWithSrcs := result.ModuleForTests(t, "libtransitive_with_srcs", "android_arm64_armv8-a_static").Rule("arWithLibs")
- barObj := result.ModuleForTests("libdirect_with_srcs", "android_arm64_armv8-a_static").Rule("cc")
- bazObj := result.ModuleForTests("libtransitive_with_srcs", "android_arm64_armv8-a_static").Rule("cc")
+ barObj := result.ModuleForTests(t, "libdirect_with_srcs", "android_arm64_armv8-a_static").Rule("cc")
+ bazObj := result.ModuleForTests(t, "libtransitive_with_srcs", "android_arm64_armv8-a_static").Rule("cc")
android.AssertStringListContains(t, "missing dependency on foo.a",
libdirect.Inputs.Strings(), "foo.a")
diff --git a/cc/lto_test.go b/cc/lto_test.go
index e4b5a3a01..3fb1f3c06 100644
--- a/cc/lto_test.go
+++ b/cc/lto_test.go
@@ -70,24 +70,24 @@ func TestThinLtoDeps(t *testing.T) {
result := LTOPreparer.RunTestWithBp(t, bp)
- libLto := result.ModuleForTests("lto_enabled", "android_arm64_armv8-a_shared").Module()
+ libLto := result.ModuleForTests(t, "lto_enabled", "android_arm64_armv8-a_shared").Module()
- libFoo := result.ModuleForTests("foo", "android_arm64_armv8-a_static").Module()
+ libFoo := result.ModuleForTests(t, "foo", "android_arm64_armv8-a_static").Module()
if !hasDep(result, libLto, libFoo) {
t.Errorf("'lto_enabled' missing dependency on the default variant of 'foo'")
}
- libBaz := result.ModuleForTests("baz", "android_arm64_armv8-a_static").Module()
+ libBaz := result.ModuleForTests(t, "baz", "android_arm64_armv8-a_static").Module()
if !hasDep(result, libFoo, libBaz) {
t.Errorf("'foo' missing dependency on the default variant of transitive dep 'baz'")
}
- libNeverLto := result.ModuleForTests("lib_never_lto", "android_arm64_armv8-a_static").Module()
+ libNeverLto := result.ModuleForTests(t, "lib_never_lto", "android_arm64_armv8-a_static").Module()
if !hasDep(result, libLto, libNeverLto) {
t.Errorf("'lto_enabled' missing dependency on the default variant of 'lib_never_lto'")
}
- libBar := result.ModuleForTests("bar", "android_arm64_armv8-a_shared").Module()
+ libBar := result.ModuleForTests(t, "bar", "android_arm64_armv8-a_shared").Module()
if !hasDep(result, libLto, libBar) {
t.Errorf("'lto_enabled' missing dependency on the default variant of 'bar'")
}
@@ -138,15 +138,15 @@ func TestThinLtoOnlyOnStaticDep(t *testing.T) {
result := LTOPreparer.RunTestWithBp(t, bp)
- libRoot := result.ModuleForTests("root", "android_arm64_armv8-a_shared").Module()
- libRootLtoNever := result.ModuleForTests("root_no_lto", "android_arm64_armv8-a_shared").Module()
+ libRoot := result.ModuleForTests(t, "root", "android_arm64_armv8-a_shared").Module()
+ libRootLtoNever := result.ModuleForTests(t, "root_no_lto", "android_arm64_armv8-a_shared").Module()
- libFoo := result.ModuleForTests("foo", "android_arm64_armv8-a_static")
+ libFoo := result.ModuleForTests(t, "foo", "android_arm64_armv8-a_static")
if !hasDep(result, libRoot, libFoo.Module()) {
t.Errorf("'root' missing dependency on the default variant of 'foo'")
}
- libFooNoLto := result.ModuleForTests("foo", "android_arm64_armv8-a_static_lto-none")
+ libFooNoLto := result.ModuleForTests(t, "foo", "android_arm64_armv8-a_static_lto-none")
if !hasDep(result, libRootLtoNever, libFooNoLto.Module()) {
t.Errorf("'root_no_lto' missing dependency on the lto_none variant of 'foo'")
}
@@ -156,7 +156,7 @@ func TestThinLtoOnlyOnStaticDep(t *testing.T) {
t.Errorf("'foo' expected to have flags %q, but got %q", w, libFooCFlags)
}
- libBaz := result.ModuleForTests("baz", "android_arm64_armv8-a_static")
+ libBaz := result.ModuleForTests(t, "baz", "android_arm64_armv8-a_static")
if !hasDep(result, libFoo.Module(), libBaz.Module()) {
t.Errorf("'foo' missing dependency on the default variant of transitive dep 'baz'")
}
@@ -187,8 +187,8 @@ func TestLtoDisabledButEnabledForArch(t *testing.T) {
}`
result := LTOPreparer.RunTestWithBp(t, bp)
- libFooWithLto := result.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
- libFooWithoutLto := result.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("ld")
+ libFooWithLto := result.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
+ libFooWithoutLto := result.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Rule("ld")
android.AssertStringDoesContain(t, "missing flag for LTO in variant that expects it",
libFooWithLto.Args["ldFlags"], "-flto=thin")
@@ -215,8 +215,8 @@ func TestLtoDoesNotPropagateToRuntimeLibs(t *testing.T) {
result := LTOPreparer.RunTestWithBp(t, bp)
- libFoo := result.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
- libBar := result.ModuleForTests("runtime_libbar", "android_arm_armv7-a-neon_shared").Rule("ld")
+ libFoo := result.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
+ libBar := result.ModuleForTests(t, "runtime_libbar", "android_arm_armv7-a-neon_shared").Rule("ld")
android.AssertStringDoesContain(t, "missing flag for LTO in LTO enabled library",
libFoo.Args["ldFlags"], "-flto=thin")
diff --git a/cc/ndk_test.go b/cc/ndk_test.go
index f20d3c61f..8574bf148 100644
--- a/cc/ndk_test.go
+++ b/cc/ndk_test.go
@@ -50,7 +50,7 @@ func TestNdkHeaderDependency(t *testing.T) {
}
`
ctx := prepareForCcTest.RunTestWithBp(t, bp)
- libfoo := ctx.ModuleForTests("libfoo.ndk", "android_arm64_armv8-a_sdk_shared")
- libfoo_headers := ctx.ModuleForTests("libfoo_headers", "")
+ libfoo := ctx.ModuleForTests(t, "libfoo.ndk", "android_arm64_armv8-a_sdk_shared")
+ libfoo_headers := ctx.ModuleForTests(t, "libfoo_headers", "")
android.AssertBoolEquals(t, "Could not find headers of ndk_library", true, isDep(ctx, libfoo.Module(), libfoo_headers.Module()))
}
diff --git a/cc/object_test.go b/cc/object_test.go
index 004dfd3e7..6d8226560 100644
--- a/cc/object_test.go
+++ b/cc/object_test.go
@@ -46,13 +46,13 @@ func TestMinSdkVersionsOfCrtObjects(t *testing.T) {
ctx := prepareForCcTest.RunTestWithBp(t, bp)
for _, v := range variants {
- cflags := ctx.ModuleForTests("crt_foo", v.variant).Rule("cc").Args["cFlags"]
+ cflags := ctx.ModuleForTests(t, "crt_foo", v.variant).Rule("cc").Args["cFlags"]
expected := "-target aarch64-linux-android" + v.num + " "
android.AssertStringDoesContain(t, "cflag", cflags, expected)
}
ctx = prepareForCcTest.RunTestWithBp(t, bp)
android.AssertStringDoesContain(t, "cflag",
- ctx.ModuleForTests("crt_foo", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"],
+ ctx.ModuleForTests(t, "crt_foo", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"],
"-target aarch64-linux-android10000 ")
}
@@ -69,13 +69,13 @@ func TestUseCrtObjectOfCorrectVersion(t *testing.T) {
// Sdk variant uses the crt object of the matching min_sdk_version
variant := "android_arm64_armv8-a_sdk"
- crt := ctx.ModuleForTests("bin", variant).Rule("ld").Args["crtBegin"]
+ crt := ctx.ModuleForTests(t, "bin", variant).Rule("ld").Args["crtBegin"]
android.AssertStringDoesContain(t, "crt dep of sdk variant", crt,
"29/crtbegin_dynamic.o")
// platform variant uses the crt object built for platform
variant = "android_arm64_armv8-a"
- crt = ctx.ModuleForTests("bin", variant).Rule("ld").Args["crtBegin"]
+ crt = ctx.ModuleForTests(t, "bin", variant).Rule("ld").Args["crtBegin"]
android.AssertStringDoesContain(t, "crt dep of platform variant", crt,
variant+"/crtbegin_dynamic.o")
}
@@ -147,7 +147,7 @@ func TestCcObjectOutputFile(t *testing.T) {
ctx := PrepareForIntegrationTestWithCc.RunTestWithBp(t, bp)
android.AssertPathRelativeToTopEquals(t, "expected output file foo.o",
fmt.Sprintf("out/soong/.intermediates/%s/android_arm64_armv8-a/foo.o", testcase.moduleName),
- ctx.ModuleForTests(testcase.moduleName, "android_arm64_armv8-a").Output("foo.o").Output)
+ ctx.ModuleForTests(t, testcase.moduleName, "android_arm64_armv8-a").Output("foo.o").Output)
})
}
diff --git a/cc/orderfile_test.go b/cc/orderfile_test.go
index 3486f964c..41253adc6 100644
--- a/cc/orderfile_test.go
+++ b/cc/orderfile_test.go
@@ -41,7 +41,7 @@ func TestOrderfileProfileSharedLibrary(t *testing.T) {
expectedCFlag := "-forder-file-instrumentation"
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_shared")
// Check cFlags of orderfile-enabled module
cFlags := libTest.Rule("cc").Args["cFlags"]
@@ -77,7 +77,7 @@ func TestOrderfileLoadSharedLibrary(t *testing.T) {
expectedCFlag := "-Wl,--symbol-ordering-file=toolchain/pgo-profiles/orderfiles/libTest.orderfile"
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_shared")
// Check ldFlags of orderfile-enabled module
ldFlags := libTest.Rule("ld").Args["ldFlags"]
@@ -106,7 +106,7 @@ func TestOrderfileProfileBinary(t *testing.T) {
expectedCFlag := "-forder-file-instrumentation"
- test := result.ModuleForTests("test", "android_arm64_armv8-a")
+ test := result.ModuleForTests(t, "test", "android_arm64_armv8-a")
// Check cFlags of orderfile-enabled module
cFlags := test.Rule("cc").Args["cFlags"]
@@ -142,7 +142,7 @@ func TestOrderfileLoadBinary(t *testing.T) {
expectedCFlag := "-Wl,--symbol-ordering-file=toolchain/pgo-profiles/orderfiles/test.orderfile"
- test := result.ModuleForTests("test", "android_arm64_armv8-a")
+ test := result.ModuleForTests(t, "test", "android_arm64_armv8-a")
// Check ldFlags of orderfile-enabled module
ldFlags := test.Rule("ld").Args["ldFlags"]
@@ -185,7 +185,7 @@ func TestOrderfileProfilePropagateStaticDeps(t *testing.T) {
expectedCFlag := "-forder-file-instrumentation"
// Check cFlags of orderfile-enabled module
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_shared")
cFlags := libTest.Rule("cc").Args["cFlags"]
if !strings.Contains(cFlags, expectedCFlag) {
@@ -193,8 +193,8 @@ func TestOrderfileProfilePropagateStaticDeps(t *testing.T) {
}
// Check cFlags of orderfile variant static libraries
- libFooOfVariant := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_orderfile")
- libBarOfVariant := result.ModuleForTests("libBar", "android_arm64_armv8-a_static_orderfile")
+ libFooOfVariant := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static_orderfile")
+ libBarOfVariant := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static_orderfile")
cFlags = libFooOfVariant.Rule("cc").Args["cFlags"]
if !strings.Contains(cFlags, expectedCFlag) {
@@ -216,8 +216,8 @@ func TestOrderfileProfilePropagateStaticDeps(t *testing.T) {
}
// Check cFlags of the non-orderfile variant static libraries
- libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
- libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static")
+ libFoo := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static")
+ libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static")
cFlags = libFoo.Rule("cc").Args["cFlags"]
if strings.Contains(cFlags, expectedCFlag) {
@@ -274,15 +274,15 @@ func TestOrderfileLoadPropagateStaticDeps(t *testing.T) {
expectedCFlag := "-Wl,--symbol-ordering-file=toolchain/pgo-profiles/orderfiles/test.orderfile"
// Check ldFlags of orderfile-enabled module
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_shared")
ldFlags := libTest.Rule("ld").Args["ldFlags"]
if !strings.Contains(ldFlags, expectedCFlag) {
t.Errorf("Expected 'libTest' to load orderfile, but did not find %q in ldFlags %q", expectedCFlag, ldFlags)
}
- libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
- libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static")
+ libFoo := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static")
+ libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static")
// Check dependency edge from orderfile-enabled module to non-orderfile variant static libraries
if !hasDirectDep(result, libTest.Module(), libFoo.Module()) {
@@ -343,7 +343,7 @@ func TestOrderfileProfilePropagateSharedDeps(t *testing.T) {
expectedCFlag := "-forder-file-instrumentation"
// Check cFlags of orderfile-enabled module
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_shared")
cFlags := libTest.Rule("cc").Args["cFlags"]
if !strings.Contains(cFlags, expectedCFlag) {
@@ -351,8 +351,8 @@ func TestOrderfileProfilePropagateSharedDeps(t *testing.T) {
}
// Check cFlags of the static and shared libraries
- libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_shared")
- libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static")
+ libFoo := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_shared")
+ libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static")
cFlags = libFoo.Rule("cc").Args["cFlags"]
if strings.Contains(cFlags, expectedCFlag) {
@@ -423,7 +423,7 @@ func TestOrderfileProfileStaticLibrary(t *testing.T) {
expectedCFlag := "-forder-file-instrumentation"
// Check cFlags of module
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_static")
+ libTest := result.ModuleForTests(t, "libTest", "android_arm64_armv8-a_static")
cFlags := libTest.Rule("cc").Args["cFlags"]
if strings.Contains(cFlags, expectedCFlag) {
@@ -431,8 +431,8 @@ func TestOrderfileProfileStaticLibrary(t *testing.T) {
}
// Check cFlags of the static libraries
- libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
- libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static")
+ libFoo := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static")
+ libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static")
cFlags = libFoo.Rule("cc").Args["cFlags"]
if strings.Contains(cFlags, expectedCFlag) {
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index 3214fb4a7..af68ca6bf 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -116,21 +116,21 @@ func TestPrebuilt(t *testing.T) {
})
// Verify that all the modules exist and that their dependencies were connected correctly
- liba := ctx.ModuleForTests("liba", "android_arm64_armv8-a_shared").Module()
- libb := ctx.ModuleForTests("libb", "android_arm64_armv8-a_static").Module()
- libd := ctx.ModuleForTests("libd", "android_arm64_armv8-a_shared").Module()
- libe := ctx.ModuleForTests("libe", "android_arm64_armv8-a_static").Module()
- libfStatic := ctx.ModuleForTests("libf", "android_arm64_armv8-a_static").Module()
- libfShared := ctx.ModuleForTests("libf", "android_arm64_armv8-a_shared").Module()
- crtx := ctx.ModuleForTests("crtx", "android_arm64_armv8-a").Module()
-
- prebuiltLiba := ctx.ModuleForTests("prebuilt_liba", "android_arm64_armv8-a_shared").Module()
- prebuiltLibb := ctx.ModuleForTests("prebuilt_libb", "android_arm64_armv8-a_static").Module()
- prebuiltLibd := ctx.ModuleForTests("prebuilt_libd", "android_arm64_armv8-a_shared").Module()
- prebuiltLibe := ctx.ModuleForTests("prebuilt_libe", "android_arm64_armv8-a_static").Module()
- prebuiltLibfStatic := ctx.ModuleForTests("prebuilt_libf", "android_arm64_armv8-a_static").Module()
- prebuiltLibfShared := ctx.ModuleForTests("prebuilt_libf", "android_arm64_armv8-a_shared").Module()
- prebuiltCrtx := ctx.ModuleForTests("prebuilt_crtx", "android_arm64_armv8-a").Module()
+ liba := ctx.ModuleForTests(t, "liba", "android_arm64_armv8-a_shared").Module()
+ libb := ctx.ModuleForTests(t, "libb", "android_arm64_armv8-a_static").Module()
+ libd := ctx.ModuleForTests(t, "libd", "android_arm64_armv8-a_shared").Module()
+ libe := ctx.ModuleForTests(t, "libe", "android_arm64_armv8-a_static").Module()
+ libfStatic := ctx.ModuleForTests(t, "libf", "android_arm64_armv8-a_static").Module()
+ libfShared := ctx.ModuleForTests(t, "libf", "android_arm64_armv8-a_shared").Module()
+ crtx := ctx.ModuleForTests(t, "crtx", "android_arm64_armv8-a").Module()
+
+ prebuiltLiba := ctx.ModuleForTests(t, "prebuilt_liba", "android_arm64_armv8-a_shared").Module()
+ prebuiltLibb := ctx.ModuleForTests(t, "prebuilt_libb", "android_arm64_armv8-a_static").Module()
+ prebuiltLibd := ctx.ModuleForTests(t, "prebuilt_libd", "android_arm64_armv8-a_shared").Module()
+ prebuiltLibe := ctx.ModuleForTests(t, "prebuilt_libe", "android_arm64_armv8-a_static").Module()
+ prebuiltLibfStatic := ctx.ModuleForTests(t, "prebuilt_libf", "android_arm64_armv8-a_static").Module()
+ prebuiltLibfShared := ctx.ModuleForTests(t, "prebuilt_libf", "android_arm64_armv8-a_shared").Module()
+ prebuiltCrtx := ctx.ModuleForTests(t, "prebuilt_crtx", "android_arm64_armv8-a").Module()
hasDep := func(m android.Module, wantDep android.Module) bool {
t.Helper()
@@ -190,7 +190,7 @@ func TestPrebuiltLibraryShared(t *testing.T) {
"libf.so": nil,
})
- shared := ctx.ModuleForTests("libtest", "android_arm64_armv8-a_shared").Module().(*Module)
+ shared := ctx.ModuleForTests(t, "libtest", "android_arm64_armv8-a_shared").Module().(*Module)
assertString(t, shared.OutputFile().Path().Base(), "libtest.so")
}
@@ -204,7 +204,7 @@ func TestPrebuiltLibraryStatic(t *testing.T) {
"libf.a": nil,
})
- static := ctx.ModuleForTests("libtest", "android_arm64_armv8-a_static").Module().(*Module)
+ static := ctx.ModuleForTests(t, "libtest", "android_arm64_armv8-a_static").Module().(*Module)
assertString(t, static.OutputFile().Path().Base(), "libf.a")
}
@@ -227,10 +227,10 @@ func TestPrebuiltLibrary(t *testing.T) {
"libf.so": nil,
})
- shared := ctx.ModuleForTests("libtest", "android_arm64_armv8-a_shared").Module().(*Module)
+ shared := ctx.ModuleForTests(t, "libtest", "android_arm64_armv8-a_shared").Module().(*Module)
assertString(t, shared.OutputFile().Path().Base(), "libtest.so")
- static := ctx.ModuleForTests("libtest", "android_arm64_armv8-a_static").Module().(*Module)
+ static := ctx.ModuleForTests(t, "libtest", "android_arm64_armv8-a_static").Module().(*Module)
assertString(t, static.OutputFile().Path().Base(), "libf.a")
}
@@ -254,10 +254,10 @@ func TestPrebuiltLibraryStem(t *testing.T) {
"libfoo.so": nil,
})
- static := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_static").Module().(*Module)
+ static := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_static").Module().(*Module)
assertString(t, static.OutputFile().Path().Base(), "libfoo.a")
- shared := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module().(*Module)
+ shared := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module().(*Module)
assertString(t, shared.OutputFile().Path().Base(), "libbar.so")
}
@@ -275,7 +275,7 @@ func TestPrebuiltLibrarySharedStem(t *testing.T) {
"libfoo.so": nil,
})
- shared := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module().(*Module)
+ shared := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module().(*Module)
assertString(t, shared.OutputFile().Path().Base(), "libbar.so")
}
@@ -312,7 +312,7 @@ func TestPrebuiltSymlinkedHostBinary(t *testing.T) {
"foo": nil,
})
- fooRule := ctx.ModuleForTests("foo", "linux_glibc_x86_64").Rule("Symlink")
+ fooRule := ctx.ModuleForTests(t, "foo", "linux_glibc_x86_64").Rule("Symlink")
assertString(t, fooRule.Output.String(), "out/soong/.intermediates/foo/linux_glibc_x86_64/foo")
assertString(t, fooRule.Args["fromPath"], "$$PWD/linux_glibc_x86_64/bin/foo")
@@ -355,16 +355,16 @@ func TestPrebuiltLibrarySanitized(t *testing.T) {
// Without SANITIZE_TARGET.
ctx := testPrebuilt(t, bp, fs)
- shared_rule := ctx.ModuleForTests("libtest", "android_arm64_armv8-a_shared").Rule("android/soong/cc.strip")
+ shared_rule := ctx.ModuleForTests(t, "libtest", "android_arm64_armv8-a_shared").Rule("android/soong/cc.strip")
assertString(t, shared_rule.Input.String(), "libf.so")
- static := ctx.ModuleForTests("libtest", "android_arm64_armv8-a_static").Module().(*Module)
+ static := ctx.ModuleForTests(t, "libtest", "android_arm64_armv8-a_static").Module().(*Module)
assertString(t, static.OutputFile().Path().Base(), "libf.a")
- shared_rule2 := ctx.ModuleForTests("libtest_shared", "android_arm64_armv8-a_shared").Rule("android/soong/cc.strip")
+ shared_rule2 := ctx.ModuleForTests(t, "libtest_shared", "android_arm64_armv8-a_shared").Rule("android/soong/cc.strip")
assertString(t, shared_rule2.Input.String(), "libf.so")
- static2 := ctx.ModuleForTests("libtest_static", "android_arm64_armv8-a_static").Module().(*Module)
+ static2 := ctx.ModuleForTests(t, "libtest_static", "android_arm64_armv8-a_static").Module().(*Module)
assertString(t, static2.OutputFile().Path().Base(), "libf.a")
// With SANITIZE_TARGET=hwaddress
@@ -374,16 +374,16 @@ func TestPrebuiltLibrarySanitized(t *testing.T) {
}),
)
- shared_rule = ctx.ModuleForTests("libtest", "android_arm64_armv8-a_shared_hwasan").Rule("android/soong/cc.strip")
+ shared_rule = ctx.ModuleForTests(t, "libtest", "android_arm64_armv8-a_shared_hwasan").Rule("android/soong/cc.strip")
assertString(t, shared_rule.Input.String(), "hwasan/libf.so")
- static = ctx.ModuleForTests("libtest", "android_arm64_armv8-a_static_hwasan").Module().(*Module)
+ static = ctx.ModuleForTests(t, "libtest", "android_arm64_armv8-a_static_hwasan").Module().(*Module)
assertString(t, static.OutputFile().Path().Base(), "libf.hwasan.a")
- shared_rule2 = ctx.ModuleForTests("libtest_shared", "android_arm64_armv8-a_shared_hwasan").Rule("android/soong/cc.strip")
+ shared_rule2 = ctx.ModuleForTests(t, "libtest_shared", "android_arm64_armv8-a_shared_hwasan").Rule("android/soong/cc.strip")
assertString(t, shared_rule2.Input.String(), "hwasan/libf.so")
- static2 = ctx.ModuleForTests("libtest_static", "android_arm64_armv8-a_static_hwasan").Module().(*Module)
+ static2 = ctx.ModuleForTests(t, "libtest_static", "android_arm64_armv8-a_static_hwasan").Module().(*Module)
assertString(t, static2.OutputFile().Path().Base(), "libf.hwasan.a")
}
@@ -394,7 +394,7 @@ cc_prebuilt_binary {
srcs: [],
}`
ctx := testPrebuilt(t, bp, map[string][]byte{})
- mod := ctx.ModuleForTests("bintest", "android_arm64_armv8-a").Module().(*Module)
+ mod := ctx.ModuleForTests(t, "bintest", "android_arm64_armv8-a").Module().(*Module)
android.AssertBoolEquals(t, `expected no srcs to yield no output file`, false, mod.OutputFile().Valid())
}
@@ -484,8 +484,8 @@ func TestMultiplePrebuilts(t *testing.T) {
"libbar.so": nil,
"crtx.o": nil,
}, preparer)
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
- expectedDependency := ctx.ModuleForTests(tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module()
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
+ expectedDependency := ctx.ModuleForTests(t, tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module()
android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName), true, hasDep(ctx, libfoo, expectedDependency))
// check that LOCAL_SHARED_LIBRARIES contains libbar and not libbar.v<N>
entries := android.AndroidMkInfoForTest(t, ctx, libfoo).PrimaryInfo
@@ -493,7 +493,7 @@ func TestMultiplePrebuilts(t *testing.T) {
// check installation rules
// the selected soong module should be exported to make
- libbar := ctx.ModuleForTests(tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module()
+ libbar := ctx.ModuleForTests(t, tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module()
android.AssertBoolEquals(t, fmt.Sprintf("dependency %s should be exported to make\n", expectedDependency), true, !libbar.IsHideFromMake())
// check LOCAL_MODULE of the selected module name
@@ -585,8 +585,8 @@ func TestMultiplePrebuiltsPreferredUsingLegacyFlags(t *testing.T) {
if tc.expectedErr != "" {
return // the fixture will assert that the excepted err has been raised
}
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
- expectedDependency := ctx.ModuleForTests(tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module()
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
+ expectedDependency := ctx.ModuleForTests(t, tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module()
android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName), true, hasDep(ctx, libfoo, expectedDependency))
}
}
@@ -638,8 +638,8 @@ func TestMissingVariantInModuleSdk(t *testing.T) {
"libbar.so": nil,
"crtx.o": nil,
}, preparer)
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
- sourceLibBar := ctx.ModuleForTests("libbar", "android_arm64_armv8-a_static").Module()
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
+ sourceLibBar := ctx.ModuleForTests(t, "libbar", "android_arm64_armv8-a_static").Module()
// Even though the prebuilt is listed in apex_contributions, the prebuilt does not have a static variant.
// Therefore source of libbar should be used.
android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from libfoo to source libbar"), true, hasDep(ctx, libfoo, sourceLibBar))
diff --git a/cc/proto_test.go b/cc/proto_test.go
index a905ea889..47b7e1770 100644
--- a/cc/proto_test.go
+++ b/cc/proto_test.go
@@ -29,7 +29,7 @@ func TestProto(t *testing.T) {
srcs: ["a.proto"],
}`)
- proto := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Output("proto/a.pb.cc")
+ proto := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Output("proto/a.pb.cc")
if cmd := proto.RuleParams.Command; !strings.Contains(cmd, "--cpp_out=") {
t.Errorf("expected '--cpp_out' in %q", cmd)
@@ -53,8 +53,8 @@ func TestProto(t *testing.T) {
buildOS := ctx.Config().BuildOS.String()
- proto := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Output("proto/a.pb.cc")
- foobar := ctx.ModuleForTests("protoc-gen-foobar", buildOS+"_x86_64")
+ proto := ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_shared").Output("proto/a.pb.cc")
+ foobar := ctx.ModuleForTests(t, "protoc-gen-foobar", buildOS+"_x86_64")
cmd := proto.RuleParams.Command
if w := "--foobar_out="; !strings.Contains(cmd, w) {
@@ -85,8 +85,8 @@ func TestProto(t *testing.T) {
buildOS := ctx.Config().BuildOS.String()
- proto := ctx.ModuleForTests("libgrpc", "android_arm_armv7-a-neon_shared").Output("proto/a.grpc.pb.cc")
- grpcCppPlugin := ctx.ModuleForTests("protoc-gen-grpc-cpp-plugin", buildOS+"_x86_64")
+ proto := ctx.ModuleForTests(t, "libgrpc", "android_arm_armv7-a-neon_shared").Output("proto/a.grpc.pb.cc")
+ grpcCppPlugin := ctx.ModuleForTests(t, "protoc-gen-grpc-cpp-plugin", buildOS+"_x86_64")
cmd := proto.RuleParams.Command
if w := "--grpc-cpp-plugin_out="; !strings.Contains(cmd, w) {
diff --git a/cc/sabi_test.go b/cc/sabi_test.go
index 6b8cc1759..3d2a98ca7 100644
--- a/cc/sabi_test.go
+++ b/cc/sabi_test.go
@@ -48,16 +48,16 @@ func TestSabi(t *testing.T) {
PrepareForTestWithCcDefaultModules,
).RunTestWithBp(t, bp)
- libsabiStatic := result.ModuleForTests("libsabi", "android_arm64_armv8-a_static_sabi")
+ libsabiStatic := result.ModuleForTests(t, "libsabi", "android_arm64_armv8-a_static_sabi")
sabiObjSDump := libsabiStatic.Output("obj/sabi.sdump")
- libDirect := result.ModuleForTests("libdirect", "android_arm64_armv8-a_static_sabi")
+ libDirect := result.ModuleForTests(t, "libdirect", "android_arm64_armv8-a_static_sabi")
directObjSDump := libDirect.Output("obj/direct.sdump")
- libTransitive := result.ModuleForTests("libtransitive", "android_arm64_armv8-a_static_sabi")
+ libTransitive := result.ModuleForTests(t, "libtransitive", "android_arm64_armv8-a_static_sabi")
transitiveObjSDump := libTransitive.Output("obj/transitive.sdump")
- libsabiShared := result.ModuleForTests("libsabi", "android_arm64_armv8-a_shared")
+ libsabiShared := result.ModuleForTests(t, "libsabi", "android_arm64_armv8-a_shared")
sabiLink := libsabiShared.Rule("sAbiLink")
android.AssertStringListContains(t, "sabi link inputs", sabiLink.Inputs.Strings(), sabiObjSDump.Output.String())
diff --git a/cc/sanitize_test.go b/cc/sanitize_test.go
index a1cfb5c36..543e80836 100644
--- a/cc/sanitize_test.go
+++ b/cc/sanitize_test.go
@@ -222,31 +222,31 @@ func TestAsan(t *testing.T) {
staticAsanVariant := staticVariant + "_asan"
// The binaries, one with asan and one without
- binWithAsan := result.ModuleForTests("bin_with_asan", asanVariant)
- binNoAsan := result.ModuleForTests("bin_no_asan", variant)
+ binWithAsan := result.ModuleForTests(t, "bin_with_asan", asanVariant)
+ binNoAsan := result.ModuleForTests(t, "bin_no_asan", variant)
// Shared libraries that don't request asan
- libShared := result.ModuleForTests("libshared", sharedVariant)
- libTransitive := result.ModuleForTests("libtransitive", sharedVariant)
+ libShared := result.ModuleForTests(t, "libshared", sharedVariant)
+ libTransitive := result.ModuleForTests(t, "libtransitive", sharedVariant)
// Shared library that requests asan
- libAsan := result.ModuleForTests("libasan", sharedAsanVariant)
+ libAsan := result.ModuleForTests(t, "libasan", sharedAsanVariant)
// Static library that uses an asan variant for bin_with_asan and a non-asan variant
// for bin_no_asan.
- libStaticAsanVariant := result.ModuleForTests("libstatic", staticAsanVariant)
- libStaticNoAsanVariant := result.ModuleForTests("libstatic", staticVariant)
+ libStaticAsanVariant := result.ModuleForTests(t, "libstatic", staticAsanVariant)
+ libStaticNoAsanVariant := result.ModuleForTests(t, "libstatic", staticVariant)
// Static library that never uses asan.
- libNoAsan := result.ModuleForTests("libnoasan", staticVariant)
+ libNoAsan := result.ModuleForTests(t, "libnoasan", staticVariant)
// Static library that specifies asan
- libStaticAsan := result.ModuleForTests("libstatic_asan", staticAsanVariant)
- libStaticAsanNoAsanVariant := result.ModuleForTests("libstatic_asan", staticVariant)
+ libStaticAsan := result.ModuleForTests(t, "libstatic_asan", staticAsanVariant)
+ libStaticAsanNoAsanVariant := result.ModuleForTests(t, "libstatic_asan", staticVariant)
- libAsanSharedRuntime := result.ModuleForTests("libclang_rt.asan", sharedVariant)
- libAsanStaticRuntime := result.ModuleForTests("libclang_rt.asan.static", staticVariant)
- libAsanStaticCxxRuntime := result.ModuleForTests("libclang_rt.asan_cxx.static", staticVariant)
+ libAsanSharedRuntime := result.ModuleForTests(t, "libclang_rt.asan", sharedVariant)
+ libAsanStaticRuntime := result.ModuleForTests(t, "libclang_rt.asan.static", staticVariant)
+ libAsanStaticCxxRuntime := result.ModuleForTests(t, "libclang_rt.asan_cxx.static", staticVariant)
expectSharedLinkDep(t, ctx, binWithAsan, libShared)
expectSharedLinkDep(t, ctx, binWithAsan, libAsan)
@@ -386,15 +386,15 @@ func TestTsan(t *testing.T) {
sharedTsanVariant := sharedVariant + "_tsan"
// The binaries, one with tsan and one without
- binWithTsan := result.ModuleForTests("bin_with_tsan", tsanVariant)
- binNoTsan := result.ModuleForTests("bin_no_tsan", variant)
+ binWithTsan := result.ModuleForTests(t, "bin_with_tsan", tsanVariant)
+ binNoTsan := result.ModuleForTests(t, "bin_no_tsan", variant)
// Shared libraries that don't request tsan
- libShared := result.ModuleForTests("libshared", sharedVariant)
- libTransitive := result.ModuleForTests("libtransitive", sharedVariant)
+ libShared := result.ModuleForTests(t, "libshared", sharedVariant)
+ libTransitive := result.ModuleForTests(t, "libtransitive", sharedVariant)
// Shared library that requests tsan
- libTsan := result.ModuleForTests("libtsan", sharedTsanVariant)
+ libTsan := result.ModuleForTests(t, "libtsan", sharedTsanVariant)
expectSharedLinkDep(t, ctx, binWithTsan, libShared)
expectSharedLinkDep(t, ctx, binWithTsan, libTsan)
@@ -479,16 +479,16 @@ func TestMiscUndefined(t *testing.T) {
staticVariant := variant + "_static"
// The binaries, one with ubsan and one without
- binWithUbsan := result.ModuleForTests("bin_with_ubsan", variant)
- binNoUbsan := result.ModuleForTests("bin_no_ubsan", variant)
+ binWithUbsan := result.ModuleForTests(t, "bin_with_ubsan", variant)
+ binNoUbsan := result.ModuleForTests(t, "bin_no_ubsan", variant)
// Static libraries that don't request ubsan
- libStatic := result.ModuleForTests("libstatic", staticVariant)
- libTransitive := result.ModuleForTests("libtransitive", staticVariant)
+ libStatic := result.ModuleForTests(t, "libstatic", staticVariant)
+ libTransitive := result.ModuleForTests(t, "libtransitive", staticVariant)
- libUbsan := result.ModuleForTests("libubsan", staticVariant)
+ libUbsan := result.ModuleForTests(t, "libubsan", staticVariant)
- libUbsanMinimal := result.ModuleForTests("libclang_rt.ubsan_minimal", staticVariant)
+ libUbsanMinimal := result.ModuleForTests(t, "libclang_rt.ubsan_minimal", staticVariant)
expectStaticLinkDep(t, ctx, binWithUbsan, libStatic)
expectStaticLinkDep(t, ctx, binWithUbsan, libUbsan)
@@ -610,31 +610,31 @@ func TestFuzz(t *testing.T) {
staticFuzzerVariant := staticVariant + "_fuzzer"
// The binaries, one with fuzzer and one without
- binWithFuzzer := result.ModuleForTests("bin_with_fuzzer", fuzzerVariant)
- binNoFuzzer := result.ModuleForTests("bin_no_fuzzer", variant)
+ binWithFuzzer := result.ModuleForTests(t, "bin_with_fuzzer", fuzzerVariant)
+ binNoFuzzer := result.ModuleForTests(t, "bin_no_fuzzer", variant)
// Shared libraries that don't request fuzzer
- libShared := result.ModuleForTests("libshared", sharedVariant)
- libTransitive := result.ModuleForTests("libtransitive", sharedVariant)
+ libShared := result.ModuleForTests(t, "libshared", sharedVariant)
+ libTransitive := result.ModuleForTests(t, "libtransitive", sharedVariant)
// Shared libraries that don't request fuzzer
- libSharedFuzzer := result.ModuleForTests("libshared", sharedFuzzerVariant)
- libTransitiveFuzzer := result.ModuleForTests("libtransitive", sharedFuzzerVariant)
+ libSharedFuzzer := result.ModuleForTests(t, "libshared", sharedFuzzerVariant)
+ libTransitiveFuzzer := result.ModuleForTests(t, "libtransitive", sharedFuzzerVariant)
// Shared library that requests fuzzer
- libFuzzer := result.ModuleForTests("libfuzzer", sharedFuzzerVariant)
+ libFuzzer := result.ModuleForTests(t, "libfuzzer", sharedFuzzerVariant)
// Static library that uses an fuzzer variant for bin_with_fuzzer and a non-fuzzer variant
// for bin_no_fuzzer.
- libStaticFuzzerVariant := result.ModuleForTests("libstatic", staticFuzzerVariant)
- libStaticNoFuzzerVariant := result.ModuleForTests("libstatic", staticVariant)
+ libStaticFuzzerVariant := result.ModuleForTests(t, "libstatic", staticFuzzerVariant)
+ libStaticNoFuzzerVariant := result.ModuleForTests(t, "libstatic", staticVariant)
// Static library that never uses fuzzer.
- libNoFuzzer := result.ModuleForTests("libnofuzzer", staticVariant)
+ libNoFuzzer := result.ModuleForTests(t, "libnofuzzer", staticVariant)
// Static library that specifies fuzzer
- libStaticFuzzer := result.ModuleForTests("libstatic_fuzzer", staticFuzzerVariant)
- libStaticFuzzerNoFuzzerVariant := result.ModuleForTests("libstatic_fuzzer", staticVariant)
+ libStaticFuzzer := result.ModuleForTests(t, "libstatic_fuzzer", staticFuzzerVariant)
+ libStaticFuzzerNoFuzzerVariant := result.ModuleForTests(t, "libstatic_fuzzer", staticVariant)
expectSharedLinkDep(t, ctx, binWithFuzzer, libSharedFuzzer)
expectSharedLinkDep(t, ctx, binWithFuzzer, libFuzzer)
@@ -781,16 +781,16 @@ func TestUbsan(t *testing.T) {
staticVariant := variant + "_static"
sharedVariant := variant + "_shared"
- minimalRuntime := result.ModuleForTests("libclang_rt.ubsan_minimal", staticVariant)
- standaloneRuntime := result.ModuleForTests("libclang_rt.ubsan_standalone.static", staticVariant)
+ minimalRuntime := result.ModuleForTests(t, "libclang_rt.ubsan_minimal", staticVariant)
+ standaloneRuntime := result.ModuleForTests(t, "libclang_rt.ubsan_standalone.static", staticVariant)
// The binaries, one with ubsan and one without
- binWithUbsan := result.ModuleForTests("bin_with_ubsan", variant)
- binDependsUbsan := result.ModuleForTests("bin_depends_ubsan_static", variant)
- libSharedUbsan := result.ModuleForTests("libsharedubsan", sharedVariant)
- binDependsUbsanShared := result.ModuleForTests("bin_depends_ubsan_shared", variant)
- binNoUbsan := result.ModuleForTests("bin_no_ubsan", variant)
- staticBin := result.ModuleForTests("static_bin_with_ubsan_dep", variant)
+ binWithUbsan := result.ModuleForTests(t, "bin_with_ubsan", variant)
+ binDependsUbsan := result.ModuleForTests(t, "bin_depends_ubsan_static", variant)
+ libSharedUbsan := result.ModuleForTests(t, "libsharedubsan", sharedVariant)
+ binDependsUbsanShared := result.ModuleForTests(t, "bin_depends_ubsan_shared", variant)
+ binNoUbsan := result.ModuleForTests(t, "bin_no_ubsan", variant)
+ staticBin := result.ModuleForTests(t, "static_bin_with_ubsan_dep", variant)
android.AssertStringListContains(t, "missing libclang_rt.ubsan_minimal in bin_with_ubsan static libs",
strings.Split(binWithUbsan.Rule("ld").Args["libFlags"], " "),
@@ -979,67 +979,67 @@ func TestSanitizeMemtagHeap(t *testing.T) {
).RunTest(t)
ctx := result.TestContext
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_sync", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_sync", variant), Sync)
// should sanitize: { diag: { memtag: true } } result in Sync instead of None here?
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_async", variant), Sync)
// should sanitize: { diag: { memtag: true } } result in Sync instead of None here?
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_sync", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_sync", variant), Sync)
}
func TestSanitizeMemtagHeapWithSanitizeDevice(t *testing.T) {
@@ -1055,66 +1055,66 @@ func TestSanitizeMemtagHeapWithSanitizeDevice(t *testing.T) {
).RunTest(t)
ctx := result.TestContext
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_async", variant), Sync)
// should sanitize: { diag: { memtag: true } } result in Sync instead of None here?
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_sync", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_sync", variant), Sync)
}
func TestSanitizeMemtagHeapWithSanitizeDeviceDiag(t *testing.T) {
@@ -1131,66 +1131,66 @@ func TestSanitizeMemtagHeapWithSanitizeDeviceDiag(t *testing.T) {
).RunTest(t)
ctx := result.TestContext
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_async", variant), Sync)
// should sanitize: { diag: { memtag: true } } result in Sync instead of None here?
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_sync", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_sync", variant), Sync)
}
func TestCfi(t *testing.T) {
@@ -1250,14 +1250,14 @@ func TestCfi(t *testing.T) {
cfi_suffix := "_cfi"
static_suffix := "_static"
- sharedWithCfiLib := result.ModuleForTests("shared_with_cfi", buildOs+shared_suffix+cfi_suffix)
- sharedNoCfiLib := result.ModuleForTests("shared_no_cfi", buildOs+shared_suffix)
- staticWithCfiLib := result.ModuleForTests("static_dep_with_cfi", buildOs+static_suffix)
- staticWithCfiLibCfiVariant := result.ModuleForTests("static_dep_with_cfi", buildOs+static_suffix+cfi_suffix)
- staticNoCfiLib := result.ModuleForTests("static_dep_no_cfi", buildOs+static_suffix)
- staticNoCfiLibCfiVariant := result.ModuleForTests("static_dep_no_cfi", buildOs+static_suffix+cfi_suffix)
- sharedRdepNoCfi := result.ModuleForTests("shared_rdep_no_cfi", buildOs+shared_suffix)
- staticDepWithCfi2Lib := result.ModuleForTests("static_dep_with_cfi_2", buildOs+static_suffix)
+ sharedWithCfiLib := result.ModuleForTests(t, "shared_with_cfi", buildOs+shared_suffix+cfi_suffix)
+ sharedNoCfiLib := result.ModuleForTests(t, "shared_no_cfi", buildOs+shared_suffix)
+ staticWithCfiLib := result.ModuleForTests(t, "static_dep_with_cfi", buildOs+static_suffix)
+ staticWithCfiLibCfiVariant := result.ModuleForTests(t, "static_dep_with_cfi", buildOs+static_suffix+cfi_suffix)
+ staticNoCfiLib := result.ModuleForTests(t, "static_dep_no_cfi", buildOs+static_suffix)
+ staticNoCfiLibCfiVariant := result.ModuleForTests(t, "static_dep_no_cfi", buildOs+static_suffix+cfi_suffix)
+ sharedRdepNoCfi := result.ModuleForTests(t, "shared_rdep_no_cfi", buildOs+shared_suffix)
+ staticDepWithCfi2Lib := result.ModuleForTests(t, "static_dep_with_cfi_2", buildOs+static_suffix)
// Confirm assumptions about propagation of CFI enablement
expectStaticLinkDep(t, ctx, sharedWithCfiLib, staticWithCfiLibCfiVariant)
diff --git a/cc/sdk_test.go b/cc/sdk_test.go
index 61925e30c..664a7c6e6 100644
--- a/cc/sdk_test.go
+++ b/cc/sdk_test.go
@@ -81,16 +81,16 @@ func TestSdkMutator(t *testing.T) {
ctx := testCc(t, bp)
- libsdkNDK := ctx.ModuleForTests("libsdk", "android_arm64_armv8-a_sdk_shared")
- libsdkPlatform := ctx.ModuleForTests("libsdk", "android_arm64_armv8-a_shared")
- libsdkdepNDK := ctx.ModuleForTests("libsdkdep", "android_arm64_armv8-a_sdk_shared")
- libsdkdepPlatform := ctx.ModuleForTests("libsdkdep", "android_arm64_armv8-a_shared")
- libplatform := ctx.ModuleForTests("libplatform", "android_arm64_armv8-a_shared")
- platformbinary := ctx.ModuleForTests("platformbinary", "android_arm64_armv8-a")
- sdkbinary := ctx.ModuleForTests("sdkbinary", "android_arm64_armv8-a_sdk")
-
- libcxxNDK := ctx.ModuleForTests("ndk_libc++_shared", "android_arm64_armv8-a_sdk_shared")
- libcxxPlatform := ctx.ModuleForTests("libc++", "android_arm64_armv8-a_shared")
+ libsdkNDK := ctx.ModuleForTests(t, "libsdk", "android_arm64_armv8-a_sdk_shared")
+ libsdkPlatform := ctx.ModuleForTests(t, "libsdk", "android_arm64_armv8-a_shared")
+ libsdkdepNDK := ctx.ModuleForTests(t, "libsdkdep", "android_arm64_armv8-a_sdk_shared")
+ libsdkdepPlatform := ctx.ModuleForTests(t, "libsdkdep", "android_arm64_armv8-a_shared")
+ libplatform := ctx.ModuleForTests(t, "libplatform", "android_arm64_armv8-a_shared")
+ platformbinary := ctx.ModuleForTests(t, "platformbinary", "android_arm64_armv8-a")
+ sdkbinary := ctx.ModuleForTests(t, "sdkbinary", "android_arm64_armv8-a_sdk")
+
+ libcxxNDK := ctx.ModuleForTests(t, "ndk_libc++_shared", "android_arm64_armv8-a_sdk_shared")
+ libcxxPlatform := ctx.ModuleForTests(t, "libc++", "android_arm64_armv8-a_shared")
assertDep(t, libsdkNDK, libsdkdepNDK)
assertDep(t, libsdkPlatform, libsdkdepPlatform)
diff --git a/cc/test_data_test.go b/cc/test_data_test.go
index a62116677..2c03ca4d5 100644
--- a/cc/test_data_test.go
+++ b/cc/test_data_test.go
@@ -132,7 +132,7 @@ func TestDataTests(t *testing.T) {
_, errs = ctx.PrepareBuildActions(config)
android.FailIfErrored(t, errs)
- foo := ctx.ModuleForTests("foo", "")
+ foo := ctx.ModuleForTests(t, "foo", "")
got := foo.Module().(*testDataTest).data
if len(got) != len(test.data) {
diff --git a/cc/testing.go b/cc/testing.go
index c9d362da2..69ae11dfd 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -708,7 +708,7 @@ func CreateTestContext(config android.Config) *android.TestContext {
func checkSnapshotIncludeExclude(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string, include bool, fake bool) {
t.Helper()
- mod := ctx.ModuleForTests(moduleName, variant)
+ mod := ctx.ModuleForTests(t, moduleName, variant)
outputFiles := mod.OutputFiles(ctx, t, "")
if len(outputFiles) != 1 {
t.Errorf("%q must have single output\n", moduleName)
@@ -750,9 +750,10 @@ func CheckSnapshotRule(t *testing.T, ctx *android.TestContext, singleton android
checkSnapshotIncludeExclude(t, ctx, singleton, moduleName, snapshotFilename, subDir, variant, true, true)
}
-func GetOutputPaths(ctx *android.TestContext, variant string, moduleNames []string) (paths android.Paths) {
+func GetOutputPaths(t *testing.T, ctx *android.TestContext, variant string, moduleNames []string) (paths android.Paths) {
+ t.Helper()
for _, moduleName := range moduleNames {
- module := ctx.ModuleForTests(moduleName, variant).Module().(*Module)
+ module := ctx.ModuleForTests(t, moduleName, variant).Module().(*Module)
output := module.outputFile.Path().RelativeToTop()
paths = append(paths, output)
}
diff --git a/cc/tidy_test.go b/cc/tidy_test.go
index 9481778a2..afc12b8d9 100644
--- a/cc/tidy_test.go
+++ b/cc/tidy_test.go
@@ -83,7 +83,7 @@ func TestTidyFlagsWarningsAsErrors(t *testing.T) {
variant := "android_arm64_armv8-a_shared"
ctx := testCc(t, test.bp)
t.Run("caseTidyFlags", func(t *testing.T) {
- flags := ctx.ModuleForTests(test.libName, variant).Rule("clangTidy").Args["tidyFlags"]
+ flags := ctx.ModuleForTests(t, test.libName, variant).Rule("clangTidy").Args["tidyFlags"]
for _, flag := range test.flags {
if !strings.Contains(flags, flag) {
t.Errorf("tidyFlags %v for %s does not contain %s.", flags, test.libName, flag)
@@ -143,7 +143,7 @@ func TestTidyChecks(t *testing.T) {
variant := "android_arm64_armv8-a_shared"
for _, test := range testCases {
libName := fmt.Sprintf("libfoo_%d", test.libNumber)
- flags := ctx.ModuleForTests(libName, variant).Rule("clangTidy").Args["tidyFlags"]
+ flags := ctx.ModuleForTests(t, libName, variant).Rule("clangTidy").Args["tidyFlags"]
splitFlags := strings.Split(flags, " ")
foundCheckFlag := false
for _, flag := range splitFlags {
@@ -231,7 +231,7 @@ func TestWithTidy(t *testing.T) {
checkLibraryRule := func(foo, variant, ruleName string) {
libName := fmt.Sprintf("lib%s_%d", foo, n)
tidyFile := "out/soong/.intermediates/" + libName + "/" + variant + "/obj/" + foo + ".tidy"
- depFiles := ctx.ModuleForTests(libName, variant).Rule(ruleName).Validations.Strings()
+ depFiles := ctx.ModuleForTests(t, libName, variant).Rule(ruleName).Validations.Strings()
if test.needTidyFile[n] {
android.AssertStringListContains(t, libName+" needs .tidy file", depFiles, tidyFile)
} else {
@@ -262,7 +262,7 @@ func TestWithGeneratedCode(t *testing.T) {
ctx := android.GroupFixturePreparers(prepareForCcTest, android.FixtureMergeEnv(testEnv)).RunTestWithBp(t, bp)
t.Run("tidy should be only run for source code, not for generated code", func(t *testing.T) {
- depFiles := ctx.ModuleForTests("libfoo", variant).Rule("ld").Validations.Strings()
+ depFiles := ctx.ModuleForTests(t, "libfoo", variant).Rule("ld").Validations.Strings()
tidyFileForCpp := "out/soong/.intermediates/libfoo/" + variant + "/obj/foo_src.tidy"
diff --git a/cc/vendor_public_library_test.go b/cc/vendor_public_library_test.go
index 7385f2b88..797bb251c 100644
--- a/cc/vendor_public_library_test.go
+++ b/cc/vendor_public_library_test.go
@@ -70,32 +70,32 @@ func TestVendorPublicLibraries(t *testing.T) {
// test if header search paths are correctly added
// _static variant is used since _shared reuses *.o from the static variant
- cc := ctx.ModuleForTests("libsystem", strings.Replace(coreVariant, "_shared", "_static", 1)).Rule("cc")
+ cc := ctx.ModuleForTests(t, "libsystem", strings.Replace(coreVariant, "_shared", "_static", 1)).Rule("cc")
cflags := cc.Args["cFlags"]
if !strings.Contains(cflags, "-Imy_include") {
t.Errorf("cflags for libsystem must contain -Imy_include, but was %#v.", cflags)
}
// test if libsystem is linked to the stub
- ld := ctx.ModuleForTests("libsystem", coreVariant).Rule("ld")
+ ld := ctx.ModuleForTests(t, "libsystem", coreVariant).Rule("ld")
libflags := ld.Args["libFlags"]
- stubPaths := GetOutputPaths(ctx, coreVariant, []string{"libvendorpublic"})
+ stubPaths := GetOutputPaths(t, ctx, coreVariant, []string{"libvendorpublic"})
if !strings.Contains(libflags, stubPaths[0].String()) {
t.Errorf("libflags for libsystem must contain %#v, but was %#v", stubPaths[0], libflags)
}
// test if libsystem is linked to the stub
- ld = ctx.ModuleForTests("libproduct", productVariant).Rule("ld")
+ ld = ctx.ModuleForTests(t, "libproduct", productVariant).Rule("ld")
libflags = ld.Args["libFlags"]
- stubPaths = GetOutputPaths(ctx, productVariant, []string{"libvendorpublic"})
+ stubPaths = GetOutputPaths(t, ctx, productVariant, []string{"libvendorpublic"})
if !strings.Contains(libflags, stubPaths[0].String()) {
t.Errorf("libflags for libproduct must contain %#v, but was %#v", stubPaths[0], libflags)
}
// test if libvendor is linked to the real shared lib
- ld = ctx.ModuleForTests("libvendor", vendorVariant).Rule("ld")
+ ld = ctx.ModuleForTests(t, "libvendor", vendorVariant).Rule("ld")
libflags = ld.Args["libFlags"]
- stubPaths = GetOutputPaths(ctx, vendorVariant, []string{"libvendorpublic"})
+ stubPaths = GetOutputPaths(t, ctx, vendorVariant, []string{"libvendorpublic"})
if !strings.Contains(libflags, stubPaths[0].String()) {
t.Errorf("libflags for libvendor must contain %#v, but was %#v", stubPaths[0], libflags)
diff --git a/dexpreopt/dexpreopt_test.go b/dexpreopt/dexpreopt_test.go
index f9b8880f5..500b2ff8c 100644
--- a/dexpreopt/dexpreopt_test.go
+++ b/dexpreopt/dexpreopt_test.go
@@ -377,7 +377,7 @@ func TestUffdGcFlagForce(t *testing.T) {
result := preparers.RunTest(t)
ctx := result.TestContext
- ctx.SingletonForTests("dexpreopt-soong-config").Output("out/soong/dexpreopt/uffd_gc_flag.txt")
+ ctx.SingletonForTests(t, "dexpreopt-soong-config").Output("out/soong/dexpreopt/uffd_gc_flag.txt")
})
}
}
@@ -394,7 +394,7 @@ func TestUffdGcFlagDefault(t *testing.T) {
ctx := result.TestContext
config := ctx.Config()
- rule := ctx.SingletonForTests("dexpreopt-soong-config").Rule("dexpreopt_uffd_gc_flag")
+ rule := ctx.SingletonForTests(t, "dexpreopt-soong-config").Rule("dexpreopt_uffd_gc_flag")
android.AssertStringDoesContain(t, "", rule.RuleParams.Command, "construct_uffd_gc_flag")
android.AssertStringPathsRelativeToTopEquals(t, "", config, []string{
diff --git a/etc/install_symlink_test.go b/etc/install_symlink_test.go
index c97d97c65..dce687381 100644
--- a/etc/install_symlink_test.go
+++ b/etc/install_symlink_test.go
@@ -39,7 +39,7 @@ func TestInstallSymlinkBasic(t *testing.T) {
t.Fatalf("expected 1 variant, got %#v", foo_variants)
}
- foo := result.ModuleForTests("foo", "android_common").Module()
+ foo := result.ModuleForTests(t, "foo", "android_common").Module()
androidMkEntries := android.AndroidMkEntriesForTest(t, result.TestContext, foo)
if len(androidMkEntries) != 1 {
t.Fatalf("expected 1 androidmkentry, got %d", len(androidMkEntries))
@@ -70,7 +70,7 @@ func TestInstallSymlinkToRecovery(t *testing.T) {
t.Fatalf("expected 1 variant, got %#v", foo_variants)
}
- foo := result.ModuleForTests("foo", "android_common").Module()
+ foo := result.ModuleForTests(t, "foo", "android_common").Module()
androidMkEntries := android.AndroidMkEntriesForTest(t, result.TestContext, foo)
if len(androidMkEntries) != 1 {
t.Fatalf("expected 1 androidmkentry, got %d", len(androidMkEntries))
@@ -149,7 +149,7 @@ func TestInstallSymlinkHostBasic(t *testing.T) {
`)
buildOS := result.Config.BuildOS.String()
- foo := result.ModuleForTests("foo", buildOS+"_common").Module()
+ foo := result.ModuleForTests(t, "foo", buildOS+"_common").Module()
androidMkEntries := android.AndroidMkEntriesForTest(t, result.TestContext, foo)
if len(androidMkEntries) != 1 {
diff --git a/etc/prebuilt_etc_test.go b/etc/prebuilt_etc_test.go
index 70b54629f..eb722b457 100644
--- a/etc/prebuilt_etc_test.go
+++ b/etc/prebuilt_etc_test.go
@@ -324,7 +324,7 @@ func TestPrebuiltEtcAllowMissingDependencies(t *testing.T) {
`)
android.AssertStringEquals(t, "expected error rule", "android/soong/android.Error",
- result.ModuleForTests("foo.conf", "android_arm64_armv8-a").Output("foo.conf").Rule.String())
+ result.ModuleForTests(t, "foo.conf", "android_arm64_armv8-a").Output("foo.conf").Rule.String())
}
func TestPrebuiltRootInstallDirPath(t *testing.T) {
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index 37260c17d..6d0b49016 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -118,9 +118,9 @@ func TestFileSystemDeps(t *testing.T) {
`)
// produces "myfilesystem.img"
- result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img")
+ result.ModuleForTests(t, "myfilesystem", "android_common").Output("myfilesystem.img")
- fs := result.ModuleForTests("myfilesystem", "android_common").Module().(*filesystem)
+ fs := result.ModuleForTests(t, "myfilesystem", "android_common").Module().(*filesystem)
expected := []string{
"app/myapp/myapp.apk",
"bin/foo",
@@ -163,7 +163,7 @@ func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) {
}
`)
- module := result.ModuleForTests("myfilesystem", "android_common")
+ module := result.ModuleForTests(t, "myfilesystem", "android_common")
output := module.Output("out/soong/.intermediates/myfilesystem/android_common/linker.config.pb")
linkerConfigCommand := output.RuleParams.Command
@@ -224,7 +224,7 @@ func TestFileSystemGathersItemsOnlyInSystemPartition(t *testing.T) {
}
`)
- module := result.ModuleForTests("myfilesystem", "android_common").Module().(*systemImage)
+ module := result.ModuleForTests(t, "myfilesystem", "android_common").Module().(*systemImage)
android.AssertDeepEquals(t, "entries should have foo and not bar", []string{"components/foo", "etc/linker.config.pb"}, module.entries)
}
@@ -236,7 +236,7 @@ func TestAvbGenVbmetaImage(t *testing.T) {
partition_name: "input_partition_name",
salt: "2222",
}`)
- cmd := result.ModuleForTests("input_hashdesc", "android_arm64_armv8-a").Rule("avbGenVbmetaImage").RuleParams.Command
+ cmd := result.ModuleForTests(t, "input_hashdesc", "android_arm64_armv8-a").Rule("avbGenVbmetaImage").RuleParams.Command
android.AssertStringDoesContain(t, "Can't find correct --partition_name argument",
cmd, "--partition_name input_partition_name")
android.AssertStringDoesContain(t, "Can't find --do_not_append_vbmeta_image",
@@ -276,7 +276,7 @@ func TestAvbAddHashFooter(t *testing.T) {
include_descriptors_from_images: ["input_hashdesc"],
}
`)
- cmd := result.ModuleForTests("myfooter", "android_arm64_armv8-a").Rule("avbAddHashFooter").RuleParams.Command
+ cmd := result.ModuleForTests(t, "myfooter", "android_arm64_armv8-a").Rule("avbAddHashFooter").RuleParams.Command
android.AssertStringDoesContain(t, "Can't find correct --partition_name argument",
cmd, "--partition_name mypartition")
android.AssertStringDoesContain(t, "Can't find correct --key argument",
@@ -331,7 +331,7 @@ func TestFileSystemWithCoverageVariants(t *testing.T) {
}
`)
- filesystem := result.ModuleForTests("myfilesystem", "android_common_cov")
+ filesystem := result.ModuleForTests(t, "myfilesystem", "android_common_cov")
inputs := filesystem.Output("staging_dir.timestamp").Implicits
android.AssertStringListContains(t, "filesystem should have libfoo(cov)",
inputs.Strings(),
@@ -341,7 +341,7 @@ func TestFileSystemWithCoverageVariants(t *testing.T) {
"out/soong/.intermediates/libbar/android_arm64_armv8-a_shared_cov/libbar.so")
filesystemOutput := filesystem.OutputFiles(result.TestContext, t, "")[0]
- prebuiltInput := result.ModuleForTests("prebuilt", "android_arm64_armv8-a").Rule("Cp").Input
+ prebuiltInput := result.ModuleForTests(t, "prebuilt", "android_arm64_armv8-a").Rule("Cp").Input
if filesystemOutput != prebuiltInput {
t.Error("prebuilt should use cov variant of filesystem")
}
@@ -403,7 +403,7 @@ func TestSystemImageDefaults(t *testing.T) {
}
`)
- fs := result.ModuleForTests("system", "android_common").Module().(*systemImage)
+ fs := result.ModuleForTests(t, "system", "android_common").Module().(*systemImage)
expected := []string{
"bin/foo",
"lib/libbar.so",
@@ -483,7 +483,7 @@ func TestTrackPhonyAsRequiredDep(t *testing.T) {
}
`)
- fs := result.ModuleForTests("fs", "android_common").Module().(*filesystem)
+ fs := result.ModuleForTests(t, "fs", "android_common").Module().(*filesystem)
expected := []string{
"bin/foo",
"lib64/libbar.so",
@@ -546,7 +546,7 @@ func TestFilterOutUnsupportedArches(t *testing.T) {
},
}
for _, c := range testcases {
- fs := result.ModuleForTests(c.fsName, "android_common").Module().(*filesystem)
+ fs := result.ModuleForTests(t, c.fsName, "android_common").Module().(*filesystem)
for _, e := range c.expected {
android.AssertStringListContains(t, "missing entry", fs.entries, e)
}
@@ -573,7 +573,7 @@ func TestErofsPartition(t *testing.T) {
}
`)
- partition := result.ModuleForTests("erofs_partition", "android_common")
+ partition := result.ModuleForTests(t, "erofs_partition", "android_common")
buildImageConfig := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("prop_pre_processing"))
android.AssertStringDoesContain(t, "erofs fs type", buildImageConfig, "fs_type=erofs")
android.AssertStringDoesContain(t, "erofs fs type compress algorithm", buildImageConfig, "erofs_default_compressor=lz4hc,9")
@@ -589,7 +589,7 @@ func TestF2fsPartition(t *testing.T) {
}
`)
- partition := result.ModuleForTests("f2fs_partition", "android_common")
+ partition := result.ModuleForTests(t, "f2fs_partition", "android_common")
buildImageConfig := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("prop_pre_processing"))
android.AssertStringDoesContain(t, "f2fs fs type", buildImageConfig, "fs_type=f2fs")
android.AssertStringDoesContain(t, "f2fs fs type sparse", buildImageConfig, "f2fs_sparse_flag=-S")
@@ -631,7 +631,7 @@ func TestDoNotPackageCrossPartitionDependencies(t *testing.T) {
}
`)
- partition := result.ModuleForTests("myfilesystem", "android_common")
+ partition := result.ModuleForTests(t, "myfilesystem", "android_common")
fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
android.AssertDeepEquals(t, "filesystem with dependencies on different partition", "bin/binfoo\n", fileList)
}
@@ -650,7 +650,7 @@ func TestUseSharedVariationOfNativeLib(t *testing.T) {
}
`)
- partition := result.ModuleForTests("myfilesystem", "android_common")
+ partition := result.ModuleForTests(t, "myfilesystem", "android_common")
fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
android.AssertDeepEquals(t, "cc_library listed in deps",
"lib64/bootstrap/libc.so\nlib64/bootstrap/libdl.so\nlib64/bootstrap/libm.so\nlib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo.so\nlib64/libm.so\n",
@@ -687,7 +687,7 @@ cc_library {
}
`)
- partition := result.ModuleForTests("myfilesystem", "android_common")
+ partition := result.ModuleForTests(t, "myfilesystem", "android_common")
fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
android.AssertDeepEquals(t, "Shared library dep of overridden binary should not be installed",
"bin/binfoo1\nlib64/bootstrap/libc.so\nlib64/bootstrap/libdl.so\nlib64/bootstrap/libm.so\nlib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo2.so\nlib64/libm.so\n",
@@ -716,7 +716,7 @@ cc_library {
}
`)
- linkerConfigCmd := result.ModuleForTests("myfilesystem", "android_common").Output("out/soong/.intermediates/myfilesystem/android_common/linker.config.pb").RuleParams.Command
+ linkerConfigCmd := result.ModuleForTests(t, "myfilesystem", "android_common").Output("out/soong/.intermediates/myfilesystem/android_common/linker.config.pb").RuleParams.Command
android.AssertStringDoesContain(t, "Could not find linker.config.json file in cmd", linkerConfigCmd, "conv_linker_config proto --force -s linker.config.json")
android.AssertStringDoesContain(t, "Could not find stub in `provideLibs`", linkerConfigCmd, "--key provideLibs --value libfoo_has_stubs.so")
}
@@ -740,7 +740,7 @@ func TestOverrideModulesInDeps(t *testing.T) {
}
`)
- partition := result.ModuleForTests("myfilesystem", "android_common")
+ partition := result.ModuleForTests(t, "myfilesystem", "android_common")
fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
android.AssertStringEquals(t, "filesystem with override app", "app/myoverrideapp/myoverrideapp.apk\n", fileList)
}
diff --git a/fsgen/filesystem_creator_test.go b/fsgen/filesystem_creator_test.go
index 565760882..0b6d272bb 100644
--- a/fsgen/filesystem_creator_test.go
+++ b/fsgen/filesystem_creator_test.go
@@ -15,11 +15,13 @@
package fsgen
import (
+ "strings"
+ "testing"
+
"android/soong/android"
"android/soong/etc"
"android/soong/filesystem"
"android/soong/java"
- "testing"
"github.com/google/blueprint/proptools"
)
@@ -61,7 +63,7 @@ func TestFileSystemCreatorSystemImageProps(t *testing.T) {
}),
).RunTest(t)
- fooSystem := result.ModuleForTests("test_product_generated_system_image", "android_common").Module().(interface {
+ fooSystem := result.ModuleForTests(t, "test_product_generated_system_image", "android_common").Module().(interface {
FsProps() filesystem.FilesystemProperties
})
android.AssertBoolEquals(
@@ -198,14 +200,14 @@ func TestFileSystemCreatorDepsWithNamespace(t *testing.T) {
).RunTest(t)
var packagingProps android.PackagingProperties
- for _, prop := range result.ModuleForTests("test_product_generated_system_image", "android_common").Module().GetProperties() {
+ for _, prop := range result.ModuleForTests(t, "test_product_generated_system_image", "android_common").Module().GetProperties() {
if packagingPropStruct, ok := prop.(*android.PackagingProperties); ok {
packagingProps = *packagingPropStruct
}
}
moduleDeps := packagingProps.Multilib.Lib64.Deps
- eval := result.ModuleForTests("test_product_generated_system_image", "android_common").Module().ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
+ eval := result.ModuleForTests(t, "test_product_generated_system_image", "android_common").Module().ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
android.AssertStringListContains(
t,
"Generated system image expected to depend on \"bar\" defined in \"a/b\" namespace",
@@ -304,7 +306,7 @@ func TestPrebuiltEtcModuleGen(t *testing.T) {
}
// check generated prebuilt_* module type install path and install partition
- generatedModule := result.ModuleForTests("system-frameworks_base_config-etc-0", "android_arm64_armv8-a").Module()
+ generatedModule := result.ModuleForTests(t, "system-frameworks_base_config-etc-0", "android_arm64_armv8-a").Module()
etcModule, _ := generatedModule.(*etc.PrebuiltEtc)
android.AssertStringEquals(
t,
@@ -322,7 +324,7 @@ func TestPrebuiltEtcModuleGen(t *testing.T) {
)
// check generated prebuilt_* module specifies correct relative_install_path property
- generatedModule = result.ModuleForTests("system-frameworks_base_data_keyboards-usr_keylayout_subdir-0", "android_arm64_armv8-a").Module()
+ generatedModule = result.ModuleForTests(t, "system-frameworks_base_data_keyboards-usr_keylayout_subdir-0", "android_arm64_armv8-a").Module()
etcModule, _ = generatedModule.(*etc.PrebuiltEtc)
android.AssertStringEquals(
t,
@@ -332,16 +334,16 @@ func TestPrebuiltEtcModuleGen(t *testing.T) {
)
// check that prebuilt_* module is not generated for non existing source file
- android.AssertPanicMessageContains(
+ android.AssertStringEquals(
t,
"prebuilt_* module not generated for non existing source file",
- "failed to find module \"system-some_non_existing-etc-0\"",
- func() { result.ModuleForTests("system-some_non_existing-etc-0", "android_arm64_armv8-a") },
+ "",
+ strings.Join(result.ModuleVariantsForTests("system-some_non_existing-etc-0"), ","),
)
// check that duplicate src file can exist in PRODUCT_COPY_FILES and generates separate modules
- generatedModule0 := result.ModuleForTests("product-device_sample_etc-etc-0", "android_arm64_armv8-a").Module()
- generatedModule1 := result.ModuleForTests("product-device_sample_etc-etc-1", "android_arm64_armv8-a").Module()
+ generatedModule0 := result.ModuleForTests(t, "product-device_sample_etc-etc-0", "android_arm64_armv8-a").Module()
+ generatedModule1 := result.ModuleForTests(t, "product-device_sample_etc-etc-1", "android_arm64_armv8-a").Module()
// check that generated prebuilt_* module sets correct srcs and dsts property
eval := generatedModule0.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
diff --git a/genrule/genrule_test.go b/genrule/genrule_test.go
index 688db0761..dcec2971b 100644
--- a/genrule/genrule_test.go
+++ b/genrule/genrule_test.go
@@ -515,7 +515,7 @@ func TestGenruleHashInputs(t *testing.T) {
for _, test := range testcases {
t.Run(test.name, func(t *testing.T) {
- gen := result.ModuleForTests(test.name, "")
+ gen := result.ModuleForTests(t, test.name, "")
manifest := android.RuleBuilderSboxProtoForTests(t, result.TestContext, gen.Output("genrule.sbox.textproto"))
hash := manifest.Commands[0].GetInputHash()
@@ -643,7 +643,7 @@ func TestGenSrcs(t *testing.T) {
ExtendWithErrorHandler(android.FixtureExpectsAllErrorsToMatchAPattern(expectedErrors)).
RunTestWithBp(t, testGenruleBp()+bp)
- mod := result.ModuleForTests("gen", "")
+ mod := result.ModuleForTests(t, "gen", "")
if expectedErrors != nil {
return
}
@@ -719,7 +719,7 @@ func TestGenruleAllowMissingDependencies(t *testing.T) {
ctx.SetAllowMissingDependencies(true)
})).RunTestWithBp(t, bp)
- gen := result.ModuleForTests("gen", "").Output("out")
+ gen := result.ModuleForTests(t, "gen", "").Output("out")
if gen.Rule != android.ErrorRule {
t.Errorf("Expected missing dependency error rule for gen, got %q", gen.Rule.String())
}
@@ -750,15 +750,15 @@ func TestGenruleOutputFiles(t *testing.T) {
android.AssertPathsRelativeToTopEquals(t,
"genrule.tag with output",
[]string{"out/soong/.intermediates/gen/gen/foo"},
- result.ModuleForTests("gen_foo", "").Module().(*useSource).srcs)
+ result.ModuleForTests(t, "gen_foo", "").Module().(*useSource).srcs)
android.AssertPathsRelativeToTopEquals(t,
"genrule.tag with output in subdir",
[]string{"out/soong/.intermediates/gen/gen/sub/bar"},
- result.ModuleForTests("gen_bar", "").Module().(*useSource).srcs)
+ result.ModuleForTests(t, "gen_bar", "").Module().(*useSource).srcs)
android.AssertPathsRelativeToTopEquals(t,
"genrule.tag with all",
[]string{"out/soong/.intermediates/gen/gen/foo", "out/soong/.intermediates/gen/gen/sub/bar"},
- result.ModuleForTests("gen_all", "").Module().(*useSource).srcs)
+ result.ModuleForTests(t, "gen_all", "").Module().(*useSource).srcs)
}
func TestGenruleInterface(t *testing.T) {
diff --git a/golang/golang_test.go b/golang/golang_test.go
index d555d144c..89a8761a5 100644
--- a/golang/golang_test.go
+++ b/golang/golang_test.go
@@ -45,7 +45,7 @@ func TestGolang(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- bin := result.ModuleForTests("gobin", result.Config.BuildOSTarget.String())
+ bin := result.ModuleForTests(t, "gobin", result.Config.BuildOSTarget.String())
expected := "^out/host/" + result.Config.PrebuiltOS() + "/bin/go/gobin/?[^/]*/obj/gobin$"
actual := android.PathsRelativeToTop(bin.OutputFiles(result.TestContext, t, ""))
diff --git a/java/aar_test.go b/java/aar_test.go
index 3ac228d35..088ad6c92 100644
--- a/java/aar_test.go
+++ b/java/aar_test.go
@@ -53,7 +53,7 @@ func TestAarImportProducesJniPackages(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
appMod := ctx.Module(tc.name, "android_common")
- appTestMod := ctx.ModuleForTests(tc.name, "android_common")
+ appTestMod := ctx.ModuleForTests(t, tc.name, "android_common")
info, ok := android.OtherModuleProvider(ctx, appMod, JniPackageProvider)
if !ok {
@@ -117,7 +117,7 @@ func TestLibraryFlagsPackages(t *testing.T) {
}
`)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
// android_library module depends on aconfig_declarations listed in flags_packages
android.AssertBoolEquals(t, "foo expected to depend on bar", true,
@@ -159,9 +159,9 @@ func TestAndroidLibraryOutputFilesRel(t *testing.T) {
}
`)
- foo := result.ModuleForTests("foo", "android_common")
- bar := result.ModuleForTests("bar", "android_common")
- baz := result.ModuleForTests("baz", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
+ bar := result.ModuleForTests(t, "bar", "android_common")
+ baz := result.ModuleForTests(t, "baz", "android_common")
fooOutputPaths := foo.OutputFiles(result.TestContext, t, "")
barOutputPaths := bar.OutputFiles(result.TestContext, t, "")
diff --git a/java/android_manifest_test.go b/java/android_manifest_test.go
index edb22fcb7..ce227b9c8 100644
--- a/java/android_manifest_test.go
+++ b/java/android_manifest_test.go
@@ -81,7 +81,7 @@ func TestManifestMerger(t *testing.T) {
result := PrepareForTestWithJavaDefaultModules.RunTestWithBp(t, bp)
- manifestMergerRule := result.ModuleForTests("app", "android_common").Rule("manifestMerger")
+ manifestMergerRule := result.ModuleForTests(t, "app", "android_common").Rule("manifestMerger")
android.AssertPathRelativeToTopEquals(t, "main manifest",
"out/soong/.intermediates/app/android_common/manifest_fixer/AndroidManifest.xml",
manifestMergerRule.Input)
@@ -129,7 +129,7 @@ func TestManifestValuesApplicationIdSetsPackageName(t *testing.T) {
result := PrepareForTestWithJavaDefaultModules.RunTestWithBp(t, bp)
- manifestMergerRule := result.ModuleForTests("test", "android_common").Rule("manifestMerger")
+ manifestMergerRule := result.ModuleForTests(t, "test", "android_common").Rule("manifestMerger")
android.AssertStringMatches(t,
"manifest merger args",
manifestMergerRule.Args["args"],
diff --git a/java/androidmk_test.go b/java/androidmk_test.go
index 9306e72a3..b4b13b11a 100644
--- a/java/androidmk_test.go
+++ b/java/androidmk_test.go
@@ -32,7 +32,7 @@ func TestRequired(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expected := []string{"libfoo"}
@@ -52,7 +52,7 @@ func TestHostdex(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
if len(entriesList) != 2 {
t.Errorf("two entries are expected, but got %d", len(entriesList))
@@ -84,7 +84,7 @@ func TestHostdexRequired(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
if len(entriesList) != 2 {
t.Errorf("two entries are expected, but got %d", len(entriesList))
@@ -120,7 +120,7 @@ func TestHostdexSpecificRequired(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
if len(entriesList) != 2 {
t.Errorf("two entries are expected, but got %d", len(entriesList))
@@ -158,7 +158,7 @@ func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
`)
// Verify the existence of internal modules
- result.ModuleForTests("foo-shared_library.xml", "android_common")
+ result.ModuleForTests(t, "foo-shared_library.xml", "android_common")
testCases := []struct {
moduleName string
@@ -168,7 +168,7 @@ func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
{"foo-no_shared_library", []string{"foo-no_shared_library.impl"}},
}
for _, tc := range testCases {
- mod := result.ModuleForTests(tc.moduleName, "android_common").Module()
+ mod := result.ModuleForTests(t, tc.moduleName, "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0]
actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
if !reflect.DeepEqual(tc.expected, actual) {
@@ -205,7 +205,7 @@ func TestAndroidTestHelperApp_LocalDisableTestConfig(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expected := []string{"true"}
@@ -254,7 +254,7 @@ func TestGetOverriddenPackages(t *testing.T) {
}
for _, expected := range expectedVariants {
- mod := ctx.ModuleForTests(expected.name, expected.variantName).Module()
+ mod := ctx.ModuleForTests(t, expected.name, expected.variantName).Module()
entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
actual := entries.EntryMap["LOCAL_OVERRIDES_PACKAGES"]
@@ -304,7 +304,7 @@ func TestJniAsRequiredDeps(t *testing.T) {
}
for _, tc := range testcases {
- mod := ctx.ModuleForTests(tc.name, "android_common").Module()
+ mod := ctx.ModuleForTests(t, tc.name, "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, ctx.TestContext, mod)[0]
required := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
android.AssertDeepEquals(t, "unexpected required deps", tc.expected, required)
diff --git a/java/app_import_test.go b/java/app_import_test.go
index 52ae71979..2600767c1 100644
--- a/java/app_import_test.go
+++ b/java/app_import_test.go
@@ -38,7 +38,7 @@ func TestAndroidAppImport(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
// Check dexpreopt outputs.
if variant.MaybeOutput("dexpreopt/foo/oat/arm64/package.vdex").Rule == nil ||
@@ -78,7 +78,7 @@ func TestAndroidAppImportWithDefaults(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
// Check dexpreopt outputs.
if variant.MaybeOutput("dexpreopt/foo/oat/arm64/package.vdex").Rule == nil ||
@@ -113,7 +113,7 @@ func TestAndroidAppImport_NoDexPreopt(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
// Check dexpreopt outputs. They shouldn't exist.
if variant.MaybeOutput("dexpreopt/foo/oat/arm64/package.vdex").Rule != nil ||
@@ -141,7 +141,7 @@ func TestAndroidAppImport_Presigned(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
// Check dexpreopt outputs.
if variant.MaybeOutput("dexpreopt/foo/oat/arm64/package.vdex").Rule == nil ||
@@ -181,7 +181,7 @@ func TestAndroidAppImport_SigningLineage(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
signedApk := variant.Output("signed/foo.apk")
// Check certificates
@@ -223,7 +223,7 @@ func TestAndroidAppImport_SigningLineageFilegroup(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
signedApk := variant.Output("signed/foo.apk")
// Check cert signing lineage flag.
@@ -253,7 +253,7 @@ func TestAndroidAppImport_DefaultDevCert(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
// Check dexpreopt outputs.
if variant.MaybeOutput("dexpreopt/foo/oat/arm64/package.vdex").Rule == nil ||
@@ -349,7 +349,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- variant := result.ModuleForTests("foo", "android_common")
+ variant := result.ModuleForTests(t, "foo", "android_common")
input := variant.Output("jnis-uncompressed/foo.apk").Input.String()
if strings.HasSuffix(input, test.expected) {
t.Errorf("wrong src apk, expected: %q got: %q", test.expected, input)
@@ -433,7 +433,7 @@ func TestAndroidAppImport_Filename(t *testing.T) {
}
for _, test := range testCases {
- variant := ctx.ModuleForTests(test.name, "android_common")
+ variant := ctx.ModuleForTests(t, test.name, "android_common")
if variant.MaybeOutput(test.expected).Rule == nil {
t.Errorf("can't find output named %q - all outputs: %v", test.expected, variant.AllOutputs())
}
@@ -586,7 +586,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, test.bp)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
if test.expected == "" {
if variant.Module().Enabled(android.PanickingConfigAndErrorContext(ctx)) {
t.Error("module should have been disabled, but wasn't")
@@ -665,7 +665,7 @@ func TestAndroidAppImport_SoongConfigVariables(t *testing.T) {
}),
).RunTestWithBp(t, test.bp).TestContext
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
if test.expected == "" {
if variant.Module().Enabled(android.PanickingConfigAndErrorContext(ctx)) {
t.Error("module should have been disabled, but wasn't")
@@ -704,7 +704,7 @@ func TestAndroidAppImport_overridesDisabledAndroidApp(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("prebuilt_foo", "android_common")
+ variant := ctx.ModuleForTests(t, "prebuilt_foo", "android_common")
a := variant.Module().(*AndroidAppImport)
// The prebuilt module should still be enabled and active even if the source-based counterpart
// is disabled.
@@ -765,7 +765,7 @@ func TestAndroidAppImport_relativeInstallPath(t *testing.T) {
t.Run(testCase.name, func(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, bp)
- mod := ctx.ModuleForTests(testCase.name, "android_common").Module().(*AndroidAppImport)
+ mod := ctx.ModuleForTests(t, testCase.name, "android_common").Module().(*AndroidAppImport)
android.AssertPathRelativeToTopEquals(t, testCase.errorMessage, testCase.expectedInstallPath, mod.installPath)
})
}
@@ -782,7 +782,7 @@ func TestAndroidAppImport_ExtractApk(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
extractRuleArgs := variant.Output("extract-apk/foo.apk").BuildParams.Args
if extractRuleArgs["extract_apk"] != "extract_path/sub_app.apk" {
t.Errorf("Unexpected extract apk args: %s", extractRuleArgs["extract_apk"])
@@ -801,7 +801,7 @@ func TestAndroidTestImport(t *testing.T) {
}
`)
- test := ctx.ModuleForTests("foo", "android_common").Module().(*AndroidTestImport)
+ test := ctx.ModuleForTests(t, "foo", "android_common").Module().(*AndroidTestImport)
// Check android mks.
entries := android.AndroidMkEntriesForTest(t, ctx, test)[0]
@@ -839,13 +839,13 @@ func TestAndroidTestImport_NoJinUncompressForPresigned(t *testing.T) {
}
`)
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
jniRule := variant.Output("jnis-uncompressed/foo.apk").BuildParams.Rule.String()
if jniRule == android.Cp.String() {
t.Errorf("Unexpected JNI uncompress rule command: %s", jniRule)
}
- variant = ctx.ModuleForTests("foo_presigned", "android_common")
+ variant = ctx.ModuleForTests(t, "foo_presigned", "android_common")
jniRule = variant.Output("jnis-uncompressed/foo_presigned.apk").BuildParams.Rule.String()
if jniRule != android.Cp.String() {
t.Errorf("Unexpected JNI uncompress rule: %s", jniRule)
@@ -867,7 +867,7 @@ func TestAndroidTestImport_Preprocessed(t *testing.T) {
`)
apkName := "foo.apk"
- variant := ctx.ModuleForTests("foo", "android_common")
+ variant := ctx.ModuleForTests(t, "foo", "android_common")
jniRule := variant.Output("jnis-uncompressed/" + apkName).BuildParams.Rule.String()
if jniRule != android.Cp.String() {
t.Errorf("Unexpected JNI uncompress rule: %s", jniRule)
@@ -912,7 +912,7 @@ func TestAndroidAppImport_Preprocessed(t *testing.T) {
// non-privileged app
apkName := "foo.apk"
- variant := result.ModuleForTests("foo", "android_common")
+ variant := result.ModuleForTests(t, "foo", "android_common")
outputBuildParams := variant.Output(apkName).BuildParams
if outputBuildParams.Rule.String() != android.Cp.String() {
t.Errorf("Unexpected prebuilt android_app_import rule: %s", outputBuildParams.Rule.String())
@@ -934,7 +934,7 @@ func TestAndroidAppImport_Preprocessed(t *testing.T) {
// privileged app
apkName = "bar.apk"
- variant = result.ModuleForTests("bar", "android_common")
+ variant = result.ModuleForTests(t, "bar", "android_common")
outputBuildParams = variant.Output(apkName).BuildParams
if outputBuildParams.Rule.String() != android.Cp.String() {
t.Errorf("Unexpected prebuilt android_app_import rule: %s", outputBuildParams.Rule.String())
@@ -1003,7 +1003,7 @@ func TestAndroidTestImport_UncompressDex(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
actual := foo.MaybeRule("uncompress-dex").Rule != nil
expect := !unbundled
@@ -1047,7 +1047,7 @@ func TestAppImportMissingCertificateAllowMissingDependencies(t *testing.T) {
certificate: ":missing_certificate",
}`)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
fooApk := foo.Output("signed/foo.apk")
if fooApk.Rule != android.ErrorRule {
t.Fatalf("expected ErrorRule for foo.apk, got %s", fooApk.Rule.String())
diff --git a/java/app_set_test.go b/java/app_set_test.go
index cc7af042b..9b4c44bc9 100644
--- a/java/app_set_test.go
+++ b/java/app_set_test.go
@@ -31,7 +31,7 @@ func TestAndroidAppSet(t *testing.T) {
set: "prebuilts/apks/app.apks",
prerelease: true,
}`)
- module := result.ModuleForTests("foo", "android_common")
+ module := result.ModuleForTests(t, "foo", "android_common")
const packedSplitApks = "foo.zip"
params := module.Output(packedSplitApks)
if params.Rule == nil {
@@ -127,7 +127,7 @@ func TestAndroidAppSet_Variants(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- module := ctx.ModuleForTests("foo", "android_common")
+ module := ctx.ModuleForTests(t, "foo", "android_common")
const packedSplitApks = "foo.zip"
params := module.Output(packedSplitApks)
for k, v := range test.expected {
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)
})
}
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go
index d181ce060..87b853c56 100644
--- a/java/bootclasspath_fragment_test.go
+++ b/java/bootclasspath_fragment_test.go
@@ -371,7 +371,7 @@ func TestFromTextWidestApiScope(t *testing.T) {
}
`)
- fragment := result.ModuleForTests("myfragment", "android_common")
+ fragment := result.ModuleForTests(t, "myfragment", "android_common")
dependencyStubDexFlag := "--dependency-stub-dex=out/soong/.intermediates/default/java/android-non-updatable.stubs.test_module_lib/android_common/dex/android-non-updatable.stubs.test_module_lib.jar"
stubFlagsCommand := fragment.Output("modular-hiddenapi/stub-flags.csv").RuleParams.Command
android.AssertStringDoesContain(t,
@@ -479,7 +479,7 @@ func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) {
// Make sure that the signature-patterns.csv is passed all the appropriate package properties
// from the bootclasspath_fragment and its contents.
- fragment := result.ModuleForTests("mybootclasspathfragment", "android_common")
+ fragment := result.ModuleForTests(t, "mybootclasspathfragment", "android_common")
rule := fragment.Output("modular-hiddenapi/signature-patterns.csv")
expectedCommand := strings.Join([]string{
"--split-package newlibrary",
diff --git a/java/container_test.go b/java/container_test.go
index 515236d7d..35a3020ec 100644
--- a/java/container_test.go
+++ b/java/container_test.go
@@ -155,7 +155,7 @@ func TestJavaContainersModuleProperties(t *testing.T) {
}
for _, c := range testcases {
- m := result.ModuleForTests(c.moduleName, "android_common")
+ m := result.ModuleForTests(t, c.moduleName, "android_common")
containers, _ := android.OtherModuleProvider(result.TestContext.OtherModuleProviderAdaptor(), m.Module(), android.ContainersInfoProvider)
belongingContainers := containers.BelongingContainers()
checkContainerMatch(t, c.moduleName, "system", c.isSystemContainer, android.InList(android.SystemContainer, belongingContainers))
diff --git a/java/device_host_converter_test.go b/java/device_host_converter_test.go
index 45369e2d6..197bb9f95 100644
--- a/java/device_host_converter_test.go
+++ b/java/device_host_converter_test.go
@@ -53,15 +53,15 @@ func TestDeviceForHost(t *testing.T) {
ctx, config := testJava(t, bp)
- deviceModule := ctx.ModuleForTests("device_module", "android_common")
+ deviceModule := ctx.ModuleForTests(t, "device_module", "android_common")
deviceTurbineCombined := deviceModule.Output("turbine-combined/device_module.jar")
deviceJavac := deviceModule.Output("javac/device_module.jar")
deviceRes := deviceModule.Output("res/device_module.jar")
- deviceImportModule := ctx.ModuleForTests("device_import_module", "android_common")
+ deviceImportModule := ctx.ModuleForTests(t, "device_import_module", "android_common")
deviceImportCombined := deviceImportModule.Output("combined/device_import_module.jar")
- hostModule := ctx.ModuleForTests("host_module", config.BuildOSCommonTarget.String())
+ hostModule := ctx.ModuleForTests(t, "host_module", config.BuildOSCommonTarget.String())
hostJavac := hostModule.Output("javac/host_module.jar")
hostRes := hostModule.Output("res/host_module.jar")
combined := hostModule.Output("combined/host_module.jar")
@@ -135,15 +135,15 @@ func TestHostForDevice(t *testing.T) {
ctx, config := testJava(t, bp)
- hostModule := ctx.ModuleForTests("host_module", config.BuildOSCommonTarget.String())
+ hostModule := ctx.ModuleForTests(t, "host_module", config.BuildOSCommonTarget.String())
hostJavac := hostModule.Output("javac/host_module.jar")
hostJavacHeader := hostModule.Output("javac-header/host_module.jar")
hostRes := hostModule.Output("res/host_module.jar")
- hostImportModule := ctx.ModuleForTests("host_import_module", config.BuildOSCommonTarget.String())
+ hostImportModule := ctx.ModuleForTests(t, "host_import_module", config.BuildOSCommonTarget.String())
hostImportCombined := hostImportModule.Output("combined/host_import_module.jar")
- deviceModule := ctx.ModuleForTests("device_module", "android_common")
+ deviceModule := ctx.ModuleForTests(t, "device_module", "android_common")
deviceJavac := deviceModule.Output("javac/device_module.jar")
deviceRes := deviceModule.Output("res/device_module.jar")
combined := deviceModule.Output("combined/device_module.jar")
diff --git a/java/dex_test.go b/java/dex_test.go
index 4e515b403..2126e42e8 100644
--- a/java/dex_test.go
+++ b/java/dex_test.go
@@ -60,11 +60,11 @@ func TestR8(t *testing.T) {
}
`)
- app := result.ModuleForTests("app", "android_common")
- stableApp := result.ModuleForTests("stable_app", "android_common")
- corePlatformApp := result.ModuleForTests("core_platform_app", "android_common")
- lib := result.ModuleForTests("lib", "android_common")
- staticLib := result.ModuleForTests("static_lib", "android_common")
+ app := result.ModuleForTests(t, "app", "android_common")
+ stableApp := result.ModuleForTests(t, "stable_app", "android_common")
+ corePlatformApp := result.ModuleForTests(t, "core_platform_app", "android_common")
+ lib := result.ModuleForTests(t, "lib", "android_common")
+ staticLib := result.ModuleForTests(t, "static_lib", "android_common")
appJavac := app.Rule("javac")
appR8 := app.Rule("r8")
@@ -210,14 +210,14 @@ func TestR8TransitiveDeps(t *testing.T) {
result := fixturePreparer.RunTestWithBp(t, bp)
getHeaderJar := func(name string) android.Path {
- mod := result.ModuleForTests(name, "android_common")
+ mod := result.ModuleForTests(t, name, "android_common")
return mod.Output("turbine-combined/" + name + ".jar").Output
}
- appR8 := result.ModuleForTests("app", "android_common").Rule("r8")
- overrideAppR8 := result.ModuleForTests("app", "android_common_override_app").Rule("r8")
+ appR8 := result.ModuleForTests(t, "app", "android_common").Rule("r8")
+ overrideAppR8 := result.ModuleForTests(t, "app", "android_common_override_app").Rule("r8")
appHeader := getHeaderJar("app")
- overrideAppHeader := result.ModuleForTests("app", "android_common_override_app").Output("turbine-combined/app.jar").Output
+ overrideAppHeader := result.ModuleForTests(t, "app", "android_common_override_app").Output("turbine-combined/app.jar").Output
libHeader := getHeaderJar("lib")
transitiveLibHeader := getHeaderJar("transitive_lib")
transitiveLib2Header := getHeaderJar("transitive_lib_2")
@@ -226,7 +226,7 @@ func TestR8TransitiveDeps(t *testing.T) {
repeatedDepHeader := getHeaderJar("repeated_dep")
usesLibHeader := getHeaderJar("uses_lib")
optionalUsesLibHeader := getHeaderJar("optional_uses_lib")
- prebuiltLibHeader := result.ModuleForTests("prebuilt_lib", "android_common").Output("combined/lib.jar").Output
+ prebuiltLibHeader := result.ModuleForTests(t, "prebuilt_lib", "android_common").Output("combined/lib.jar").Output
for _, rule := range []android.TestingBuildParams{appR8, overrideAppR8} {
android.AssertStringDoesNotContain(t, "expected no app header jar in app r8 classpath",
@@ -278,7 +278,7 @@ func TestR8Flags(t *testing.T) {
}
`)
- app := result.ModuleForTests("app", "android_common")
+ app := result.ModuleForTests(t, "app", "android_common")
appR8 := app.Rule("r8")
android.AssertStringDoesContain(t, "expected -dontshrink in app r8 flags",
appR8.Args["r8Flags"], "-dontshrink")
@@ -323,10 +323,10 @@ func TestD8(t *testing.T) {
}
`)
- foo := result.ModuleForTests("foo", "android_common")
- lib := result.ModuleForTests("lib", "android_common")
- app := result.ModuleForTests("app", "android_common")
- staticLib := result.ModuleForTests("static_lib", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
+ lib := result.ModuleForTests(t, "lib", "android_common")
+ app := result.ModuleForTests(t, "app", "android_common")
+ staticLib := result.ModuleForTests(t, "static_lib", "android_common")
fooJavac := foo.Rule("javac")
fooD8 := foo.Rule("d8")
@@ -398,7 +398,7 @@ func TestProguardFlagsInheritanceStatic(t *testing.T) {
}
`)
- app := result.ModuleForTests("app", "android_common")
+ app := result.ModuleForTests(t, "app", "android_common")
appR8 := app.Rule("r8")
android.AssertStringDoesContain(t, "expected primary_lib's proguard flags from direct dep",
appR8.Args["r8Flags"], "primary.flags")
@@ -647,7 +647,7 @@ func TestProguardFlagsInheritance(t *testing.T) {
tc.transitiveDepExportsFlagsFiles,
),
)
- appR8 := result.ModuleForTests("app", "android_common").Rule("r8")
+ appR8 := result.ModuleForTests(t, "app", "android_common").Rule("r8")
shouldHaveDepFlags := android.InList(directDepFlagsFileName, tc.expectedFlagsFiles)
if shouldHaveDepFlags {
@@ -689,7 +689,7 @@ func TestProguardFlagsInheritanceAppImport(t *testing.T) {
PrepareForTestWithJavaDefaultModules,
).RunTestWithBp(t, bp)
- appR8 := result.ModuleForTests("app", "android_common").Rule("r8")
+ appR8 := result.ModuleForTests(t, "app", "android_common").Rule("r8")
android.AssertStringDoesContain(t, "expected aarimports's proguard flags",
appR8.Args["r8Flags"], "proguard.txt")
}
@@ -709,7 +709,7 @@ func TestR8FlagsArtProfile(t *testing.T) {
}
`)
- app := result.ModuleForTests("app", "android_common")
+ app := result.ModuleForTests(t, "app", "android_common")
appR8 := app.Rule("r8")
android.AssertStringDoesContain(t, "expected --art-profile in app r8 flags",
appR8.Args["r8Flags"], "--art-profile")
@@ -847,7 +847,7 @@ func TestDebugReleaseFlags(t *testing.T) {
dexRuleKey = "d8"
}
dexFlagsKey := dexRuleKey + "Flags"
- appDex := result.ModuleForTests("app", "android_common").Rule(dexRuleKey)
+ appDex := result.ModuleForTests(t, "app", "android_common").Rule(dexRuleKey)
android.AssertStringDoesContain(t, "expected flag in dex flags",
appDex.Args[dexFlagsKey], tc.expectedFlags)
diff --git a/java/dexpreopt_config_testing.go b/java/dexpreopt_config_testing.go
index fbdb7b028..241941eb8 100644
--- a/java/dexpreopt_config_testing.go
+++ b/java/dexpreopt_config_testing.go
@@ -1237,7 +1237,7 @@ func nestedCheckBootImageConfig(t *testing.T, result *android.TestResult, imageC
android.AssertPathRelativeToTopEquals(t, "zip", expected.zip, imageConfig.zip)
if !mutated {
- dexBootJarModule := result.ModuleForTests("dex_bootjars", "android_common")
+ dexBootJarModule := result.ModuleForTests(t, "dex_bootjars", "android_common")
profileInstallInfo, _ := android.OtherModuleProvider(result, dexBootJarModule.Module(), profileInstallInfoProvider)
assertInstallsEqual(t, "profileInstalls", expected.profileInstalls, profileInstallInfo.profileInstalls)
android.AssertStringEquals(t, "profileLicenseMetadataFile", expected.profileLicenseMetadataFile, profileInstallInfo.profileLicenseMetadataFile.RelativeToTop().String())
@@ -1281,7 +1281,7 @@ func CheckMutatedFrameworkBootImageConfig(t *testing.T, result *android.TestResu
// checkDexpreoptMakeVars checks the DEXPREOPT_ prefixed make vars produced by dexpreoptBootJars
// singleton.
func checkDexpreoptMakeVars(t *testing.T, result *android.TestResult, expectedLicenseMetadataFile string) {
- vars := result.MakeVarsForTesting(func(variable android.MakeVarVariable) bool {
+ vars := result.MakeVarsForTesting(t, func(variable android.MakeVarVariable) bool {
return strings.HasPrefix(variable.Name(), "DEXPREOPT_")
})
diff --git a/java/dexpreopt_test.go b/java/dexpreopt_test.go
index bf660475f..f437da02c 100644
--- a/java/dexpreopt_test.go
+++ b/java/dexpreopt_test.go
@@ -239,7 +239,7 @@ func TestDexpreoptEnabled(t *testing.T) {
variant += "_apex1000"
}
- dexpreopt := ctx.ModuleForTests(moduleName, variant).MaybeRule("dexpreopt")
+ dexpreopt := ctx.ModuleForTests(t, moduleName, variant).MaybeRule("dexpreopt")
enabled := dexpreopt.Rule != nil
if enabled != test.enabled {
@@ -325,7 +325,7 @@ func TestApexSystemServerDexpreoptInstalls(t *testing.T) {
sdk_version: "current",
}`)
ctx := result.TestContext
- module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
+ module := ctx.ModuleForTests(t, "service-foo", "android_common_apex1000")
library := module.Module().(*Library)
installs := library.dexpreopter.ApexSystemServerDexpreoptInstalls()
@@ -367,7 +367,7 @@ func TestApexSystemServerDexpreoptInstalls(t *testing.T) {
sdk_version: "current",
}`)
ctx = result.TestContext
- module = ctx.ModuleForTests("foo", "android_common")
+ module = ctx.ModuleForTests(t, "foo", "android_common")
library = module.Module().(*Library)
installs = library.dexpreopter.ApexSystemServerDexpreoptInstalls()
@@ -396,7 +396,7 @@ func TestGenerateProfileEvenIfDexpreoptIsDisabled(t *testing.T) {
}`)
ctx := result.TestContext
- dexpreopt := ctx.ModuleForTests("foo", "android_common").MaybeRule("dexpreopt")
+ dexpreopt := ctx.ModuleForTests(t, "foo", "android_common").MaybeRule("dexpreopt")
expected := []string{"out/soong/.intermediates/foo/android_common/dexpreopt/foo/profile.prof"}
diff --git a/java/droiddoc_test.go b/java/droiddoc_test.go
index 2256f1e23..0c977bceb 100644
--- a/java/droiddoc_test.go
+++ b/java/droiddoc_test.go
@@ -70,13 +70,13 @@ func TestDroiddoc(t *testing.T) {
"bar-doc/a.java": nil,
"bar-doc/b.java": nil,
})
- barStubsOutputs := ctx.ModuleForTests("bar-stubs", "android_common").OutputFiles(ctx, t, "")
+ barStubsOutputs := ctx.ModuleForTests(t, "bar-stubs", "android_common").OutputFiles(ctx, t, "")
if len(barStubsOutputs) != 1 {
t.Errorf("Expected one output from \"bar-stubs\" got %s", barStubsOutputs)
}
barStubsOutput := barStubsOutputs[0]
- barDoc := ctx.ModuleForTests("bar-doc", "android_common")
+ barDoc := ctx.ModuleForTests(t, "bar-doc", "android_common")
javaDoc := barDoc.Rule("javadoc")
if g, w := android.PathsRelativeToTop(javaDoc.Implicits), android.PathRelativeToTop(barStubsOutput); !inList(w, g) {
t.Errorf("implicits of bar-doc must contain %q, but was %q.", w, g)
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index faa9a1539..dfdf87703 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -83,7 +83,7 @@ func TestDroidstubs(t *testing.T) {
},
}
for _, c := range testcases {
- m := ctx.ModuleForTests(c.moduleName, "android_common")
+ m := ctx.ModuleForTests(t, c.moduleName, "android_common")
manifest := m.Output("metalava.sbox.textproto")
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, manifest)
cmdline := String(sboxProto.Commands[0].Command)
@@ -132,7 +132,7 @@ func getAndroidJarPatternsForDroidstubs(t *testing.T, sdkType string) []string {
"foo-doc/a.java": nil,
})
- m := ctx.ModuleForTests("foo-stubs", "android_common")
+ m := ctx.ModuleForTests(t, "foo-stubs", "android_common")
manifest := m.Output("metalava.sbox.textproto")
cmd := String(android.RuleBuilderSboxProtoForTests(t, ctx, manifest).Commands[0].Command)
r := regexp.MustCompile(`--android-jar-pattern [^ ]+/android.jar`)
@@ -210,7 +210,7 @@ func TestDroidstubsSandbox(t *testing.T) {
"bar-doc/a.java": nil,
})
- m := ctx.ModuleForTests("bar-stubs", "android_common")
+ m := ctx.ModuleForTests(t, "bar-stubs", "android_common")
metalava := m.Rule("metalava")
if g, w := metalava.Inputs.Strings(), []string{"bar-doc/a.java"}; !reflect.DeepEqual(w, g) {
t.Errorf("Expected inputs %q, got %q", w, g)
@@ -271,7 +271,7 @@ func TestDroidstubsWithSystemModules(t *testing.T) {
}
func checkSystemModulesUseByDroidstubs(t *testing.T, ctx *android.TestContext, moduleName string, systemJar string) {
- metalavaRule := ctx.ModuleForTests(moduleName, "android_common").Rule("metalava")
+ metalavaRule := ctx.ModuleForTests(t, moduleName, "android_common").Rule("metalava")
var systemJars []string
for _, i := range metalavaRule.Implicits {
systemJars = append(systemJars, i.Base())
@@ -304,7 +304,7 @@ func TestDroidstubsWithSdkExtensions(t *testing.T) {
"sdk/extensions/1/public/some-mainline-module-stubs.jar": nil,
"sdk/extensions/info.txt": nil,
})
- m := ctx.ModuleForTests("baz-stubs", "android_common")
+ m := ctx.ModuleForTests(t, "baz-stubs", "android_common")
manifest := m.Output("metalava.sbox.textproto")
cmdline := String(android.RuleBuilderSboxProtoForTests(t, ctx, manifest).Commands[0].Command)
android.AssertStringDoesContain(t, "android-jar-pattern present", cmdline, "--android-jar-pattern sdk/extensions/{version:extension}/public/{module}.jar")
@@ -332,7 +332,7 @@ func TestDroidStubsApiContributionGeneration(t *testing.T) {
},
)
- ctx.ModuleForTests("foo.api.contribution", "")
+ ctx.ModuleForTests(t, "foo.api.contribution", "")
}
func TestGeneratedApiContributionVisibilityTest(t *testing.T) {
@@ -366,7 +366,7 @@ func TestGeneratedApiContributionVisibilityTest(t *testing.T) {
},
)
- ctx.ModuleForTests("bar", "android_common")
+ ctx.ModuleForTests(t, "bar", "android_common")
}
func TestAconfigDeclarations(t *testing.T) {
@@ -408,7 +408,7 @@ func TestAconfigDeclarations(t *testing.T) {
android.AssertBoolEquals(t, "foo expected to depend on bar",
CheckModuleHasDependency(t, result.TestContext, "foo", "android_common", "bar"), true)
- m := result.ModuleForTests("foo", "android_common")
+ m := result.ModuleForTests(t, "foo", "android_common")
android.AssertStringDoesContain(t, "foo generates revert annotations file",
strings.Join(m.AllOutputs(), ""), "revert-annotations-exportable.txt")
@@ -458,7 +458,7 @@ func TestReleaseExportRuntimeApis(t *testing.T) {
}
`)
- m := result.ModuleForTests("foo", "android_common")
+ m := result.ModuleForTests(t, "foo", "android_common")
rule := m.Output("released-flagged-apis-exportable.txt")
exposeWritableApisFilter := "--filter='state:ENABLED+permission:READ_ONLY' --filter='permission:READ_WRITE'"
diff --git a/java/fuzz_test.go b/java/fuzz_test.go
index 40adae0cb..8cbe873ad 100644
--- a/java/fuzz_test.go
+++ b/java/fuzz_test.go
@@ -64,14 +64,14 @@ func TestJavaFuzz(t *testing.T) {
osCommonTarget := result.Config.BuildOSCommonTarget.String()
- javac := result.ModuleForTests("foo", osCommonTarget).Rule("javac")
- combineJar := result.ModuleForTests("foo", osCommonTarget).Description("for javac")
+ javac := result.ModuleForTests(t, "foo", osCommonTarget).Rule("javac")
+ combineJar := result.ModuleForTests(t, "foo", osCommonTarget).Description("for javac")
if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "a.java" {
t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
}
- baz := result.ModuleForTests("baz", osCommonTarget).Rule("javac").Output.String()
+ baz := result.ModuleForTests(t, "baz", osCommonTarget).Rule("javac").Output.String()
barOut := filepath.Join("out", "soong", ".intermediates", "bar", osCommonTarget, "javac-header", "bar.jar")
bazOut := filepath.Join("out", "soong", ".intermediates", "baz", osCommonTarget, "javac-header", "baz.jar")
@@ -83,7 +83,7 @@ func TestJavaFuzz(t *testing.T) {
}
ctx := result.TestContext
- foo := ctx.ModuleForTests("foo", osCommonTarget).Module().(*JavaFuzzTest)
+ foo := ctx.ModuleForTests(t, "foo", osCommonTarget).Module().(*JavaFuzzTest)
expected := "lib64/libjni.so"
if runtime.GOOS == "darwin" {
diff --git a/java/generated_java_library_test.go b/java/generated_java_library_test.go
index 7efd54b39..e5ee5861e 100644
--- a/java/generated_java_library_test.go
+++ b/java/generated_java_library_test.go
@@ -61,6 +61,6 @@ func TestGenLib(t *testing.T) {
`
result := testGenLib(t, android.FixtureExpectsNoErrors, bp)
- javagenlibtest := result.ModuleForTests("javagenlibtest", "android_common").Module().(*GeneratedJavaLibraryModule)
+ javagenlibtest := result.ModuleForTests(t, "javagenlibtest", "android_common").Module().(*GeneratedJavaLibraryModule)
android.AssertPathsEndWith(t, "Generated_srcjars", []string{"/blah.srcjar"}, javagenlibtest.Library.properties.Generated_srcjars)
}
diff --git a/java/genrule_combiner_test.go b/java/genrule_combiner_test.go
index a45895202..7d024cfec 100644
--- a/java/genrule_combiner_test.go
+++ b/java/genrule_combiner_test.go
@@ -57,15 +57,15 @@ func TestJarGenruleCombinerSingle(t *testing.T) {
}
`).TestContext
- fooMod := ctx.ModuleForTests("foo", "android_common")
+ fooMod := ctx.ModuleForTests(t, "foo", "android_common")
fooCombined := fooMod.Output("turbine-combined/foo.jar")
fooOutputFiles, _ := android.OtherModuleProvider(ctx.OtherModuleProviderAdaptor(), fooMod.Module(), android.OutputFilesProvider)
fooHeaderJars := fooOutputFiles.TaggedOutputFiles[".hjar"]
- genMod := ctx.ModuleForTests("gen", "android_common")
+ genMod := ctx.ModuleForTests(t, "gen", "android_common")
gen := genMod.Output("gen.jar")
- jarcombMod := ctx.ModuleForTests("jarcomb", "android_common")
+ jarcombMod := ctx.ModuleForTests(t, "jarcomb", "android_common")
jarcombInfo, _ := android.OtherModuleProvider(ctx.OtherModuleProviderAdaptor(), jarcombMod.Module(), JavaInfoProvider)
jarcombOutputFiles, _ := android.OtherModuleProvider(ctx.OtherModuleProviderAdaptor(), jarcombMod.Module(), android.OutputFilesProvider)
@@ -93,7 +93,7 @@ func TestJarGenruleCombinerSingle(t *testing.T) {
android.PathsRelativeToTop(jarcombInfo.HeaderJars), android.PathRelativeToTop(fooCombined.Output))
}
- barMod := ctx.ModuleForTests("bar", "android_common")
+ barMod := ctx.ModuleForTests(t, "bar", "android_common")
bar := barMod.Output("javac/bar.jar")
barCombined := barMod.Output("combined/bar.jar")
@@ -105,7 +105,7 @@ func TestJarGenruleCombinerSingle(t *testing.T) {
barCombined.Inputs.Strings(), bar.Output.String(), gen.Output.String())
}
- bazMod := ctx.ModuleForTests("baz", "android_common")
+ bazMod := ctx.ModuleForTests(t, "baz", "android_common")
baz := bazMod.Output("javac/baz.jar")
string_in_list := func(s string, l []string) bool {
@@ -176,12 +176,12 @@ func TestJarGenruleCombinerMulti(t *testing.T) {
}
`).TestContext
- gen1Mod := ctx.ModuleForTests("gen1", "android_common")
+ gen1Mod := ctx.ModuleForTests(t, "gen1", "android_common")
gen1 := gen1Mod.Output("gen1.jar")
- gen2Mod := ctx.ModuleForTests("gen2", "android_common")
+ gen2Mod := ctx.ModuleForTests(t, "gen2", "android_common")
gen2 := gen2Mod.Output("gen2.jar")
- jarcombMod := ctx.ModuleForTests("jarcomb", "android_common")
+ jarcombMod := ctx.ModuleForTests(t, "jarcomb", "android_common")
jarcomb := jarcombMod.Output("combined/jarcomb.jar")
jarcombTurbine := jarcombMod.Output("turbine-combined/jarcomb.jar")
_ = jarcombTurbine
@@ -203,7 +203,7 @@ func TestJarGenruleCombinerMulti(t *testing.T) {
android.PathsRelativeToTop(jarcombHeaderJars), android.PathRelativeToTop(jarcombTurbine.Output))
}
- barMod := ctx.ModuleForTests("bar", "android_common")
+ barMod := ctx.ModuleForTests(t, "bar", "android_common")
bar := barMod.Output("javac/bar.jar")
barCombined := barMod.Output("combined/bar.jar")
@@ -215,7 +215,7 @@ func TestJarGenruleCombinerMulti(t *testing.T) {
barCombined.Inputs.Strings(), bar.Output.String(), jarcomb.Output.String())
}
- bazMod := ctx.ModuleForTests("baz", "android_common")
+ bazMod := ctx.ModuleForTests(t, "baz", "android_common")
baz := bazMod.Output("javac/baz.jar")
string_in_list := func(s string, l []string) bool {
diff --git a/java/genrule_test.go b/java/genrule_test.go
index b4e9d218d..c112e4503 100644
--- a/java/genrule_test.go
+++ b/java/genrule_test.go
@@ -57,7 +57,7 @@ func TestGenruleCmd(t *testing.T) {
t.Fatal(errs)
}
- gen := ctx.ModuleForTests("gen", "android_common").Output("out")
+ gen := ctx.ModuleForTests(t, "gen", "android_common").Output("out")
expected := []string{"foo"}
if !reflect.DeepEqual(expected, gen.Implicits.Strings()[:len(expected)]) {
t.Errorf(`want arm inputs %v, got %v`, expected, gen.Implicits.Strings())
@@ -93,11 +93,11 @@ func TestJarGenrules(t *testing.T) {
}
`)
- foo := ctx.ModuleForTests("foo", "android_common").Output("javac/foo.jar")
- jargen := ctx.ModuleForTests("jargen", "android_common").Output("jargen.jar")
- bar := ctx.ModuleForTests("bar", "android_common").Output("javac/bar.jar")
- baz := ctx.ModuleForTests("baz", "android_common").Output("javac/baz.jar")
- barCombined := ctx.ModuleForTests("bar", "android_common").Output("combined/bar.jar")
+ foo := ctx.ModuleForTests(t, "foo", "android_common").Output("javac/foo.jar")
+ jargen := ctx.ModuleForTests(t, "jargen", "android_common").Output("jargen.jar")
+ bar := ctx.ModuleForTests(t, "bar", "android_common").Output("javac/bar.jar")
+ baz := ctx.ModuleForTests(t, "baz", "android_common").Output("javac/baz.jar")
+ barCombined := ctx.ModuleForTests(t, "bar", "android_common").Output("combined/bar.jar")
if g, w := jargen.Implicits.Strings(), foo.Output.String(); !android.InList(w, g) {
t.Errorf("expected jargen inputs [%q], got %q", w, g)
diff --git a/java/hiddenapi_singleton_test.go b/java/hiddenapi_singleton_test.go
index c14fdb7bb..147f326c7 100644
--- a/java/hiddenapi_singleton_test.go
+++ b/java/hiddenapi_singleton_test.go
@@ -57,7 +57,7 @@ func TestHiddenAPISingleton(t *testing.T) {
}
`)
- hiddenAPI := result.ModuleForTests("platform-bootclasspath", "android_common")
+ hiddenAPI := result.ModuleForTests(t, "platform-bootclasspath", "android_common")
hiddenapiRule := hiddenAPI.Rule("platform-bootclasspath-monolithic-hiddenapi-stub-flags")
want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want)
@@ -101,7 +101,7 @@ func TestHiddenAPISingletonWithPrebuilt(t *testing.T) {
}
`)
- hiddenAPI := result.ModuleForTests("platform-bootclasspath", "android_common")
+ hiddenAPI := result.ModuleForTests(t, "platform-bootclasspath", "android_common")
hiddenapiRule := hiddenAPI.Rule("platform-bootclasspath-monolithic-hiddenapi-stub-flags")
want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want)
@@ -128,7 +128,7 @@ func TestHiddenAPISingletonWithPrebuiltUseSource(t *testing.T) {
}
`)
- hiddenAPI := result.ModuleForTests("platform-bootclasspath", "android_common")
+ hiddenAPI := result.ModuleForTests(t, "platform-bootclasspath", "android_common")
hiddenapiRule := hiddenAPI.Rule("platform-bootclasspath-monolithic-hiddenapi-stub-flags")
fromSourceJarArg := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, fromSourceJarArg)
@@ -158,7 +158,7 @@ func TestHiddenAPISingletonWithPrebuiltOverrideSource(t *testing.T) {
}
`)
- hiddenAPI := result.ModuleForTests("platform-bootclasspath", "android_common")
+ hiddenAPI := result.ModuleForTests(t, "platform-bootclasspath", "android_common")
hiddenapiRule := hiddenAPI.Rule("platform-bootclasspath-monolithic-hiddenapi-stub-flags")
prebuiltJarArg := "--boot-dex=out/soong/.intermediates/prebuilt_foo/android_common/dex/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, prebuiltJarArg)
@@ -219,7 +219,7 @@ func TestHiddenAPISingletonSdks(t *testing.T) {
}
`)
- hiddenAPI := result.ModuleForTests("platform-bootclasspath", "android_common")
+ hiddenAPI := result.ModuleForTests(t, "platform-bootclasspath", "android_common")
hiddenapiRule := hiddenAPI.Rule("platform-bootclasspath-monolithic-hiddenapi-stub-flags")
wantPublicStubs := "--public-stub-classpath=" + generateSdkDexPath(tc.publicStub, tc.unbundledBuild)
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, wantPublicStubs)
@@ -279,9 +279,9 @@ func TestHiddenAPISingletonWithPrebuiltCsvFile(t *testing.T) {
expectedCpOutput := "out/soong/hiddenapi/hiddenapi-flags.csv"
expectedFlagsCsv := "out/soong/hiddenapi/hiddenapi-flags.csv"
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
- hiddenAPI := result.SingletonForTests("hiddenapi")
+ hiddenAPI := result.SingletonForTests(t, "hiddenapi")
cpRule := hiddenAPI.Rule("Cp")
actualCpInput := cpRule.BuildParams.Input
actualCpOutput := cpRule.BuildParams.Output
@@ -318,7 +318,7 @@ func TestHiddenAPIEncoding_JavaSdkLibrary(t *testing.T) {
`)
checkDexEncoded := func(t *testing.T, name, unencodedDexJar, encodedDexJar string) {
- moduleForTests := result.ModuleForTests(name+".impl", "android_common")
+ moduleForTests := result.ModuleForTests(t, name+".impl", "android_common")
encodeDexRule := moduleForTests.Rule("hiddenAPIEncodeDex")
actualUnencodedDexJar := encodeDexRule.Input
diff --git a/java/jarjar_test.go b/java/jarjar_test.go
index 82bfa2b86..b68976155 100644
--- a/java/jarjar_test.go
+++ b/java/jarjar_test.go
@@ -22,7 +22,7 @@ import (
)
func AssertJarJarRename(t *testing.T, result *android.TestResult, libName, original, expectedRename string) {
- module := result.ModuleForTests(libName, "android_common")
+ module := result.ModuleForTests(t, libName, "android_common")
provider, found := android.OtherModuleProvider(result.OtherModuleProviderAdaptor(), module.Module(), JarJarProvider)
android.AssertBoolEquals(t, fmt.Sprintf("found provider (%s)", libName), true, found)
diff --git a/java/java_test.go b/java/java_test.go
index de58237bc..f097762eb 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -349,7 +349,7 @@ func TestSimple(t *testing.T) {
PrepareForTestWithJavaDefaultModules,
tt.preparer,
).RunTestWithBp(t, bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
fooJavac := foo.Rule("javac")
android.AssertPathsRelativeToTopEquals(t, "foo javac inputs", tt.fooJavacInputs, fooJavac.Inputs)
@@ -364,7 +364,7 @@ func TestSimple(t *testing.T) {
fooCombinedHeaderJar := foo.Output("turbine-combined/foo.jar")
android.AssertPathsRelativeToTopEquals(t, "foo header combined inputs", tt.fooHeaderCombinedInputs, fooCombinedHeaderJar.Inputs)
- bar := result.ModuleForTests("bar", "android_common")
+ bar := result.ModuleForTests(t, "bar", "android_common")
barJavac := bar.Rule("javac")
android.AssertPathsRelativeToTopEquals(t, "bar javac inputs", tt.barJavacInputs, barJavac.Inputs)
@@ -475,11 +475,11 @@ func TestExportedPlugins(t *testing.T) {
`+test.extra)
for _, want := range test.results {
- javac := ctx.ModuleForTests(want.library, "android_common").Rule("javac")
+ javac := ctx.ModuleForTests(t, want.library, "android_common").Rule("javac")
if javac.Args["processor"] != want.processors {
t.Errorf("For library %v, expected %v, found %v", want.library, want.processors, javac.Args["processor"])
}
- turbine := ctx.ModuleForTests(want.library, "android_common").MaybeRule("turbine")
+ turbine := ctx.ModuleForTests(t, want.library, "android_common").MaybeRule("turbine")
disableTurbine := turbine.BuildParams.Rule == nil
if disableTurbine != want.disableTurbine {
t.Errorf("For library %v, expected disableTurbine %v, found %v", want.library, want.disableTurbine, disableTurbine)
@@ -545,7 +545,7 @@ func TestArchSpecific(t *testing.T) {
}
`)
- javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Rule("javac")
if len(javac.Inputs) != 2 || javac.Inputs[0].String() != "a.java" || javac.Inputs[1].String() != "b.java" {
t.Errorf(`foo inputs %v != ["a.java", "b.java"]`, javac.Inputs)
}
@@ -576,11 +576,11 @@ func TestBinary(t *testing.T) {
buildOS := ctx.Config().BuildOS.String()
- bar := ctx.ModuleForTests("bar", buildOS+"_common")
+ bar := ctx.ModuleForTests(t, "bar", buildOS+"_common")
barJar := bar.Output("bar.jar").Output.String()
barWrapperDeps := bar.Output("bar").Implicits.Strings()
- libjni := ctx.ModuleForTests("libjni", buildOS+"_x86_64_shared")
+ libjni := ctx.ModuleForTests(t, "libjni", buildOS+"_x86_64_shared")
libjniSO := libjni.Rule("Cp").Output.String()
// Test that the install binary wrapper depends on the installed jar file
@@ -613,7 +613,7 @@ func TestTest(t *testing.T) {
buildOS := ctx.Config().BuildOS.String()
- foo := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost)
+ foo := ctx.ModuleForTests(t, "foo", buildOS+"_common").Module().(*TestHost)
expected := "lib64/libjni.so"
if runtime.GOOS == "darwin" {
@@ -649,7 +649,7 @@ func TestHostBinaryNoJavaDebugInfoOverride(t *testing.T) {
).RunTestWithBp(t, bp)
// first, check that the -g flag is added to target modules
- targetLibrary := result.ModuleForTests("target_library", "android_common")
+ targetLibrary := result.ModuleForTests(t, "target_library", "android_common")
targetJavaFlags := targetLibrary.Module().VariablesForTests()["javacFlags"]
if !strings.Contains(targetJavaFlags, "-g:source,lines") {
t.Errorf("target library javac flags %v should contain "+
@@ -658,7 +658,7 @@ func TestHostBinaryNoJavaDebugInfoOverride(t *testing.T) {
// check that -g is not overridden for host modules
buildOS := result.Config.BuildOS.String()
- hostBinary := result.ModuleForTests("host_binary", buildOS+"_common")
+ hostBinary := result.ModuleForTests(t, "host_binary", buildOS+"_common")
hostJavaFlags := hostBinary.Module().VariablesForTests()["javacFlags"]
if strings.Contains(hostJavaFlags, "-g:source,lines") {
t.Errorf("java_binary_host javac flags %v should not have "+
@@ -722,14 +722,14 @@ func TestPrebuilts(t *testing.T) {
}
`)
- fooModule := ctx.ModuleForTests("foo", "android_common")
+ fooModule := ctx.ModuleForTests(t, "foo", "android_common")
javac := fooModule.Rule("javac")
- combineJar := ctx.ModuleForTests("foo", "android_common").Description("for javac")
- barModule := ctx.ModuleForTests("bar", "android_common")
+ combineJar := ctx.ModuleForTests(t, "foo", "android_common").Description("for javac")
+ barModule := ctx.ModuleForTests(t, "bar", "android_common")
barJar := barModule.Output("combined/bar.jar").Output
- bazModule := ctx.ModuleForTests("baz", "android_common")
+ bazModule := ctx.ModuleForTests(t, "baz", "android_common")
bazJar := bazModule.Output("combined/baz.jar").Output
- sdklibStubsJar := ctx.ModuleForTests("sdklib.stubs", "android_common").
+ sdklibStubsJar := ctx.ModuleForTests(t, "sdklib.stubs", "android_common").
Output("combined/sdklib.stubs.jar").Output
fooLibrary := fooModule.Module().(*Library)
@@ -762,7 +762,7 @@ func TestPrebuilts(t *testing.T) {
expectedDexJar := "out/soong/.intermediates/baz/android_common/dex/baz.jar"
android.AssertPathRelativeToTopEquals(t, "baz dex jar build path", expectedDexJar, bazDexJar)
- ctx.ModuleForTests("qux", "android_common").Rule("Cp")
+ ctx.ModuleForTests(t, "qux", "android_common").Rule("Cp")
entries := android.AndroidMkEntriesForTest(t, ctx, fooModule.Module())[0]
android.AssertStringEquals(t, "unexpected LOCAL_SOONG_MODULE_TYPE", "java_library", entries.EntryMap["LOCAL_SOONG_MODULE_TYPE"][0])
@@ -788,7 +788,7 @@ prebuilt_stubs_sources {
"stubs/sources/pkg/B.java": nil,
})
- zipSrc := ctx.ModuleForTests("stubs-source", "android_common").Rule("zip_src")
+ zipSrc := ctx.ModuleForTests(t, "stubs-source", "android_common").Rule("zip_src")
if expected, actual := expectedInputs, zipSrc.Inputs.Strings(); !reflect.DeepEqual(expected, actual) {
t.Errorf("mismatch of inputs to soong_zip: expected %q, actual %q", expected, actual)
}
@@ -851,8 +851,8 @@ func TestDefaults(t *testing.T) {
}
`)
- javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
- combineJar := ctx.ModuleForTests("foo", "android_common").Description("for javac")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Rule("javac")
+ combineJar := ctx.ModuleForTests(t, "foo", "android_common").Description("for javac")
if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "a.java" {
t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
@@ -863,22 +863,22 @@ func TestDefaults(t *testing.T) {
t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], barTurbine)
}
- baz := ctx.ModuleForTests("baz", "android_common").Rule("javac").Output.String()
+ baz := ctx.ModuleForTests(t, "baz", "android_common").Rule("javac").Output.String()
if len(combineJar.Inputs) != 2 || combineJar.Inputs[1].String() != baz {
t.Errorf("foo combineJar inputs %v does not contain %q", combineJar.Inputs, baz)
}
- atestOptimize := ctx.ModuleForTests("atestOptimize", "android_common").MaybeRule("r8")
+ atestOptimize := ctx.ModuleForTests(t, "atestOptimize", "android_common").MaybeRule("r8")
if atestOptimize.Output == nil {
t.Errorf("atestOptimize should optimize APK")
}
- atestNoOptimize := ctx.ModuleForTests("atestNoOptimize", "android_common").MaybeRule("d8")
+ atestNoOptimize := ctx.ModuleForTests(t, "atestNoOptimize", "android_common").MaybeRule("d8")
if atestNoOptimize.Output == nil {
t.Errorf("atestNoOptimize should not optimize APK")
}
- atestDefault := ctx.ModuleForTests("atestDefault", "android_common").MaybeRule("d8")
+ atestDefault := ctx.ModuleForTests(t, "atestDefault", "android_common").MaybeRule("d8")
if atestDefault.Output == nil {
t.Errorf("atestDefault should not optimize APK")
}
@@ -976,8 +976,8 @@ func TestResources(t *testing.T) {
},
)
- foo := ctx.ModuleForTests("foo", "android_common").Output("withres/foo.jar")
- fooRes := ctx.ModuleForTests("foo", "android_common").Output("res/foo.jar")
+ foo := ctx.ModuleForTests(t, "foo", "android_common").Output("withres/foo.jar")
+ fooRes := ctx.ModuleForTests(t, "foo", "android_common").Output("res/foo.jar")
if !inList(fooRes.Output.String(), foo.Inputs.Strings()) {
t.Errorf("foo combined jars %v does not contain %q",
@@ -1022,8 +1022,8 @@ func TestIncludeSrcs(t *testing.T) {
})
// Test a library with include_srcs: true
- foo := ctx.ModuleForTests("foo", "android_common").Output("withres/foo.jar")
- fooSrcJar := ctx.ModuleForTests("foo", "android_common").Output("foo.srcjar")
+ foo := ctx.ModuleForTests(t, "foo", "android_common").Output("withres/foo.jar")
+ fooSrcJar := ctx.ModuleForTests(t, "foo", "android_common").Output("foo.srcjar")
if g, w := fooSrcJar.Output.String(), foo.Inputs.Strings(); !inList(g, w) {
t.Errorf("foo combined jars %v does not contain %q", w, g)
@@ -1034,10 +1034,10 @@ func TestIncludeSrcs(t *testing.T) {
}
// Test a library with include_srcs: true and resources
- bar := ctx.ModuleForTests("bar", "android_common").Output("withres/bar.jar")
- barResCombined := ctx.ModuleForTests("bar", "android_common").Output("res-combined/bar.jar")
- barRes := ctx.ModuleForTests("bar", "android_common").Output("res/bar.jar")
- barSrcJar := ctx.ModuleForTests("bar", "android_common").Output("bar.srcjar")
+ bar := ctx.ModuleForTests(t, "bar", "android_common").Output("withres/bar.jar")
+ barResCombined := ctx.ModuleForTests(t, "bar", "android_common").Output("res-combined/bar.jar")
+ barRes := ctx.ModuleForTests(t, "bar", "android_common").Output("res/bar.jar")
+ barSrcJar := ctx.ModuleForTests(t, "bar", "android_common").Output("bar.srcjar")
if g, w := barSrcJar.Output.String(), barResCombined.Inputs.Strings(); !inList(g, w) {
t.Errorf("bar combined resource jars %v does not contain %q", w, g)
@@ -1082,8 +1082,8 @@ func TestGeneratedSources(t *testing.T) {
"b.java": nil,
})
- javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
- genrule := ctx.ModuleForTests("gen", "").Rule("generator")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Rule("javac")
+ genrule := ctx.ModuleForTests(t, "gen", "").Rule("generator")
if filepath.Base(genrule.Output.String()) != "gen.java" {
t.Fatalf(`gen output file %v is not ".../gen.java"`, genrule.Output.String())
@@ -1123,11 +1123,11 @@ func TestTurbine(t *testing.T) {
}
`)
- fooTurbine := result.ModuleForTests("foo", "android_common").Rule("turbine")
- barTurbine := result.ModuleForTests("bar", "android_common").Rule("turbine")
- barJavac := result.ModuleForTests("bar", "android_common").Rule("javac")
- barTurbineCombined := result.ModuleForTests("bar", "android_common").Description("for turbine")
- bazJavac := result.ModuleForTests("baz", "android_common").Rule("javac")
+ fooTurbine := result.ModuleForTests(t, "foo", "android_common").Rule("turbine")
+ barTurbine := result.ModuleForTests(t, "bar", "android_common").Rule("turbine")
+ barJavac := result.ModuleForTests(t, "bar", "android_common").Rule("javac")
+ barTurbineCombined := result.ModuleForTests(t, "bar", "android_common").Description("for turbine")
+ bazJavac := result.ModuleForTests(t, "baz", "android_common").Rule("javac")
android.AssertPathsRelativeToTopEquals(t, "foo inputs", []string{"a.java"}, fooTurbine.Inputs)
@@ -1151,7 +1151,7 @@ func TestSharding(t *testing.T) {
barHeaderJar := filepath.Join("out", "soong", ".intermediates", "bar", "android_common", "turbine", "bar.jar")
for i := 0; i < 3; i++ {
- barJavac := ctx.ModuleForTests("bar", "android_common").Description("javac" + strconv.Itoa(i))
+ barJavac := ctx.ModuleForTests(t, "bar", "android_common").Description("javac" + strconv.Itoa(i))
if !strings.HasPrefix(barJavac.Args["classpath"], "-classpath "+barHeaderJar+":") {
t.Errorf("bar javac classpath %v does start with %q", barJavac.Args["classpath"], barHeaderJar)
}
@@ -1178,7 +1178,7 @@ func TestExcludeFileGroupInSrcs(t *testing.T) {
}
`)
- javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Rule("javac")
if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "java-fg/c.java" {
t.Errorf(`foo inputs %v != ["java-fg/c.java"]`, javac.Inputs)
@@ -1249,7 +1249,7 @@ func TestJavaImport(t *testing.T) {
PrepareForTestWithJavaDefaultModules,
).RunTestWithBp(t, bp)
- source := ctx.ModuleForTests("source_library", "android_common")
+ source := ctx.ModuleForTests(t, "source_library", "android_common")
sourceJar := source.Output("javac/source_library.jar")
sourceHeaderJar := source.Output("turbine-combined/source_library.jar")
sourceJavaInfo, _ := android.OtherModuleProvider(ctx, source.Module(), JavaInfoProvider)
@@ -1260,7 +1260,7 @@ func TestJavaImport(t *testing.T) {
android.AssertPathsRelativeToTopEquals(t, "source library header jar",
[]string{sourceHeaderJar.Output.String()}, sourceJavaInfo.HeaderJars)
- importWithNoDeps := ctx.ModuleForTests("import_with_no_deps", "android_common")
+ importWithNoDeps := ctx.ModuleForTests(t, "import_with_no_deps", "android_common")
importWithNoDepsJar := importWithNoDeps.Output("combined/import_with_no_deps.jar")
importWithNoDepsJavaInfo, _ := android.OtherModuleProvider(ctx, importWithNoDeps.Module(), JavaInfoProvider)
@@ -1272,7 +1272,7 @@ func TestJavaImport(t *testing.T) {
android.AssertPathsRelativeToTopEquals(t, "import with no deps combined inputs",
[]string{"no_deps.jar"}, importWithNoDepsJar.Inputs)
- importWithSourceDeps := ctx.ModuleForTests("import_with_source_deps", "android_common")
+ importWithSourceDeps := ctx.ModuleForTests(t, "import_with_source_deps", "android_common")
importWithSourceDepsJar := importWithSourceDeps.Output("combined/import_with_source_deps.jar")
importWithSourceDepsHeaderJar := importWithSourceDeps.Output("turbine-combined/import_with_source_deps.jar")
importWithSourceDepsJavaInfo, _ := android.OtherModuleProvider(ctx, importWithSourceDeps.Module(), JavaInfoProvider)
@@ -1287,7 +1287,7 @@ func TestJavaImport(t *testing.T) {
android.AssertPathsRelativeToTopEquals(t, "import with source deps combined header jar inputs",
[]string{"source_deps.jar", sourceHeaderJar.Output.String()}, importWithSourceDepsHeaderJar.Inputs)
- importWithImportDeps := ctx.ModuleForTests("import_with_import_deps", "android_common")
+ importWithImportDeps := ctx.ModuleForTests(t, "import_with_import_deps", "android_common")
importWithImportDepsJar := importWithImportDeps.Output("combined/import_with_import_deps.jar")
importWithImportDepsJavaInfo, _ := android.OtherModuleProvider(ctx, importWithImportDeps.Module(), JavaInfoProvider)
@@ -1364,7 +1364,7 @@ func TestCompilerFlags(t *testing.T) {
// TODO(jungjw): Consider making this more robust by ignoring path order.
func checkPatchModuleFlag(t *testing.T, ctx *android.TestContext, moduleName string, expected string) {
- variables := ctx.ModuleForTests(moduleName, "android_common").VariablesForTestsRelativeToTop()
+ variables := ctx.ModuleForTests(t, moduleName, "android_common").VariablesForTestsRelativeToTop()
flags := strings.Split(variables["javacFlags"], " ")
got := ""
for _, flag := range flags {
@@ -1505,7 +1505,7 @@ func TestJavaLibraryWithSystemModules(t *testing.T) {
}
func checkBootClasspathForLibWithSystemModule(t *testing.T, ctx *android.TestContext, moduleName string, expectedSuffix string) {
- javacRule := ctx.ModuleForTests(moduleName, "android_common").Rule("javac")
+ javacRule := ctx.ModuleForTests(t, moduleName, "android_common").Rule("javac")
bootClasspath := javacRule.Args["bootClasspath"]
if strings.HasPrefix(bootClasspath, "--system ") && strings.HasSuffix(bootClasspath, expectedSuffix) {
t.Errorf("bootclasspath of %q must start with --system and end with %q, but was %#v.", moduleName, expectedSuffix, bootClasspath)
@@ -1530,7 +1530,7 @@ func TestAidlExportIncludeDirsFromImports(t *testing.T) {
}
`)
- aidlCommand := ctx.ModuleForTests("foo", "android_common").Rule("aidl").RuleParams.Command
+ aidlCommand := ctx.ModuleForTests(t, "foo", "android_common").Rule("aidl").RuleParams.Command
expectedAidlFlag := "-Iaidl/bar"
if !strings.Contains(aidlCommand, expectedAidlFlag) {
t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag)
@@ -1547,7 +1547,7 @@ func TestAidlFlagsArePassedToTheAidlCompiler(t *testing.T) {
}
`)
- aidlCommand := ctx.ModuleForTests("foo", "android_common").Rule("aidl").RuleParams.Command
+ aidlCommand := ctx.ModuleForTests(t, "foo", "android_common").Rule("aidl").RuleParams.Command
expectedAidlFlag := "-Werror"
if !strings.Contains(aidlCommand, expectedAidlFlag) {
t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag)
@@ -1577,7 +1577,7 @@ func TestAidlFlagsWithMinSdkVersion(t *testing.T) {
`+tc.sdkVersion+`
}
`)
- aidlCommand := ctx.ModuleForTests("foo", "android_common").Rule("aidl").RuleParams.Command
+ aidlCommand := ctx.ModuleForTests(t, "foo", "android_common").Rule("aidl").RuleParams.Command
expectedAidlFlag := "--min_sdk_version=" + tc.expected
if !strings.Contains(aidlCommand, expectedAidlFlag) {
t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag)
@@ -1614,7 +1614,7 @@ func TestAidlFlagsMinSdkVersionDroidstubs(t *testing.T) {
}
for _, tc := range testCases {
ctx := prepareForJavaTest.RunTestWithBp(t, fmt.Sprintf(bpTemplate, tc.sdkVersionBp))
- aidlCmd := ctx.ModuleForTests("foo-stubs", "android_common").Rule("aidl").RuleParams.Command
+ aidlCmd := ctx.ModuleForTests(t, "foo-stubs", "android_common").Rule("aidl").RuleParams.Command
expected := "--min_sdk_version=" + tc.minSdkVersionExpected
android.AssertStringDoesContain(t, "aidl command conatins incorrect min_sdk_version for testCse: "+tc.desc, aidlCmd, expected)
}
@@ -1630,7 +1630,7 @@ func TestAidlEnforcePermissions(t *testing.T) {
}
`)
- aidlCommand := ctx.ModuleForTests("foo", "android_common").Rule("aidl").RuleParams.Command
+ aidlCommand := ctx.ModuleForTests(t, "foo", "android_common").Rule("aidl").RuleParams.Command
expectedAidlFlag := "-Wmissing-permission-annotation -Werror"
if !strings.Contains(aidlCommand, expectedAidlFlag) {
t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag)
@@ -1647,7 +1647,7 @@ func TestAidlEnforcePermissionsException(t *testing.T) {
}
`)
- aidlCommand := ctx.ModuleForTests("foo", "android_common").Rule("aidl").RuleParams.Command
+ aidlCommand := ctx.ModuleForTests(t, "foo", "android_common").Rule("aidl").RuleParams.Command
expectedAidlFlag := "$$FLAGS -Wmissing-permission-annotation -Werror aidl/foo/IFoo.aidl"
if !strings.Contains(aidlCommand, expectedAidlFlag) {
t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag)
@@ -1677,7 +1677,7 @@ func TestDataNativeBinaries(t *testing.T) {
buildOS := ctx.Config().BuildOS.String()
- test := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost)
+ test := ctx.ModuleForTests(t, "foo", buildOS+"_common").Module().(*TestHost)
entries := android.AndroidMkEntriesForTest(t, ctx, test)[0]
expected := []string{"out/soong/.intermediates/bin/" + buildOS + "_x86_64/bin:bin"}
actual := entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"]
@@ -1693,7 +1693,7 @@ func TestDefaultInstallable(t *testing.T) {
`)
buildOS := ctx.Config().BuildOS.String()
- module := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost)
+ module := ctx.ModuleForTests(t, "foo", buildOS+"_common").Module().(*TestHost)
assertDeepEquals(t, "Default installable value should be true.", proptools.BoolPtr(true),
module.properties.Installable)
}
@@ -1710,7 +1710,7 @@ func TestErrorproneEnabled(t *testing.T) {
}
`)
- javac := ctx.ModuleForTests("foo", "android_common").Description("javac")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Description("javac")
// Test that the errorprone plugins are passed to javac
expectedSubstring := "-Xplugin:ErrorProne"
@@ -1721,7 +1721,7 @@ func TestErrorproneEnabled(t *testing.T) {
// Modules with errorprone { enabled: true } will include errorprone checks
// in the main javac build rule. Only when RUN_ERROR_PRONE is true will
// the explicit errorprone build rule be created.
- errorprone := ctx.ModuleForTests("foo", "android_common").MaybeDescription("errorprone")
+ errorprone := ctx.ModuleForTests(t, "foo", "android_common").MaybeDescription("errorprone")
if errorprone.RuleParams.Description != "" {
t.Errorf("expected errorprone build rule to not exist, but it did")
}
@@ -1745,7 +1745,7 @@ func TestErrorproneDisabled(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- javac := ctx.ModuleForTests("foo", "android_common").Description("javac")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Description("javac")
// Test that the errorprone plugins are not passed to javac, like they would
// be if enabled was true.
@@ -1756,7 +1756,7 @@ func TestErrorproneDisabled(t *testing.T) {
// Check that no errorprone build rule is created, like there would be
// if enabled was unset and RUN_ERROR_PRONE was true.
- errorprone := ctx.ModuleForTests("foo", "android_common").MaybeDescription("errorprone")
+ errorprone := ctx.ModuleForTests(t, "foo", "android_common").MaybeDescription("errorprone")
if errorprone.RuleParams.Description != "" {
t.Errorf("expected errorprone build rule to not exist, but it did")
}
@@ -1777,8 +1777,8 @@ func TestErrorproneEnabledOnlyByEnvironmentVariable(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- javac := ctx.ModuleForTests("foo", "android_common").Description("javac")
- errorprone := ctx.ModuleForTests("foo", "android_common").Description("errorprone")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Description("javac")
+ errorprone := ctx.ModuleForTests(t, "foo", "android_common").Description("errorprone")
// Check that the errorprone plugins are not passed to javac, because they
// will instead be passed to the separate errorprone compilation
@@ -1940,7 +1940,7 @@ func TestDataDeviceBinsBuildsDeviceBinary(t *testing.T) {
}
buildOS := ctx.Config.BuildOS.String()
- fooVariant := ctx.ModuleForTests("foo", buildOS+"_common")
+ fooVariant := ctx.ModuleForTests(t, "foo", buildOS+"_common")
fooMod := fooVariant.Module().(*TestHost)
entries := android.AndroidMkEntriesForTest(t, ctx.TestContext, fooMod)[0]
@@ -1952,7 +1952,7 @@ func TestDataDeviceBinsBuildsDeviceBinary(t *testing.T) {
expectedData := []string{}
for _, variant := range tc.variants {
- barVariant := ctx.ModuleForTests("bar", variant)
+ barVariant := ctx.ModuleForTests(t, "bar", variant)
relocated := barVariant.Output("bar")
expectedInput := fmt.Sprintf("out/soong/.intermediates/bar/%s/unstripped/bar", variant)
android.AssertPathRelativeToTopEquals(t, "relocation input", expectedInput, relocated.Input)
@@ -1976,7 +1976,7 @@ func TestDeviceBinaryWrapperGeneration(t *testing.T) {
main_class: "foo.bar.jb",
}
`)
- wrapperPath := fmt.Sprint(ctx.ModuleForTests("foo", "android_common").AllOutputs())
+ wrapperPath := fmt.Sprint(ctx.ModuleForTests(t, "foo", "android_common").AllOutputs())
if !strings.Contains(wrapperPath, "foo.sh") {
t.Errorf("wrapper file foo.sh is not generated")
}
@@ -2072,7 +2072,7 @@ func TestJavaApiLibraryAndProviderLink(t *testing.T) {
},
}
for _, c := range testcases {
- m := ctx.ModuleForTests(c.moduleName, "android_common")
+ m := ctx.ModuleForTests(t, c.moduleName, "android_common")
manifest := m.Output("metalava.sbox.textproto")
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx.TestContext, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
@@ -2181,7 +2181,7 @@ func TestJavaApiLibraryAndDefaultsLink(t *testing.T) {
},
}
for _, c := range testcases {
- m := ctx.ModuleForTests(c.moduleName, "android_common")
+ m := ctx.ModuleForTests(t, c.moduleName, "android_common")
manifest := m.Output("metalava.sbox.textproto")
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx.TestContext, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
@@ -2249,7 +2249,7 @@ func TestJavaApiLibraryJarGeneration(t *testing.T) {
},
}
for _, c := range testcases {
- m := ctx.ModuleForTests(c.moduleName, "android_common")
+ m := ctx.ModuleForTests(t, c.moduleName, "android_common")
outputs := fmt.Sprint(m.AllOutputs())
if !strings.Contains(outputs, c.outputJarName) {
t.Errorf("Module output does not contain expected jar %s", c.outputJarName)
@@ -2335,7 +2335,7 @@ func TestJavaApiLibraryLibsLink(t *testing.T) {
},
}
for _, c := range testcases {
- m := ctx.ModuleForTests(c.moduleName, "android_common")
+ m := ctx.ModuleForTests(t, c.moduleName, "android_common")
javacRules := m.Rule("javac")
classPathArgs := javacRules.Args["classpath"]
for _, jarName := range c.classPathJarNames {
@@ -2424,7 +2424,7 @@ func TestJavaApiLibraryStaticLibsLink(t *testing.T) {
},
}
for _, c := range testcases {
- m := ctx.ModuleForTests(c.moduleName, "android_common")
+ m := ctx.ModuleForTests(t, c.moduleName, "android_common")
mergeZipsCommand := m.Rule("merge_zips").RuleParams.Command
for _, jarName := range c.staticLibJarNames {
if !strings.Contains(mergeZipsCommand, jarName) {
@@ -2452,7 +2452,7 @@ func TestTransitiveSrcFiles(t *testing.T) {
static_libs: ["b"],
}
`)
- c := ctx.ModuleForTests("c", "android_common").Module()
+ c := ctx.ModuleForTests(t, "c", "android_common").Module()
javaInfo, _ := android.OtherModuleProvider(ctx, c, JavaInfoProvider)
transitiveSrcFiles := android.Paths(javaInfo.TransitiveSrcFiles.ToList())
android.AssertArrayString(t, "unexpected jar deps", []string{"b.java", "c.java"}, transitiveSrcFiles.Strings())
@@ -2475,7 +2475,7 @@ java_test_host {
`)
buildOS := result.Config.BuildOS.String()
- args := result.ModuleForTests("foo", buildOS+"_common").
+ args := result.ModuleForTests(t, "foo", buildOS+"_common").
Output("out/soong/.intermediates/foo/" + buildOS + "_common/foo.config").Args
expected := proptools.NinjaAndShellEscape("<option name=\"exclude-path\" value=\"org/apache\" />")
if args["extraConfigs"] != expected {
@@ -2500,7 +2500,7 @@ java_test_host {
`)
buildOS := result.Config.BuildOS.String()
- args := result.ModuleForTests("foo", buildOS+"_common").
+ args := result.ModuleForTests(t, "foo", buildOS+"_common").
Output("out/soong/.intermediates/foo/" + buildOS + "_common/foo.config").Args
expected := proptools.NinjaAndShellEscape("<option name=\"test-timeout\" value=\"10m\" />\\n ")
if args["extraTestRunnerConfigs"] != expected {
@@ -2521,7 +2521,7 @@ func TestJavaLibraryWithResourcesStem(t *testing.T) {
"test-jar/test/resource.txt": nil,
})
- m := ctx.ModuleForTests("foo", "android_common")
+ m := ctx.ModuleForTests(t, "foo", "android_common")
outputs := fmt.Sprint(m.AllOutputs())
if !strings.Contains(outputs, "test.jar") {
t.Errorf("Module output does not contain expected jar %s", "test.jar")
@@ -2538,12 +2538,12 @@ func TestHeadersOnly(t *testing.T) {
}
`)
- turbine := ctx.ModuleForTests("foo", "android_common").Rule("turbine")
+ turbine := ctx.ModuleForTests(t, "foo", "android_common").Rule("turbine")
if len(turbine.Inputs) != 1 || turbine.Inputs[0].String() != "a.java" {
t.Errorf(`foo inputs %v != ["a.java"]`, turbine.Inputs)
}
- javac := ctx.ModuleForTests("foo", "android_common").MaybeRule("javac")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").MaybeRule("javac")
android.AssertDeepEquals(t, "javac rule", nil, javac.Rule)
}
@@ -2568,7 +2568,7 @@ func TestJavaApiContributionImport(t *testing.T) {
api_surface: "public",
}
`)
- m := ctx.ModuleForTests("foo", "android_common")
+ m := ctx.ModuleForTests(t, "foo", "android_common")
manifest := m.Output("metalava.sbox.textproto")
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx.TestContext, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
@@ -2591,7 +2591,7 @@ func TestJavaApiLibraryApiFilesSorting(t *testing.T) {
stubs_type: "everything",
}
`)
- m := ctx.ModuleForTests("foo", "android_common")
+ m := ctx.ModuleForTests(t, "foo", "android_common")
manifest := m.Output("metalava.sbox.textproto")
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, manifest)
manifestCommand := sboxProto.Commands[0].GetCommand()
@@ -2666,9 +2666,9 @@ func TestApiLibraryDroidstubsDependency(t *testing.T) {
`)
currentApiTimestampPath := "api-stubs-docs-non-updatable/android_common/everything/check_current_api.timestamp"
- foo := result.ModuleForTests("foo", "android_common").Module().(*ApiLibrary)
+ foo := result.ModuleForTests(t, "foo", "android_common").Module().(*ApiLibrary)
fooValidationPathsString := strings.Join(foo.validationPaths.Strings(), " ")
- bar := result.ModuleForTests("bar", "android_common").Module().(*ApiLibrary)
+ bar := result.ModuleForTests(t, "bar", "android_common").Module().(*ApiLibrary)
barValidationPathsString := strings.Join(bar.validationPaths.Strings(), " ")
android.AssertStringDoesContain(t,
"Module expected to have validation",
@@ -2796,8 +2796,8 @@ func TestMultiplePrebuilts(t *testing.T) {
).RunTestWithBp(t, fmt.Sprintf(bp, tc.selectedDependencyName))
// check that rdep gets the correct variation of dep
- foo := ctx.ModuleForTests("foo", "android_common")
- expectedDependency := ctx.ModuleForTests(tc.expectedDependencyName, "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
+ expectedDependency := ctx.ModuleForTests(t, tc.expectedDependencyName, "android_common")
android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", foo.Module().Name(), tc.expectedDependencyName), true, hasDep(ctx, foo.Module(), expectedDependency.Module()))
// check that output file of dep is always bar.jar
@@ -2866,7 +2866,7 @@ func TestMultiplePlatformCompatConfigPrebuilts(t *testing.T) {
android.PrepareForTestWithBuildFlag("RELEASE_APEX_CONTRIBUTIONS_ADSERVICES", "myapex_contributions"),
).RunTestWithBp(t, fmt.Sprintf(bp, tc.selectedDependencyName))
- mergedGlobalConfig := ctx.SingletonForTests("platform_compat_config_singleton").Output("compat_config/merged_compat_config.xml")
+ mergedGlobalConfig := ctx.SingletonForTests(t, "platform_compat_config_singleton").Output("compat_config/merged_compat_config.xml")
android.AssertIntEquals(t, "The merged compat config file should only have a single dependency", 1, len(mergedGlobalConfig.Implicits))
android.AssertStringEquals(t, "The merged compat config file is missing the appropriate platform compat config", mergedGlobalConfig.Implicits[0].String(), tc.expectedPlatformCompatConfigXml)
}
@@ -2915,7 +2915,7 @@ func TestApiLibraryAconfigDeclarations(t *testing.T) {
android.AssertBoolEquals(t, "foo expected to depend on bar",
CheckModuleHasDependency(t, result.TestContext, "foo", "android_common", "bar"), true)
- m := result.ModuleForTests("foo", "android_common")
+ m := result.ModuleForTests(t, "foo", "android_common")
android.AssertStringDoesContain(t, "foo generates revert annotations file",
strings.Join(m.AllOutputs(), ""), "revert-annotations-exportable.txt")
@@ -3030,7 +3030,7 @@ func TestJavaLibHostWithStem(t *testing.T) {
`)
buildOS := ctx.Config().BuildOS.String()
- foo := ctx.ModuleForTests("foo", buildOS+"_common")
+ foo := ctx.ModuleForTests(t, "foo", buildOS+"_common")
outputs := fmt.Sprint(foo.AllOutputs())
if !strings.Contains(outputs, "foo-new.jar") {
@@ -3048,7 +3048,7 @@ func TestJavaLibWithStem(t *testing.T) {
}
`)
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
outputs := fmt.Sprint(foo.AllOutputs())
if !strings.Contains(outputs, "foo-new.jar") {
@@ -3079,9 +3079,9 @@ func TestJavaLibraryOutputFilesRel(t *testing.T) {
}
`)
- foo := result.ModuleForTests("foo", "android_common")
- bar := result.ModuleForTests("bar", "android_common")
- baz := result.ModuleForTests("baz", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
+ bar := result.ModuleForTests(t, "bar", "android_common")
+ baz := result.ModuleForTests(t, "baz", "android_common")
fooOutputPaths := foo.OutputFiles(result.TestContext, t, "")
barOutputPaths := bar.OutputFiles(result.TestContext, t, "")
@@ -3124,8 +3124,8 @@ func TestCoverage(t *testing.T) {
}
`)
- foo := result.ModuleForTests("foo", "android_common")
- androidCar := result.ModuleForTests("android.car", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
+ androidCar := result.ModuleForTests(t, "android.car", "android_common")
fooJacoco := foo.Rule("jacoco")
fooCombine := foo.Description("for javac")
@@ -3196,6 +3196,6 @@ cc_library_shared {
}
`
res, _ := testJava(t, bp)
- deps := findDepsOfModule(res, res.ModuleForTests("myjavabin", "android_common").Module(), "mynativelib")
+ deps := findDepsOfModule(res, res.ModuleForTests(t, "myjavabin", "android_common").Module(), "mynativelib")
android.AssertIntEquals(t, "Create a dep on the first variant", 1, len(deps))
}
diff --git a/java/jdeps_test.go b/java/jdeps_test.go
index 2cbf75bc7..00f383997 100644
--- a/java/jdeps_test.go
+++ b/java/jdeps_test.go
@@ -32,7 +32,7 @@ func TestCollectJavaLibraryPropertiesAddLibsDeps(t *testing.T) {
libs: ["Foo", "Bar"],
}
`)
- module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
+ module := ctx.ModuleForTests(t, "javalib", "android_common").Module().(*Library)
dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
for _, expected := range []string{"Foo", "Bar"} {
@@ -53,7 +53,7 @@ func TestCollectJavaLibraryPropertiesAddStaticLibsDeps(t *testing.T) {
static_libs: ["Foo", "Bar"],
}
`)
- module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
+ module := ctx.ModuleForTests(t, "javalib", "android_common").Module().(*Library)
dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
for _, expected := range []string{"Foo", "Bar"} {
@@ -72,7 +72,7 @@ func TestCollectJavaLibraryPropertiesAddScrs(t *testing.T) {
srcs: ["Foo.java", "Bar.java"],
}
`)
- module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
+ module := ctx.ModuleForTests(t, "javalib", "android_common").Module().(*Library)
dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
expected := []string{"Foo.java", "Bar.java"}
@@ -92,7 +92,7 @@ func TestCollectJavaLibraryPropertiesAddAidlIncludeDirs(t *testing.T) {
},
}
`)
- module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
+ module := ctx.ModuleForTests(t, "javalib", "android_common").Module().(*Library)
dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
expected := []string{"Foo", "Bar"}
@@ -111,7 +111,7 @@ func TestCollectJavaLibraryWithJarJarRules(t *testing.T) {
jarjar_rules: "jarjar_rules.txt",
}
`)
- module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
+ module := ctx.ModuleForTests(t, "javalib", "android_common").Module().(*Library)
dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
android.AssertStringEquals(t, "IdeInfo.Srcs of repackaged library should not be empty", "foo.java", dpInfo.Srcs[0])
@@ -135,7 +135,7 @@ func TestCollectJavaLibraryLinkingAgainstVersionedSdk(t *testing.T) {
sdk_version: "29",
}
`)
- module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
+ module := ctx.ModuleForTests(t, "javalib", "android_common").Module().(*Library)
dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
android.AssertStringListContains(t, "IdeInfo.Deps should contain versioned sdk module", dpInfo.Deps, "sdk_public_29_android")
@@ -171,11 +171,11 @@ func TestDoNotAddNoneSystemModulesToDeps(t *testing.T) {
api_surface: "public",
}
`)
- javalib := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
+ javalib := ctx.ModuleForTests(t, "javalib", "android_common").Module().(*Library)
dpInfo, _ := android.OtherModuleProvider(ctx, javalib, android.IdeInfoProviderKey)
android.AssertStringListDoesNotContain(t, "IdeInfo.Deps should contain not contain `none`", dpInfo.Deps, "none")
- javalib_stubs := ctx.ModuleForTests("javalib.stubs", "android_common").Module().(*ApiLibrary)
+ javalib_stubs := ctx.ModuleForTests(t, "javalib.stubs", "android_common").Module().(*ApiLibrary)
dpInfo, _ = android.OtherModuleProvider(ctx, javalib_stubs, android.IdeInfoProviderKey)
android.AssertStringListDoesNotContain(t, "IdeInfo.Deps should contain not contain `none`", dpInfo.Deps, "none")
}
diff --git a/java/kotlin_test.go b/java/kotlin_test.go
index 3a203358a..c7b1ece98 100644
--- a/java/kotlin_test.go
+++ b/java/kotlin_test.go
@@ -240,7 +240,7 @@ func TestKotlin(t *testing.T) {
PrepareForTestWithJavaDefaultModules,
tt.preparer,
).RunTestWithBp(t, bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
fooKotlinc := foo.Rule("kotlinc")
android.AssertPathsRelativeToTopEquals(t, "foo kotlinc inputs", tt.fooKotlincInputs, fooKotlinc.Inputs)
@@ -260,7 +260,7 @@ func TestKotlin(t *testing.T) {
fooCombinedHeaderJar := foo.Output("turbine-combined/foo.jar")
android.AssertPathsRelativeToTopEquals(t, "foo header combined inputs", tt.fooHeaderCombinedInputs, fooCombinedHeaderJar.Inputs)
- bar := result.ModuleForTests("bar", "android_common")
+ bar := result.ModuleForTests(t, "bar", "android_common")
barKotlinc := bar.Rule("kotlinc")
android.AssertPathsRelativeToTopEquals(t, "bar kotlinc inputs", tt.barKotlincInputs, barKotlinc.Inputs)
@@ -311,14 +311,14 @@ func TestKapt(t *testing.T) {
buildOS := ctx.Config().BuildOS.String()
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
kaptStubs := foo.Rule("kapt")
turbineApt := foo.Description("turbine apt")
kotlinc := foo.Rule("kotlinc")
javac := foo.Rule("javac")
- bar := ctx.ModuleForTests("bar", buildOS+"_common").Rule("javac").Output.String()
- baz := ctx.ModuleForTests("baz", buildOS+"_common").Rule("javac").Output.String()
+ bar := ctx.ModuleForTests(t, "bar", buildOS+"_common").Rule("javac").Output.String()
+ baz := ctx.ModuleForTests(t, "baz", buildOS+"_common").Rule("javac").Output.String()
// Test that the kotlin and java sources are passed to kapt and kotlinc
if len(kaptStubs.Inputs) != 2 || kaptStubs.Inputs[0].String() != "a.java" || kaptStubs.Inputs[1].String() != "b.kt" {
@@ -400,13 +400,13 @@ func TestKapt(t *testing.T) {
buildOS := result.Config.BuildOS.String()
- kapt := result.ModuleForTests("foo", "android_common").Rule("kapt")
- javac := result.ModuleForTests("foo", "android_common").Description("javac")
- errorprone := result.ModuleForTests("foo", "android_common").Description("errorprone")
+ kapt := result.ModuleForTests(t, "foo", "android_common").Rule("kapt")
+ javac := result.ModuleForTests(t, "foo", "android_common").Description("javac")
+ errorprone := result.ModuleForTests(t, "foo", "android_common").Description("errorprone")
- bar := result.ModuleForTests("bar", buildOS+"_common").Description("javac").Output.String()
- baz := result.ModuleForTests("baz", buildOS+"_common").Description("javac").Output.String()
- myCheck := result.ModuleForTests("my_check", buildOS+"_common").Description("javac").Output.String()
+ bar := result.ModuleForTests(t, "bar", buildOS+"_common").Description("javac").Output.String()
+ baz := result.ModuleForTests(t, "baz", buildOS+"_common").Description("javac").Output.String()
+ myCheck := result.ModuleForTests(t, "my_check", buildOS+"_common").Description("javac").Output.String()
// Test that the errorprone plugins are not passed to kapt
expectedProcessorPath := "-P plugin:org.jetbrains.kotlin.kapt3:apclasspath=" + bar +
@@ -531,9 +531,9 @@ func TestKotlinCompose(t *testing.T) {
buildOS := result.Config.BuildOS.String()
- composeCompiler := result.ModuleForTests("kotlin-compose-compiler-plugin", buildOS+"_common").Rule("combineJar").Output
- withCompose := result.ModuleForTests("withcompose", "android_common")
- noCompose := result.ModuleForTests("nocompose", "android_common")
+ composeCompiler := result.ModuleForTests(t, "kotlin-compose-compiler-plugin", buildOS+"_common").Rule("combineJar").Output
+ withCompose := result.ModuleForTests(t, "withcompose", "android_common")
+ noCompose := result.ModuleForTests(t, "nocompose", "android_common")
android.AssertStringListContains(t, "missing compose compiler dependency",
withCompose.Rule("kotlinc").Implicits.Strings(), composeCompiler.String())
@@ -579,9 +579,9 @@ func TestKotlinPlugin(t *testing.T) {
buildOS := result.Config.BuildOS.String()
- kotlinPlugin := result.ModuleForTests("kotlin_plugin", buildOS+"_common").Rule("combineJar").Output
- withKotlinPlugin := result.ModuleForTests("with_kotlin_plugin", "android_common")
- noKotlinPlugin := result.ModuleForTests("no_kotlin_plugin", "android_common")
+ kotlinPlugin := result.ModuleForTests(t, "kotlin_plugin", buildOS+"_common").Rule("combineJar").Output
+ withKotlinPlugin := result.ModuleForTests(t, "with_kotlin_plugin", "android_common")
+ noKotlinPlugin := result.ModuleForTests(t, "no_kotlin_plugin", "android_common")
android.AssertStringListContains(t, "missing plugin compiler dependency",
withKotlinPlugin.Rule("kotlinc").Implicits.Strings(), kotlinPlugin.String())
diff --git a/java/lint_test.go b/java/lint_test.go
index f7d3229b9..236fa63ba 100644
--- a/java/lint_test.go
+++ b/java/lint_test.go
@@ -38,7 +38,7 @@ func TestJavaLintDoesntUseBaselineImplicitly(t *testing.T) {
"lint-baseline.xml": nil,
})
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, foo.Output("lint.sbox.textproto"))
if strings.Contains(*sboxProto.Commands[0].Command, "--baseline lint-baseline.xml") {
@@ -87,7 +87,7 @@ func TestJavaLintUsesCorrectBpConfig(t *testing.T) {
"mybaseline.xml": nil,
})
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, foo.Output("lint.sbox.textproto"))
if !strings.Contains(*sboxProto.Commands[0].Command, "--baseline mybaseline.xml") {
@@ -193,7 +193,7 @@ func TestJavaLintStrictUpdatabilityLinting(t *testing.T) {
result := android.GroupFixturePreparers(PrepareForTestWithJavaDefaultModules, fs.AddToFixture()).
RunTestWithBp(t, bp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
strictUpdatabilityCheck := foo.Output("lint_strict_updatability_check.stamp")
if !strings.Contains(strictUpdatabilityCheck.RuleParams.Command,
"--disallowed_issues NewApi") {
@@ -256,7 +256,7 @@ func TestJavaLintDatabaseSelectionFull(t *testing.T) {
})).
RunTestWithBp(t, thisBp)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
sboxProto := android.RuleBuilderSboxProtoForTests(t, result.TestContext, foo.Output("lint.sbox.textproto"))
if !strings.Contains(*sboxProto.Commands[0].Command, "/"+testCase.expected_file) {
t.Error("did not use full api database for case", testCase)
@@ -313,7 +313,7 @@ func TestNotTestViaDefault(t *testing.T) {
result := PrepareForTestWithJavaDefaultModules.RunTestWithBp(t, bp)
ctx := result.TestContext
- foo := ctx.ModuleForTests("foo", "android_common")
+ foo := ctx.ModuleForTests(t, "foo", "android_common")
sboxProto := android.RuleBuilderSboxProtoForTests(t, ctx, foo.Output("lint.sbox.textproto"))
command := *sboxProto.Commands[0].Command
@@ -321,7 +321,7 @@ func TestNotTestViaDefault(t *testing.T) {
t.Fatalf("Expected command to not contain --test")
}
- foo2 := ctx.ModuleForTests("foo2", "android_common")
+ foo2 := ctx.ModuleForTests(t, "foo2", "android_common")
sboxProto2 := android.RuleBuilderSboxProtoForTests(t, ctx, foo2.Output("lint.sbox.textproto"))
command2 := *sboxProto2.Commands[0].Command
diff --git a/java/platform_bootclasspath_test.go b/java/platform_bootclasspath_test.go
index db8557914..727e30670 100644
--- a/java/platform_bootclasspath_test.go
+++ b/java/platform_bootclasspath_test.go
@@ -93,7 +93,7 @@ func TestPlatformBootclasspath(t *testing.T) {
checkSrcJarInputs := func(t *testing.T, result *android.TestResult, name string, expected []string) {
t.Helper()
- srcjar := result.ModuleForTests(name, "android_common").Output(name + "-transitive.srcjar")
+ srcjar := result.ModuleForTests(t, name, "android_common").Output(name + "-transitive.srcjar")
android.AssertStringDoesContain(t, "srcjar arg", srcjar.Args["jarArgs"], "-srcjar")
android.AssertArrayString(t, "srcjar inputs", expected, srcjar.Implicits.Strings())
}
@@ -367,7 +367,7 @@ func TestPlatformBootclasspath_HiddenAPIMonolithicFiles(t *testing.T) {
// Make sure that the foo-hiddenapi-annotations.jar is included in the inputs to the rules that
// creates the index.csv file.
- platformBootclasspath := result.ModuleForTests("myplatform-bootclasspath", "android_common")
+ platformBootclasspath := result.ModuleForTests(t, "myplatform-bootclasspath", "android_common")
var rule android.TestingBuildParams
diff --git a/java/plugin_test.go b/java/plugin_test.go
index 95f4aca4c..007b74a9e 100644
--- a/java/plugin_test.go
+++ b/java/plugin_test.go
@@ -27,8 +27,8 @@ func TestNoPlugin(t *testing.T) {
}
`)
- javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
- turbine := ctx.ModuleForTests("foo", "android_common").MaybeRule("turbine")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Rule("javac")
+ turbine := ctx.ModuleForTests(t, "foo", "android_common").MaybeRule("turbine")
if turbine.Rule == nil {
t.Errorf("expected turbine to be enabled")
@@ -61,14 +61,14 @@ func TestPlugin(t *testing.T) {
buildOS := ctx.Config().BuildOS.String()
- javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
- turbine := ctx.ModuleForTests("foo", "android_common").MaybeRule("turbine")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Rule("javac")
+ turbine := ctx.ModuleForTests(t, "foo", "android_common").MaybeRule("turbine")
if turbine.Rule == nil {
t.Errorf("expected turbine to be enabled")
}
- bar := ctx.ModuleForTests("bar", buildOS+"_common").Rule("javac").Output.String()
+ bar := ctx.ModuleForTests(t, "bar", buildOS+"_common").Rule("javac").Output.String()
if !inList(bar, javac.Implicits.Strings()) {
t.Errorf("foo implicits %v does not contain %q", javac.Implicits.Strings(), bar)
@@ -102,14 +102,14 @@ func TestPluginGeneratesApi(t *testing.T) {
buildOS := ctx.Config().BuildOS.String()
- javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
- turbine := ctx.ModuleForTests("foo", "android_common").MaybeRule("turbine")
+ javac := ctx.ModuleForTests(t, "foo", "android_common").Rule("javac")
+ turbine := ctx.ModuleForTests(t, "foo", "android_common").MaybeRule("turbine")
if turbine.Rule != nil {
t.Errorf("expected turbine to be disabled")
}
- bar := ctx.ModuleForTests("bar", buildOS+"_common").Rule("javac").Output.String()
+ bar := ctx.ModuleForTests(t, "bar", buildOS+"_common").Rule("javac").Output.String()
if !inList(bar, javac.Implicits.Strings()) {
t.Errorf("foo implicits %v does not contain %q", javac.Implicits.Strings(), bar)
diff --git a/java/prebuilt_apis_test.go b/java/prebuilt_apis_test.go
index c6a5913b0..1f095e49b 100644
--- a/java/prebuilt_apis_test.go
+++ b/java/prebuilt_apis_test.go
@@ -78,9 +78,9 @@ func TestPrebuiltApis_WithExtensions(t *testing.T) {
"2": {"foo", "bar"},
}),
).RunTest(t)
- foo_input = result.ModuleForTests("foo.api.public.latest", "").Rule("generator").Implicits[0].String()
- bar_input = result.ModuleForTests("bar.api.public.latest", "").Rule("generator").Implicits[0].String()
- baz_input = result.ModuleForTests("baz.api.public.latest", "").Rule("generator").Implicits[0].String()
+ foo_input = result.ModuleForTests(t, "foo.api.public.latest", "").Rule("generator").Implicits[0].String()
+ bar_input = result.ModuleForTests(t, "bar.api.public.latest", "").Rule("generator").Implicits[0].String()
+ baz_input = result.ModuleForTests(t, "baz.api.public.latest", "").Rule("generator").Implicits[0].String()
return
}
// Extension 2 is the latest for both foo and bar, finalized after the base extension version.
@@ -114,9 +114,9 @@ func TestPrebuiltApis_WithIncrementalApi(t *testing.T) {
"current": {"foo", "bar"},
}),
).RunTest(t)
- foo_input = result.ModuleForTests("foo.api.public.latest", "").Rule("generator").Implicits[0].String()
- bar_input = result.ModuleForTests("bar.api.public.latest", "").Rule("generator").Implicits[0].String()
- baz_input = result.ModuleForTests("baz.api.public.latest", "").Rule("generator").Implicits[0].String()
+ foo_input = result.ModuleForTests(t, "foo.api.public.latest", "").Rule("generator").Implicits[0].String()
+ bar_input = result.ModuleForTests(t, "bar.api.public.latest", "").Rule("generator").Implicits[0].String()
+ baz_input = result.ModuleForTests(t, "baz.api.public.latest", "").Rule("generator").Implicits[0].String()
return
}
// 33.1 is the latest for baz, 33.2 is the latest for both foo & bar
diff --git a/java/proto_test.go b/java/proto_test.go
index 5b184b673..3fbe3e602 100644
--- a/java/proto_test.go
+++ b/java/proto_test.go
@@ -46,7 +46,7 @@ func TestProtoStream(t *testing.T) {
PrepareForIntegrationTestWithJava,
).RunTestWithBp(t, protoModules+bp)
- proto0 := ctx.ModuleForTests("java-stream-protos", "android_common").Output("proto/proto0.srcjar")
+ proto0 := ctx.ModuleForTests(t, "java-stream-protos", "android_common").Output("proto/proto0.srcjar")
if cmd := proto0.RuleParams.Command; !strings.Contains(cmd, "--javastream_out=") {
t.Errorf("expected '--javastream_out' in %q", cmd)
diff --git a/java/ravenwood_test.go b/java/ravenwood_test.go
index ac4f14782..24a02bbdc 100644
--- a/java/ravenwood_test.go
+++ b/java/ravenwood_test.go
@@ -121,7 +121,7 @@ func TestRavenwoodRuntime(t *testing.T) {
CheckModuleHasDependency(t, ctx.TestContext, "ravenwood-utils", "android_common", "framework-rules.ravenwood")
// Verify that we've emitted artifacts in expected location
- runtime := ctx.ModuleForTests("ravenwood-runtime", "android_common")
+ runtime := ctx.ModuleForTests(t, "ravenwood-runtime", "android_common")
runtime.Output(installPathPrefix + "/ravenwood-runtime/framework-minus-apex.ravenwood.jar")
runtime.Output(installPathPrefix + "/ravenwood-runtime/framework-services.ravenwood.jar")
runtime.Output(installPathPrefix + "/ravenwood-runtime/lib64/ravenwood-runtime-jni1.so")
@@ -129,7 +129,7 @@ func TestRavenwoodRuntime(t *testing.T) {
runtime.Output(installPathPrefix + "/ravenwood-runtime/lib64/ravenwood-runtime-jni3.so")
runtime.Output(installPathPrefix + "/ravenwood-runtime/ravenwood-data/app1.apk")
runtime.Output(installPathPrefix + "/ravenwood-runtime/fonts/Font.ttf")
- utils := ctx.ModuleForTests("ravenwood-utils", "android_common")
+ utils := ctx.ModuleForTests(t, "ravenwood-utils", "android_common")
utils.Output(installPathPrefix + "/ravenwood-utils/framework-rules.ravenwood.jar")
}
@@ -193,7 +193,7 @@ func TestRavenwoodTest(t *testing.T) {
CheckModuleHasDependency(t, ctx.TestContext, "ravenwood-test", "android_common", "ravenwood-utils")
CheckModuleHasDependency(t, ctx.TestContext, "ravenwood-test", "android_common", "jni-lib")
- module := ctx.ModuleForTests("ravenwood-test", "android_common")
+ module := ctx.ModuleForTests(t, "ravenwood-test", "android_common")
classpath := module.Rule("javac").Args["classpath"]
// Verify that we're linking against test_current
@@ -214,7 +214,7 @@ func TestRavenwoodTest(t *testing.T) {
module.Output(installPathPrefix + "/ravenwood-test/ravenwood-res-apks/ravenwood-res.apk")
module.Output(installPathPrefix + "/ravenwood-test/ravenwood-res-apks/ravenwood-inst-res.apk")
- module = ctx.ModuleForTests("ravenwood-test-empty", "android_common")
+ module = ctx.ModuleForTests(t, "ravenwood-test-empty", "android_common")
module.Output(installPathPrefix + "/ravenwood-test-empty/ravenwood.properties")
// ravenwood-runtime*.so are included in the runtime, so it shouldn't be emitted.
diff --git a/java/robolectric_test.go b/java/robolectric_test.go
index ad0613ebd..4bf224b4f 100644
--- a/java/robolectric_test.go
+++ b/java/robolectric_test.go
@@ -105,6 +105,6 @@ func TestRobolectricJniTest(t *testing.T) {
CheckModuleHasDependency(t, ctx.TestContext, "robo-test", "android_common", "jni-lib1")
// Check that the .so files make it into the output.
- module := ctx.ModuleForTests("robo-test", "android_common")
+ module := ctx.ModuleForTests(t, "robo-test", "android_common")
module.Output(installPathPrefix + "/robo-test/lib64/jni-lib1.so")
}
diff --git a/java/rro_test.go b/java/rro_test.go
index 1978ad67d..0ccc8e707 100644
--- a/java/rro_test.go
+++ b/java/rro_test.go
@@ -67,7 +67,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
fs.AddToFixture(),
).RunTestWithBp(t, bp)
- m := result.ModuleForTests("foo", "android_common")
+ m := result.ModuleForTests(t, "foo", "android_common")
// Check AAPT2 link flags.
aapt2Flags := m.Output("package-res.apk").Args["flags"]
@@ -116,7 +116,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", result.Config, expectedPath, path)
// A themed module has a different device location
- m = result.ModuleForTests("foo_themed", "android_common")
+ m = result.ModuleForTests(t, "foo_themed", "android_common")
androidMkEntries = android.AndroidMkEntriesForTest(t, result.TestContext, m.Module())[0]
path = androidMkEntries.EntryMap["LOCAL_MODULE_PATH"]
expectedPath = []string{shared.JoinPath("out/target/product/test_device/product/overlay/faza")}
@@ -155,7 +155,7 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
//
// RRO module with defaults
//
- m := result.ModuleForTests("foo_with_defaults", "android_common")
+ m := result.ModuleForTests(t, "foo_with_defaults", "android_common")
// Check AAPT2 link flags.
aapt2Flags := strings.Split(m.Output("package-res.apk").Args["flags"], " ")
@@ -173,7 +173,7 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
//
// RRO module without defaults
//
- m = result.ModuleForTests("foo_barebones", "android_common")
+ m = result.ModuleForTests(t, "foo_barebones", "android_common")
// Check AAPT2 link flags.
aapt2Flags = strings.Split(m.Output("package-res.apk").Args["flags"], " ")
@@ -235,7 +235,7 @@ func TestOverrideRuntimeResourceOverlay(t *testing.T) {
},
}
for _, expected := range expectedVariants {
- variant := ctx.ModuleForTests("foo_overlay", expected.variantName)
+ variant := ctx.ModuleForTests(t, "foo_overlay", expected.variantName)
// Check the final apk name
variant.Output(expected.apkPath)
@@ -306,7 +306,7 @@ func TestRuntimeResourceOverlayPartition(t *testing.T) {
}
for _, testCase := range testCases {
ctx, _ := testJava(t, bp)
- mod := ctx.ModuleForTests(testCase.name, "android_common").Module().(*RuntimeResourceOverlay)
+ mod := ctx.ModuleForTests(t, testCase.name, "android_common").Module().(*RuntimeResourceOverlay)
android.AssertPathRelativeToTopEquals(t, "Install dir is not correct for "+testCase.name, testCase.expectedPath, mod.installDir)
}
}
@@ -341,7 +341,7 @@ func TestRuntimeResourceOverlayFlagsPackages(t *testing.T) {
}
`)
- foo := result.ModuleForTests("foo", "android_common")
+ foo := result.ModuleForTests(t, "foo", "android_common")
// runtime_resource_overlay module depends on aconfig_declarations listed in flags_packages
android.AssertBoolEquals(t, "foo expected to depend on bar", true,
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index 0d872f008..2cb827dc2 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -115,19 +115,19 @@ func TestJavaSdkLibrary(t *testing.T) {
`)
// check the existence of the internal modules
- foo := result.ModuleForTests("foo", "android_common")
- result.ModuleForTests(apiScopePublic.stubsLibraryModuleName("foo"), "android_common")
- result.ModuleForTests(apiScopeSystem.stubsLibraryModuleName("foo"), "android_common")
- result.ModuleForTests(apiScopeTest.stubsLibraryModuleName("foo"), "android_common")
- result.ModuleForTests(apiScopePublic.stubsSourceModuleName("foo"), "android_common")
- result.ModuleForTests(apiScopeSystem.stubsSourceModuleName("foo"), "android_common")
- result.ModuleForTests(apiScopeTest.stubsSourceModuleName("foo"), "android_common")
- result.ModuleForTests(apiScopePublic.stubsSourceModuleName("foo")+".api.contribution", "")
- result.ModuleForTests(apiScopePublic.apiLibraryModuleName("foo"), "android_common")
- result.ModuleForTests("foo"+sdkXmlFileSuffix, "android_common")
- result.ModuleForTests("foo.api.public.28", "")
- result.ModuleForTests("foo.api.system.28", "")
- result.ModuleForTests("foo.api.test.28", "")
+ foo := result.ModuleForTests(t, "foo", "android_common")
+ result.ModuleForTests(t, apiScopePublic.stubsLibraryModuleName("foo"), "android_common")
+ result.ModuleForTests(t, apiScopeSystem.stubsLibraryModuleName("foo"), "android_common")
+ result.ModuleForTests(t, apiScopeTest.stubsLibraryModuleName("foo"), "android_common")
+ result.ModuleForTests(t, apiScopePublic.stubsSourceModuleName("foo"), "android_common")
+ result.ModuleForTests(t, apiScopeSystem.stubsSourceModuleName("foo"), "android_common")
+ result.ModuleForTests(t, apiScopeTest.stubsSourceModuleName("foo"), "android_common")
+ result.ModuleForTests(t, apiScopePublic.stubsSourceModuleName("foo")+".api.contribution", "")
+ result.ModuleForTests(t, apiScopePublic.apiLibraryModuleName("foo"), "android_common")
+ result.ModuleForTests(t, "foo"+sdkXmlFileSuffix, "android_common")
+ result.ModuleForTests(t, "foo.api.public.28", "")
+ result.ModuleForTests(t, "foo.api.system.28", "")
+ result.ModuleForTests(t, "foo.api.test.28", "")
exportedComponentsInfo, _ := android.OtherModuleProvider(result, foo.Module(), android.ExportedComponentsInfoProvider)
expectedFooExportedComponents := []string{
@@ -147,7 +147,7 @@ func TestJavaSdkLibrary(t *testing.T) {
}
android.AssertArrayString(t, "foo exported components", expectedFooExportedComponents, exportedComponentsInfo.Components)
- bazJavac := result.ModuleForTests("baz", "android_common").Rule("javac")
+ bazJavac := result.ModuleForTests(t, "baz", "android_common").Rule("javac")
// tests if baz is actually linked to the stubs lib
android.AssertStringDoesContain(t, "baz javac classpath", bazJavac.Args["classpath"], "foo.stubs.system.jar")
// ... and not to the impl lib
@@ -155,20 +155,20 @@ func TestJavaSdkLibrary(t *testing.T) {
// test if baz is not linked to the system variant of foo
android.AssertStringDoesNotContain(t, "baz javac classpath", bazJavac.Args["classpath"], "foo.stubs.jar")
- bazTestJavac := result.ModuleForTests("baz-test", "android_common").Rule("javac")
+ bazTestJavac := result.ModuleForTests(t, "baz-test", "android_common").Rule("javac")
// tests if baz-test is actually linked to the test stubs lib
android.AssertStringDoesContain(t, "baz-test javac classpath", bazTestJavac.Args["classpath"], "foo.stubs.test.jar")
- baz29Javac := result.ModuleForTests("baz-29", "android_common").Rule("javac")
+ baz29Javac := result.ModuleForTests(t, "baz-29", "android_common").Rule("javac")
// tests if baz-29 is actually linked to the system 29 stubs lib
android.AssertStringDoesContain(t, "baz-29 javac classpath", baz29Javac.Args["classpath"], "prebuilts/sdk/sdk_system_29_foo/android_common/combined/sdk_system_29_foo.jar")
- bazModule30Javac := result.ModuleForTests("baz-module-30", "android_common").Rule("javac")
+ bazModule30Javac := result.ModuleForTests(t, "baz-module-30", "android_common").Rule("javac")
// tests if "baz-module-30" is actually linked to the module 30 stubs lib
android.AssertStringDoesContain(t, "baz-module-30 javac classpath", bazModule30Javac.Args["classpath"], "prebuilts/sdk/sdk_module-lib_30_foo/android_common/combined/sdk_module-lib_30_foo.jar")
// test if baz has exported SDK lib names foo and bar to qux
- qux := result.ModuleForTests("qux", "android_common")
+ qux := result.ModuleForTests(t, "qux", "android_common")
if quxLib, ok := qux.Module().(*Library); ok {
requiredSdkLibs, optionalSdkLibs := quxLib.ClassLoaderContexts().UsesLibs()
android.AssertDeepEquals(t, "qux exports (required)", []string{"fred", "quuz", "foo", "bar"}, requiredSdkLibs)
@@ -176,13 +176,13 @@ func TestJavaSdkLibrary(t *testing.T) {
}
// test if quuz have created the api_contribution module
- result.ModuleForTests(apiScopePublic.stubsSourceModuleName("quuz")+".api.contribution", "")
+ result.ModuleForTests(t, apiScopePublic.stubsSourceModuleName("quuz")+".api.contribution", "")
- fooImplDexJar := result.ModuleForTests("foo.impl", "android_common").Rule("d8")
+ fooImplDexJar := result.ModuleForTests(t, "foo.impl", "android_common").Rule("d8")
// tests if kotlinc generated files are NOT excluded from output of foo.impl.
android.AssertStringDoesNotContain(t, "foo.impl dex", fooImplDexJar.BuildParams.Args["mergeZipsFlags"], "-stripFile META-INF/*.kotlin_module")
- barImplDexJar := result.ModuleForTests("bar.impl", "android_common").Rule("d8")
+ barImplDexJar := result.ModuleForTests(t, "bar.impl", "android_common").Rule("d8")
// tests if kotlinc generated files are excluded from output of bar.impl.
android.AssertStringDoesContain(t, "bar.impl dex", barImplDexJar.BuildParams.Args["mergeZipsFlags"], "-stripFile META-INF/*.kotlin_module")
}
@@ -220,7 +220,7 @@ func TestJavaSdkLibrary_UpdatableLibrary(t *testing.T) {
`)
// test that updatability attributes are passed on correctly
- fooUpdatable := result.ModuleForTests("fooUpdatable.xml", "android_common").Output("fooUpdatable.xml")
+ fooUpdatable := result.ModuleForTests(t, "fooUpdatable.xml", "android_common").Output("fooUpdatable.xml")
fooUpdatableContents := android.ContentFromFileRuleForTests(t, result.TestContext, fooUpdatable)
android.AssertStringDoesContain(t, "fooUpdatable.xml contents", fooUpdatableContents, `on-bootclasspath-since="U"`)
android.AssertStringDoesContain(t, "fooUpdatable.xml contents", fooUpdatableContents, `on-bootclasspath-before="V"`)
@@ -229,7 +229,7 @@ func TestJavaSdkLibrary_UpdatableLibrary(t *testing.T) {
// double check that updatability attributes are not written if they don't exist in the bp file
// the permissions file for the foo library defined above
- fooPermissions := result.ModuleForTests("foo.xml", "android_common").Output("foo.xml")
+ fooPermissions := result.ModuleForTests(t, "foo.xml", "android_common").Output("foo.xml")
fooPermissionsContents := android.ContentFromFileRuleForTests(t, result.TestContext, fooPermissions)
android.AssertStringDoesNotContain(t, "foo.xml contents", fooPermissionsContents, `on-bootclasspath-since`)
android.AssertStringDoesNotContain(t, "foo.xml contents", fooPermissionsContents, `on-bootclasspath-before`)
@@ -370,7 +370,7 @@ func TestJavaSdkLibrary_UpdatableLibrary_usesNewTag(t *testing.T) {
}
`)
// test that updatability attributes are passed on correctly
- fooUpdatable := result.ModuleForTests("foo.xml", "android_common").Output("foo.xml")
+ fooUpdatable := result.ModuleForTests(t, "foo.xml", "android_common").Output("foo.xml")
fooUpdatableContents := android.ContentFromFileRuleForTests(t, result.TestContext, fooUpdatable)
android.AssertStringDoesContain(t, "foo.xml contents", fooUpdatableContents, `<apex-library`)
android.AssertStringDoesNotContain(t, "foo.xml contents", fooUpdatableContents, `<library`)
@@ -417,11 +417,11 @@ func TestJavaSdkLibrary_StubOrImplOnlyLibs(t *testing.T) {
{lib: "stub-only-static-lib", in_stub_combined: true},
}
verify := func(sdklib, dep string, cp, combined bool) {
- sdklibCp := result.ModuleForTests(sdklib, "android_common").Rule("javac").Args["classpath"]
+ sdklibCp := result.ModuleForTests(t, sdklib, "android_common").Rule("javac").Args["classpath"]
expected := cp || combined // Every combined jar is also on the classpath.
android.AssertStringContainsEquals(t, "bad classpath for "+sdklib, sdklibCp, "/"+dep+".jar", expected)
- combineJarInputs := result.ModuleForTests(sdklib, "android_common").Rule("combineJar").Inputs.Strings()
+ combineJarInputs := result.ModuleForTests(t, sdklib, "android_common").Rule("combineJar").Inputs.Strings()
depPath := filepath.Join("out", "soong", ".intermediates", dep, "android_common", "turbine-combined", dep+".jar")
android.AssertStringListContainsEquals(t, "bad combined inputs for "+sdklib, combineJarInputs, depPath, combined)
}
@@ -457,7 +457,7 @@ func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
`)
// The bar library should depend on the stubs jar.
- barLibrary := result.ModuleForTests("bar", "android_common").Rule("javac")
+ barLibrary := result.ModuleForTests(t, "bar", "android_common").Rule("javac")
if expected, actual := `^-classpath .*:out/soong/[^:]*/turbine-combined/foo\.stubs\.jar$`, barLibrary.Args["classpath"]; !regexp.MustCompile(expected).MatchString(actual) {
t.Errorf("expected %q, found %#q", expected, actual)
}
@@ -797,7 +797,7 @@ func TestJavaSdkLibrary_SystemServer_AccessToStubScopeLibs(t *testing.T) {
// The bar library should depend on the highest (where system server is highest and public is
// lowest) API scopes provided by each of the foo-* modules. The highest API scope provided by the
// foo-<x> module is <x>.
- barLibrary := result.ModuleForTests("bar", "android_common").Rule("javac")
+ barLibrary := result.ModuleForTests(t, "bar", "android_common").Rule("javac")
stubLibraries := []string{
stubsPath("foo-public", apiScopePublic),
stubsPath("foo-system", apiScopeSystem),
@@ -850,10 +850,10 @@ func TestJavaSdkLibraryImport(t *testing.T) {
`)
for _, scope := range []string{"", ".system", ".test"} {
- fooModule := result.ModuleForTests("foo"+scope, "android_common")
+ fooModule := result.ModuleForTests(t, "foo"+scope, "android_common")
javac := fooModule.Rule("javac")
- sdklibStubsJar := result.ModuleForTests("sdklib.stubs"+scope, "android_common").Output("combined/sdklib.stubs" + scope + ".jar").Output
+ sdklibStubsJar := result.ModuleForTests(t, "sdklib.stubs"+scope, "android_common").Output("combined/sdklib.stubs" + scope + ".jar").Output
android.AssertStringDoesContain(t, "foo classpath", javac.Args["classpath"], sdklibStubsJar.String())
}
@@ -999,7 +999,7 @@ func testJavaSdkLibraryImport_Preferred(t *testing.T, prefer string, preparer an
// Make sure that dependencies on sdklib that resolve to one of the child libraries use the
// prebuilt library.
- public := result.ModuleForTests("public", "android_common")
+ public := result.ModuleForTests(t, "public", "android_common")
rule := public.Output("javac/public.jar")
inputs := rule.Implicits.Strings()
expected := "out/soong/.intermediates/prebuilt_sdklib.stubs/android_common/combined/sdklib.stubs.jar"
@@ -1119,7 +1119,7 @@ func TestSdkLibraryImport_MetadataModuleSupersedesPreferred(t *testing.T) {
).RunTestWithBp(t, bp)
// Make sure that rdeps get the correct source vs prebuilt based on mainline_module_contributions
- public := result.ModuleForTests("public", "android_common")
+ public := result.ModuleForTests(t, "public", "android_common")
rule := public.Output("javac/public.jar")
inputs := rule.Implicits.Strings()
expectedInputs := []string{
@@ -1207,7 +1207,7 @@ func TestJavaSdkLibraryDist(t *testing.T) {
for _, tt := range testCases {
t.Run(tt.module, func(t *testing.T) {
t.Parallel()
- m := result.ModuleForTests(apiScopePublic.exportableStubsLibraryModuleName(tt.module), "android_common").Module().(*Library)
+ m := result.ModuleForTests(t, apiScopePublic.exportableStubsLibraryModuleName(tt.module), "android_common").Module().(*Library)
dists := m.Dists()
if len(dists) != 1 {
t.Fatalf("expected exactly 1 dist entry, got %d", len(dists))
@@ -1330,7 +1330,7 @@ func TestJavaSdkLibrary_StubOnlyLibs_PassedToDroidstubs(t *testing.T) {
`)
// The foo.stubs.source should depend on bar-lib
- fooStubsSources := result.ModuleForTests("foo.stubs.source", "android_common").Module().(*Droidstubs)
+ fooStubsSources := result.ModuleForTests(t, "foo.stubs.source", "android_common").Module().(*Droidstubs)
eval := fooStubsSources.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
android.AssertStringListContains(t, "foo stubs should depend on bar-lib", fooStubsSources.Javadoc.properties.Libs.GetOrDefault(eval, nil), "bar-lib")
}
@@ -1358,7 +1358,7 @@ func TestJavaSdkLibrary_Scope_Libs_PassedToDroidstubs(t *testing.T) {
`)
// The foo.stubs.source should depend on bar-lib
- fooStubsSources := result.ModuleForTests("foo.stubs.source", "android_common").Module().(*Droidstubs)
+ fooStubsSources := result.ModuleForTests(t, "foo.stubs.source", "android_common").Module().(*Droidstubs)
eval := fooStubsSources.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
android.AssertStringListContains(t, "foo stubs should depend on bar-lib", fooStubsSources.Javadoc.properties.Libs.GetOrDefault(eval, nil), "bar-lib")
}
@@ -1409,7 +1409,7 @@ func TestJavaSdkLibrary_ApiLibrary(t *testing.T) {
}
for _, c := range testCases {
- m := result.ModuleForTests(c.scope.apiLibraryModuleName("foo"), "android_common").Module().(*ApiLibrary)
+ m := result.ModuleForTests(t, c.scope.apiLibraryModuleName("foo"), "android_common").Module().(*ApiLibrary)
android.AssertArrayString(t, "Module expected to contain api contributions", c.apiContributions, m.properties.Api_contributions)
}
}
@@ -1472,7 +1472,7 @@ func TestSdkLibraryDependency(t *testing.T) {
}
`)
- barPermissions := result.ModuleForTests("bar.xml", "android_common").Output("bar.xml")
+ barPermissions := result.ModuleForTests(t, "bar.xml", "android_common").Output("bar.xml")
barContents := android.ContentFromFileRuleForTests(t, result.TestContext, barPermissions)
android.AssertStringDoesContain(t, "bar.xml java_sdk_xml command", barContents, `dependency="foo"`)
}
@@ -1515,8 +1515,8 @@ func TestSdkLibraryExportableStubsLibrary(t *testing.T) {
exportableSourceStubsLibraryModuleName := apiScopePublic.exportableSourceStubsLibraryModuleName("foo")
// Check modules generation
- result.ModuleForTests(exportableStubsLibraryModuleName, "android_common")
- result.ModuleForTests(exportableSourceStubsLibraryModuleName, "android_common")
+ result.ModuleForTests(t, exportableStubsLibraryModuleName, "android_common")
+ result.ModuleForTests(t, exportableSourceStubsLibraryModuleName, "android_common")
// Check static lib dependency
android.AssertBoolEquals(t, "exportable top level stubs library module depends on the"+
@@ -1575,7 +1575,7 @@ func TestStubResolutionOfJavaSdkLibraryInLibs(t *testing.T) {
result := fixture.RunTestWithBp(t, bp)
// Make sure that rdeps get the correct source vs prebuilt based on mainline_module_contributions
- public := result.ModuleForTests("mymodule", "android_common")
+ public := result.ModuleForTests(t, "mymodule", "android_common")
rule := public.Output("javac/mymodule.jar")
inputs := rule.Implicits.Strings()
android.AssertStringListContains(t, "Could not find the expected stub on classpath", inputs, "out/soong/.intermediates/sdklib.stubs/android_common/turbine-combined/sdklib.stubs.jar")
@@ -1661,7 +1661,7 @@ func TestMultipleSdkLibraryPrebuilts(t *testing.T) {
result := fixture.RunTestWithBp(t, fmt.Sprintf(bp, tc.selectedDependencyName))
// Make sure that rdeps get the correct source vs prebuilt based on mainline_module_contributions
- public := result.ModuleForTests("mymodule", "android_common")
+ public := result.ModuleForTests(t, "mymodule", "android_common")
rule := public.Output("javac/mymodule.jar")
inputs := rule.Implicits.Strings()
android.AssertStringListContains(t, "Could not find the expected stub on classpath", inputs, tc.expectedStubPath)
diff --git a/java/sdk_test.go b/java/sdk_test.go
index e926307fb..49983ada2 100644
--- a/java/sdk_test.go
+++ b/java/sdk_test.go
@@ -501,7 +501,7 @@ func testClasspathTestCases(t *testing.T, classpathTestcases []classpathTestCase
}
checkClasspath := func(t *testing.T, result *android.TestResult, isJava8 bool) {
- foo := result.ModuleForTests("foo", variant(result))
+ foo := result.ModuleForTests(t, "foo", variant(result))
javac := foo.Rule("javac")
var deps []string
@@ -579,7 +579,7 @@ func testClasspathTestCases(t *testing.T, classpathTestcases []classpathTestCase
checkClasspath(t, result, true /* isJava8 */)
if testcase.host != android.Host {
- aidl := result.ModuleForTests("foo", variant(result)).Rule("aidl")
+ aidl := result.ModuleForTests(t, "foo", variant(result)).Rule("aidl")
android.AssertStringDoesContain(t, "aidl command", aidl.RuleParams.Command, testcase.aidl+" -I.")
}
@@ -593,7 +593,7 @@ func testClasspathTestCases(t *testing.T, classpathTestcases []classpathTestCase
checkClasspath(t, result, false /* isJava8 */)
if testcase.host != android.Host {
- aidl := result.ModuleForTests("foo", variant(result)).Rule("aidl")
+ aidl := result.ModuleForTests(t, "foo", variant(result)).Rule("aidl")
android.AssertStringDoesContain(t, "aidl command", aidl.RuleParams.Command, testcase.aidl+" -I.")
}
diff --git a/java/sdk_version_test.go b/java/sdk_version_test.go
index 6f0370a52..03d55f70a 100644
--- a/java/sdk_version_test.go
+++ b/java/sdk_version_test.go
@@ -58,7 +58,7 @@ func TestSystemSdkFromVendor(t *testing.T) {
vendor: true,
sdk_version: "system_current",
}`)
- fooModule := result.ModuleForTests("foo", "android_common")
+ fooModule := result.ModuleForTests(t, "foo", "android_common")
fooClasspath := fooModule.Rule("javac").Args["classpath"]
android.AssertStringDoesContain(t, "foo classpath", fooClasspath, "prebuilts/sdk/34/system/android.jar")
diff --git a/java/system_modules_test.go b/java/system_modules_test.go
index b7a99b51a..99301bc52 100644
--- a/java/system_modules_test.go
+++ b/java/system_modules_test.go
@@ -55,7 +55,7 @@ func TestJavaSystemModules(t *testing.T) {
result := android.GroupFixturePreparers(prepareForJavaTest, addSourceSystemModules).RunTest(t)
// check the existence of the source module
- sourceSystemModules := result.ModuleForTests("system-modules", "android_common")
+ sourceSystemModules := result.ModuleForTests(t, "system-modules", "android_common")
sourceInputs := sourceSystemModules.Rule("jarsTosystemModules").Inputs
// The expected paths are the header jars from the source input modules.
@@ -83,7 +83,7 @@ func TestJavaSystemModulesImport(t *testing.T) {
result := android.GroupFixturePreparers(prepareForJavaTest, addPrebuiltSystemModules).RunTest(t)
// check the existence of the renamed prebuilt module
- prebuiltSystemModules := result.ModuleForTests("system-modules", "android_common")
+ prebuiltSystemModules := result.ModuleForTests(t, "system-modules", "android_common")
prebuiltInputs := prebuiltSystemModules.Rule("jarsTosystemModules").Inputs
// The expected paths are the header jars from the renamed prebuilt input modules.
@@ -100,7 +100,7 @@ func TestJavaSystemModulesMixSourceAndPrebuilt(t *testing.T) {
).RunTest(t)
// check the existence of the source module
- sourceSystemModules := result.ModuleForTests("system-modules", "android_common")
+ sourceSystemModules := result.ModuleForTests(t, "system-modules", "android_common")
sourceInputs := sourceSystemModules.Rule("jarsTosystemModules").Inputs
// The expected paths are the header jars from the source input modules.
@@ -108,7 +108,7 @@ func TestJavaSystemModulesMixSourceAndPrebuilt(t *testing.T) {
android.AssertArrayString(t, "source system modules inputs", expectedSourcePaths, sourceInputs.RelativeToTop().Strings())
// check the existence of the renamed prebuilt module
- prebuiltSystemModules := result.ModuleForTests("prebuilt_system-modules", "android_common")
+ prebuiltSystemModules := result.ModuleForTests(t, "prebuilt_system-modules", "android_common")
prebuiltInputs := prebuiltSystemModules.Rule("jarsTosystemModules").Inputs
// The expected paths are the header jars from the renamed prebuilt input modules.
diff --git a/java/testing.go b/java/testing.go
index 0a032526c..b3071d7c6 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -604,7 +604,7 @@ func gatherRequiredDepsForTest() string {
func getModuleDependencies(t *testing.T, ctx *android.TestContext, name, variant string) []string {
t.Helper()
- module := ctx.ModuleForTests(name, variant).Module()
+ module := ctx.ModuleForTests(t, name, variant).Module()
deps := []string{}
ctx.VisitDirectDeps(module, func(m blueprint.Module) {
deps = append(deps, m.Name())
@@ -635,7 +635,7 @@ func CheckModuleHasDependency(t *testing.T, ctx *android.TestContext, name, vari
// CheckModuleHasDependency returns true if the module depends on the expected dependency.
func CheckModuleHasDependencyWithTag(t *testing.T, ctx *android.TestContext, name, variant string, desiredTag blueprint.DependencyTag, expected string) bool {
- module := ctx.ModuleForTests(name, variant).Module()
+ module := ctx.ModuleForTests(t, name, variant).Module()
found := false
ctx.VisitDirectDepsWithTags(module, func(m blueprint.Module, tag blueprint.DependencyTag) {
if tag == desiredTag && m.Name() == expected {
@@ -671,7 +671,7 @@ func CheckClasspathFragmentProtoContentInfoProvider(t *testing.T, result *androi
// name of the apex, or platform is it is not part of an apex and <module> is the module name.
func CheckPlatformBootclasspathDependencies(t *testing.T, ctx *android.TestContext, name, variant string, expected []string) {
t.Helper()
- platformBootclasspath := ctx.ModuleForTests(name, variant).Module().(*platformBootclasspathModule)
+ platformBootclasspath := ctx.ModuleForTests(t, name, variant).Module().(*platformBootclasspathModule)
modules := []android.Module{}
ctx.VisitDirectDeps(platformBootclasspath, func(m blueprint.Module) {
modules = append(modules, m.(android.Module))
@@ -746,7 +746,7 @@ func CheckHiddenAPIRuleInputs(t *testing.T, message string, expected string, hid
// Check that the merged file create by platform_compat_config_singleton has the correct inputs.
func CheckMergedCompatConfigInputs(t *testing.T, result *android.TestResult, message string, expectedPaths ...string) {
- sourceGlobalCompatConfig := result.SingletonForTests("platform_compat_config_singleton")
+ sourceGlobalCompatConfig := result.SingletonForTests(t, "platform_compat_config_singleton")
allOutputs := sourceGlobalCompatConfig.AllOutputs()
android.AssertIntEquals(t, message+": output len", 1, len(allOutputs))
output := sourceGlobalCompatConfig.Output(allOutputs[0])
diff --git a/kernel/prebuilt_kernel_modules_test.go b/kernel/prebuilt_kernel_modules_test.go
index 7b818695b..0fc2720be 100644
--- a/kernel/prebuilt_kernel_modules_test.go
+++ b/kernel/prebuilt_kernel_modules_test.go
@@ -50,7 +50,7 @@ func TestKernelModulesFilelist(t *testing.T) {
var actual []string
for _, ps := range android.OtherModuleProviderOrDefault(
- ctx, ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module(), android.InstallFilesProvider).PackagingSpecs {
+ ctx, ctx.ModuleForTests(t, "foo", "android_arm64_armv8-a").Module(), android.InstallFilesProvider).PackagingSpecs {
actual = append(actual, ps.RelPathInPackage())
}
actual = android.SortedUniqueStrings(actual)
diff --git a/linkerconfig/linkerconfig_test.go b/linkerconfig/linkerconfig_test.go
index 939e4bbb1..9e08b1950 100644
--- a/linkerconfig/linkerconfig_test.go
+++ b/linkerconfig/linkerconfig_test.go
@@ -46,7 +46,7 @@ func TestBaseLinkerConfig(t *testing.T) {
"LOCAL_INSTALLED_MODULE_STEM": {"linker.config.pb"},
}
- p := result.ModuleForTests("linker-config-base", "android_arm64_armv8-a").Module().(*linkerConfig)
+ p := result.ModuleForTests(t, "linker-config-base", "android_arm64_armv8-a").Module().(*linkerConfig)
if p.outputFilePath.Base() != "linker.config.pb" {
t.Errorf("expected linker.config.pb, got %q", p.outputFilePath.Base())
@@ -79,7 +79,7 @@ func TestUninstallableLinkerConfig(t *testing.T) {
expected := []string{"true"}
- p := result.ModuleForTests("linker-config-base", "android_arm64_armv8-a").Module().(*linkerConfig)
+ p := result.ModuleForTests(t, "linker-config-base", "android_arm64_armv8-a").Module().(*linkerConfig)
entries := android.AndroidMkEntriesForTest(t, result.TestContext, p)[0]
if value, ok := entries.EntryMap["LOCAL_UNINSTALLABLE_MODULE"]; ok {
if !reflect.DeepEqual(value, expected) {
diff --git a/provenance/provenance_singleton_test.go b/provenance/provenance_singleton_test.go
index 0f1eae220..05f3474b6 100644
--- a/provenance/provenance_singleton_test.go
+++ b/provenance/provenance_singleton_test.go
@@ -28,9 +28,9 @@ func TestProvenanceSingleton(t *testing.T) {
PrepareForTestWithProvenanceSingleton,
android.PrepareForTestWithAndroidMk).RunTestWithBp(t, "")
- outputs := result.SingletonForTests("provenance_metadata_singleton").AllOutputs()
+ outputs := result.SingletonForTests(t, "provenance_metadata_singleton").AllOutputs()
for _, output := range outputs {
- testingBuildParam := result.SingletonForTests("provenance_metadata_singleton").Output(output)
+ testingBuildParam := result.SingletonForTests(t, "provenance_metadata_singleton").Output(output)
switch {
case strings.Contains(output, "soong/provenance_metadata.textproto"):
android.AssertStringEquals(t, "Invalid build rule", "android/soong/provenance.mergeProvenanceMetaData", testingBuildParam.Rule.String())
diff --git a/python/python_test.go b/python/python_test.go
index 0e97626d6..5f971cdd1 100644
--- a/python/python_test.go
+++ b/python/python_test.go
@@ -313,7 +313,7 @@ func TestInvalidTestOnlyTargets(t *testing.T) {
}
func expectModule(t *testing.T, ctx *android.TestContext, name, variant, expectedSrcsZip string, expectedPyRunfiles []string) {
- module := ctx.ModuleForTests(name, variant)
+ module := ctx.ModuleForTests(t, name, variant)
base, baseOk := module.Module().(*PythonLibraryModule)
if !baseOk {
diff --git a/rust/afdo_test.go b/rust/afdo_test.go
index 0cdf70491..69aa97e22 100644
--- a/rust/afdo_test.go
+++ b/rust/afdo_test.go
@@ -50,7 +50,7 @@ func TestAfdoEnabled(t *testing.T) {
rustMockedFiles.AddToFixture(),
).RunTestWithBp(t, bp)
- foo := result.ModuleForTests("foo", "android_arm64_armv8-a").Rule("rustc")
+ foo := result.ModuleForTests(t, "foo", "android_arm64_armv8-a").Rule("rustc")
expectedCFlag := fmt.Sprintf(afdoFlagFormat, "afdo_profiles_package/foo.afdo")
@@ -96,8 +96,8 @@ func TestAfdoEnabledWithMultiArchs(t *testing.T) {
rustMockedFiles.AddToFixture(),
).RunTestWithBp(t, bp)
- fooArm := result.ModuleForTests("foo", "android_arm_armv7-a-neon").Rule("rustc")
- fooArm64 := result.ModuleForTests("foo", "android_arm64_armv8-a").Rule("rustc")
+ fooArm := result.ModuleForTests(t, "foo", "android_arm_armv7-a-neon").Rule("rustc")
+ fooArm64 := result.ModuleForTests(t, "foo", "android_arm64_armv8-a").Rule("rustc")
expectedCFlagArm := fmt.Sprintf(afdoFlagFormat, "afdo_profiles_package/foo_arm.afdo")
expectedCFlagArm64 := fmt.Sprintf(afdoFlagFormat, "afdo_profiles_package/foo_arm64.afdo")
diff --git a/rust/benchmark_test.go b/rust/benchmark_test.go
index 734dda71d..c239a0985 100644
--- a/rust/benchmark_test.go
+++ b/rust/benchmark_test.go
@@ -28,7 +28,7 @@ func TestRustBenchmark(t *testing.T) {
srcs: ["foo.rs"],
}`)
- testingModule := ctx.ModuleForTests("my_bench", "linux_glibc_x86_64")
+ testingModule := ctx.ModuleForTests(t, "my_bench", "linux_glibc_x86_64")
expectedOut := "my_bench/linux_glibc_x86_64/my_bench"
outPath := testingModule.Output("my_bench").Output.String()
if !strings.Contains(outPath, expectedOut) {
@@ -43,7 +43,7 @@ func TestRustBenchmarkLinkage(t *testing.T) {
srcs: ["foo.rs"],
}`)
- testingModule := ctx.ModuleForTests("my_bench", "android_arm64_armv8-a").Module().(*Module)
+ testingModule := ctx.ModuleForTests(t, "my_bench", "android_arm64_armv8-a").Module().(*Module)
if !android.InList("libcriterion.rlib-std", testingModule.Properties.AndroidMkRlibs) {
t.Errorf("rlib-std variant for libcriterion not detected as a rustlib-defined rlib dependency for device rust_benchmark module")
diff --git a/rust/binary_test.go b/rust/binary_test.go
index ef9303768..33710f9a8 100644
--- a/rust/binary_test.go
+++ b/rust/binary_test.go
@@ -36,7 +36,7 @@ func TestBinaryHostLinkage(t *testing.T) {
host_supported: true,
}
`)
- fizzBuzz := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Module().(*Module)
+ fizzBuzz := ctx.ModuleForTests(t, "fizz-buzz", "linux_glibc_x86_64").Module().(*Module)
if !android.InList("libfoo.rlib-std", fizzBuzz.Properties.AndroidMkRlibs) {
t.Errorf("rustlibs dependency libfoo should be an rlib dep for host binaries")
}
@@ -65,8 +65,8 @@ func TestBinaryLinkage(t *testing.T) {
host_supported: true,
}`)
- fizzBuzzHost := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Module().(*Module)
- fizzBuzzDevice := ctx.ModuleForTests("fizz-buzz", "android_arm64_armv8-a").Module().(*Module)
+ fizzBuzzHost := ctx.ModuleForTests(t, "fizz-buzz", "linux_glibc_x86_64").Module().(*Module)
+ fizzBuzzDevice := ctx.ModuleForTests(t, "fizz-buzz", "android_arm64_armv8-a").Module().(*Module)
if !android.InList("libfoo.rlib-std", fizzBuzzHost.Properties.AndroidMkRlibs) {
t.Errorf("rustlibs dependency libfoo should be an rlib dep for host modules")
@@ -76,7 +76,7 @@ func TestBinaryLinkage(t *testing.T) {
t.Errorf("rustlibs dependency libfoo should be an dylib dep for device modules")
}
- rlibLinkDevice := ctx.ModuleForTests("rlib_linked", "android_arm64_armv8-a").Module().(*Module)
+ rlibLinkDevice := ctx.ModuleForTests(t, "rlib_linked", "android_arm64_armv8-a").Module().(*Module)
if !android.InList("libfoo.rlib-std", rlibLinkDevice.Properties.AndroidMkRlibs) {
t.Errorf("rustlibs dependency libfoo should be an rlib dep for device modules when prefer_rlib is set")
@@ -100,7 +100,7 @@ func TestBinaryPreferRlib(t *testing.T) {
host_supported: true,
}`)
- mod := ctx.ModuleForTests("rlib_linked", "android_arm64_armv8-a").Module().(*Module)
+ mod := ctx.ModuleForTests(t, "rlib_linked", "android_arm64_armv8-a").Module().(*Module)
if !android.InList("libfoo.rlib-std", mod.Properties.AndroidMkRlibs) {
t.Errorf("rustlibs dependency libfoo should be an rlib dep when prefer_rlib is defined")
@@ -119,7 +119,7 @@ func TestHostToolPath(t *testing.T) {
srcs: ["foo.rs"],
}`)
- path := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Module().(*Module).HostToolPath()
+ path := ctx.ModuleForTests(t, "fizz-buzz", "linux_glibc_x86_64").Module().(*Module).HostToolPath()
if g, w := path.String(), "/host/linux-x86/bin/fizz-buzz"; !strings.Contains(g, w) {
t.Errorf("wrong host tool path, expected %q got %q", w, g)
}
@@ -133,7 +133,7 @@ func TestBinaryFlags(t *testing.T) {
srcs: ["foo.rs"],
}`)
- fizzBuzz := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Rule("rustc")
+ fizzBuzz := ctx.ModuleForTests(t, "fizz-buzz", "linux_glibc_x86_64").Rule("rustc")
flags := fizzBuzz.Args["rustcFlags"]
if strings.Contains(flags, "--test") {
@@ -150,7 +150,7 @@ func TestBootstrap(t *testing.T) {
bootstrap: true,
}`)
- foo := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Rule("rustc")
+ foo := ctx.ModuleForTests(t, "foo", "android_arm64_armv8-a").Rule("rustc")
flag := "-Wl,-dynamic-linker,/system/bin/bootstrap/linker64"
if !strings.Contains(foo.Args["linkFlags"], flag) {
@@ -166,8 +166,8 @@ func TestStaticBinaryFlags(t *testing.T) {
static_executable: true,
}`)
- fizzOut := ctx.ModuleForTests("fizz", "android_arm64_armv8-a").Rule("rustc")
- fizzMod := ctx.ModuleForTests("fizz", "android_arm64_armv8-a").Module().(*Module)
+ fizzOut := ctx.ModuleForTests(t, "fizz", "android_arm64_armv8-a").Rule("rustc")
+ fizzMod := ctx.ModuleForTests(t, "fizz", "android_arm64_armv8-a").Module().(*Module)
flags := fizzOut.Args["rustcFlags"]
linkFlags := fizzOut.Args["linkFlags"]
@@ -200,7 +200,7 @@ func TestLinkObjects(t *testing.T) {
name: "libfoo",
}`)
- fizzBuzz := ctx.ModuleForTests("fizz-buzz", "android_arm64_armv8-a").Rule("rustc")
+ fizzBuzz := ctx.ModuleForTests(t, "fizz-buzz", "android_arm64_armv8-a").Rule("rustc")
linkFlags := fizzBuzz.Args["linkFlags"]
if !strings.Contains(linkFlags, "/libfoo.so") {
t.Errorf("missing shared dependency 'libfoo.so' in linkFlags: %#v", linkFlags)
@@ -223,7 +223,7 @@ func TestStrippedBinary(t *testing.T) {
}
`)
- foo := ctx.ModuleForTests("foo", "android_arm64_armv8-a")
+ foo := ctx.ModuleForTests(t, "foo", "android_arm64_armv8-a")
foo.Output("unstripped/foo")
foo.Output("foo")
@@ -233,7 +233,7 @@ func TestStrippedBinary(t *testing.T) {
t.Errorf("installed binary not based on stripped version: %v", cp.Input)
}
- fizzBar := ctx.ModuleForTests("bar", "android_arm64_armv8-a").MaybeOutput("unstripped/bar")
+ fizzBar := ctx.ModuleForTests(t, "bar", "android_arm64_armv8-a").MaybeOutput("unstripped/bar")
if fizzBar.Rule != nil {
t.Errorf("unstripped binary exists, so stripped binary has incorrectly been generated")
}
diff --git a/rust/bindgen_test.go b/rust/bindgen_test.go
index 2b7362f08..267fb1cba 100644
--- a/rust/bindgen_test.go
+++ b/rust/bindgen_test.go
@@ -67,10 +67,10 @@ func TestRustBindgen(t *testing.T) {
cflags: ["--default-flag"],
}
`)
- libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
- libbindgenStatic := ctx.ModuleForTests("libbindgen_staticlib", "android_arm64_armv8-a_source").Output("bindings.rs")
- libbindgenHeader := ctx.ModuleForTests("libbindgen_headerlib", "android_arm64_armv8-a_source").Output("bindings.rs")
- libbindgenHeaderModule := ctx.ModuleForTests("libbindgen_headerlib", "android_arm64_armv8-a_source").Module().(*Module)
+ libbindgen := ctx.ModuleForTests(t, "libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
+ libbindgenStatic := ctx.ModuleForTests(t, "libbindgen_staticlib", "android_arm64_armv8-a_source").Output("bindings.rs")
+ libbindgenHeader := ctx.ModuleForTests(t, "libbindgen_headerlib", "android_arm64_armv8-a_source").Output("bindings.rs")
+ libbindgenHeaderModule := ctx.ModuleForTests(t, "libbindgen_headerlib", "android_arm64_armv8-a_source").Module().(*Module)
// Ensure that the flags are present and escaped
if !strings.Contains(libbindgen.Args["flags"], "'--bindgen-flag.*'") {
t.Errorf("missing bindgen flags in rust_bindgen rule: flags %#v", libbindgen.Args["flags"])
@@ -113,7 +113,7 @@ func TestRustBindgenCustomBindgen(t *testing.T) {
}
`)
- libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
+ libbindgen := ctx.ModuleForTests(t, "libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
// The rule description should contain the custom binary name rather than bindgen, so checking the description
// should be sufficient.
@@ -155,8 +155,8 @@ func TestRustBindgenStdVersions(t *testing.T) {
}
`)
- libbindgen_cstd := ctx.ModuleForTests("libbindgen_cstd", "android_arm64_armv8-a_source").Output("bindings.rs")
- libbindgen_cppstd := ctx.ModuleForTests("libbindgen_cppstd", "android_arm64_armv8-a_source").Output("bindings.rs")
+ libbindgen_cstd := ctx.ModuleForTests(t, "libbindgen_cstd", "android_arm64_armv8-a_source").Output("bindings.rs")
+ libbindgen_cppstd := ctx.ModuleForTests(t, "libbindgen_cppstd", "android_arm64_armv8-a_source").Output("bindings.rs")
if !strings.Contains(libbindgen_cstd.Args["cflags"], "-std=foo") {
t.Errorf("c_std value not passed in to rust_bindgen as a clang flag")
@@ -216,7 +216,7 @@ func TestBindgenFlagFile(t *testing.T) {
],
}
`)
- libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
+ libbindgen := ctx.ModuleForTests(t, "libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
if !strings.Contains(libbindgen.Args["flagfiles"], "/dev/null") {
t.Errorf("missing /dev/null in rust_bindgen rule: flags %#v", libbindgen.Args["flagfiles"])
@@ -246,7 +246,7 @@ func TestBindgenHandleStaticInlining(t *testing.T) {
include_dirs: ["src/"],
}
`)
- libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
+ libbindgen := ctx.ModuleForTests(t, "libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
// Make sure the flag to support `static inline` functions is present
if !strings.Contains(libbindgen.Args["flags"], "--wrap-static-fns") {
t.Errorf("missing flag to handle static inlining in rust_bindgen rule: flags %#v", libbindgen.Args["flags"])
diff --git a/rust/builder_test.go b/rust/builder_test.go
index b4b022ed9..7d6b56ac9 100644
--- a/rust/builder_test.go
+++ b/rust/builder_test.go
@@ -160,7 +160,7 @@ func TestCompilationOutputFiles(t *testing.T) {
}
for _, tc := range testcases {
t.Run(tc.testName, func(t *testing.T) {
- modOutputs := ctx.ModuleForTests(tc.moduleName, tc.variant).AllOutputs()
+ modOutputs := ctx.ModuleForTests(t, tc.moduleName, tc.variant).AllOutputs()
sort.Strings(tc.expectedFiles)
sort.Strings(modOutputs)
android.AssertStringPathsRelativeToTopEquals(
diff --git a/rust/clippy_test.go b/rust/clippy_test.go
index bd3bfb151..3563348ea 100644
--- a/rust/clippy_test.go
+++ b/rust/clippy_test.go
@@ -62,13 +62,13 @@ func TestClippy(t *testing.T) {
android.FixtureAddTextFile(tc.modulePath+"Android.bp", bp),
).RunTest(t)
- r := result.ModuleForTests("libfoo", "android_arm64_armv8-a_dylib").MaybeRule("clippy")
+ r := result.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_dylib").MaybeRule("clippy")
android.AssertStringEquals(t, "libfoo flags", tc.fooFlags, r.Args["clippyFlags"])
- r = result.ModuleForTests("libbar", "android_arm64_armv8-a_dylib").MaybeRule("clippy")
+ r = result.ModuleForTests(t, "libbar", "android_arm64_armv8-a_dylib").MaybeRule("clippy")
android.AssertStringEquals(t, "libbar flags", "${config.ClippyDefaultLints}", r.Args["clippyFlags"])
- r = result.ModuleForTests("libfoobar", "android_arm64_armv8-a_dylib").MaybeRule("clippy")
+ r = result.ModuleForTests(t, "libfoobar", "android_arm64_armv8-a_dylib").MaybeRule("clippy")
if r.Rule != nil {
t.Errorf("libfoobar is setup to use clippy when explicitly disabled: clippyFlags=%q", r.Args["clippyFlags"])
}
diff --git a/rust/compiler_test.go b/rust/compiler_test.go
index 4caa12b3e..8805d15eb 100644
--- a/rust/compiler_test.go
+++ b/rust/compiler_test.go
@@ -34,7 +34,7 @@ func TestFeaturesToFlags(t *testing.T) {
],
}`)
- libfooDylib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
+ libfooDylib := ctx.ModuleForTests(t, "libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
if !strings.Contains(libfooDylib.Args["rustcFlags"], "cfg 'feature=\"fizz\"'") ||
!strings.Contains(libfooDylib.Args["rustcFlags"], "cfg 'feature=\"buzz\"'") {
@@ -55,7 +55,7 @@ func TestCfgsToFlags(t *testing.T) {
],
}`)
- libfooDylib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
+ libfooDylib := ctx.ModuleForTests(t, "libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
if !strings.Contains(libfooDylib.Args["rustcFlags"], "cfg 'std'") ||
!strings.Contains(libfooDylib.Args["rustcFlags"], "cfg 'cfg1=\"one\"'") {
@@ -81,8 +81,8 @@ func TestLtoFlag(t *testing.T) {
}
`)
- libfoo := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
- libfooLto := ctx.ModuleForTests("libfoo_lto", "linux_glibc_x86_64_dylib").Rule("rustc")
+ libfoo := ctx.ModuleForTests(t, "libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
+ libfooLto := ctx.ModuleForTests(t, "libfoo_lto", "linux_glibc_x86_64_dylib").Rule("rustc")
if strings.Contains(libfoo.Args["rustcFlags"], "-C lto=thin") {
t.Fatalf("libfoo expected to disable lto -- rustcFlags: %#v", libfoo.Args["rustcFlags"])
@@ -174,7 +174,7 @@ func TestCargoCompat(t *testing.T) {
cargo_pkg_version: "1.0.0"
}`)
- fizz := ctx.ModuleForTests("fizz", "android_arm64_armv8-a").Rule("rustc")
+ fizz := ctx.ModuleForTests(t, "fizz", "android_arm64_armv8-a").Rule("rustc")
if !strings.Contains(fizz.Args["envVars"], "CARGO_BIN_NAME=fizz") {
t.Fatalf("expected 'CARGO_BIN_NAME=fizz' in envVars, actual envVars: %#v", fizz.Args["envVars"])
@@ -199,11 +199,11 @@ func TestInstallDir(t *testing.T) {
srcs: ["foo.rs"],
}`)
- install_path_lib64 := ctx.ModuleForTests("libfoo",
+ install_path_lib64 := ctx.ModuleForTests(t, "libfoo",
"android_arm64_armv8-a_dylib").Module().(*Module).compiler.(*libraryDecorator).path.String()
- install_path_lib32 := ctx.ModuleForTests("libfoo",
+ install_path_lib32 := ctx.ModuleForTests(t, "libfoo",
"android_arm_armv7-a-neon_dylib").Module().(*Module).compiler.(*libraryDecorator).path.String()
- install_path_bin := ctx.ModuleForTests("fizzbuzz",
+ install_path_bin := ctx.ModuleForTests(t, "fizzbuzz",
"android_arm64_armv8-a").Module().(*Module).compiler.(*binaryDecorator).path.String()
if !strings.HasSuffix(install_path_lib64, "system/lib64/libfoo.dylib.so") {
@@ -259,13 +259,13 @@ func TestLints(t *testing.T) {
android.FixtureAddTextFile(tc.modulePath+"Android.bp", bp),
).RunTest(t)
- r := result.ModuleForTests("libfoo", "android_arm64_armv8-a_dylib").MaybeRule("rustc")
+ r := result.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_dylib").MaybeRule("rustc")
android.AssertStringDoesContain(t, "libfoo flags", r.Args["rustcFlags"], tc.fooFlags)
- r = result.ModuleForTests("libbar", "android_arm64_armv8-a_dylib").MaybeRule("rustc")
+ r = result.ModuleForTests(t, "libbar", "android_arm64_armv8-a_dylib").MaybeRule("rustc")
android.AssertStringDoesContain(t, "libbar flags", r.Args["rustcFlags"], "${config.RustDefaultLints}")
- r = result.ModuleForTests("libfoobar", "android_arm64_armv8-a_dylib").MaybeRule("rustc")
+ r = result.ModuleForTests(t, "libfoobar", "android_arm64_armv8-a_dylib").MaybeRule("rustc")
android.AssertStringDoesContain(t, "libfoobar flags", r.Args["rustcFlags"], "${config.RustAllowAllLints}")
})
}
@@ -283,9 +283,9 @@ func TestStdDeviceLinkage(t *testing.T) {
srcs: ["foo.rs"],
crate_name: "foo",
}`)
- fizz := ctx.ModuleForTests("fizz", "android_arm64_armv8-a").Module().(*Module)
- fooRlib := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib_dylib-std").Module().(*Module)
- fooDylib := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_dylib").Module().(*Module)
+ fizz := ctx.ModuleForTests(t, "fizz", "android_arm64_armv8-a").Module().(*Module)
+ fooRlib := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_rlib_dylib-std").Module().(*Module)
+ fooDylib := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_dylib").Module().(*Module)
if !android.InList("libstd", fizz.Properties.AndroidMkDylibs) {
t.Errorf("libstd is not linked dynamically for device binaries")
diff --git a/rust/coverage_test.go b/rust/coverage_test.go
index 0f599d745..f9198f1f0 100644
--- a/rust/coverage_test.go
+++ b/rust/coverage_test.go
@@ -51,10 +51,10 @@ func TestCoverageFlags(t *testing.T) {
}
// Just test the dylib variants unless the library coverage logic changes to distinguish between the types.
- libfooCov := ctx.ModuleForTests("libfoo_cov", "android_arm64_armv8-a_dylib_cov").Rule("rustc")
- libbarNoCov := ctx.ModuleForTests("libbar_nocov", "android_arm64_armv8-a_dylib").Rule("rustc")
- fizzCov := ctx.ModuleForTests("fizz_cov", "android_arm64_armv8-a_cov").Rule("rustc")
- buzzNoCov := ctx.ModuleForTests("buzzNoCov", "android_arm64_armv8-a").Rule("rustc")
+ libfooCov := ctx.ModuleForTests(t, "libfoo_cov", "android_arm64_armv8-a_dylib_cov").Rule("rustc")
+ libbarNoCov := ctx.ModuleForTests(t, "libbar_nocov", "android_arm64_armv8-a_dylib").Rule("rustc")
+ fizzCov := ctx.ModuleForTests(t, "fizz_cov", "android_arm64_armv8-a_cov").Rule("rustc")
+ buzzNoCov := ctx.ModuleForTests(t, "buzzNoCov", "android_arm64_armv8-a").Rule("rustc")
rustcCoverageFlags := []string{"-C instrument-coverage", " -g "}
for _, flag := range rustcCoverageFlags {
@@ -103,7 +103,7 @@ func TestCoverageDeps(t *testing.T) {
srcs: ["foo.rs"],
}`)
- fizz := ctx.ModuleForTests("fizz", "android_arm64_armv8-a_cov").Rule("rustc")
+ fizz := ctx.ModuleForTests(t, "fizz", "android_arm64_armv8-a_cov").Rule("rustc")
if !strings.Contains(fizz.Args["linkFlags"], "libprofile-clang-extras.a") {
t.Fatalf("missing expected coverage 'libprofile-clang-extras' dependency in linkFlags: %#v", fizz.Args["linkFlags"])
}
diff --git a/rust/fuzz_test.go b/rust/fuzz_test.go
index 3598c9970..bdcfbbba1 100644
--- a/rust/fuzz_test.go
+++ b/rust/fuzz_test.go
@@ -41,7 +41,7 @@ func TestRustFuzz(t *testing.T) {
`)
// Check that appropriate dependencies are added and that the rustlib linkage is correct.
- fuzz_libtest_mod := ctx.ModuleForTests("fuzz_libtest", "android_arm64_armv8-a_fuzzer").Module().(*Module)
+ fuzz_libtest_mod := ctx.ModuleForTests(t, "fuzz_libtest", "android_arm64_armv8-a_fuzzer").Module().(*Module)
if !android.InList("liblibfuzzer_sys.rlib-std", fuzz_libtest_mod.Properties.AndroidMkRlibs) {
t.Errorf("liblibfuzzer_sys rlib library dependency missing for rust_fuzz module. %#v", fuzz_libtest_mod.Properties.AndroidMkRlibs)
}
@@ -50,21 +50,21 @@ func TestRustFuzz(t *testing.T) {
}
// Check that compiler flags are set appropriately .
- fuzz_libtest := ctx.ModuleForTests("fuzz_libtest", "android_arm64_armv8-a_fuzzer").Rule("rustc")
+ fuzz_libtest := ctx.ModuleForTests(t, "fuzz_libtest", "android_arm64_armv8-a_fuzzer").Rule("rustc")
if !strings.Contains(fuzz_libtest.Args["rustcFlags"], "-C passes='sancov-module'") ||
!strings.Contains(fuzz_libtest.Args["rustcFlags"], "--cfg fuzzing") {
t.Errorf("rust_fuzz module does not contain the expected flags (sancov-module, cfg fuzzing).")
}
// Check that host modules support fuzzing.
- host_fuzzer := ctx.ModuleForTests("fuzz_libtest", "android_arm64_armv8-a_fuzzer").Rule("rustc")
+ host_fuzzer := ctx.ModuleForTests(t, "fuzz_libtest", "android_arm64_armv8-a_fuzzer").Rule("rustc")
if !strings.Contains(host_fuzzer.Args["rustcFlags"], "-C passes='sancov-module'") ||
!strings.Contains(host_fuzzer.Args["rustcFlags"], "--cfg fuzzing") {
t.Errorf("rust_fuzz_host module does not contain the expected flags (sancov-module, cfg fuzzing).")
}
// Check that dependencies have 'fuzzer' variants produced for them as well.
- libtest_fuzzer := ctx.ModuleForTests("libtest_fuzzing", "android_arm64_armv8-a_rlib_rlib-std_fuzzer").Output("libtest_fuzzing.rlib")
+ libtest_fuzzer := ctx.ModuleForTests(t, "libtest_fuzzing", "android_arm64_armv8-a_rlib_rlib-std_fuzzer").Output("libtest_fuzzing.rlib")
if !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "-C passes='sancov-module'") ||
!strings.Contains(libtest_fuzzer.Args["rustcFlags"], "--cfg fuzzing") {
t.Errorf("rust_fuzz dependent library does not contain the expected flags (sancov-module, cfg fuzzing).")
@@ -93,7 +93,7 @@ func TestRustFuzzDepBundling(t *testing.T) {
}
`)
- fuzz_libtest := ctx.ModuleForTests("fuzz_libtest", "android_arm64_armv8-a_fuzzer").Module().(*Module)
+ fuzz_libtest := ctx.ModuleForTests(t, "fuzz_libtest", "android_arm64_armv8-a_fuzzer").Module().(*Module)
if !strings.Contains(fuzz_libtest.FuzzSharedLibraries().String(), ":libcc_direct_dep.so") {
t.Errorf("rust_fuzz does not contain the expected bundled direct shared libs ('libcc_direct_dep'): %#v", fuzz_libtest.FuzzSharedLibraries().String())
@@ -134,9 +134,9 @@ func TestCCFuzzDepBundling(t *testing.T) {
}
`)
- fuzz_shared_libtest := ctx.ModuleForTests("fuzz_shared_libtest", "android_arm64_armv8-a_fuzzer").Module().(cc.LinkableInterface)
- fuzz_static_libtest := ctx.ModuleForTests("fuzz_static_libtest", "android_arm64_armv8-a_fuzzer").Module().(cc.LinkableInterface)
- fuzz_staticffi_libtest := ctx.ModuleForTests("fuzz_staticffi_libtest", "android_arm64_armv8-a_fuzzer").Module().(cc.LinkableInterface)
+ fuzz_shared_libtest := ctx.ModuleForTests(t, "fuzz_shared_libtest", "android_arm64_armv8-a_fuzzer").Module().(cc.LinkableInterface)
+ fuzz_static_libtest := ctx.ModuleForTests(t, "fuzz_static_libtest", "android_arm64_armv8-a_fuzzer").Module().(cc.LinkableInterface)
+ fuzz_staticffi_libtest := ctx.ModuleForTests(t, "fuzz_staticffi_libtest", "android_arm64_armv8-a_fuzzer").Module().(cc.LinkableInterface)
if !strings.Contains(fuzz_shared_libtest.FuzzSharedLibraries().String(), ":libcc_transitive_dep.so") {
t.Errorf("cc_fuzz does not contain the expected bundled transitive shared libs from rust_ffi_shared ('libcc_transitive_dep'): %#v", fuzz_shared_libtest.FuzzSharedLibraries().String())
diff --git a/rust/image_test.go b/rust/image_test.go
index 0581fa7f8..e5ecd7972 100644
--- a/rust/image_test.go
+++ b/rust/image_test.go
@@ -45,7 +45,7 @@ func TestVendorLinkage(t *testing.T) {
}
`)
- vendorBinary := ctx.ModuleForTests("fizz_vendor_available", "android_vendor_arm64_armv8-a").Module().(*cc.Module)
+ vendorBinary := ctx.ModuleForTests(t, "fizz_vendor_available", "android_vendor_arm64_armv8-a").Module().(*cc.Module)
if android.InList("libfoo_vendor.vendor", vendorBinary.Properties.AndroidMkStaticLibs) {
t.Errorf("vendorBinary should not have a staticlib dependency on libfoo_vendor.vendor: %#v", vendorBinary.Properties.AndroidMkStaticLibs)
@@ -64,7 +64,7 @@ func TestImageCfgFlag(t *testing.T) {
}
`)
- vendor := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Rule("rustc")
+ vendor := ctx.ModuleForTests(t, "libfoo", "android_vendor_arm64_armv8-a_shared").Rule("rustc")
if !strings.Contains(vendor.Args["rustcFlags"], "--cfg 'android_vndk'") {
t.Errorf("missing \"--cfg 'android_vndk'\" for libfoo vendor variant, rustcFlags: %#v", vendor.Args["rustcFlags"])
@@ -76,7 +76,7 @@ func TestImageCfgFlag(t *testing.T) {
t.Errorf("unexpected \"--cfg 'android_product'\" for libfoo vendor variant, rustcFlags: %#v", vendor.Args["rustcFlags"])
}
- product := ctx.ModuleForTests("libfoo", "android_product_arm64_armv8-a_shared").Rule("rustc")
+ product := ctx.ModuleForTests(t, "libfoo", "android_product_arm64_armv8-a_shared").Rule("rustc")
if !strings.Contains(product.Args["rustcFlags"], "--cfg 'android_vndk'") {
t.Errorf("missing \"--cfg 'android_vndk'\" for libfoo product variant, rustcFlags: %#v", product.Args["rustcFlags"])
}
@@ -87,7 +87,7 @@ func TestImageCfgFlag(t *testing.T) {
t.Errorf("missing \"--cfg 'android_product'\" for libfoo product variant, rustcFlags: %#v", product.Args["rustcFlags"])
}
- system := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("rustc")
+ system := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Rule("rustc")
if strings.Contains(system.Args["rustcFlags"], "--cfg 'android_vndk'") {
t.Errorf("unexpected \"--cfg 'android_vndk'\" for libfoo system variant, rustcFlags: %#v", system.Args["rustcFlags"])
}
@@ -119,7 +119,7 @@ func TestVendorRamdiskLinkage(t *testing.T) {
}
`)
- vendorRamdiskLibrary := ctx.ModuleForTests("libcc_vendor_ramdisk", "android_vendor_ramdisk_arm64_armv8-a_shared").Module().(*cc.Module)
+ vendorRamdiskLibrary := ctx.ModuleForTests(t, "libcc_vendor_ramdisk", "android_vendor_ramdisk_arm64_armv8-a_shared").Module().(*cc.Module)
if android.InList("libfoo_vendor_ramdisk.vendor_ramdisk", vendorRamdiskLibrary.Properties.AndroidMkStaticLibs) {
t.Errorf("libcc_vendor_ramdisk should not have a dependency on the libfoo_vendor_ramdisk static library")
@@ -144,7 +144,7 @@ func TestForbiddenVendorLinkage(t *testing.T) {
}
func checkInstallPartition(t *testing.T, ctx *android.TestContext, name, variant, expected string) {
- mod := ctx.ModuleForTests(name, variant).Module().(*Module)
+ mod := ctx.ModuleForTests(t, name, variant).Module().(*Module)
partitionDefined := false
checkPartition := func(specific bool, partition string) {
if specific {
diff --git a/rust/library_test.go b/rust/library_test.go
index 1198fcc9f..6db95253f 100644
--- a/rust/library_test.go
+++ b/rust/library_test.go
@@ -42,10 +42,10 @@ func TestLibraryVariants(t *testing.T) {
}`)
// Test all variants are being built.
- libfooRlib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_rlib_rlib-std").Rule("rustc")
- libfooDylib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
- libfooFFIRlib := ctx.ModuleForTests("libfoo.ffi", "linux_glibc_x86_64_rlib_rlib-std").Rule("rustc")
- libfooShared := ctx.ModuleForTests("libfoo.ffi", "linux_glibc_x86_64_shared").Rule("rustc")
+ libfooRlib := ctx.ModuleForTests(t, "libfoo", "linux_glibc_x86_64_rlib_rlib-std").Rule("rustc")
+ libfooDylib := ctx.ModuleForTests(t, "libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
+ libfooFFIRlib := ctx.ModuleForTests(t, "libfoo.ffi", "linux_glibc_x86_64_rlib_rlib-std").Rule("rustc")
+ libfooShared := ctx.ModuleForTests(t, "libfoo.ffi", "linux_glibc_x86_64_shared").Rule("rustc")
rlibCrateType := "rlib"
dylibCrateType := "dylib"
@@ -82,7 +82,7 @@ func TestDylibPreferDynamic(t *testing.T) {
crate_name: "foo",
}`)
- libfooDylib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
+ libfooDylib := ctx.ModuleForTests(t, "libfoo", "linux_glibc_x86_64_dylib").Rule("rustc")
if !strings.Contains(libfooDylib.Args["rustcFlags"], "prefer-dynamic") {
t.Errorf("missing prefer-dynamic flag for libfoo dylib, rustcFlags: %#v", libfooDylib.Args["rustcFlags"])
@@ -134,7 +134,7 @@ func TestSharedLibrary(t *testing.T) {
crate_name: "foo",
}`)
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared")
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared")
libfooOutput := libfoo.Rule("rustc")
if !strings.Contains(libfooOutput.Args["linkFlags"], "-Wl,-soname=libfoo.so") {
@@ -160,7 +160,7 @@ func TestSharedLibraryToc(t *testing.T) {
shared_libs: ["libfoo"],
}`)
- fizzbuzz := ctx.ModuleForTests("fizzbuzz", "android_arm64_armv8-a").Rule("ld")
+ fizzbuzz := ctx.ModuleForTests(t, "fizzbuzz", "android_arm64_armv8-a").Rule("ld")
if !android.SuffixInList(fizzbuzz.Implicits.Strings(), "libfoo.so.toc") {
t.Errorf("missing expected libfoo.so.toc implicit dependency, instead found: %#v",
@@ -176,7 +176,7 @@ func TestStaticLibraryLinkage(t *testing.T) {
crate_name: "foo",
}`)
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib_rlib-std")
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_rlib_rlib-std")
if !android.InList("libstd", libfoo.Module().(*Module).Properties.AndroidMkRlibs) {
t.Errorf("Static libstd rlib expected to be a dependency of Rust rlib libraries. Rlib deps are: %#v",
@@ -209,9 +209,9 @@ func TestNativeDependencyOfRlib(t *testing.T) {
}
`)
- rustRlibRlibStd := ctx.ModuleForTests("librust_rlib", "android_arm64_armv8-a_rlib_rlib-std")
- rustRlibDylibStd := ctx.ModuleForTests("librust_rlib", "android_arm64_armv8-a_rlib_dylib-std")
- ffiRlib := ctx.ModuleForTests("libffi_static", "android_arm64_armv8-a_rlib_rlib-std")
+ rustRlibRlibStd := ctx.ModuleForTests(t, "librust_rlib", "android_arm64_armv8-a_rlib_rlib-std")
+ rustRlibDylibStd := ctx.ModuleForTests(t, "librust_rlib", "android_arm64_armv8-a_rlib_dylib-std")
+ ffiRlib := ctx.ModuleForTests(t, "libffi_static", "android_arm64_armv8-a_rlib_rlib-std")
modules := []android.TestingModule{
rustRlibRlibStd,
@@ -285,10 +285,10 @@ func TestAutoDeps(t *testing.T) {
],
}`)
- libfooRlib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_rlib_rlib-std")
- libfooDylib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_dylib")
- libfooFFIRlib := ctx.ModuleForTests("libfoo.ffi", "linux_glibc_x86_64_rlib_rlib-std")
- libfooShared := ctx.ModuleForTests("libfoo.ffi", "linux_glibc_x86_64_shared")
+ libfooRlib := ctx.ModuleForTests(t, "libfoo", "linux_glibc_x86_64_rlib_rlib-std")
+ libfooDylib := ctx.ModuleForTests(t, "libfoo", "linux_glibc_x86_64_dylib")
+ libfooFFIRlib := ctx.ModuleForTests(t, "libfoo.ffi", "linux_glibc_x86_64_rlib_rlib-std")
+ libfooShared := ctx.ModuleForTests(t, "libfoo.ffi", "linux_glibc_x86_64_shared")
for _, static := range []android.TestingModule{libfooRlib, libfooFFIRlib} {
if !android.InList("libbar.rlib-std", static.Module().(*Module).Properties.AndroidMkRlibs) {
@@ -330,7 +330,7 @@ func TestStrippedLibrary(t *testing.T) {
}
`)
- foo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_dylib")
+ foo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_dylib")
foo.Output("libfoo.dylib.so")
foo.Output("unstripped/libfoo.dylib.so")
// Check that the `cp` rule is using the stripped version as input.
@@ -339,7 +339,7 @@ func TestStrippedLibrary(t *testing.T) {
t.Errorf("installed library not based on stripped version: %v", cp.Input)
}
- fizzBar := ctx.ModuleForTests("libbar", "android_arm64_armv8-a_dylib").MaybeOutput("unstripped/libbar.dylib.so")
+ fizzBar := ctx.ModuleForTests(t, "libbar", "android_arm64_armv8-a_dylib").MaybeOutput("unstripped/libbar.dylib.so")
if fizzBar.Rule != nil {
t.Errorf("unstripped library exists, so stripped library has incorrectly been generated")
}
@@ -372,15 +372,15 @@ func TestLibstdLinkage(t *testing.T) {
prefer_rlib: true,
}`)
- libfooDylib := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_dylib").Module().(*Module)
- libfooRlibStatic := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib_rlib-std").Module().(*Module)
- libfooRlibDynamic := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib_dylib-std").Module().(*Module)
+ libfooDylib := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_dylib").Module().(*Module)
+ libfooRlibStatic := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_rlib_rlib-std").Module().(*Module)
+ libfooRlibDynamic := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_rlib_dylib-std").Module().(*Module)
- libbarShared := ctx.ModuleForTests("libbar", "android_arm64_armv8-a_shared").Module().(*Module)
- libbarFFIRlib := ctx.ModuleForTests("libbar", "android_arm64_armv8-a_rlib_rlib-std").Module().(*Module)
+ libbarShared := ctx.ModuleForTests(t, "libbar", "android_arm64_armv8-a_shared").Module().(*Module)
+ libbarFFIRlib := ctx.ModuleForTests(t, "libbar", "android_arm64_armv8-a_rlib_rlib-std").Module().(*Module)
// prefer_rlib works the same for both rust_library and rust_ffi, so a single check is sufficient here.
- libbarRlibStd := ctx.ModuleForTests("libbar.prefer_rlib", "android_arm64_armv8-a_shared").Module().(*Module)
+ libbarRlibStd := ctx.ModuleForTests(t, "libbar.prefer_rlib", "android_arm64_armv8-a_shared").Module().(*Module)
if !android.InList("libstd", libfooRlibStatic.Properties.AndroidMkRlibs) {
t.Errorf("rlib-std variant for device rust_library_rlib does not link libstd as an rlib")
@@ -422,7 +422,7 @@ func TestRustFFIExportedIncludes(t *testing.T) {
shared_libs: ["libbar"],
host_supported: true,
}`)
- libfooStatic := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_static").Rule("cc")
+ libfooStatic := ctx.ModuleForTests(t, "libfoo", "linux_glibc_x86_64_static").Rule("cc")
android.AssertStringDoesContain(t, "cFlags for lib module", libfooStatic.Args["cFlags"], " -Irust_includes ")
}
@@ -443,8 +443,8 @@ func TestRustVersionScript(t *testing.T) {
`)
//linkFlags
- librs := ctx.ModuleForTests("librs", "android_arm64_armv8-a_dylib").Rule("rustc")
- libffi := ctx.ModuleForTests("libffi", "android_arm64_armv8-a_shared").Rule("rustc")
+ librs := ctx.ModuleForTests(t, "librs", "android_arm64_armv8-a_dylib").Rule("rustc")
+ libffi := ctx.ModuleForTests(t, "libffi", "android_arm64_armv8-a_shared").Rule("rustc")
if !strings.Contains(librs.Args["linkFlags"], "-Wl,--version-script=librs.map.txt") {
t.Errorf("missing expected -Wl,--version-script= linker flag for libextended shared lib, linkFlags: %#v",
@@ -632,13 +632,13 @@ func TestVersionedStubs(t *testing.T) {
}
}
- libBarLinkRule := ctx.ModuleForTests("libBar", "android_arm64_armv8-a_shared").Rule("ld")
+ libBarLinkRule := ctx.ModuleForTests(t, "libBar", "android_arm64_armv8-a_shared").Rule("ld")
libBarFlags := libBarLinkRule.Args["libFlags"]
- libBarRsRustcRule := ctx.ModuleForTests("libbar_rs", "android_arm64_armv8-a_dylib").Rule("rustc")
+ libBarRsRustcRule := ctx.ModuleForTests(t, "libbar_rs", "android_arm64_armv8-a_dylib").Rule("rustc")
libBarRsFlags := libBarRsRustcRule.Args["linkFlags"]
- libBarFfiRsRustcRule := ctx.ModuleForTests("libbar_ffi_rs", "android_arm64_armv8-a_shared").Rule("rustc")
+ libBarFfiRsRustcRule := ctx.ModuleForTests(t, "libbar_ffi_rs", "android_arm64_armv8-a_shared").Rule("rustc")
libBarFfiRsFlags := libBarFfiRsRustcRule.Args["linkFlags"]
libFoo1StubPath := "libFoo/android_arm64_armv8-a_shared_1/unstripped/libFoo.so"
@@ -709,7 +709,7 @@ func TestAddnoOverride64GlobalCflags(t *testing.T) {
android.PrepareForTestWithVisibility,
rustMockedFiles.AddToFixture()).RunTestWithBp(t, bp)
- cFlags := ctx.ModuleForTests("libclient", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
+ cFlags := ctx.ModuleForTests(t, "libclient", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
if !strings.Contains(cFlags, "${config.NoOverride64GlobalCflags}") {
t.Errorf("expected %q in cflags, got %q", "${config.NoOverride64GlobalCflags}", cFlags)
diff --git a/rust/proc_macro_test.go b/rust/proc_macro_test.go
index cc8193858..8a95eb483 100644
--- a/rust/proc_macro_test.go
+++ b/rust/proc_macro_test.go
@@ -28,7 +28,7 @@ func TestRustProcMacro(t *testing.T) {
}
`)
- libprocmacro := ctx.ModuleForTests("libprocmacro", "linux_glibc_x86_64").Rule("rustc")
+ libprocmacro := ctx.ModuleForTests(t, "libprocmacro", "linux_glibc_x86_64").Rule("rustc")
if !strings.Contains(libprocmacro.Args["rustcFlags"], "--extern proc_macro") {
t.Errorf("--extern proc_macro flag not being passed to rustc for proc macro %#v", libprocmacro.Args["rustcFlags"])
diff --git a/rust/protobuf_test.go b/rust/protobuf_test.go
index cae071b8f..531e034e8 100644
--- a/rust/protobuf_test.go
+++ b/rust/protobuf_test.go
@@ -41,13 +41,13 @@ func TestRustProtobuf3(t *testing.T) {
}
`)
// Check that libprotobuf is added as a dependency.
- librust_proto := ctx.ModuleForTests("librust_proto", "android_arm64_armv8-a_dylib").Module().(*Module)
+ librust_proto := ctx.ModuleForTests(t, "librust_proto", "android_arm64_armv8-a_dylib").Module().(*Module)
if !android.InList("libprotobuf", librust_proto.Properties.AndroidMkDylibs) {
t.Errorf("libprotobuf dependency missing for rust_protobuf (dependency missing from AndroidMkDylibs)")
}
// Make sure the correct plugin is being used.
- librust_proto_out := ctx.ModuleForTests("librust_proto", "android_arm64_armv8-a_source").Output("buf.rs")
+ librust_proto_out := ctx.ModuleForTests(t, "librust_proto", "android_arm64_armv8-a_source").Output("buf.rs")
cmd := librust_proto_out.RuleParams.Command
if w := "protoc-gen-rust"; !strings.Contains(cmd, w) {
t.Errorf("expected %q in %q", w, cmd)
@@ -62,7 +62,7 @@ func TestRustProtobuf3(t *testing.T) {
}
// Check proto.rs, the second protobuf, is listed as an output
- librust_proto_outputs := ctx.ModuleForTests("librust_proto", "android_arm64_armv8-a_source").AllOutputs()
+ librust_proto_outputs := ctx.ModuleForTests(t, "librust_proto", "android_arm64_armv8-a_source").AllOutputs()
if android.InList("proto.rs", librust_proto_outputs) {
t.Errorf("rust_protobuf is not producing multiple outputs; expected 'proto.rs' in list, got: %#v ",
librust_proto_outputs)
@@ -92,7 +92,7 @@ func TestRustProtobufInclude(t *testing.T) {
}
`)
// Check that librust_exported_proto is added as additional crate to generate source.
- librust_proto := ctx.ModuleForTests("librust_proto", "android_arm64_armv8-a_source").Module().(*Module).sourceProvider.(*protobufDecorator)
+ librust_proto := ctx.ModuleForTests(t, "librust_proto", "android_arm64_armv8-a_source").Module().(*Module).sourceProvider.(*protobufDecorator)
if !android.InList("rust_exported_proto", librust_proto.additionalCrates) {
t.Errorf("librust_proto should have librust_exported_proto included as an additional crate for generated source, instead got: %#v", librust_proto.additionalCrates)
}
@@ -111,7 +111,7 @@ func TestRustProtobufInclude(t *testing.T) {
}
// Check librust_proto args includes -Iproto
- librust_proto_rule := ctx.ModuleForTests("librust_proto", "android_arm64_armv8-a_source").Output("proto.rs")
+ librust_proto_rule := ctx.ModuleForTests(t, "librust_proto", "android_arm64_armv8-a_source").Output("proto.rs")
cmd := librust_proto_rule.RuleParams.Command
if w := "-Iproto"; !strings.Contains(cmd, w) {
t.Errorf("expected %q in %q", w, cmd)
@@ -131,7 +131,7 @@ func TestRustGrpc(t *testing.T) {
`)
// Check that libprotobuf is added as a dependency.
- librust_grpcio_module := ctx.ModuleForTests("librust_grpcio", "android_arm64_armv8-a_dylib").Module().(*Module)
+ librust_grpcio_module := ctx.ModuleForTests(t, "librust_grpcio", "android_arm64_armv8-a_dylib").Module().(*Module)
// Check that libgrpcio is added as a dependency.
if !android.InList("libgrpcio", librust_grpcio_module.Properties.AndroidMkDylibs) {
@@ -144,7 +144,7 @@ func TestRustGrpc(t *testing.T) {
}
// Make sure the correct plugin is being used.
- librust_grpcio_out := ctx.ModuleForTests("librust_grpcio", "android_arm64_armv8-a_source").Output("foo_grpc.rs")
+ librust_grpcio_out := ctx.ModuleForTests(t, "librust_grpcio", "android_arm64_armv8-a_source").Output("foo_grpc.rs")
cmd := librust_grpcio_out.RuleParams.Command
if w := "protoc-gen-grpc"; !strings.Contains(cmd, w) {
t.Errorf("expected %q in %q", w, cmd)
@@ -156,7 +156,7 @@ func TestRustGrpc(t *testing.T) {
}
// Check proto.rs, the second protobuf, is listed as an output
- librust_grpcio_outputs := ctx.ModuleForTests("librust_grpcio", "android_arm64_armv8-a_source").AllOutputs()
+ librust_grpcio_outputs := ctx.ModuleForTests(t, "librust_grpcio", "android_arm64_armv8-a_source").AllOutputs()
if android.InList("proto_grpc.rs", librust_grpcio_outputs) {
t.Errorf("rust_protobuf is not producing multiple outputs; expected 'proto_grpc.rs' in list, got: %#v ",
librust_grpcio_outputs)
diff --git a/rust/rust_test.go b/rust/rust_test.go
index 2e016f0c7..fbb994752 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -184,8 +184,8 @@ func TestDepsTracking(t *testing.T) {
srcs: ["foo.rs"],
}
`)
- module := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Module().(*Module)
- rustc := ctx.ModuleForTests("librlib", "linux_glibc_x86_64_rlib_rlib-std").Rule("rustc")
+ module := ctx.ModuleForTests(t, "fizz-buzz", "linux_glibc_x86_64").Module().(*Module)
+ rustc := ctx.ModuleForTests(t, "librlib", "linux_glibc_x86_64_rlib_rlib-std").Rule("rustc")
// Since dependencies are added to AndroidMk* properties, we can check these to see if they've been picked up.
if !android.InList("librlib.rlib-std", module.Properties.AndroidMkRlibs) {
@@ -274,7 +274,7 @@ func TestSourceProviderDeps(t *testing.T) {
}
`)
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib_dylib-std").Rule("rustc")
+ libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_rlib_dylib-std").Rule("rustc")
if !android.SuffixInList(libfoo.Implicits.Strings(), "/out/bindings.rs") {
t.Errorf("rust_bindgen generated source not included as implicit input for libfoo; Implicits %#v", libfoo.Implicits.Strings())
}
@@ -282,7 +282,7 @@ func TestSourceProviderDeps(t *testing.T) {
t.Errorf("genrule generated source not included as implicit input for libfoo; Implicits %#v", libfoo.Implicits.Strings())
}
- fizzBuzz := ctx.ModuleForTests("fizz-buzz-dep", "android_arm64_armv8-a").Rule("rustc")
+ fizzBuzz := ctx.ModuleForTests(t, "fizz-buzz-dep", "android_arm64_armv8-a").Rule("rustc")
if !android.SuffixInList(fizzBuzz.Implicits.Strings(), "/out/bindings.rs") {
t.Errorf("rust_bindgen generated source not included as implicit input for fizz-buzz-dep; Implicits %#v", libfoo.Implicits.Strings())
}
@@ -290,7 +290,7 @@ func TestSourceProviderDeps(t *testing.T) {
t.Errorf("genrule generated source not included as implicit input for fizz-buzz-dep; Implicits %#v", libfoo.Implicits.Strings())
}
- libprocmacro := ctx.ModuleForTests("libprocmacro", "linux_glibc_x86_64").Rule("rustc")
+ libprocmacro := ctx.ModuleForTests(t, "libprocmacro", "linux_glibc_x86_64").Rule("rustc")
if !android.SuffixInList(libprocmacro.Implicits.Strings(), "/out/bindings.rs") {
t.Errorf("rust_bindgen generated source not included as implicit input for libprocmacro; Implicits %#v", libfoo.Implicits.Strings())
}
@@ -299,15 +299,15 @@ func TestSourceProviderDeps(t *testing.T) {
}
// Check that our bindings are picked up as crate dependencies as well
- libfooMod := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_dylib").Module().(*Module)
+ libfooMod := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_dylib").Module().(*Module)
if !android.InList("libbindings", libfooMod.Properties.AndroidMkRlibs) {
t.Errorf("bindgen dependency not detected as a rlib dependency (dependency missing from AndroidMkRlibs)")
}
- fizzBuzzMod := ctx.ModuleForTests("fizz-buzz-dep", "android_arm64_armv8-a").Module().(*Module)
+ fizzBuzzMod := ctx.ModuleForTests(t, "fizz-buzz-dep", "android_arm64_armv8-a").Module().(*Module)
if !android.InList("libbindings", fizzBuzzMod.Properties.AndroidMkRlibs) {
t.Errorf("bindgen dependency not detected as a rlib dependency (dependency missing from AndroidMkRlibs)")
}
- libprocmacroMod := ctx.ModuleForTests("libprocmacro", "linux_glibc_x86_64").Module().(*Module)
+ libprocmacroMod := ctx.ModuleForTests(t, "libprocmacro", "linux_glibc_x86_64").Module().(*Module)
if !android.InList("libbindings.rlib-std", libprocmacroMod.Properties.AndroidMkRlibs) {
t.Errorf("bindgen dependency not detected as a rlib dependency (dependency missing from AndroidMkRlibs)")
}
@@ -354,7 +354,7 @@ func TestProcMacroDeviceDeps(t *testing.T) {
srcs: ["foo.rs"],
}
`)
- rustc := ctx.ModuleForTests("libpm", "linux_glibc_x86_64").Rule("rustc")
+ rustc := ctx.ModuleForTests(t, "libpm", "linux_glibc_x86_64").Rule("rustc")
if !strings.Contains(rustc.Args["libFlags"], "libbar/linux_glibc_x86_64") {
t.Errorf("Proc_macro is not using host variant of dependent modules.")
@@ -369,7 +369,7 @@ func TestNoStdlibs(t *testing.T) {
srcs: ["foo.rs"],
no_stdlibs: true,
}`)
- module := ctx.ModuleForTests("fizz-buzz", "android_arm64_armv8-a").Module().(*Module)
+ module := ctx.ModuleForTests(t, "fizz-buzz", "android_arm64_armv8-a").Module().(*Module)
if android.InList("libstd", module.Properties.AndroidMkDylibs) {
t.Errorf("no_stdlibs did not suppress dependency on libstd")
@@ -385,8 +385,8 @@ func TestMultilib(t *testing.T) {
crate_name: "foo",
}`)
- _ = ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_rlib_dylib-std")
- _ = ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_rlib_dylib-std")
+ _ = ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_rlib_dylib-std")
+ _ = ctx.ModuleForTests(t, "libfoo", "android_arm_armv7-a-neon_rlib_dylib-std")
}
// Test that library size measurements are generated.
@@ -398,7 +398,7 @@ func TestLibrarySizes(t *testing.T) {
crate_name: "waldo",
}`)
- m := ctx.SingletonForTests("file_metrics")
+ m := ctx.SingletonForTests(t, "file_metrics")
m.Output("unstripped/libwaldo.dylib.so.bloaty.csv")
m.Output("libwaldo.dylib.so.bloaty.csv")
}
@@ -423,7 +423,7 @@ func TestRustAliases(t *testing.T) {
aliases: ["bar:bar_renamed"],
}`)
- fooRustc := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Rule("rustc")
+ fooRustc := ctx.ModuleForTests(t, "foo", "android_arm64_armv8-a").Rule("rustc")
if !strings.Contains(fooRustc.Args["libFlags"], "--extern force:bar_renamed=out/soong/.intermediates/libbar/android_arm64_armv8-a_dylib/unstripped/libbar.dylib.so") {
t.Errorf("--extern force:bar_renamed=out/soong/.intermediates/libbar/android_arm64_armv8-a_dylib/unstripped/libbar.dylib.so flag not being passed to rustc for rust_binary with aliases. libFlags: %#v", fooRustc.Args["libFlags"])
}
@@ -509,18 +509,18 @@ func TestRustFFIRlibs(t *testing.T) {
rlibs: ["librs", "libbar"],
static_libs: ["libcc_static"],
}
- `)
+ `)
- libbar := ctx.ModuleForTests("libbar", "android_arm64_armv8-a_rlib_rlib-std").Rule("rustc")
- libcc_shared_rustc := ctx.ModuleForTests("libcc_shared", "android_arm64_armv8-a_shared").Rule("rustc")
- libcc_shared_ld := ctx.ModuleForTests("libcc_shared", "android_arm64_armv8-a_shared").Rule("ld")
- libcc_shared_cc := ctx.ModuleForTests("libcc_shared", "android_arm64_armv8-a_shared").Rule("cc")
- ccbin_rustc := ctx.ModuleForTests("ccBin", "android_arm64_armv8-a").Rule("rustc")
- ccbin_ld := ctx.ModuleForTests("ccBin", "android_arm64_armv8-a").Rule("ld")
- ccbin_cc := ctx.ModuleForTests("ccBin", "android_arm64_armv8-a").Rule("cc")
- rustbin_genlib := ctx.ModuleForTests("rsBin", "android_arm64_armv8-a").Output("generated_rust_staticlib/librustlibs.a")
- rustbin := ctx.ModuleForTests("rsBin", "android_arm64_armv8-a").Output("unstripped/rsBin")
- librs_rlib := ctx.ModuleForTests("librs", "android_arm64_armv8-a_rlib_dylib-std").MaybeOutput("generated_rust_staticlib/librustlibs.a")
+ libbar := ctx.ModuleForTests(t, "libbar", "android_arm64_armv8-a_rlib_rlib-std").Rule("rustc")
+ libcc_shared_rustc := ctx.ModuleForTests(t, "libcc_shared", "android_arm64_armv8-a_shared").Rule("rustc")
+ libcc_shared_ld := ctx.ModuleForTests(t, "libcc_shared", "android_arm64_armv8-a_shared").Rule("ld")
+ libcc_shared_cc := ctx.ModuleForTests(t, "libcc_shared", "android_arm64_armv8-a_shared").Rule("cc")
+ ccbin_rustc := ctx.ModuleForTests(t, "ccBin", "android_arm64_armv8-a").Rule("rustc")
+ ccbin_ld := ctx.ModuleForTests(t, "ccBin", "android_arm64_armv8-a").Rule("ld")
+ ccbin_cc := ctx.ModuleForTests(t, "ccBin", "android_arm64_armv8-a").Rule("cc")
+ rustbin_genlib := ctx.ModuleForTests(t, "rsBin", "android_arm64_armv8-a").Output("generated_rust_staticlib/librustlibs.a")
+ rustbin := ctx.ModuleForTests(t, "rsBin", "android_arm64_armv8-a").Output("unstripped/rsBin")
+ librs_rlib := ctx.ModuleForTests(t, "librs", "android_arm64_armv8-a_rlib_dylib-std").MaybeOutput("generated_rust_staticlib/librustlibs.a")
if !strings.Contains(libbar.Args["rustcFlags"], "crate-type=rlib") {
t.Errorf("missing crate-type for static variant, expecting %#v, rustcFlags: %#v", "rlib", libbar.Args["rustcFlags"])
@@ -752,8 +752,8 @@ func TestRustLinkPropagation(t *testing.T) {
}
`)
- librlib3 := ctx.ModuleForTests("librlib3", "android_arm64_armv8-a_rlib_dylib-std").Rule("rustc")
- libdylib3 := ctx.ModuleForTests("libdylib3", "android_arm64_armv8-a_dylib").Rule("rustc")
+ librlib3 := ctx.ModuleForTests(t, "librlib3", "android_arm64_armv8-a_rlib_dylib-std").Rule("rustc")
+ libdylib3 := ctx.ModuleForTests(t, "libdylib3", "android_arm64_armv8-a_dylib").Rule("rustc")
// Test static lib propagation from:
// rlib -> rlib
diff --git a/rust/sanitize_test.go b/rust/sanitize_test.go
index d6a14b295..a3fe2828a 100644
--- a/rust/sanitize_test.go
+++ b/rust/sanitize_test.go
@@ -153,65 +153,65 @@ func TestSanitizeMemtagHeap(t *testing.T) {
).RunTest(t)
ctx := result.TestContext
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_sync", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_sync", variant), Sync)
}
func TestSanitizeMemtagHeapWithSanitizeDevice(t *testing.T) {
@@ -226,67 +226,67 @@ func TestSanitizeMemtagHeapWithSanitizeDevice(t *testing.T) {
).RunTest(t)
ctx := result.TestContext
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_sync", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_sync", variant), Sync)
// should sanitize: { diag: { memtag: true } } result in Sync instead of None here?
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_async", variant), Sync)
// should sanitize: { diag: { memtag: true } } result in Sync instead of None here?
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_sync", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_sync", variant), Sync)
}
func TestSanitizeMemtagHeapWithSanitizeDeviceDiag(t *testing.T) {
@@ -302,64 +302,64 @@ func TestSanitizeMemtagHeapWithSanitizeDeviceDiag(t *testing.T) {
).RunTest(t)
ctx := result.TestContext
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_binary_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_no_override", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_async", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("no_memtag_test_override_default_sync", variant), None)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_no_override", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_async", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_disable", variant), Async)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_test_override_default_sync", variant), Async)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_binary_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_no_override", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_async", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "no_memtag_test_override_default_sync", variant), None)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_binary_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_no_override", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_async", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_disable", variant), Async)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_async_test_override_default_sync", variant), Async)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "set_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_async", variant), Sync)
// should sanitize: { diag: { memtag: true } } result in Sync instead of None here?
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_memtag_set_sync_test_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_disable", variant), None)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_binary_override_default_sync", variant), Sync)
-
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_no_override", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_async", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_disable", variant), Sync)
- checkHasMemtagNote(t, ctx.ModuleForTests("unset_test_override_default_sync", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_memtag_set_sync_test_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_disable", variant), None)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_binary_override_default_sync", variant), Sync)
+
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_no_override", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_async", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_disable", variant), Sync)
+ checkHasMemtagNote(t, ctx.ModuleForTests(t, "unset_test_override_default_sync", variant), Sync)
}
diff --git a/rust/test_test.go b/rust/test_test.go
index 1097da226..076a2598b 100644
--- a/rust/test_test.go
+++ b/rust/test_test.go
@@ -29,7 +29,7 @@ func TestRustTest(t *testing.T) {
data: ["data.txt"],
}`)
- testingModule := ctx.ModuleForTests("my_test", "linux_glibc_x86_64")
+ testingModule := ctx.ModuleForTests(t, "my_test", "linux_glibc_x86_64")
expectedOut := "my_test/linux_glibc_x86_64/my_test"
outPath := testingModule.Output("my_test").Output.String()
if !strings.Contains(outPath, expectedOut) {
@@ -62,7 +62,7 @@ func TestRustTestLinkage(t *testing.T) {
crate_name: "bar",
}`)
- testingModule := ctx.ModuleForTests("my_test", "android_arm64_armv8-a").Module().(*Module)
+ testingModule := ctx.ModuleForTests(t, "my_test", "android_arm64_armv8-a").Module().(*Module)
if !android.InList("libfoo.rlib-std", testingModule.Properties.AndroidMkRlibs) {
t.Errorf("rlib-std variant for libfoo not detected as a rustlib-defined rlib dependency for device rust_test module")
@@ -106,7 +106,7 @@ func TestDataLibs(t *testing.T) {
ctx := testRust(t, bp)
- testingModule := ctx.ModuleForTests("main_test", "android_arm64_armv8-a")
+ testingModule := ctx.ModuleForTests(t, "main_test", "android_arm64_armv8-a")
testBinary := testingModule.Module().(*Module).compiler.(*testDecorator)
outputFiles := testingModule.OutputFiles(ctx, t, "")
if len(outputFiles) != 1 {
@@ -165,7 +165,7 @@ func TestDataLibsRelativeInstallPath(t *testing.T) {
`
ctx := testRust(t, bp)
- testingModule := ctx.ModuleForTests("main_test", "android_arm64_armv8-a")
+ testingModule := ctx.ModuleForTests(t, "main_test", "android_arm64_armv8-a")
module := testingModule.Module()
testBinary := module.(*Module).compiler.(*testDecorator)
outputFiles := testingModule.OutputFiles(ctx, t, "")
diff --git a/sdk/bootclasspath_fragment_sdk_test.go b/sdk/bootclasspath_fragment_sdk_test.go
index ca630202a..80ced00bf 100644
--- a/sdk/bootclasspath_fragment_sdk_test.go
+++ b/sdk/bootclasspath_fragment_sdk_test.go
@@ -272,7 +272,7 @@ java_import {
// package check rule.
func checkBootJarsPackageCheckRule(t *testing.T, result *android.TestResult, expectedModules ...string) {
t.Helper()
- platformBcp := result.ModuleForTests("platform-bootclasspath", "android_common")
+ platformBcp := result.ModuleForTests(t, "platform-bootclasspath", "android_common")
bootJarsCheckRule := platformBcp.Rule("boot_jars_package_check")
command := bootJarsCheckRule.RuleParams.Command
expectedCommandArgs := " build/soong/scripts/check_boot_jars/package_allowed_list.txt " + strings.Join(expectedModules, " ") + " &&"
@@ -481,7 +481,7 @@ java_sdk_library_import {
checkAllCopyRules(copyRules),
snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot),
snapshotTestChecker(checkSnapshotWithoutSource, func(t *testing.T, result *android.TestResult) {
- module := result.ModuleForTests("platform-bootclasspath", "android_common")
+ module := result.ModuleForTests(t, "platform-bootclasspath", "android_common")
var rule android.TestingBuildParams
rule = module.Output("out/soong/hiddenapi/hiddenapi-flags.csv")
java.CheckHiddenAPIRuleInputs(t, "monolithic flags", `
@@ -507,7 +507,7 @@ java_sdk_library_import {
}),
snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot),
snapshotTestChecker(checkSnapshotWithSourcePreferred, func(t *testing.T, result *android.TestResult) {
- module := result.ModuleForTests("platform-bootclasspath", "android_common")
+ module := result.ModuleForTests(t, "platform-bootclasspath", "android_common")
rule := module.Output("out/soong/hiddenapi/hiddenapi-flags.csv.valid")
android.AssertStringDoesContain(t, "verify-overlaps", rule.RuleParams.Command, " out/soong/.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi/filtered-flags.csv:out/soong/.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv ")
}),
@@ -1133,7 +1133,7 @@ func testSnapshotWithBootClasspathFragment_MinSdkVersion(t *testing.T, targetBui
`),
).RunTest(t)
- bcpf := result.ModuleForTests("mybootclasspathfragment", "android_common")
+ bcpf := result.ModuleForTests(t, "mybootclasspathfragment", "android_common")
rule := bcpf.Output("out/soong/.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi" + suffix + "/stub-flags.csv")
android.AssertPathsRelativeToTopEquals(t, "stub flags inputs", android.SortedUniqueStrings(expectedStubFlagsInputs), android.SortedUniquePaths(rule.Implicits))
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index b525eb8a3..985641e95 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -350,7 +350,7 @@ func TestSnapshot_EnvConfiguration(t *testing.T) {
)
checkZipFile := func(t *testing.T, result *android.TestResult, expected string) {
- zipRule := result.ModuleForTests("mysdk", "common_os").Rule("SnapshotZipFiles")
+ zipRule := result.ModuleForTests(t, "mysdk", "common_os").Rule("SnapshotZipFiles")
android.AssertStringEquals(t, "snapshot zip file", expected, zipRule.Output.String())
}
diff --git a/sh/sh_binary_test.go b/sh/sh_binary_test.go
index 28f997d8e..c2e2d2bd1 100644
--- a/sh/sh_binary_test.go
+++ b/sh/sh_binary_test.go
@@ -58,7 +58,7 @@ func TestShTestSubDir(t *testing.T) {
}
`)
- mod := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
+ mod := result.ModuleForTests(t, "foo", "android_arm64_armv8-a").Module().(*ShTest)
entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0]
@@ -83,7 +83,7 @@ func TestShTest(t *testing.T) {
}
`)
- mod := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
+ mod := result.ModuleForTests(t, "foo", "android_arm64_armv8-a").Module().(*ShTest)
entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0]
@@ -129,7 +129,7 @@ func TestShTest_dataModules(t *testing.T) {
buildOS := config.BuildOS.String()
arches := []string{"android_arm64_armv8-a", buildOS + "_x86_64"}
for _, arch := range arches {
- variant := ctx.ModuleForTests("foo", arch)
+ variant := ctx.ModuleForTests(t, "foo", arch)
libExt := ".so"
if arch == "darwin_x86_64" {
@@ -167,7 +167,7 @@ func TestShTestHost(t *testing.T) {
`)
buildOS := ctx.Config().BuildOS.String()
- mod := ctx.ModuleForTests("foo", buildOS+"_x86_64").Module().(*ShTest)
+ mod := ctx.ModuleForTests(t, "foo", buildOS+"_x86_64").Module().(*ShTest)
if !mod.Host() {
t.Errorf("host bit is not set for a sh_test_host module.")
}
@@ -186,7 +186,7 @@ func TestShTestExtraTestConfig(t *testing.T) {
}
`)
- mod := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
+ mod := result.ModuleForTests(t, "foo", "android_arm64_armv8-a").Module().(*ShTest)
entries := android.AndroidMkEntriesForTest(t, result, mod)[0]
actualData := entries.EntryMap["LOCAL_EXTRA_FULL_TEST_CONFIGS"]
android.AssertStringPathsRelativeToTopEquals(t, "extra_configs", result.Config(), []string{"config1.xml", "config2.xml"}, actualData)
@@ -221,7 +221,7 @@ func TestShTestHost_dataDeviceModules(t *testing.T) {
buildOS := config.BuildOS.String()
variant := buildOS + "_x86_64"
- foo := ctx.ModuleForTests("foo", variant)
+ foo := ctx.ModuleForTests(t, "foo", variant)
relocated := foo.Output(filepath.Join("out/soong/.intermediates/foo", variant, "relocated/lib64/libbar.so"))
expectedInput := "out/soong/.intermediates/libbar/android_arm64_armv8-a_shared/libbar.so"
@@ -266,7 +266,7 @@ func TestShTestHost_dataDeviceModulesAutogenTradefedConfig(t *testing.T) {
`)
buildOS := config.BuildOS.String()
- fooModule := ctx.ModuleForTests("foo", buildOS+"_x86_64")
+ fooModule := ctx.ModuleForTests(t, "foo", buildOS+"_x86_64")
expectedBinAutogenConfig := `<option name="push-file" key="bar" value="/data/local/tests/unrestricted/foo/bar" />`
autogen := fooModule.Rule("autogen")
@@ -296,7 +296,7 @@ func TestShTestHost_javaData(t *testing.T) {
}
`)
buildOS := ctx.Config().BuildOS.String()
- mod := ctx.ModuleForTests("foo", buildOS+"_x86_64").Module().(*ShTest)
+ mod := ctx.ModuleForTests(t, "foo", buildOS+"_x86_64").Module().(*ShTest)
if !mod.Host() {
t.Errorf("host bit is not set for a sh_test_host module.")
}
@@ -345,7 +345,7 @@ func TestDefaultsForTests(t *testing.T) {
`)
buildOS := ctx.Config().BuildOS.String()
- mod := ctx.ModuleForTests("foo", buildOS+"_x86_64").Module().(*ShTest)
+ mod := ctx.ModuleForTests(t, "foo", buildOS+"_x86_64").Module().(*ShTest)
if !mod.Host() {
t.Errorf("host bit is not set for a sh_test_host module.")
}
@@ -365,7 +365,7 @@ func TestDefaultsForTests(t *testing.T) {
":testdata/data1",
":testdata/sub/data2",
}
- mod = ctx.ModuleForTests("sh-test", "android_arm64_armv8-a").Module().(*ShTest)
+ mod = ctx.ModuleForTests(t, "sh-test", "android_arm64_armv8-a").Module().(*ShTest)
entries = android.AndroidMkEntriesForTest(t, ctx, mod)[0]
actualData = entries.EntryMap["LOCAL_TEST_DATA"]
android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_TEST_DATA", config, expectedData, actualData)
@@ -388,7 +388,7 @@ func TestDefaultsForBinaries(t *testing.T) {
}
`)
buildOS := ctx.Config().BuildOS.String()
- mod := ctx.ModuleForTests("the-host-binary", buildOS+"_x86_64").Module().(*ShBinary)
+ mod := ctx.ModuleForTests(t, "the-host-binary", buildOS+"_x86_64").Module().(*ShBinary)
if !mod.Host() {
t.Errorf("host bit is not set for a sh_binary_host module.")
}
@@ -396,6 +396,6 @@ func TestDefaultsForBinaries(t *testing.T) {
expectedFilename := "test.sh"
android.AssertStringEquals(t, "Filename", expectedFilename, *mod.properties.Filename)
- mod = ctx.ModuleForTests("the-binary", "android_arm64_armv8-a").Module().(*ShBinary)
+ mod = ctx.ModuleForTests(t, "the-binary", "android_arm64_armv8-a").Module().(*ShBinary)
android.AssertStringEquals(t, "Filename", expectedFilename, *mod.properties.Filename)
}
diff --git a/sysprop/sysprop_test.go b/sysprop/sysprop_test.go
index 7d4e69d87..06c5e9c9c 100644
--- a/sysprop/sysprop_test.go
+++ b/sysprop/sysprop_test.go
@@ -261,9 +261,9 @@ func TestSyspropLibrary(t *testing.T) {
"android_vendor_arm64_armv8-a_shared",
"android_vendor_arm64_armv8-a_static",
} {
- result.ModuleForTests("libsysprop-platform", variant)
- result.ModuleForTests("libsysprop-vendor", variant)
- result.ModuleForTests("libsysprop-odm", variant)
+ result.ModuleForTests(t, "libsysprop-platform", variant)
+ result.ModuleForTests(t, "libsysprop-vendor", variant)
+ result.ModuleForTests(t, "libsysprop-odm", variant)
}
// product variant of vendor-owned sysprop_library
@@ -273,7 +273,7 @@ func TestSyspropLibrary(t *testing.T) {
"android_product_arm64_armv8-a_shared",
"android_product_arm64_armv8-a_static",
} {
- result.ModuleForTests("libsysprop-vendor-on-product", variant)
+ result.ModuleForTests(t, "libsysprop-vendor-on-product", variant)
}
for _, variant := range []string{
@@ -282,15 +282,15 @@ func TestSyspropLibrary(t *testing.T) {
"android_arm64_armv8-a_shared",
"android_arm64_armv8-a_static",
} {
- library := result.ModuleForTests("libsysprop-platform", variant).Module().(*cc.Module)
+ library := result.ModuleForTests(t, "libsysprop-platform", variant).Module().(*cc.Module)
expectedApexAvailableOnLibrary := []string{"//apex_available:platform"}
android.AssertDeepEquals(t, "apex available property on libsysprop-platform", expectedApexAvailableOnLibrary, library.ApexProperties.Apex_available)
}
- result.ModuleForTests("sysprop-platform", "android_common")
- result.ModuleForTests("sysprop-platform_public", "android_common")
- result.ModuleForTests("sysprop-vendor", "android_common")
- result.ModuleForTests("sysprop-vendor-on-product", "android_common")
+ result.ModuleForTests(t, "sysprop-platform", "android_common")
+ result.ModuleForTests(t, "sysprop-platform_public", "android_common")
+ result.ModuleForTests(t, "sysprop-vendor", "android_common")
+ result.ModuleForTests(t, "sysprop-vendor-on-product", "android_common")
// Check for exported includes
coreVariant := "android_arm64_armv8-a_static"
@@ -305,19 +305,19 @@ func TestSyspropLibrary(t *testing.T) {
vendorInternalPath := "libsysprop-vendor/android_vendor_arm64_armv8-a_static/gen/sysprop/include"
vendorOnProductPath := "libsysprop-vendor-on-product/android_product_arm64_armv8-a_static/gen/sysprop/public/include"
- platformClient := result.ModuleForTests("cc-client-platform", coreVariant)
+ platformClient := result.ModuleForTests(t, "cc-client-platform", coreVariant)
platformFlags := platformClient.Rule("cc").Args["cFlags"]
// platform should use platform's internal header
android.AssertStringDoesContain(t, "flags for platform", platformFlags, platformInternalPath)
- platformStaticClient := result.ModuleForTests("cc-client-platform-static", coreVariant)
+ platformStaticClient := result.ModuleForTests(t, "cc-client-platform-static", coreVariant)
platformStaticFlags := platformStaticClient.Rule("cc").Args["cFlags"]
// platform-static should use platform's internal header
android.AssertStringDoesContain(t, "flags for platform-static", platformStaticFlags, platformInternalPath)
- productClient := result.ModuleForTests("cc-client-product", productVariant)
+ productClient := result.ModuleForTests(t, "cc-client-product", productVariant)
productFlags := productClient.Rule("cc").Args["cFlags"]
// Product should use platform's and vendor's public headers
@@ -327,7 +327,7 @@ func TestSyspropLibrary(t *testing.T) {
platformOnProductPath, vendorOnProductPath, productFlags)
}
- vendorClient := result.ModuleForTests("cc-client-vendor", vendorVariant)
+ vendorClient := result.ModuleForTests(t, "cc-client-vendor", vendorVariant)
vendorFlags := vendorClient.Rule("cc").Args["cFlags"]
// Vendor should use platform's public header and vendor's internal header
@@ -338,8 +338,8 @@ func TestSyspropLibrary(t *testing.T) {
}
// Java modules linking against system API should use public stub
- javaSystemApiClient := result.ModuleForTests("java-platform", "android_common").Rule("javac")
- syspropPlatformPublic := result.ModuleForTests("sysprop-platform_public", "android_common").Description("for turbine")
+ javaSystemApiClient := result.ModuleForTests(t, "java-platform", "android_common").Rule("javac")
+ syspropPlatformPublic := result.ModuleForTests(t, "sysprop-platform_public", "android_common").Description("for turbine")
if g, w := javaSystemApiClient.Implicits.Strings(), syspropPlatformPublic.Output.String(); !android.InList(w, g) {
t.Errorf("system api client should use public stub %q, got %q", w, g)
}
@@ -358,15 +358,15 @@ func TestApexAvailabilityIsForwarded(t *testing.T) {
expected := []string{"//apex_available:platform"}
- ccModule := result.ModuleForTests("libsysprop-platform", "android_arm64_armv8-a_shared").Module().(*cc.Module)
+ ccModule := result.ModuleForTests(t, "libsysprop-platform", "android_arm64_armv8-a_shared").Module().(*cc.Module)
propFromCc := ccModule.ApexProperties.Apex_available
android.AssertDeepEquals(t, "apex_available forwarding to cc module", expected, propFromCc)
- javaModule := result.ModuleForTests("sysprop-platform", "android_common").Module().(*java.Library)
+ javaModule := result.ModuleForTests(t, "sysprop-platform", "android_common").Module().(*java.Library)
propFromJava := javaModule.ApexProperties.Apex_available
android.AssertDeepEquals(t, "apex_available forwarding to java module", expected, propFromJava)
- rustModule := result.ModuleForTests("libsysprop_platform_rust", "android_arm64_armv8-a_rlib_rlib-std").Module().(*rust.Module)
+ rustModule := result.ModuleForTests(t, "libsysprop_platform_rust", "android_arm64_armv8-a_rlib_rlib-std").Module().(*rust.Module)
propFromRust := rustModule.ApexProperties.Apex_available
android.AssertDeepEquals(t, "apex_available forwarding to rust module", expected, propFromRust)
}
@@ -390,15 +390,15 @@ func TestMinSdkVersionIsForwarded(t *testing.T) {
}
`)
- ccModule := result.ModuleForTests("libsysprop-platform", "android_arm64_armv8-a_shared").Module().(*cc.Module)
+ ccModule := result.ModuleForTests(t, "libsysprop-platform", "android_arm64_armv8-a_shared").Module().(*cc.Module)
propFromCc := proptools.String(ccModule.Properties.Min_sdk_version)
android.AssertStringEquals(t, "min_sdk_version forwarding to cc module", "29", propFromCc)
- javaModule := result.ModuleForTests("sysprop-platform", "android_common").Module().(*java.Library)
+ javaModule := result.ModuleForTests(t, "sysprop-platform", "android_common").Module().(*java.Library)
propFromJava := javaModule.MinSdkVersionString()
android.AssertStringEquals(t, "min_sdk_version forwarding to java module", "30", propFromJava)
- rustModule := result.ModuleForTests("libsysprop_platform_rust", "android_arm64_armv8-a_rlib_rlib-std").Module().(*rust.Module)
+ rustModule := result.ModuleForTests(t, "libsysprop_platform_rust", "android_arm64_armv8-a_rlib_rlib-std").Module().(*rust.Module)
propFromRust := proptools.String(rustModule.Properties.Min_sdk_version)
android.AssertStringEquals(t, "min_sdk_version forwarding to rust module", "29", propFromRust)
}
diff --git a/systemfeatures/system_features_test.go b/systemfeatures/system_features_test.go
index 558bb958e..58e6a0660 100644
--- a/systemfeatures/system_features_test.go
+++ b/systemfeatures/system_features_test.go
@@ -36,7 +36,7 @@ java_system_features_srcs {
android.PrepareForTestWithBuildFlag("RELEASE_NOT_SYSTEM_FEATURE_FOO", "BAR"),
).RunTestWithBp(t, bp)
- module := res.ModuleForTests("system-features-srcs", "")
+ module := res.ModuleForTests(t, "system-features-srcs", "")
cmd := module.Rule("system-features-srcs").RuleParams.Command
android.AssertStringDoesContain(t, "Expected fully class name", cmd, " com.android.test.RoSystemFeatures ")
android.AssertStringDoesContain(t, "Expected readonly flag", cmd, "--readonly=true")
diff --git a/tradefed_modules/test_module_config_test.go b/tradefed_modules/test_module_config_test.go
index 037dcea04..302f9a9d5 100644
--- a/tradefed_modules/test_module_config_test.go
+++ b/tradefed_modules/test_module_config_test.go
@@ -65,13 +65,13 @@ func TestModuleConfigAndroidTest(t *testing.T) {
android.FixtureRegisterWithContext(RegisterTestModuleConfigBuildComponents),
).RunTestWithBp(t, bp)
- derived := ctx.ModuleForTests("derived_test", variant)
+ derived := ctx.ModuleForTests(t, "derived_test", variant)
// Assert there are rules to create these files.
derived.Output("test_module_config.manifest")
derived.Output("test_config_fixer/derived_test.config")
// Ensure some basic rules exist.
- ctx.ModuleForTests("base", "android_common").Output("package-res.apk")
+ ctx.ModuleForTests(t, "base", "android_common").Output("package-res.apk")
entries := android.AndroidMkEntriesForTest(t, ctx.TestContext, derived.Module())[0]
// Ensure some entries from base are there, specifically support files for data and helper apps.
@@ -136,7 +136,7 @@ func TestModuleConfigShTest(t *testing.T) {
options: [{name: "SomeName", value: "OptionValue"}],
}
`)
- derived := ctx.ModuleForTests("conch", variant) //
+ derived := ctx.ModuleForTests(t, "conch", variant) //
conch := derived.Module().(*testModuleConfigModule)
android.AssertArrayString(t, "TestcaseRelDataFiles", []string{"arm64/testdata/data1", "arm64/testdata/sub/data2"}, conch.provider.TestcaseRelDataFiles)
android.AssertStringEquals(t, "Rel OutputFile", "test.sh", conch.provider.OutputFile.Rel())
@@ -191,7 +191,7 @@ func TestModuleConfigOptions(t *testing.T) {
).RunTestWithBp(t, bp)
// Check that we generate a rule to make a new AndroidTest.xml/Module.config file.
- derived := ctx.ModuleForTests("derived_test", variant)
+ derived := ctx.ModuleForTests(t, "derived_test", variant)
rule_cmd := derived.Rule("fix_test_config").RuleParams.Command
android.AssertStringDoesContain(t, "Bad FixConfig rule inputs", rule_cmd,
`--test-runner-options='[{"Name":"exclude-filter","Key":"","Value":"android.test.example.devcodelab.DevCodelabTest#testHelloFail"},{"Name":"include-annotation","Key":"","Value":"android.platform.test.annotations.LargeTest"}]'`)
@@ -288,7 +288,7 @@ func TestModuleConfigNoFiltersOrAnnotationsShouldFail(t *testing.T) {
).ExtendWithErrorHandler(
android.FixtureExpectsAtLeastOneErrorMatchingPattern("Test options must be given")).
RunTestWithBp(t, badBp)
- ctx.ModuleForTests("derived_test", variant)
+ ctx.ModuleForTests(t, "derived_test", variant)
}
func TestModuleConfigMultipleDerivedTestsWriteDistinctMakeEntries(t *testing.T) {
@@ -326,7 +326,7 @@ func TestModuleConfigMultipleDerivedTestsWriteDistinctMakeEntries(t *testing.T)
).RunTestWithBp(t, multiBp)
{
- derived := ctx.ModuleForTests("derived_test", variant)
+ derived := ctx.ModuleForTests(t, "derived_test", variant)
entries := android.AndroidMkEntriesForTest(t, ctx.TestContext, derived.Module())[0]
// All these should be the same in both derived tests
android.AssertStringPathsRelativeToTopEquals(t, "support-files", ctx.Config,
@@ -342,7 +342,7 @@ func TestModuleConfigMultipleDerivedTestsWriteDistinctMakeEntries(t *testing.T)
}
{
- derived := ctx.ModuleForTests("another_derived_test", variant)
+ derived := ctx.ModuleForTests(t, "another_derived_test", variant)
entries := android.AndroidMkEntriesForTest(t, ctx.TestContext, derived.Module())[0]
// All these should be the same in both derived tests
android.AssertStringPathsRelativeToTopEquals(t, "support-files", ctx.Config,
@@ -381,7 +381,7 @@ func TestModuleConfigHostBasics(t *testing.T) {
).RunTestWithBp(t, bp)
variant := ctx.Config.BuildOS.String() + "_common"
- derived := ctx.ModuleForTests("derived_test", variant)
+ derived := ctx.ModuleForTests(t, "derived_test", variant)
mod := derived.Module().(*testModuleConfigHostModule)
allEntries := android.AndroidMkEntriesForTest(t, ctx.TestContext, mod)
entries := allEntries[0]
diff --git a/tradefed_modules/test_suite_test.go b/tradefed_modules/test_suite_test.go
index 3c0a9eb2c..3e1472cee 100644
--- a/tradefed_modules/test_suite_test.go
+++ b/tradefed_modules/test_suite_test.go
@@ -46,7 +46,7 @@ func TestTestSuites(t *testing.T) {
]
}
`)
- manifestPath := ctx.ModuleForTests("my-suite", "android_common").Output("out/soong/test_suites/my-suite/my-suite.json")
+ manifestPath := ctx.ModuleForTests(t, "my-suite", "android_common").Output("out/soong/test_suites/my-suite/my-suite.json")
var actual testSuiteManifest
if err := json.Unmarshal([]byte(android.ContentFromFileRuleForTests(t, ctx.TestContext, manifestPath)), &actual); err != nil {
t.Errorf("failed to unmarshal manifest: %v", err)
@@ -106,7 +106,7 @@ func TestTestSuitesWithNested(t *testing.T) {
]
}
`)
- manifestPath := ctx.ModuleForTests("my-all-tests-suite", "android_common").Output("out/soong/test_suites/my-all-tests-suite/my-all-tests-suite.json")
+ manifestPath := ctx.ModuleForTests(t, "my-all-tests-suite", "android_common").Output("out/soong/test_suites/my-all-tests-suite/my-all-tests-suite.json")
var actual testSuiteManifest
if err := json.Unmarshal([]byte(android.ContentFromFileRuleForTests(t, ctx.TestContext, manifestPath)), &actual); err != nil {
t.Errorf("failed to unmarshal manifest: %v", err)
diff --git a/xml/xml_test.go b/xml/xml_test.go
index 9f28315b7..212b0c5af 100644
--- a/xml/xml_test.go
+++ b/xml/xml_test.go
@@ -71,7 +71,7 @@ func TestPrebuiltEtcXml(t *testing.T) {
{rule: "xmllint-minimal", input: "baz.xml"},
} {
t.Run(tc.schemaType, func(t *testing.T) {
- rule := result.ModuleForTests(tc.input, "android_arm64_armv8-a").Rule(tc.rule)
+ rule := result.ModuleForTests(t, tc.input, "android_arm64_armv8-a").Rule(tc.rule)
android.AssertStringEquals(t, "input", tc.input, rule.Input.String())
if tc.schemaType != "" {
android.AssertStringEquals(t, "schema", tc.schema, rule.Args[tc.schemaType])
@@ -79,6 +79,6 @@ func TestPrebuiltEtcXml(t *testing.T) {
})
}
- m := result.ModuleForTests("foo.xml", "android_arm64_armv8-a").Module().(*prebuiltEtcXml)
+ m := result.ModuleForTests(t, "foo.xml", "android_arm64_armv8-a").Module().(*prebuiltEtcXml)
android.AssertPathRelativeToTopEquals(t, "installDir", "out/target/product/test_device/system/etc", m.InstallDirPath())
}