Merge "Remove VNDK information from CC and APEX tests" into main

This commit is contained in:
Kiyoung Kim
2024-03-29 04:37:25 +00:00
committed by Gerrit Code Review
11 changed files with 53 additions and 2247 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -200,7 +200,7 @@ func TestVendorProductVariantGenrule(t *testing.T) {
}
`
t.Helper()
ctx := PrepareForTestWithCcIncludeVndk.RunTestWithBp(t, bp)
ctx := PrepareForIntegrationTestWithCc.RunTestWithBp(t, bp)
variants := ctx.ModuleVariantsForTests("gen")
if !slices.Contains(variants, "android_vendor_arm64_armv8-a") {

View File

@@ -496,11 +496,10 @@ func (v *CcApiVariant) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext)
func (v *CcApiVariant) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { return false }
func (v *CcApiVariant) ExtraImageVariations(ctx android.BaseModuleContext) []string {
var variations []string
platformVndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
if String(v.properties.Variant) == "llndk" {
variations = append(variations, VendorVariationPrefix+platformVndkVersion)
variations = append(variations, ProductVariationPrefix+platformVndkVersion)
variations = append(variations, VendorVariation)
variations = append(variations, ProductVariation)
}
return variations

View File

@@ -71,8 +71,8 @@ func TestApiLibraryReplacesExistingModule(t *testing.T) {
android.AssertBoolEquals(t, "original library should be linked with non-stub variant", true, hasDirectDependency(t, ctx, libfoo, libbar))
android.AssertBoolEquals(t, "Stub library from API surface should be not linked with non-stub variant", false, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
libfooVendor := ctx.ModuleForTests("libfoo", "android_vendor.29_arm64_armv8-a_shared").Module()
libbarApiImportVendor := ctx.ModuleForTests("libbar.apiimport", "android_vendor.29_arm64_armv8-a_shared").Module()
libfooVendor := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
libbarApiImportVendor := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
android.AssertBoolEquals(t, "original library should not be linked", false, hasDirectDependency(t, ctx, libfooVendor, libbar))
android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, libfooVendor, libbarApiImportVendor))
@@ -102,8 +102,8 @@ func TestApiLibraryDoNotRequireOriginalModule(t *testing.T) {
ctx := prepareForCcTest.RunTestWithBp(t, bp)
libfoo := ctx.ModuleForTests("libfoo", "android_vendor.29_arm64_armv8-a_shared").Module()
libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor.29_arm64_armv8-a_shared").Module()
libfoo := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
}
@@ -135,9 +135,9 @@ func TestApiLibraryShouldNotReplaceWithoutApiImport(t *testing.T) {
ctx := prepareForCcTest.RunTestWithBp(t, bp)
libfoo := ctx.ModuleForTests("libfoo", "android_vendor.29_arm64_armv8-a_shared").Module()
libbar := ctx.ModuleForTests("libbar", "android_vendor.29_arm64_armv8-a_shared").Module()
libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor.29_arm64_armv8-a_shared").Module()
libfoo := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
libbar := ctx.ModuleForTests("libbar", "android_vendor_arm64_armv8-a_shared").Module()
libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
android.AssertBoolEquals(t, "original library should be linked", true, hasDirectDependency(t, ctx, libfoo, libbar))
android.AssertBoolEquals(t, "Stub library from API surface should not be linked", false, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
@@ -174,13 +174,13 @@ func TestExportDirFromStubLibrary(t *testing.T) {
}
`
ctx := prepareForCcTest.RunTestWithBp(t, bp)
vendorCFlags := ctx.ModuleForTests("vendorbin", "android_vendor.29_arm64_armv8-a").Rule("cc").Args["cFlags"]
vendorCFlags := ctx.ModuleForTests("vendorbin", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"]
android.AssertStringDoesContain(t, "Vendor binary should compile using headers provided by stub", vendorCFlags, "-Istub_include_dir")
android.AssertStringDoesNotContain(t, "Vendor binary should not compile using headers of source", vendorCFlags, "-Isource_include_dir")
android.AssertStringDoesContain(t, "Vendor binary should compile using system headers provided by stub", vendorCFlags, "-isystem stub_system_include_dir")
android.AssertStringDoesNotContain(t, "Vendor binary should not compile using system headers of source", vendorCFlags, "-isystem source_system_include_dir")
vendorImplicits := ctx.ModuleForTests("vendorbin", "android_vendor.29_arm64_armv8-a").Rule("cc").OrderOnly.Strings()
vendorImplicits := ctx.ModuleForTests("vendorbin", "android_vendor_arm64_armv8-a").Rule("cc").OrderOnly.Strings()
// Building the stub.so file first assembles its .h files in multi-tree out.
// These header files are required for compiling the other API domain (vendor in this case)
android.AssertStringListContains(t, "Vendor binary compilation should have an implicit dep on the stub .so file", vendorImplicits, "libfoo.so")
@@ -223,17 +223,17 @@ func TestApiLibraryWithLlndkVariant(t *testing.T) {
ctx := prepareForCcTest.RunTestWithBp(t, bp)
binfoo := ctx.ModuleForTests("binfoo", "android_vendor.29_arm64_armv8-a").Module()
libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor.29_arm64_armv8-a_shared").Module()
libbarApiVariant := ctx.ModuleForTests("libbar.llndk.apiimport", "android_vendor.29_arm64_armv8-a").Module()
binfoo := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Module()
libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
libbarApiVariant := ctx.ModuleForTests("libbar.llndk.apiimport", "android_vendor_arm64_armv8-a").Module()
android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, binfoo, libbarApiImport))
android.AssertBoolEquals(t, "Stub library variant from API surface should be linked", true, hasDirectDependency(t, ctx, libbarApiImport, libbarApiVariant))
binFooLibFlags := ctx.ModuleForTests("binfoo", "android_vendor.29_arm64_armv8-a").Rule("ld").Args["libFlags"]
binFooLibFlags := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Rule("ld").Args["libFlags"]
android.AssertStringDoesContain(t, "Vendor binary should be linked with LLNDK variant source", binFooLibFlags, "libbar.llndk.apiimport.so")
binFooCFlags := ctx.ModuleForTests("binfoo", "android_vendor.29_arm64_armv8-a").Rule("cc").Args["cFlags"]
binFooCFlags := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"]
android.AssertStringDoesContain(t, "Vendor binary should include headers from the LLNDK variant source", binFooCFlags, "-Ilibbar_llndk_include")
}
@@ -446,12 +446,12 @@ func TestApiLibraryWithMultipleVariants(t *testing.T) {
binfoo := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Module()
libbarApiImportv29 := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_sdk_shared_29").Module()
libbarApiImportLlndk := ctx.ModuleForTests("libbar.apiimport", "android_vendor.29_arm64_armv8-a_shared").Module()
libbarApiImportLlndk := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
android.AssertBoolEquals(t, "Binary using SDK should be linked with API library from NDK variant", true, hasDirectDependency(t, ctx, binfoo, libbarApiImportv29))
android.AssertBoolEquals(t, "Binary using SDK should not be linked with API library from LLNDK variant", false, hasDirectDependency(t, ctx, binfoo, libbarApiImportLlndk))
binbaz := ctx.ModuleForTests("binbaz", "android_vendor.29_arm64_armv8-a").Module()
binbaz := ctx.ModuleForTests("binbaz", "android_vendor_arm64_armv8-a").Module()
android.AssertBoolEquals(t, "Vendor binary should be linked with API library from LLNDK variant", true, hasDirectDependency(t, ctx, binbaz, libbarApiImportLlndk))
android.AssertBoolEquals(t, "Vendor binary should not be linked with API library from NDK variant", false, hasDirectDependency(t, ctx, binbaz, libbarApiImportv29))

View File

@@ -41,7 +41,7 @@ func TestMinSdkVersionsOfCrtObjects(t *testing.T) {
{"android_arm64_armv8-a_sdk_29", "29"},
{"android_arm64_armv8-a_sdk_30", "30"},
{"android_arm64_armv8-a_sdk_current", "10000"},
{"android_vendor.29_arm64_armv8-a", "29"},
{"android_vendor_arm64_armv8-a", "10000"},
}
ctx := prepareForCcTest.RunTestWithBp(t, bp)
@@ -50,7 +50,7 @@ func TestMinSdkVersionsOfCrtObjects(t *testing.T) {
expected := "-target aarch64-linux-android" + v.num + " "
android.AssertStringDoesContain(t, "cflag", cflags, expected)
}
ctx = prepareForCcTestWithoutVndk.RunTestWithBp(t, bp)
ctx = prepareForCcTest.RunTestWithBp(t, bp)
android.AssertStringDoesContain(t, "cflag",
ctx.ModuleForTests("crt_foo", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"],
"-target aarch64-linux-android10000 ")

View File

@@ -305,10 +305,7 @@ func commonDefaultModules() string {
recovery_available: true,
host_supported: true,
min_sdk_version: "29",
vndk: {
enabled: true,
support_system_process: true,
},
double_loadable: true,
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
@@ -624,19 +621,6 @@ var PrepareForTestOnLinuxBionic = android.GroupFixturePreparers(
android.FixtureOverrideTextFile(linuxBionicDefaultsPath, withLinuxBionic()),
)
// This adds some additional modules and singletons which might negatively impact the performance
// of tests so they are not included in the PrepareForIntegrationTestWithCc.
var PrepareForTestWithCcIncludeVndk = android.GroupFixturePreparers(
PrepareForIntegrationTestWithCc,
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
snapshot.VendorSnapshotImageSingleton.Init(ctx)
snapshot.RecoverySnapshotImageSingleton.Init(ctx)
RegisterVendorSnapshotModules(ctx)
RegisterRecoverySnapshotModules(ctx)
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
}),
)
// PrepareForTestWithHostMusl sets the host configuration to musl libc instead of glibc. It also disables the test
// on mac, which doesn't support musl libc, and adds musl modules.
var PrepareForTestWithHostMusl = android.GroupFixturePreparers(
@@ -722,7 +706,6 @@ func CreateTestContext(config android.Config) *android.TestContext {
snapshot.RecoverySnapshotImageSingleton.Init(ctx)
RegisterVendorSnapshotModules(ctx)
RegisterRecoverySnapshotModules(ctx)
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
RegisterVndkLibraryTxtTypes(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)

View File

@@ -65,8 +65,8 @@ func TestVendorPublicLibraries(t *testing.T) {
`)
coreVariant := "android_arm64_armv8-a_shared"
vendorVariant := "android_vendor.29_arm64_armv8-a_shared"
productVariant := "android_product.29_arm64_armv8-a_shared"
vendorVariant := "android_vendor_arm64_armv8-a_shared"
productVariant := "android_product_arm64_armv8-a_shared"
// test if header search paths are correctly added
// _static variant is used since _shared reuses *.o from the static variant