Don't use incorrect version names like VER or BOARD even in tests

All version names will go through ApiLevelFromUser which triggers an
error when the name is not a valid one.

Bug: 175678607
Test: m
Change-Id: Id33bf64085603914d45ad7942cb8908a4734493f
This commit is contained in:
Jiyong Park 2021-04-01 21:35:20 +09:00
parent 54105c48f4
commit f58c46e36f
7 changed files with 122 additions and 122 deletions

View File

@ -216,7 +216,7 @@ var prepareForApexTest = android.GroupFixturePreparers(
variables.Platform_sdk_codename = proptools.StringPtr("Q")
variables.Platform_sdk_final = proptools.BoolPtr(false)
variables.Platform_version_active_codenames = []string{"Q"}
variables.Platform_vndk_version = proptools.StringPtr("VER")
variables.Platform_vndk_version = proptools.StringPtr("29")
}),
)
@ -1366,13 +1366,13 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
ensureListEmpty(t, names(apexManifestRule.Args["provideNativeLibs"]))
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libbar.so")
mylibLdFlags := ctx.ModuleForTests("mylib", "android_vendor.VER_arm64_armv8-a_shared_"+tc.apexVariant).Rule("ld").Args["libFlags"]
ensureContains(t, mylibLdFlags, "libbar/android_vendor.VER_arm64_armv8-a_shared_"+tc.shouldLink+"/libbar.so")
mylibLdFlags := ctx.ModuleForTests("mylib", "android_vendor.29_arm64_armv8-a_shared_"+tc.apexVariant).Rule("ld").Args["libFlags"]
ensureContains(t, mylibLdFlags, "libbar/android_vendor.29_arm64_armv8-a_shared_"+tc.shouldLink+"/libbar.so")
for _, ver := range tc.shouldNotLink {
ensureNotContains(t, mylibLdFlags, "libbar/android_vendor.VER_arm64_armv8-a_shared_"+ver+"/libbar.so")
ensureNotContains(t, mylibLdFlags, "libbar/android_vendor.29_arm64_armv8-a_shared_"+ver+"/libbar.so")
}
mylibCFlags := ctx.ModuleForTests("mylib", "android_vendor.VER_arm64_armv8-a_static_"+tc.apexVariant).Rule("cc").Args["cFlags"]
mylibCFlags := ctx.ModuleForTests("mylib", "android_vendor.29_arm64_armv8-a_static_"+tc.apexVariant).Rule("cc").Args["cFlags"]
ver := tc.shouldLink
if tc.shouldLink == "current" {
ver = strconv.Itoa(android.FutureApiLevelInt)
@ -2411,8 +2411,8 @@ func TestUseVendor(t *testing.T) {
inputsString := strings.Join(inputsList, " ")
// ensure that the apex includes vendor variants of the direct and indirect deps
ensureContains(t, inputsString, "android_vendor.VER_arm64_armv8-a_shared_apex10000/mylib.so")
ensureContains(t, inputsString, "android_vendor.VER_arm64_armv8-a_shared_apex10000/mylib2.so")
ensureContains(t, inputsString, "android_vendor.29_arm64_armv8-a_shared_apex10000/mylib.so")
ensureContains(t, inputsString, "android_vendor.29_arm64_armv8-a_shared_apex10000/mylib2.so")
// ensure that the apex does not include core variants
ensureNotContains(t, inputsString, "android_arm64_armv8-a_shared_apex10000/mylib.so")
@ -2558,7 +2558,7 @@ func TestVendorApex_use_vndk_as_stable(t *testing.T) {
}
`)
vendorVariant := "android_vendor.VER_arm64_armv8-a"
vendorVariant := "android_vendor.29_arm64_armv8-a"
ldRule := ctx.ModuleForTests("mybin", vendorVariant+"_apex10000").Rule("ld")
libs := names(ldRule.Args["libFlags"])
@ -2607,7 +2607,7 @@ func TestProductVariant(t *testing.T) {
)
cflags := strings.Fields(
ctx.ModuleForTests("foo", "android_product.VER_arm64_armv8-a_apex10000").Rule("cc").Args["cFlags"])
ctx.ModuleForTests("foo", "android_product.29_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__")
@ -3305,11 +3305,11 @@ func TestVndkApexCurrent(t *testing.T) {
"lib64/libvndk.so",
"lib64/libvndksp.so",
"lib64/libc++.so",
"etc/llndk.libraries.VER.txt",
"etc/vndkcore.libraries.VER.txt",
"etc/vndksp.libraries.VER.txt",
"etc/vndkprivate.libraries.VER.txt",
"etc/vndkproduct.libraries.VER.txt",
"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",
})
}
@ -3495,7 +3495,7 @@ func TestVndkApexNameRule(t *testing.T) {
}
}
assertApexName("com.android.vndk.vVER", "com.android.vndk.current")
assertApexName("com.android.vndk.v29", "com.android.vndk.current")
assertApexName("com.android.vndk.v28", "com.android.vndk.v28")
}

View File

@ -59,11 +59,11 @@ func TestVndkApexForVndkLite(t *testing.T) {
"lib/libc++.so",
"lib64/libvndksp.so",
"lib64/libc++.so",
"etc/llndk.libraries.VER.txt",
"etc/vndkcore.libraries.VER.txt",
"etc/vndksp.libraries.VER.txt",
"etc/vndkprivate.libraries.VER.txt",
"etc/vndkproduct.libraries.VER.txt",
"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",
})
}
@ -111,7 +111,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
// VNDK APEX doesn't create apex variant
files := getFiles(t, ctx, "com.android.vndk.current", "android_common_image")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.VER_arm_armv7-a-neon_shared/libfoo.so")
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) {
@ -123,7 +123,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
)
files := getFiles(t, ctx, "com.android.vndk.current", "android_common_image")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.VER_arm_armv7-a-neon_shared/libfoo.so")
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) {
@ -135,9 +135,9 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
)
files := getFiles(t, ctx, "com.android.vndk.current", "android_common_image")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.VER_arm_armv7-a-neon_shared/libfoo.so")
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_image")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.VER_arm_armv7-a-neon_shared_cov/libfoo.so")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared_cov/libfoo.so")
})
}

View File

@ -35,7 +35,7 @@ var prepareForCcTest = android.GroupFixturePreparers(
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.DeviceVndkVersion = StringPtr("current")
variables.ProductVndkVersion = StringPtr("current")
variables.Platform_vndk_version = StringPtr("VER")
variables.Platform_vndk_version = StringPtr("29")
}),
)
@ -75,7 +75,7 @@ func testCc(t *testing.T, bp string) *android.TestContext {
func testCcNoVndk(t *testing.T, bp string) *android.TestContext {
t.Helper()
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
return testCcWithConfig(t, config)
}
@ -89,7 +89,7 @@ func testCcNoProductVndk(t *testing.T, bp string) *android.TestContext {
t.Helper()
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
return testCcWithConfig(t, config)
}
@ -116,7 +116,7 @@ func testCcError(t *testing.T, pattern string, bp string) {
t.Helper()
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
testCcErrorWithConfig(t, pattern, config)
return
}
@ -131,15 +131,15 @@ func testCcErrorProductVndk(t *testing.T, pattern string, bp string) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
testCcErrorWithConfig(t, pattern, config)
return
}
const (
coreVariant = "android_arm64_armv8-a_shared"
vendorVariant = "android_vendor.VER_arm64_armv8-a_shared"
productVariant = "android_product.VER_arm64_armv8-a_shared"
vendorVariant = "android_vendor.29_arm64_armv8-a_shared"
productVariant = "android_product.29_arm64_armv8-a_shared"
recoveryVariant = "android_recovery_arm64_armv8-a_shared"
)
@ -456,7 +456,7 @@ func TestVndk(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := testCcWithConfig(t, config)
@ -486,8 +486,8 @@ func TestVndk(t *testing.T) {
vndkCoreLib2ndPath := filepath.Join(vndkLib2ndPath, "shared", "vndk-core")
vndkSpLib2ndPath := filepath.Join(vndkLib2ndPath, "shared", "vndk-sp")
variant := "android_vendor.VER_arm64_armv8-a_shared"
variant2nd := "android_vendor.VER_arm_armv7-a-neon_shared"
variant := "android_vendor.29_arm64_armv8-a_shared"
variant2nd := "android_vendor.29_arm_armv7-a-neon_shared"
snapshotSingleton := ctx.SingletonForTests("vndk-snapshot")
@ -577,12 +577,12 @@ func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
}`
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := testCcWithConfig(t, config)
module := ctx.ModuleForTests("llndk.libraries.txt", "")
entries := android.AndroidMkEntriesForTest(t, ctx, module.Module())[0]
assertArrayString(t, entries.EntryMap["LOCAL_MODULE_STEM"], []string{"llndk.libraries.VER.txt"})
assertArrayString(t, entries.EntryMap["LOCAL_MODULE_STEM"], []string{"llndk.libraries.29.txt"})
}
func TestVndkUsingCoreVariant(t *testing.T) {
@ -627,7 +627,7 @@ func TestVndkUsingCoreVariant(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
setVndkMustUseVendorVariantListForTest(config, []string{"libvndk"})
@ -654,7 +654,7 @@ func TestDataLibs(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
ctx := testCcWithConfig(t, config)
@ -705,7 +705,7 @@ func TestDataLibsRelativeInstallPath(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
ctx := testCcWithConfig(t, config)
@ -1331,7 +1331,7 @@ func TestVndkExt(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := testCcWithConfig(t, config)
@ -1776,7 +1776,7 @@ func TestProductVndkExtDependency(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
testCcWithConfig(t, config)
}
@ -2140,7 +2140,7 @@ func TestEnforceProductVndkVersion(t *testing.T) {
}
func TestEnforceProductVndkVersionErrors(t *testing.T) {
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.VER", `
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.29", `
cc_library {
name: "libprod",
product_specific: true,
@ -2155,7 +2155,7 @@ func TestEnforceProductVndkVersionErrors(t *testing.T) {
nocrt: true,
}
`)
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.VER", `
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.29", `
cc_library {
name: "libprod",
product_specific: true,
@ -2169,7 +2169,7 @@ func TestEnforceProductVndkVersionErrors(t *testing.T) {
nocrt: true,
}
`)
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.VER", `
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.29", `
cc_library {
name: "libprod",
product_specific: true,
@ -2204,7 +2204,7 @@ func TestEnforceProductVndkVersionErrors(t *testing.T) {
nocrt: true,
}
`)
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.VER", `
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.29", `
cc_library {
name: "libprod",
product_specific: true,
@ -2330,7 +2330,7 @@ func TestMakeLinkType(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
// native:vndk
ctx := testCcWithConfig(t, config)
@ -2664,27 +2664,27 @@ func TestLlndkLibrary(t *testing.T) {
`)
actual := ctx.ModuleVariantsForTests("libllndk")
for i := 0; i < len(actual); i++ {
if !strings.HasPrefix(actual[i], "android_vendor.VER_") {
if !strings.HasPrefix(actual[i], "android_vendor.29_") {
actual = append(actual[:i], actual[i+1:]...)
i--
}
}
expected := []string{
"android_vendor.VER_arm64_armv8-a_shared_1",
"android_vendor.VER_arm64_armv8-a_shared_2",
"android_vendor.VER_arm64_armv8-a_shared_current",
"android_vendor.VER_arm64_armv8-a_shared",
"android_vendor.VER_arm_armv7-a-neon_shared_1",
"android_vendor.VER_arm_armv7-a-neon_shared_2",
"android_vendor.VER_arm_armv7-a-neon_shared_current",
"android_vendor.VER_arm_armv7-a-neon_shared",
"android_vendor.29_arm64_armv8-a_shared_1",
"android_vendor.29_arm64_armv8-a_shared_2",
"android_vendor.29_arm64_armv8-a_shared_current",
"android_vendor.29_arm64_armv8-a_shared",
"android_vendor.29_arm_armv7-a-neon_shared_1",
"android_vendor.29_arm_armv7-a-neon_shared_2",
"android_vendor.29_arm_armv7-a-neon_shared_current",
"android_vendor.29_arm_armv7-a-neon_shared",
}
checkEquals(t, "variants for llndk stubs", expected, actual)
params := ctx.ModuleForTests("libllndk", "android_vendor.VER_arm_armv7-a-neon_shared").Description("generate stub")
params := ctx.ModuleForTests("libllndk", "android_vendor.29_arm_armv7-a-neon_shared").Description("generate stub")
checkEquals(t, "use VNDK version for default stubs", "current", params.Args["apiLevel"])
params = ctx.ModuleForTests("libllndk", "android_vendor.VER_arm_armv7-a-neon_shared_1").Description("generate stub")
params = ctx.ModuleForTests("libllndk", "android_vendor.29_arm_armv7-a-neon_shared_1").Description("generate stub")
checkEquals(t, "override apiLevel for versioned stubs", "1", params.Args["apiLevel"])
}
@ -2714,7 +2714,7 @@ func TestLlndkHeaders(t *testing.T) {
`)
// _static variant is used since _shared reuses *.o from the static variant
cc := ctx.ModuleForTests("libvendor", "android_vendor.VER_arm_armv7-a-neon_static").Rule("cc")
cc := ctx.ModuleForTests("libvendor", "android_vendor.29_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)
@ -2835,7 +2835,7 @@ func TestRuntimeLibs(t *testing.T) {
// runtime_libs for vendor variants have '.vendor' suffixes if the modules have both core
// and vendor variants.
variant = "android_vendor.VER_arm64_armv8-a_shared"
variant = "android_vendor.29_arm64_armv8-a_shared"
module = ctx.ModuleForTests("libvendor_available1", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available.vendor"}, module)
@ -2845,7 +2845,7 @@ func TestRuntimeLibs(t *testing.T) {
// runtime_libs for product variants have '.product' suffixes if the modules have both core
// and product variants.
variant = "android_product.VER_arm64_armv8-a_shared"
variant = "android_product.29_arm64_armv8-a_shared"
module = ctx.ModuleForTests("libproduct_available1", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available.product"}, module)
@ -2861,7 +2861,7 @@ func TestExcludeRuntimeLibs(t *testing.T) {
module := ctx.ModuleForTests("libvendor_available2", variant).Module().(*Module)
checkRuntimeLibs(t, []string{"liball_available"}, module)
variant = "android_vendor.VER_arm64_armv8-a_shared"
variant = "android_vendor.29_arm64_armv8-a_shared"
module = ctx.ModuleForTests("libvendor_available2", variant).Module().(*Module)
checkRuntimeLibs(t, nil, module)
}
@ -3044,7 +3044,7 @@ func TestVendorPublicLibraries(t *testing.T) {
`)
coreVariant := "android_arm64_armv8-a_shared"
vendorVariant := "android_vendor.VER_arm64_armv8-a_shared"
vendorVariant := "android_vendor.29_arm64_armv8-a_shared"
// test if header search paths are correctly added
// _static variant is used since _shared reuses *.o from the static variant
@ -3124,7 +3124,7 @@ func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
ctx := testCcWithConfig(t, config)

View File

@ -88,7 +88,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
`
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := testCcWithConfig(t, config)
// Check Vendor snapshot output.
@ -108,7 +108,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant)
// For shared libraries, only non-VNDK vendor_available modules are captured
sharedVariant := fmt.Sprintf("android_vendor.VER_%s_%s_shared", archType, archVariant)
sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant)
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
checkSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant)
checkSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant)
@ -121,8 +121,8 @@ func TestVendorSnapshotCapture(t *testing.T) {
// For static libraries, all vendor:true and vendor_available modules (including VNDK) are captured.
// Also cfi variants are captured, except for prebuilts like toolchain_library
staticVariant := fmt.Sprintf("android_vendor.VER_%s_%s_static", archType, archVariant)
staticCfiVariant := fmt.Sprintf("android_vendor.VER_%s_%s_static_cfi", archType, archVariant)
staticVariant := fmt.Sprintf("android_vendor.29_%s_%s_static", archType, archVariant)
staticCfiVariant := fmt.Sprintf("android_vendor.29_%s_%s_static_cfi", archType, archVariant)
staticDir := filepath.Join(snapshotVariantPath, archDir, "static")
checkSnapshot(t, ctx, snapshotSingleton, "libb", "libb.a", staticDir, staticVariant)
checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.a", staticDir, staticVariant)
@ -142,7 +142,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
// For binary executables, all vendor:true and vendor_available modules are captured.
if archType == "arm64" {
binaryVariant := fmt.Sprintf("android_vendor.VER_%s_%s", archType, archVariant)
binaryVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant)
binaryDir := filepath.Join(snapshotVariantPath, archDir, "binary")
checkSnapshot(t, ctx, snapshotSingleton, "vendor_bin", "vendor_bin", binaryDir, binaryVariant)
checkSnapshot(t, ctx, snapshotSingleton, "vendor_available_bin", "vendor_available_bin", binaryDir, binaryVariant)
@ -156,7 +156,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
jsonFiles = append(jsonFiles, filepath.Join(headerDir, "libvendor_headers.json"))
// For object modules, all vendor:true and vendor_available modules are captured.
objectVariant := fmt.Sprintf("android_vendor.VER_%s_%s", archType, archVariant)
objectVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant)
objectDir := filepath.Join(snapshotVariantPath, archDir, "object")
checkSnapshot(t, ctx, snapshotSingleton, "obj", "obj.o", objectDir, objectVariant)
jsonFiles = append(jsonFiles, filepath.Join(objectDir, "obj.o.json"))
@ -214,7 +214,7 @@ func TestVendorSnapshotDirected(t *testing.T) {
`
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
config.TestProductVariables.DirectedVendorSnapshot = true
config.TestProductVariables.VendorSnapshotModules = make(map[string]bool)
config.TestProductVariables.VendorSnapshotModules["libvendor"] = true
@ -237,7 +237,7 @@ func TestVendorSnapshotDirected(t *testing.T) {
archVariant := arch[1]
archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant)
sharedVariant := fmt.Sprintf("android_vendor.VER_%s_%s_shared", archType, archVariant)
sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant)
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
// Included modules
@ -308,7 +308,7 @@ func TestVendorSnapshotUse(t *testing.T) {
vndkBp := `
vndk_prebuilt_shared {
name: "libvndk",
version: "BOARD",
version: "28",
target_arch: "arm64",
vendor_available: true,
product_available: true,
@ -326,7 +326,7 @@ func TestVendorSnapshotUse(t *testing.T) {
// old snapshot module which has to be ignored
vndk_prebuilt_shared {
name: "libvndk",
version: "OLD",
version: "26",
target_arch: "arm64",
vendor_available: true,
product_available: true,
@ -381,7 +381,7 @@ func TestVendorSnapshotUse(t *testing.T) {
vendor_snapshot {
name: "vendor_snapshot",
compile_multilib: "first",
version: "BOARD",
version: "28",
vndk_libs: [
"libvndk",
],
@ -401,7 +401,7 @@ func TestVendorSnapshotUse(t *testing.T) {
vendor_snapshot_static {
name: "libvndk",
version: "BOARD",
version: "28",
target_arch: "arm64",
vendor: true,
arch: {
@ -414,7 +414,7 @@ func TestVendorSnapshotUse(t *testing.T) {
vendor_snapshot_shared {
name: "libvendor",
version: "BOARD",
version: "28",
target_arch: "arm64",
compile_multilib: "64",
vendor: true,
@ -433,7 +433,7 @@ func TestVendorSnapshotUse(t *testing.T) {
vendor_snapshot_static {
name: "libvendor",
version: "BOARD",
version: "28",
target_arch: "arm64",
vendor: true,
arch: {
@ -447,7 +447,7 @@ func TestVendorSnapshotUse(t *testing.T) {
vendor_snapshot_shared {
name: "libvendor_available",
androidmk_suffix: ".vendor",
version: "BOARD",
version: "28",
target_arch: "arm64",
vendor: true,
arch: {
@ -461,7 +461,7 @@ func TestVendorSnapshotUse(t *testing.T) {
vendor_snapshot_static {
name: "libvendor_available",
androidmk_suffix: ".vendor",
version: "BOARD",
version: "28",
target_arch: "arm64",
vendor: true,
arch: {
@ -474,7 +474,7 @@ func TestVendorSnapshotUse(t *testing.T) {
vendor_snapshot_binary {
name: "bin",
version: "BOARD",
version: "28",
target_arch: "arm64",
vendor: true,
arch: {
@ -487,7 +487,7 @@ func TestVendorSnapshotUse(t *testing.T) {
// old snapshot module which has to be ignored
vendor_snapshot_binary {
name: "bin",
version: "OLD",
version: "26",
target_arch: "arm64",
vendor: true,
arch: {
@ -517,8 +517,8 @@ func TestVendorSnapshotUse(t *testing.T) {
}
config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS)
config.TestProductVariables.DeviceVndkVersion = StringPtr("BOARD")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.DeviceVndkVersion = StringPtr("28")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := CreateTestContext(config)
ctx.Register()
@ -527,11 +527,11 @@ func TestVendorSnapshotUse(t *testing.T) {
_, errs = ctx.PrepareBuildActions(config)
android.FailIfErrored(t, errs)
sharedVariant := "android_vendor.BOARD_arm64_armv8-a_shared"
staticVariant := "android_vendor.BOARD_arm64_armv8-a_static"
binaryVariant := "android_vendor.BOARD_arm64_armv8-a"
sharedVariant := "android_vendor.28_arm64_armv8-a_shared"
staticVariant := "android_vendor.28_arm64_armv8-a_static"
binaryVariant := "android_vendor.28_arm64_armv8-a"
// libclient uses libvndk.vndk.BOARD.arm64, libvendor.vendor_static.BOARD.arm64, libvendor_without_snapshot
// libclient uses libvndk.vndk.28.arm64, libvendor.vendor_static.28.arm64, libvendor_without_snapshot
libclientCcFlags := ctx.ModuleForTests("libclient", sharedVariant).Rule("cc").Args["cFlags"]
for _, includeFlags := range []string{
"-Ivndk/include/libvndk", // libvndk
@ -545,8 +545,8 @@ func TestVendorSnapshotUse(t *testing.T) {
libclientLdFlags := ctx.ModuleForTests("libclient", sharedVariant).Rule("ld").Args["libFlags"]
for _, input := range [][]string{
[]string{sharedVariant, "libvndk.vndk.BOARD.arm64"},
[]string{staticVariant, "libvendor.vendor_static.BOARD.arm64"},
[]string{sharedVariant, "libvndk.vndk.28.arm64"},
[]string{staticVariant, "libvendor.vendor_static.28.arm64"},
[]string{staticVariant, "libvendor_without_snapshot"},
} {
outputPaths := getOutputPaths(ctx, input[0] /* variant */, []string{input[1]} /* module name */)
@ -565,7 +565,7 @@ func TestVendorSnapshotUse(t *testing.T) {
t.Errorf("wanted libclient AndroidMkStaticLibs %q, got %q", w, g)
}
// bin_without_snapshot uses libvndk.vendor_static.BOARD.arm64
// bin_without_snapshot uses libvndk.vendor_static.28.arm64
binWithoutSnapshotCcFlags := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("cc").Args["cFlags"]
if !strings.Contains(binWithoutSnapshotCcFlags, "-Ivendor/include/libvndk") {
t.Errorf("flags for bin_without_snapshot must contain %#v, but was %#v.",
@ -573,28 +573,28 @@ func TestVendorSnapshotUse(t *testing.T) {
}
binWithoutSnapshotLdFlags := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("ld").Args["libFlags"]
libVndkStaticOutputPaths := getOutputPaths(ctx, staticVariant, []string{"libvndk.vendor_static.BOARD.arm64"})
libVndkStaticOutputPaths := getOutputPaths(ctx, staticVariant, []string{"libvndk.vendor_static.28.arm64"})
if !strings.Contains(binWithoutSnapshotLdFlags, libVndkStaticOutputPaths[0].String()) {
t.Errorf("libflags for bin_without_snapshot must contain %#v, but was %#v",
libVndkStaticOutputPaths[0], binWithoutSnapshotLdFlags)
}
// libvendor.so is installed by libvendor.vendor_shared.BOARD.arm64
ctx.ModuleForTests("libvendor.vendor_shared.BOARD.arm64", sharedVariant).Output("libvendor.so")
// libvendor.so is installed by libvendor.vendor_shared.28.arm64
ctx.ModuleForTests("libvendor.vendor_shared.28.arm64", sharedVariant).Output("libvendor.so")
// libvendor_available.so is installed by libvendor_available.vendor_shared.BOARD.arm64
ctx.ModuleForTests("libvendor_available.vendor_shared.BOARD.arm64", sharedVariant).Output("libvendor_available.so")
// libvendor_available.so is installed by libvendor_available.vendor_shared.28.arm64
ctx.ModuleForTests("libvendor_available.vendor_shared.28.arm64", sharedVariant).Output("libvendor_available.so")
// libvendor_without_snapshot.so is installed by libvendor_without_snapshot
ctx.ModuleForTests("libvendor_without_snapshot", sharedVariant).Output("libvendor_without_snapshot.so")
// bin is installed by bin.vendor_binary.BOARD.arm64
ctx.ModuleForTests("bin.vendor_binary.BOARD.arm64", binaryVariant).Output("bin")
// bin is installed by bin.vendor_binary.28.arm64
ctx.ModuleForTests("bin.vendor_binary.28.arm64", binaryVariant).Output("bin")
// bin_without_snapshot is installed by bin_without_snapshot
ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Output("bin_without_snapshot")
// libvendor, libvendor_available and bin don't have vendor.BOARD variant
// libvendor, libvendor_available and bin don't have vendor.28 variant
libvendorVariants := ctx.ModuleVariantsForTests("libvendor")
if inList(sharedVariant, libvendorVariants) {
t.Errorf("libvendor must not have variant %#v, but it does", sharedVariant)
@ -617,7 +617,7 @@ func TestVendorSnapshotSanitizer(t *testing.T) {
name: "libsnapshot",
vendor: true,
target_arch: "arm64",
version: "BOARD",
version: "28",
arch: {
arm64: {
src: "libsnapshot.a",
@ -629,18 +629,18 @@ func TestVendorSnapshotSanitizer(t *testing.T) {
}
`
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("BOARD")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.DeviceVndkVersion = StringPtr("28")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := testCcWithConfig(t, config)
// Check non-cfi and cfi variant.
staticVariant := "android_vendor.BOARD_arm64_armv8-a_static"
staticCfiVariant := "android_vendor.BOARD_arm64_armv8-a_static_cfi"
staticVariant := "android_vendor.28_arm64_armv8-a_static"
staticCfiVariant := "android_vendor.28_arm64_armv8-a_static_cfi"
staticModule := ctx.ModuleForTests("libsnapshot.vendor_static.BOARD.arm64", staticVariant).Module().(*Module)
staticModule := ctx.ModuleForTests("libsnapshot.vendor_static.28.arm64", staticVariant).Module().(*Module)
assertString(t, staticModule.outputFile.Path().Base(), "libsnapshot.a")
staticCfiModule := ctx.ModuleForTests("libsnapshot.vendor_static.BOARD.arm64", staticCfiVariant).Module().(*Module)
staticCfiModule := ctx.ModuleForTests("libsnapshot.vendor_static.28.arm64", staticCfiVariant).Module().(*Module)
assertString(t, staticCfiModule.outputFile.Path().Base(), "libsnapshot.cfi.a")
}
@ -709,7 +709,7 @@ func TestVendorSnapshotExclude(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := CreateTestContext(config)
ctx.Register()
@ -744,7 +744,7 @@ func TestVendorSnapshotExclude(t *testing.T) {
archVariant := arch[1]
archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant)
sharedVariant := fmt.Sprintf("android_vendor.VER_%s_%s_shared", archType, archVariant)
sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant)
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
// Included modules
@ -801,7 +801,7 @@ func TestVendorSnapshotExcludeInVendorProprietaryPathErrors(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := CreateTestContext(config)
ctx.Register()
@ -875,7 +875,7 @@ func TestRecoverySnapshotCapture(t *testing.T) {
`
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := testCcWithConfig(t, config)
// Check Recovery snapshot output.
@ -993,7 +993,7 @@ func TestRecoverySnapshotExclude(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS)
config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
ctx := CreateTestContext(config)
ctx.Register()
@ -1094,7 +1094,7 @@ func TestRecoverySnapshotDirected(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
config.TestProductVariables.DirectedRecoverySnapshot = true
config.TestProductVariables.RecoverySnapshotModules = make(map[string]bool)
config.TestProductVariables.RecoverySnapshotModules["librecovery"] = true

View File

@ -38,7 +38,7 @@ func TestVendorLinkage(t *testing.T) {
}
`)
vendorBinary := ctx.ModuleForTests("fizz_vendor", "android_vendor.VER_arm64_armv8-a").Module().(*cc.Module)
vendorBinary := ctx.ModuleForTests("fizz_vendor", "android_vendor.29_arm64_armv8-a").Module().(*cc.Module)
if !android.InList("libfoo_vendor", vendorBinary.Properties.AndroidMkStaticLibs) {
t.Errorf("vendorBinary should have a dependency on libfoo_vendor")
@ -56,7 +56,7 @@ func TestImageVndkCfgFlag(t *testing.T) {
}
`)
vendor := ctx.ModuleForTests("libfoo", "android_vendor.VER_arm64_armv8-a_static").Rule("rustc")
vendor := ctx.ModuleForTests("libfoo", "android_vendor.29_arm64_armv8-a_static").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"])

View File

@ -75,7 +75,7 @@ func testRustVndk(t *testing.T, bp string) *android.TestContext {
func(variables android.FixtureProductVariables) {
variables.DeviceVndkVersion = StringPtr("current")
variables.ProductVndkVersion = StringPtr("current")
variables.Platform_vndk_version = StringPtr("VER")
variables.Platform_vndk_version = StringPtr("29")
},
),
).RunTestWithBp(t, bp)

View File

@ -129,7 +129,7 @@ func test(t *testing.T, bp string) *android.TestResult {
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.DeviceSystemSdkVersions = []string{"28"}
variables.DeviceVndkVersion = proptools.StringPtr("current")
variables.Platform_vndk_version = proptools.StringPtr("VER")
variables.Platform_vndk_version = proptools.StringPtr("29")
}),
mockFS.AddToFixture(),
android.FixtureWithRootAndroidBp(bp),
@ -246,10 +246,10 @@ func TestSyspropLibrary(t *testing.T) {
// Check for generated cc_library
for _, variant := range []string{
"android_vendor.VER_arm_armv7-a-neon_shared",
"android_vendor.VER_arm_armv7-a-neon_static",
"android_vendor.VER_arm64_armv8-a_shared",
"android_vendor.VER_arm64_armv8-a_static",
"android_vendor.29_arm_armv7-a-neon_shared",
"android_vendor.29_arm_armv7-a-neon_static",
"android_vendor.29_arm64_armv8-a_shared",
"android_vendor.29_arm64_armv8-a_static",
} {
result.ModuleForTests("libsysprop-platform", variant)
result.ModuleForTests("libsysprop-vendor", variant)
@ -277,15 +277,15 @@ func TestSyspropLibrary(t *testing.T) {
// Check for exported includes
coreVariant := "android_arm64_armv8-a_static"
vendorVariant := "android_vendor.VER_arm64_armv8-a_static"
vendorVariant := "android_vendor.29_arm64_armv8-a_static"
platformInternalPath := "libsysprop-platform/android_arm64_armv8-a_static/gen/sysprop/include"
platformPublicCorePath := "libsysprop-platform/android_arm64_armv8-a_static/gen/sysprop/public/include"
platformPublicVendorPath := "libsysprop-platform/android_vendor.VER_arm64_armv8-a_static/gen/sysprop/public/include"
platformPublicVendorPath := "libsysprop-platform/android_vendor.29_arm64_armv8-a_static/gen/sysprop/public/include"
platformOnProductPath := "libsysprop-platform-on-product/android_arm64_armv8-a_static/gen/sysprop/public/include"
vendorInternalPath := "libsysprop-vendor/android_vendor.VER_arm64_armv8-a_static/gen/sysprop/include"
vendorInternalPath := "libsysprop-vendor/android_vendor.29_arm64_armv8-a_static/gen/sysprop/include"
vendorPublicPath := "libsysprop-vendor-on-product/android_arm64_armv8-a_static/gen/sysprop/public/include"
platformClient := result.ModuleForTests("cc-client-platform", coreVariant)