Remove VNDK information from CC and APEX tests

VNDK is deprecated in 24Q2, so soong should be tested with no device and
platform vndk versions. This change removes all VNDK related tests and
VNDK versions from soong-cc and soong-apex tests.

Bug: 330100430
Test: m nothing --no-skip-soong-tests passed
Change-Id: I45e6c13e6c0a6bc9710b120e8d5b167e2051631e
This commit is contained in:
Kiyoung Kim 2024-03-26 16:33:58 +09:00
parent d8ec229bc0
commit 0d1c1e6aef
11 changed files with 53 additions and 2247 deletions

View file

@ -40,7 +40,6 @@ bootstrap_go_package {
"dexpreopt_bootjars_test.go", "dexpreopt_bootjars_test.go",
"platform_bootclasspath_test.go", "platform_bootclasspath_test.go",
"systemserver_classpath_fragment_test.go", "systemserver_classpath_fragment_test.go",
"vndk_test.go",
], ],
pluginFor: ["soong_build"], pluginFor: ["soong_build"],
} }

View file

@ -218,7 +218,6 @@ var prepareForApexTest = android.GroupFixturePreparers(
), ),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.DeviceVndkVersion = proptools.StringPtr("current")
variables.DefaultAppCertificate = proptools.StringPtr("vendor/foo/devkeys/test") variables.DefaultAppCertificate = proptools.StringPtr("vendor/foo/devkeys/test")
variables.CertificateOverrides = []string{"myapex_keytest:myapex.certificate.override"} variables.CertificateOverrides = []string{"myapex_keytest:myapex.certificate.override"}
variables.Platform_sdk_codename = proptools.StringPtr("Q") variables.Platform_sdk_codename = proptools.StringPtr("Q")
@ -226,7 +225,6 @@ var prepareForApexTest = android.GroupFixturePreparers(
// "Tiramisu" needs to be in the next line for compatibility with soong code, // "Tiramisu" needs to be in the next line for compatibility with soong code,
// not because of these tests specifically (it's not used by the tests) // not because of these tests specifically (it's not used by the tests)
variables.Platform_version_active_codenames = []string{"Q", "Tiramisu"} variables.Platform_version_active_codenames = []string{"Q", "Tiramisu"}
variables.Platform_vndk_version = proptools.StringPtr("29")
variables.BuildId = proptools.StringPtr("TEST.BUILD_ID") variables.BuildId = proptools.StringPtr("TEST.BUILD_ID")
}), }),
) )
@ -2062,9 +2060,9 @@ func TestApexMinSdkVersion_InVendorApex(t *testing.T) {
} }
`) `)
vendorVariant := "android_vendor.29_arm64_armv8-a" vendorVariant := "android_vendor_arm64_armv8-a"
mylib := ctx.ModuleForTests("mylib", vendorVariant+"_shared_myapex") mylib := ctx.ModuleForTests("mylib", vendorVariant+"_shared_apex29")
// Ensure that mylib links with "current" LLNDK // Ensure that mylib links with "current" LLNDK
libFlags := names(mylib.Rule("ld").Args["libFlags"]) libFlags := names(mylib.Rule("ld").Args["libFlags"])
@ -3025,158 +3023,6 @@ func TestVendorApex(t *testing.T) {
ensureListNotContains(t, requireNativeLibs, ":vndk") ensureListNotContains(t, requireNativeLibs, ":vndk")
} }
func TestVendorApex_use_vndk_as_stable_TryingToIncludeVNDKLib(t *testing.T) {
testApexError(t, `Trying to include a VNDK library`, `
apex {
name: "myapex",
key: "myapex.key",
native_shared_libs: ["libc++"], // libc++ is a VNDK lib
vendor: true,
use_vndk_as_stable: true,
updatable: false,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}`)
}
func TestVendorApex_use_vndk_as_stable(t *testing.T) {
// myapex myapex2
// | |
// mybin ------. mybin2
// \ \ / |
// (stable) .---\--------` |
// \ / \ |
// \ / \ /
// libvndk libvendor
// (vndk)
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
binaries: ["mybin"],
vendor: true,
use_vndk_as_stable: true,
updatable: false,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_binary {
name: "mybin",
vendor: true,
shared_libs: ["libvndk", "libvendor"],
}
cc_library {
name: "libvndk",
vndk: {
enabled: true,
},
vendor_available: true,
product_available: true,
}
cc_library {
name: "libvendor",
vendor: true,
stl: "none",
}
apex {
name: "myapex2",
key: "myapex.key",
binaries: ["mybin2"],
vendor: true,
use_vndk_as_stable: false,
updatable: false,
}
cc_binary {
name: "mybin2",
vendor: true,
shared_libs: ["libvndk", "libvendor"],
}
`,
android.FixtureModifyConfig(func(config android.Config) {
config.TestProductVariables.KeepVndk = proptools.BoolPtr(true)
}),
)
vendorVariant := "android_vendor.29_arm64_armv8-a"
for _, tc := range []struct {
name string
apexName string
moduleName string
moduleVariant string
libs []string
contents []string
requireVndkNamespace bool
}{
{
name: "use_vndk_as_stable",
apexName: "myapex",
moduleName: "mybin",
moduleVariant: vendorVariant + "_apex10000",
libs: []string{
// should link with vendor variants of VNDK libs(libvndk/libc++)
"out/soong/.intermediates/libvndk/" + vendorVariant + "_shared/libvndk.so",
"out/soong/.intermediates/" + cc.DefaultCcCommonTestModulesDir + "libc++/" + vendorVariant + "_shared/libc++.so",
// unstable Vendor libs as APEX variant
"out/soong/.intermediates/libvendor/" + vendorVariant + "_shared_apex10000/libvendor.so",
},
contents: []string{
"bin/mybin",
"lib64/libvendor.so",
// VNDK libs (libvndk/libc++) are not included
},
requireVndkNamespace: true,
},
{
name: "!use_vndk_as_stable",
apexName: "myapex2",
moduleName: "mybin2",
moduleVariant: vendorVariant + "_myapex2",
libs: []string{
// should link with "unique" APEX(myapex2) variant of VNDK libs(libvndk/libc++)
"out/soong/.intermediates/libvndk/" + vendorVariant + "_shared_myapex2/libvndk.so",
"out/soong/.intermediates/" + cc.DefaultCcCommonTestModulesDir + "libc++/" + vendorVariant + "_shared_myapex2/libc++.so",
// unstable vendor libs have "merged" APEX variants
"out/soong/.intermediates/libvendor/" + vendorVariant + "_shared_apex10000/libvendor.so",
},
contents: []string{
"bin/mybin2",
"lib64/libvendor.so",
// VNDK libs are included as well
"lib64/libvndk.so",
"lib64/libc++.so",
},
requireVndkNamespace: false,
},
} {
t.Run(tc.name, func(t *testing.T) {
// Check linked libs
ldRule := ctx.ModuleForTests(tc.moduleName, tc.moduleVariant).Rule("ld")
libs := names(ldRule.Args["libFlags"])
for _, lib := range tc.libs {
ensureListContains(t, libs, lib)
}
// Check apex contents
ensureExactContents(t, ctx, tc.apexName, "android_common_"+tc.apexName, tc.contents)
// Check "requireNativeLibs"
apexManifestRule := ctx.ModuleForTests(tc.apexName, "android_common_"+tc.apexName).Rule("apexManifestRule")
requireNativeLibs := names(apexManifestRule.Args["requireNativeLibs"])
if tc.requireVndkNamespace {
ensureListContains(t, requireNativeLibs, ":vndk")
} else {
ensureListNotContains(t, requireNativeLibs, ":vndk")
}
})
}
}
func TestProductVariant(t *testing.T) { func TestProductVariant(t *testing.T) {
ctx := testApex(t, ` ctx := testApex(t, `
apex { apex {
@ -3202,7 +3048,7 @@ func TestProductVariant(t *testing.T) {
`) `)
cflags := strings.Fields( cflags := strings.Fields(
ctx.ModuleForTests("foo", "android_product.29_arm64_armv8-a_myapex").Rule("cc").Args["cFlags"]) ctx.ModuleForTests("foo", "android_product_arm64_armv8-a_apex10000").Rule("cc").Args["cFlags"])
ensureListContains(t, cflags, "-D__ANDROID_VNDK__") ensureListContains(t, cflags, "-D__ANDROID_VNDK__")
ensureListContains(t, cflags, "-D__ANDROID_APEX__") ensureListContains(t, cflags, "-D__ANDROID_APEX__")
ensureListContains(t, cflags, "-D__ANDROID_PRODUCT__") ensureListContains(t, cflags, "-D__ANDROID_PRODUCT__")
@ -3823,166 +3669,6 @@ func ensureExactDeapexedContents(t *testing.T, ctx *android.TestContext, moduleN
assertFileListEquals(t, files, actualFiles) assertFileListEquals(t, files, actualFiles)
} }
func TestVndkApexCurrent(t *testing.T) {
commonFiles := []string{
"lib/libc++.so",
"lib64/libc++.so",
"etc/llndk.libraries.29.txt",
"etc/vndkcore.libraries.29.txt",
"etc/vndksp.libraries.29.txt",
"etc/vndkprivate.libraries.29.txt",
"etc/vndkproduct.libraries.29.txt",
}
testCases := []struct {
vndkVersion string
expectedFiles []string
}{
{
vndkVersion: "current",
expectedFiles: append(commonFiles,
"lib/libvndk.so",
"lib/libvndksp.so",
"lib64/libvndk.so",
"lib64/libvndksp.so"),
},
}
for _, tc := range testCases {
t.Run("VNDK.current with DeviceVndkVersion="+tc.vndkVersion, func(t *testing.T) {
ctx := testApex(t, `
apex_vndk {
name: "com.android.vndk.current",
key: "com.android.vndk.current.key",
updatable: false,
}
apex_key {
name: "com.android.vndk.current.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "libvndk",
srcs: ["mylib.cpp"],
vendor_available: true,
product_available: true,
vndk: {
enabled: true,
},
system_shared_libs: [],
stl: "none",
apex_available: [ "com.android.vndk.current" ],
}
cc_library {
name: "libvndksp",
srcs: ["mylib.cpp"],
vendor_available: true,
product_available: true,
vndk: {
enabled: true,
support_system_process: true,
},
system_shared_libs: [],
stl: "none",
apex_available: [ "com.android.vndk.current" ],
}
// VNDK-Ext should not cause any problems
cc_library {
name: "libvndk.ext",
srcs: ["mylib2.cpp"],
vendor: true,
vndk: {
enabled: true,
extends: "libvndk",
},
system_shared_libs: [],
stl: "none",
}
cc_library {
name: "libvndksp.ext",
srcs: ["mylib2.cpp"],
vendor: true,
vndk: {
enabled: true,
support_system_process: true,
extends: "libvndksp",
},
system_shared_libs: [],
stl: "none",
}
`+vndkLibrariesTxtFiles("current"), android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.DeviceVndkVersion = proptools.StringPtr(tc.vndkVersion)
variables.KeepVndk = proptools.BoolPtr(true)
}))
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", tc.expectedFiles)
})
}
}
func TestVndkApexWithPrebuilt(t *testing.T) {
ctx := testApex(t, `
apex_vndk {
name: "com.android.vndk.current",
key: "com.android.vndk.current.key",
updatable: false,
}
apex_key {
name: "com.android.vndk.current.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_prebuilt_library_shared {
name: "libvndk",
srcs: ["libvndk.so"],
vendor_available: true,
product_available: true,
vndk: {
enabled: true,
},
system_shared_libs: [],
stl: "none",
apex_available: [ "com.android.vndk.current" ],
}
cc_prebuilt_library_shared {
name: "libvndk.arm",
srcs: ["libvndk.arm.so"],
vendor_available: true,
product_available: true,
vndk: {
enabled: true,
},
enabled: false,
arch: {
arm: {
enabled: true,
},
},
system_shared_libs: [],
stl: "none",
apex_available: [ "com.android.vndk.current" ],
}
`+vndkLibrariesTxtFiles("current"),
withFiles(map[string][]byte{
"libvndk.so": nil,
"libvndk.arm.so": nil,
}))
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", []string{
"lib/libvndk.so",
"lib/libvndk.arm.so",
"lib64/libvndk.so",
"lib/libc++.so",
"lib64/libc++.so",
"etc/*",
})
}
func vndkLibrariesTxtFiles(vers ...string) (result string) { func vndkLibrariesTxtFiles(vers ...string) (result string) {
for _, v := range vers { for _, v := range vers {
if v == "current" { if v == "current" {
@ -4090,9 +3776,10 @@ func TestVndkApexVersion(t *testing.T) {
func TestVndkApexNameRule(t *testing.T) { func TestVndkApexNameRule(t *testing.T) {
ctx := testApex(t, ` ctx := testApex(t, `
apex_vndk { apex_vndk {
name: "com.android.vndk.current", name: "com.android.vndk.v29",
key: "myapex.key", key: "myapex.key",
file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts",
vndk_version: "29",
updatable: false, updatable: false,
} }
apex_vndk { apex_vndk {
@ -4106,7 +3793,7 @@ func TestVndkApexNameRule(t *testing.T) {
name: "myapex.key", name: "myapex.key",
public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey",
private_key: "testkey.pem", private_key: "testkey.pem",
}`+vndkLibrariesTxtFiles("28", "current")) }`+vndkLibrariesTxtFiles("28", "29"))
assertApexName := func(expected, moduleName string) { assertApexName := func(expected, moduleName string) {
module := ctx.ModuleForTests(moduleName, "android_common") module := ctx.ModuleForTests(moduleName, "android_common")
@ -4114,51 +3801,10 @@ func TestVndkApexNameRule(t *testing.T) {
ensureContains(t, apexManifestRule.Args["opt"], "-v name "+expected) ensureContains(t, apexManifestRule.Args["opt"], "-v name "+expected)
} }
assertApexName("com.android.vndk.v29", "com.android.vndk.current") assertApexName("com.android.vndk.v29", "com.android.vndk.v29")
assertApexName("com.android.vndk.v28", "com.android.vndk.v28") assertApexName("com.android.vndk.v28", "com.android.vndk.v28")
} }
func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
ctx := testApex(t, `
apex_vndk {
name: "com.android.vndk.current",
key: "com.android.vndk.current.key",
file_contexts: ":myapex-file_contexts",
updatable: false,
}
apex_key {
name: "com.android.vndk.current.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "libvndk",
srcs: ["mylib.cpp"],
vendor_available: true,
product_available: true,
native_bridge_supported: true,
host_supported: true,
vndk: {
enabled: true,
},
system_shared_libs: [],
stl: "none",
apex_available: [ "com.android.vndk.current" ],
}
`+vndkLibrariesTxtFiles("current"),
withNativeBridgeEnabled)
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", []string{
"lib/libvndk.so",
"lib64/libvndk.so",
"lib/libc++.so",
"lib64/libc++.so",
"etc/*",
})
}
func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) { func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
testApexError(t, `module "com.android.vndk.current" .*: native_bridge_supported: .* doesn't support native bridge binary`, ` testApexError(t, `module "com.android.vndk.current" .*: native_bridge_supported: .* doesn't support native bridge binary`, `
apex_vndk { apex_vndk {
@ -4259,47 +3905,6 @@ func TestVndkApexWithBinder32(t *testing.T) {
}) })
} }
func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) {
ctx := testApex(t, `
apex_vndk {
name: "com.android.vndk.current",
key: "com.android.vndk.current.key",
file_contexts: ":myapex-file_contexts",
updatable: false,
}
apex_key {
name: "com.android.vndk.current.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "libz",
vendor_available: true,
product_available: true,
vndk: {
enabled: true,
},
stubs: {
symbol_file: "libz.map.txt",
versions: ["30"],
}
}
`+vndkLibrariesTxtFiles("current"), withFiles(map[string][]byte{
"libz.map.txt": nil,
}))
apexManifestRule := ctx.ModuleForTests("com.android.vndk.current", "android_common").Rule("apexManifestRule")
provideNativeLibs := names(apexManifestRule.Args["provideNativeLibs"])
ensureListEmpty(t, provideNativeLibs)
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", []string{
"out/soong/.intermediates/libz/android_vendor.29_arm64_armv8-a_shared/libz.so:lib64/libz.so",
"out/soong/.intermediates/libz/android_vendor.29_arm_armv7-a-neon_shared/libz.so:lib/libz.so",
"*/*",
})
}
func TestVendorApexWithVndkPrebuilts(t *testing.T) { func TestVendorApexWithVndkPrebuilts(t *testing.T) {
ctx := testApex(t, "", ctx := testApex(t, "",
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {

View file

@ -1,78 +0,0 @@
package apex
import (
"testing"
"github.com/google/blueprint/proptools"
"android/soong/android"
)
func TestVndkApexUsesVendorVariant(t *testing.T) {
bp := `
apex_vndk {
name: "com.android.vndk.current",
key: "mykey",
updatable: false,
}
apex_key {
name: "mykey",
}
cc_library {
name: "libfoo",
vendor_available: true,
product_available: true,
vndk: {
enabled: true,
},
system_shared_libs: [],
stl: "none",
}
` + vndkLibrariesTxtFiles("current")
ensureFileSrc := func(t *testing.T, files []fileInApex, path, src string) {
t.Helper()
for _, f := range files {
if f.path == path {
ensureContains(t, f.src, src)
return
}
}
t.Errorf("expected path %q not found", path)
}
t.Run("VNDK lib doesn't have an apex variant", func(t *testing.T) {
ctx := testApex(t, bp)
// libfoo doesn't have apex variants
for _, variant := range ctx.ModuleVariantsForTests("libfoo") {
ensureNotContains(t, variant, "_myapex")
}
// VNDK APEX doesn't create apex variant
files := getFiles(t, ctx, "com.android.vndk.current", "android_common")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared/libfoo.so")
})
t.Run("VNDK APEX gathers only vendor variants even if product variants are available", func(t *testing.T) {
ctx := testApex(t, bp)
files := getFiles(t, ctx, "com.android.vndk.current", "android_common")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared/libfoo.so")
})
t.Run("VNDK APEX supports coverage variants", func(t *testing.T) {
ctx := testApex(t, bp,
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.GcovCoverage = proptools.BoolPtr(true)
variables.Native_coverage = proptools.BoolPtr(true)
}),
)
files := getFiles(t, ctx, "com.android.vndk.current", "android_common")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared/libfoo.so")
files = getFiles(t, ctx, "com.android.vndk.current", "android_common_cov")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared_cov/libfoo.so")
})
}

File diff suppressed because it is too large Load diff

View file

@ -200,7 +200,7 @@ func TestVendorProductVariantGenrule(t *testing.T) {
} }
` `
t.Helper() t.Helper()
ctx := PrepareForTestWithCcIncludeVndk.RunTestWithBp(t, bp) ctx := PrepareForIntegrationTestWithCc.RunTestWithBp(t, bp)
variants := ctx.ModuleVariantsForTests("gen") variants := ctx.ModuleVariantsForTests("gen")
if !slices.Contains(variants, "android_vendor_arm64_armv8-a") { 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) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { return false }
func (v *CcApiVariant) ExtraImageVariations(ctx android.BaseModuleContext) []string { func (v *CcApiVariant) ExtraImageVariations(ctx android.BaseModuleContext) []string {
var variations []string var variations []string
platformVndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
if String(v.properties.Variant) == "llndk" { if String(v.properties.Variant) == "llndk" {
variations = append(variations, VendorVariationPrefix+platformVndkVersion) variations = append(variations, VendorVariation)
variations = append(variations, ProductVariationPrefix+platformVndkVersion) variations = append(variations, ProductVariation)
} }
return variations 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, "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)) 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() libfooVendor := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
libbarApiImportVendor := ctx.ModuleForTests("libbar.apiimport", "android_vendor.29_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, "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)) 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) ctx := prepareForCcTest.RunTestWithBp(t, bp)
libfoo := ctx.ModuleForTests("libfoo", "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.29_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)) 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) ctx := prepareForCcTest.RunTestWithBp(t, bp)
libfoo := ctx.ModuleForTests("libfoo", "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.29_arm64_armv8-a_shared").Module() libbar := ctx.ModuleForTests("libbar", "android_vendor_arm64_armv8-a_shared").Module()
libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor.29_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, "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)) 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) 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.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.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.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") 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. // 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) // 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") 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) ctx := prepareForCcTest.RunTestWithBp(t, bp)
binfoo := ctx.ModuleForTests("binfoo", "android_vendor.29_arm64_armv8-a").Module() binfoo := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Module()
libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor.29_arm64_armv8-a_shared").Module() libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
libbarApiVariant := ctx.ModuleForTests("libbar.llndk.apiimport", "android_vendor.29_arm64_armv8-a").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 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)) 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") 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") 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() binfoo := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Module()
libbarApiImportv29 := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_sdk_shared_29").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 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)) 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 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)) 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_29", "29"},
{"android_arm64_armv8-a_sdk_30", "30"}, {"android_arm64_armv8-a_sdk_30", "30"},
{"android_arm64_armv8-a_sdk_current", "10000"}, {"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) ctx := prepareForCcTest.RunTestWithBp(t, bp)
@ -50,7 +50,7 @@ func TestMinSdkVersionsOfCrtObjects(t *testing.T) {
expected := "-target aarch64-linux-android" + v.num + " " expected := "-target aarch64-linux-android" + v.num + " "
android.AssertStringDoesContain(t, "cflag", cflags, expected) android.AssertStringDoesContain(t, "cflag", cflags, expected)
} }
ctx = prepareForCcTestWithoutVndk.RunTestWithBp(t, bp) ctx = prepareForCcTest.RunTestWithBp(t, bp)
android.AssertStringDoesContain(t, "cflag", android.AssertStringDoesContain(t, "cflag",
ctx.ModuleForTests("crt_foo", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"], ctx.ModuleForTests("crt_foo", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"],
"-target aarch64-linux-android10000 ") "-target aarch64-linux-android10000 ")

View file

@ -305,10 +305,7 @@ func commonDefaultModules() string {
recovery_available: true, recovery_available: true,
host_supported: true, host_supported: true,
min_sdk_version: "29", min_sdk_version: "29",
vndk: { double_loadable: true,
enabled: true,
support_system_process: true,
},
apex_available: [ apex_available: [
"//apex_available:platform", "//apex_available:platform",
"//apex_available:anyapex", "//apex_available:anyapex",
@ -624,19 +621,6 @@ var PrepareForTestOnLinuxBionic = android.GroupFixturePreparers(
android.FixtureOverrideTextFile(linuxBionicDefaultsPath, withLinuxBionic()), 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 // 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. // on mac, which doesn't support musl libc, and adds musl modules.
var PrepareForTestWithHostMusl = android.GroupFixturePreparers( var PrepareForTestWithHostMusl = android.GroupFixturePreparers(
@ -722,7 +706,6 @@ func CreateTestContext(config android.Config) *android.TestContext {
snapshot.RecoverySnapshotImageSingleton.Init(ctx) snapshot.RecoverySnapshotImageSingleton.Init(ctx)
RegisterVendorSnapshotModules(ctx) RegisterVendorSnapshotModules(ctx)
RegisterRecoverySnapshotModules(ctx) RegisterRecoverySnapshotModules(ctx)
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
RegisterVndkLibraryTxtTypes(ctx) RegisterVndkLibraryTxtTypes(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)

View file

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

View file

@ -47,7 +47,7 @@ var PrepareForIntegrationTestWithRust = android.GroupFixturePreparers(
var PrepareForTestWithRustIncludeVndk = android.GroupFixturePreparers( var PrepareForTestWithRustIncludeVndk = android.GroupFixturePreparers(
PrepareForIntegrationTestWithRust, PrepareForIntegrationTestWithRust,
cc.PrepareForTestWithCcIncludeVndk, cc.PrepareForIntegrationTestWithCc,
) )
func GatherRequiredDepsForTest() string { func GatherRequiredDepsForTest() string {