Refactor some tests to not use bp2build_avail

Bug: 301312260
Test: presubmits
Change-Id: I67ca45f17d11e9b893fae5f6c6df1239ae4220b6
This commit is contained in:
Chris Parsons 2023-09-21 15:30:27 +00:00
parent f2d858e5ba
commit 4c81ce0307
7 changed files with 21 additions and 33 deletions

View file

@ -818,7 +818,7 @@ func TestApexBundleSimple_manifestIsEmpty_baseApexOverrideApexInDifferentAndroid
Description: "override_apex - manifest of base apex is empty, base apex and override_apex is in different Android.bp",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
StubbedBuildDefinitions: []string{"//a/b:com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@ -828,7 +828,6 @@ filegroup {
"a/b/Android.bp": `
apex {
name: "com.android.apogee",
bazel_module: { bp2build_available: false },
}
`,
},
@ -852,7 +851,7 @@ func TestApexBundleSimple_manifestIsSet_baseApexOverrideApexInDifferentAndroidBp
Description: "override_apex - manifest of base apex is set, base apex and override_apex is in different Android.bp",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
StubbedBuildDefinitions: []string{"//a/b:com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@ -863,7 +862,6 @@ filegroup {
apex {
name: "com.android.apogee",
manifest: "apogee_manifest.json",
bazel_module: { bp2build_available: false },
}
`,
},
@ -887,7 +885,7 @@ func TestApexBundleSimple_manifestIsEmpty_baseApexOverrideApexInSameAndroidBp(t
Description: "override_apex - manifest of base apex is empty, base apex and override_apex is in same Android.bp",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@ -898,7 +896,6 @@ filegroup {
Blueprint: `
apex {
name: "com.android.apogee",
bazel_module: { bp2build_available: false },
}
override_apex {
@ -920,7 +917,7 @@ func TestApexBundleSimple_manifestIsSet_baseApexOverrideApexInSameAndroidBp(t *t
Description: "override_apex - manifest of base apex is set, base apex and override_apex is in same Android.bp",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@ -932,7 +929,6 @@ filegroup {
apex {
name: "com.android.apogee",
manifest: "apogee_manifest.json",
bazel_module: { bp2build_available: false },
}
override_apex {
@ -954,7 +950,7 @@ func TestApexBundleSimple_packageNameOverride(t *testing.T) {
Description: "override_apex - override package name",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@ -965,7 +961,6 @@ filegroup {
Blueprint: `
apex {
name: "com.android.apogee",
bazel_module: { bp2build_available: false },
}
override_apex {
@ -1109,7 +1104,7 @@ func TestApexBundleSimple_NoLoggingParentOverride(t *testing.T) {
Description: "override_apex - logging_parent - no override",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@ -1120,7 +1115,6 @@ filegroup {
Blueprint: `
apex {
name: "com.android.apogee",
bazel_module: { bp2build_available: false },
logging_parent: "foo.bar.baz",
}
@ -1144,7 +1138,7 @@ func TestApexBundleSimple_LoggingParentOverride(t *testing.T) {
Description: "override_apex - logging_parent - override",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@ -1155,7 +1149,6 @@ filegroup {
Blueprint: `
apex {
name: "com.android.apogee",
bazel_module: { bp2build_available: false },
logging_parent: "foo.bar.baz",
}
@ -1398,7 +1391,7 @@ func TestBp2BuildOverrideApex_CertificateIsSrc(t *testing.T) {
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
Filesystem: map[string]string{},
StubbedBuildDefinitions: []string{"com.android.apogee.certificate", "com.android.apogee", "com.android.apogee-file_contexts"},
StubbedBuildDefinitions: []string{"com.android.apogee", "com.android.apogee.certificate", "com.android.apogee", "com.android.apogee-file_contexts"},
Blueprint: `
android_app_certificate {
name: "com.android.apogee.certificate",
@ -1417,7 +1410,6 @@ apex {
manifest: "apogee_manifest.json",
file_contexts: ":com.android.apogee-file_contexts",
certificate: ":com.android.apogee.certificate",
bazel_module: { bp2build_available: false },
}
override_apex {

View file

@ -1857,7 +1857,6 @@ func TestCcLibrary_SystemSharedLibsBionicEmpty(t *testing.T) {
Blueprint: soongCcLibraryPreamble + `
cc_library {
name: "libc_musl",
bazel_module: { bp2build_available: false },
}
cc_library {
@ -1912,10 +1911,10 @@ func TestCcLibrary_SystemSharedLibsLinuxMuslEmpty(t *testing.T) {
Description: "cc_library system_shared_lib empty for linux_musl variant",
ModuleTypeUnderTest: "cc_library",
ModuleTypeUnderTestFactory: cc.LibraryFactory,
StubbedBuildDefinitions: []string{"libc_musl"},
Blueprint: soongCcLibraryPreamble + `
cc_library {
name: "libc_musl",
bazel_module: { bp2build_available: false },
}
cc_library {

View file

@ -1595,6 +1595,7 @@ func TestCcLibrarySdkVariantUsesStubs(t *testing.T) {
Description: "cc_library_shared stubs",
ModuleTypeUnderTest: "cc_library_shared",
ModuleTypeUnderTestFactory: cc.LibrarySharedFactory,
StubbedBuildDefinitions: []string{"libNoStubs", "libHasApexStubs", "libHasApexAndNdkStubs"},
Blueprint: soongCcLibrarySharedPreamble + `
cc_library_shared {
name: "libUsesSdk",
@ -1607,22 +1608,21 @@ cc_library_shared {
}
cc_library_shared {
name: "libNoStubs",
bazel_module: { bp2build_available: false },
}
cc_library_shared {
name: "libHasApexStubs",
stubs: { symbol_file: "a.map.txt", versions: ["28", "29", "current"] },
bazel_module: { bp2build_available: false },
apex_available: ["apex_a"],
}
cc_library_shared {
name: "libHasApexAndNdkStubs",
stubs: { symbol_file: "b.map.txt", versions: ["28", "29", "current"] },
bazel_module: { bp2build_available: false },
apex_available: ["apex_b"],
}
ndk_library {
name: "libHasApexAndNdkStubs",
// TODO: b/301321658 - Stub this once existing-build-file handling can deal with
// modules that generate targets of a different name.
bazel_module: { bp2build_available: false },
}
`,

View file

@ -1398,11 +1398,11 @@ cc_library_static {
func TestStaticLibrary_SystemSharedLibsMuslEmpty(t *testing.T) {
runCcLibraryStaticTestCase(t, Bp2buildTestCase{
Description: "cc_library_static system_shared_lib empty for musl variant",
Description: "cc_library_static system_shared_lib empty for musl variant",
StubbedBuildDefinitions: []string{"libc_musl"},
Blueprint: soongCcLibraryStaticPreamble + `
cc_library {
name: "libc_musl",
bazel_module: { bp2build_available: false },
}
cc_library_static {
@ -1425,11 +1425,11 @@ cc_library_static {
func TestStaticLibrary_SystemSharedLibsLinuxMuslEmpty(t *testing.T) {
runCcLibraryStaticTestCase(t, Bp2buildTestCase{
Description: "cc_library_static system_shared_lib empty for linux_musl variant",
Description: "cc_library_static system_shared_lib empty for linux_musl variant",
StubbedBuildDefinitions: []string{"libc_musl"},
Blueprint: soongCcLibraryStaticPreamble + `
cc_library {
name: "libc_musl",
bazel_module: { bp2build_available: false },
}
cc_library_static {

View file

@ -86,13 +86,11 @@ func TestJavaPluginNoSrcs(t *testing.T) {
java_library {
name: "java-lib-1",
srcs: ["b.java"],
bazel_module: { bp2build_available: false },
}
java_library {
name: "java-lib-2",
srcs: ["c.java"],
bazel_module: { bp2build_available: false },
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("java_plugin", "java-plug-1", AttrNameToString{

View file

@ -140,7 +140,8 @@ func TestJavaProtoDefault(t *testing.T) {
func TestJavaLibsAndOnlyProtoSrcs(t *testing.T) {
runJavaProtoTestCase(t, Bp2buildTestCase{
Description: "java_library that has only proto srcs",
Description: "java_library that has only proto srcs",
StubbedBuildDefinitions: []string{"java-lib"},
Blueprint: `java_library_static {
name: "java-protos",
srcs: ["a.proto"],
@ -151,7 +152,6 @@ func TestJavaLibsAndOnlyProtoSrcs(t *testing.T) {
java_library_static {
name: "java-lib",
bazel_module: { bp2build_available: false },
}
`,
ExpectedBazelTargets: []string{

View file

@ -32,8 +32,9 @@ func runJavaTestHostTestCase(t *testing.T, tc Bp2buildTestCase) {
func TestJavaTestHostGeneral(t *testing.T) {
runJavaTestHostTestCase(t, Bp2buildTestCase{
Description: "java_test_host general",
Filesystem: map[string]string{},
Description: "java_test_host general",
Filesystem: map[string]string{},
StubbedBuildDefinitions: []string{"lib_a", "lib_b"},
Blueprint: `
java_test_host {
name: "java_test_host-1",
@ -47,12 +48,10 @@ java_test_host {
java_library {
name: "lib_a",
bazel_module: { bp2build_available: false },
}
java_library {
name: "static_libs_a",
bazel_module: { bp2build_available: false },
}
`,
ExpectedBazelTargets: []string{