summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Parsons <cparsons@google.com> 2023-09-21 15:30:27 +0000
committer Chris Parsons <cparsons@google.com> 2023-09-21 17:08:09 +0000
commit4c81ce0307a2338533cec4d7e6b48554b7ee196f (patch)
tree677e0a7f1ad15f65b88493a0522d022c2114fe1d
parentf2d858e5bacdf96892d7845cf49a6daf6d57dcee (diff)
Refactor some tests to not use bp2build_avail
Bug: 301312260 Test: presubmits Change-Id: I67ca45f17d11e9b893fae5f6c6df1239ae4220b6
-rw-r--r--bp2build/apex_conversion_test.go24
-rw-r--r--bp2build/cc_library_conversion_test.go3
-rw-r--r--bp2build/cc_library_shared_conversion_test.go6
-rw-r--r--bp2build/cc_library_static_conversion_test.go8
-rw-r--r--bp2build/java_plugin_conversion_test.go2
-rw-r--r--bp2build/java_proto_conversion_test.go4
-rw-r--r--bp2build/java_test_host_conversion_test.go7
7 files changed, 21 insertions, 33 deletions
diff --git a/bp2build/apex_conversion_test.go b/bp2build/apex_conversion_test.go
index 2a58d0103..60de28cc5 100644
--- a/bp2build/apex_conversion_test.go
+++ b/bp2build/apex_conversion_test.go
@@ -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 {
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index ec603c294..2cbcfc138 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -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 {
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index 6f600da5c..5153224d5 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -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 },
}
`,
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index 0587aaea1..7b97b3906 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -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 {
diff --git a/bp2build/java_plugin_conversion_test.go b/bp2build/java_plugin_conversion_test.go
index b284112c6..dcc17b5ce 100644
--- a/bp2build/java_plugin_conversion_test.go
+++ b/bp2build/java_plugin_conversion_test.go
@@ -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{
diff --git a/bp2build/java_proto_conversion_test.go b/bp2build/java_proto_conversion_test.go
index b25471048..3d55eb27a 100644
--- a/bp2build/java_proto_conversion_test.go
+++ b/bp2build/java_proto_conversion_test.go
@@ -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{
diff --git a/bp2build/java_test_host_conversion_test.go b/bp2build/java_test_host_conversion_test.go
index f41345e87..95c239dbf 100644
--- a/bp2build/java_test_host_conversion_test.go
+++ b/bp2build/java_test_host_conversion_test.go
@@ -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{