diff options
Diffstat (limited to 'cc/cc_test.go')
-rw-r--r-- | cc/cc_test.go | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/cc/cc_test.go b/cc/cc_test.go index 5c5275ede..321bd380b 100644 --- a/cc/cc_test.go +++ b/cc/cc_test.go @@ -26,6 +26,8 @@ import ( "android/soong/aidl_library" "android/soong/android" + + "github.com/google/blueprint" ) func init() { @@ -45,6 +47,14 @@ var prepareForCcTest = android.GroupFixturePreparers( }), ) +// TODO(b/316829758) Update prepareForCcTest with this configuration and remove prepareForCcTestWithoutVndk +var prepareForCcTestWithoutVndk = android.GroupFixturePreparers( + PrepareForIntegrationTestWithCc, + android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { + variables.VendorApiLevel = StringPtr("202404") + }), +) + var apexVariationName = "apex28" var apexVersion = "28" @@ -2640,6 +2650,7 @@ func TestLlndkLibrary(t *testing.T) { name: "libexternal_headers", export_include_dirs: ["include"], vendor_available: true, + product_available: true, } cc_library_headers { name: "libexternal_llndk_headers", @@ -4784,3 +4795,51 @@ func TestStrippedAllOutputFile(t *testing.T) { return } } + +// TODO(b/316829758) Remove this test and do not set VNDK version from other tests +func TestImageVariantsWithoutVndk(t *testing.T) { + t.Parallel() + + bp := ` + cc_binary { + name: "binfoo", + srcs: ["binfoo.cc"], + vendor_available: true, + product_available: true, + shared_libs: ["libbar"] + } + cc_library { + name: "libbar", + srcs: ["libbar.cc"], + vendor_available: true, + product_available: true, + } + ` + + ctx := prepareForCcTestWithoutVndk.RunTestWithBp(t, bp) + + hasDep := func(m android.Module, wantDep android.Module) bool { + t.Helper() + var found bool + ctx.VisitDirectDeps(m, func(dep blueprint.Module) { + if dep == wantDep { + found = true + } + }) + return found + } + + testDepWithVariant := func(imageVariant string) { + imageVariantStr := "" + if imageVariant != "core" { + imageVariantStr = "_" + imageVariant + } + binFooModule := ctx.ModuleForTests("binfoo", "android"+imageVariantStr+"_arm64_armv8-a").Module() + libBarModule := ctx.ModuleForTests("libbar", "android"+imageVariantStr+"_arm64_armv8-a_shared").Module() + android.AssertBoolEquals(t, "binfoo should have dependency on libbar with image variant "+imageVariant, true, hasDep(binFooModule, libBarModule)) + } + + testDepWithVariant("core") + testDepWithVariant("vendor") + testDepWithVariant("product") +} |