Loading apex/apex_test.go +49 −96 Original line number Original line Diff line number Diff line Loading @@ -155,6 +155,7 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr "system/sepolicy/apex/myapex2-file_contexts": nil, "system/sepolicy/apex/myapex2-file_contexts": nil, "system/sepolicy/apex/otherapex-file_contexts": nil, "system/sepolicy/apex/otherapex-file_contexts": nil, "system/sepolicy/apex/com.android.vndk-file_contexts": nil, "system/sepolicy/apex/com.android.vndk-file_contexts": nil, "system/sepolicy/apex/com.android.vndk.current-file_contexts": nil, "mylib.cpp": nil, "mylib.cpp": nil, "mytest.cpp": nil, "mytest.cpp": nil, "mytest1.cpp": nil, "mytest1.cpp": nil, Loading Loading @@ -3204,12 +3205,12 @@ func ensureExactContents(t *testing.T, ctx *android.TestContext, moduleName, var func TestVndkApexCurrent(t *testing.T) { func TestVndkApexCurrent(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3224,7 +3225,7 @@ func TestVndkApexCurrent(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } cc_library { cc_library { Loading @@ -3238,11 +3239,11 @@ func TestVndkApexCurrent(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } `+vndkLibrariesTxtFiles("current")) `+vndkLibrariesTxtFiles("current")) ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{ "lib/libvndk.so", "lib/libvndk.so", "lib/libvndksp.so", "lib/libvndksp.so", "lib/libc++.so", "lib/libc++.so", Loading @@ -3260,12 +3261,12 @@ func TestVndkApexCurrent(t *testing.T) { func TestVndkApexWithPrebuilt(t *testing.T) { func TestVndkApexWithPrebuilt(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3280,7 +3281,7 @@ func TestVndkApexWithPrebuilt(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } cc_prebuilt_library_shared { cc_prebuilt_library_shared { Loading @@ -3299,15 +3300,14 @@ func TestVndkApexWithPrebuilt(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } `+vndkLibrariesTxtFiles("current"), `+vndkLibrariesTxtFiles("current"), withFiles(map[string][]byte{ withFiles(map[string][]byte{ "libvndk.so": nil, "libvndk.so": nil, "libvndk.arm.so": nil, "libvndk.arm.so": nil, })) })) ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{ ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ "lib/libvndk.so", "lib/libvndk.so", "lib/libvndk.arm.so", "lib/libvndk.arm.so", "lib64/libvndk.so", "lib64/libvndk.so", Loading Loading @@ -3344,7 +3344,7 @@ func vndkLibrariesTxtFiles(vers ...string) (result string) { func TestVndkApexVersion(t *testing.T) { func TestVndkApexVersion(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex_v27", name: "com.android.vndk.v27", key: "myapex.key", key: "myapex.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", vndk_version: "27", vndk_version: "27", Loading Loading @@ -3373,7 +3373,7 @@ func TestVndkApexVersion(t *testing.T) { srcs: ["libvndk27_arm64.so"], srcs: ["libvndk27_arm64.so"], }, }, }, }, apex_available: [ "myapex_v27" ], apex_available: [ "com.android.vndk.v27" ], } } vndk_prebuilt_shared { vndk_prebuilt_shared { Loading Loading @@ -3402,70 +3402,22 @@ func TestVndkApexVersion(t *testing.T) { "libvndk27_x86_64.so": nil, "libvndk27_x86_64.so": nil, })) })) ensureExactContents(t, ctx, "myapex_v27", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.v27", "android_common_image", []string{ "lib/libvndk27_arm.so", "lib/libvndk27_arm.so", "lib64/libvndk27_arm64.so", "lib64/libvndk27_arm64.so", "etc/*", "etc/*", }) }) } } func TestVndkApexErrorWithDuplicateVersion(t *testing.T) { testApexError(t, `module "myapex_v27.*" .*: vndk_version: 27 is already defined in "myapex_v27.*"`, ` apex_vndk { name: "myapex_v27", key: "myapex.key", file_contexts: ":myapex-file_contexts", vndk_version: "27", } apex_vndk { name: "myapex_v27_other", key: "myapex.key", file_contexts: ":myapex-file_contexts", vndk_version: "27", } apex_key { name: "myapex.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", } vndk_prebuilt_shared { name: "libvndk", version: "27", vendor_available: true, product_available: true, vndk: { enabled: true, }, srcs: ["libvndk.so"], } `, withFiles(map[string][]byte{ "libvndk.so": nil, })) } func TestVndkApexNameRule(t *testing.T) { func TestVndkApexNameRule(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "myapex.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", } } apex_vndk { apex_vndk { name: "myapex_v28", name: "com.android.vndk.v28", key: "myapex.key", key: "myapex.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", vndk_version: "28", vndk_version: "28", Loading @@ -3484,20 +3436,20 @@ func TestVndkApexNameRule(t *testing.T) { } } } } assertApexName("com.android.vndk.vVER", "myapex") assertApexName("com.android.vndk.vVER", "com.android.vndk.current") assertApexName("com.android.vndk.v28", "myapex_v28") assertApexName("com.android.vndk.v28", "com.android.vndk.v28") } } func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3514,11 +3466,12 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } `+vndkLibrariesTxtFiles("current"), withNativeBridgeEnabled) `+vndkLibrariesTxtFiles("current"), withNativeBridgeEnabled) ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{ "lib/libvndk.so", "lib/libvndk.so", "lib64/libvndk.so", "lib64/libvndk.so", "lib/libc++.so", "lib/libc++.so", Loading @@ -3528,16 +3481,16 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { } } func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) { func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) { testApexError(t, `module "myapex" .*: 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 { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", native_bridge_supported: true, native_bridge_supported: true, } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3561,7 +3514,7 @@ func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) { func TestVndkApexWithBinder32(t *testing.T) { func TestVndkApexWithBinder32(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex_v27", name: "com.android.vndk.v27", key: "myapex.key", key: "myapex.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", vndk_version: "27", vndk_version: "27", Loading Loading @@ -3604,7 +3557,7 @@ func TestVndkApexWithBinder32(t *testing.T) { srcs: ["libvndk27binder32.so"], srcs: ["libvndk27binder32.so"], } } }, }, apex_available: [ "myapex_v27" ], apex_available: [ "com.android.vndk.v27" ], } } `+vndkLibrariesTxtFiles("27"), `+vndkLibrariesTxtFiles("27"), withFiles(map[string][]byte{ withFiles(map[string][]byte{ Loading @@ -3620,7 +3573,7 @@ func TestVndkApexWithBinder32(t *testing.T) { }), }), ) ) ensureExactContents(t, ctx, "myapex_v27", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.v27", "android_common_image", []string{ "lib/libvndk27binder32.so", "lib/libvndk27binder32.so", "etc/*", "etc/*", }) }) Loading @@ -3629,13 +3582,13 @@ func TestVndkApexWithBinder32(t *testing.T) { func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) { func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3656,7 +3609,7 @@ func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) { "libz.map.txt": nil, "libz.map.txt": nil, })) })) apexManifestRule := ctx.ModuleForTests("myapex", "android_common_image").Rule("apexManifestRule") apexManifestRule := ctx.ModuleForTests("com.android.vndk.current", "android_common_image").Rule("apexManifestRule") provideNativeLibs := names(apexManifestRule.Args["provideNativeLibs"]) provideNativeLibs := names(apexManifestRule.Args["provideNativeLibs"]) ensureListEmpty(t, provideNativeLibs) ensureListEmpty(t, provideNativeLibs) } } Loading apex/vndk.go +10 −24 Original line number Original line Diff line number Diff line Loading @@ -17,7 +17,6 @@ package apex import ( import ( "path/filepath" "path/filepath" "strings" "strings" "sync" "android/soong/android" "android/soong/android" "android/soong/cc" "android/soong/cc" Loading Loading @@ -60,17 +59,6 @@ type apexVndkProperties struct { Vndk_version *string Vndk_version *string } } var ( vndkApexListKey = android.NewOnceKey("vndkApexList") vndkApexListMutex sync.Mutex ) func vndkApexList(config android.Config) map[string]string { return config.Once(vndkApexListKey, func() interface{} { return map[string]string{} }).(map[string]string) } func apexVndkMutator(mctx android.TopDownMutatorContext) { func apexVndkMutator(mctx android.TopDownMutatorContext) { if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex { if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex { if ab.IsNativeBridgeSupported() { if ab.IsNativeBridgeSupported() { Loading @@ -80,15 +68,6 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) { vndkVersion := ab.vndkVersion(mctx.DeviceConfig()) vndkVersion := ab.vndkVersion(mctx.DeviceConfig()) // Ensure VNDK APEX mount point is formatted as com.android.vndk.v### // Ensure VNDK APEX mount point is formatted as com.android.vndk.v### ab.properties.Apex_name = proptools.StringPtr(vndkApexNamePrefix + vndkVersion) ab.properties.Apex_name = proptools.StringPtr(vndkApexNamePrefix + vndkVersion) // vndk_version should be unique vndkApexListMutex.Lock() defer vndkApexListMutex.Unlock() vndkApexList := vndkApexList(mctx.Config()) if other, ok := vndkApexList[vndkVersion]; ok { mctx.PropertyErrorf("vndk_version", "%v is already defined in %q", vndkVersion, other) } vndkApexList[vndkVersion] = mctx.ModuleName() } } } } Loading @@ -99,9 +78,16 @@ func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) { if vndkVersion == "" { if vndkVersion == "" { vndkVersion = mctx.DeviceConfig().PlatformVndkVersion() vndkVersion = mctx.DeviceConfig().PlatformVndkVersion() } } vndkApexList := vndkApexList(mctx.Config()) if vndkVersion == mctx.DeviceConfig().PlatformVndkVersion() { if vndkApex, ok := vndkApexList[vndkVersion]; ok { vndkVersion = "current" mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApex) } else { vndkVersion = "v" + vndkVersion } vndkApexName := "com.android.vndk." + vndkVersion if mctx.OtherModuleExists(vndkApexName) { mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApexName) } } } else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex { } else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex { vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current") vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current") Loading apex/vndk_test.go +12 −12 Original line number Original line Diff line number Diff line Loading @@ -11,12 +11,12 @@ import ( func TestVndkApexForVndkLite(t *testing.T) { func TestVndkApexForVndkLite(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -31,7 +31,7 @@ func TestVndkApexForVndkLite(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } cc_library { cc_library { Loading @@ -45,13 +45,13 @@ func TestVndkApexForVndkLite(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } `+vndkLibrariesTxtFiles("current"), func(fs map[string][]byte, config android.Config) { `+vndkLibrariesTxtFiles("current"), func(fs map[string][]byte, config android.Config) { config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("") config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("") }) }) // VNDK-Lite contains only core variants of VNDK-Sp libraries // VNDK-Lite contains only core variants of VNDK-Sp libraries ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{ "lib/libvndksp.so", "lib/libvndksp.so", "lib/libc++.so", "lib/libc++.so", "lib64/libvndksp.so", "lib64/libvndksp.so", Loading @@ -67,7 +67,7 @@ func TestVndkApexForVndkLite(t *testing.T) { func TestVndkApexUsesVendorVariant(t *testing.T) { func TestVndkApexUsesVendorVariant(t *testing.T) { bp := ` bp := ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "mykey", key: "mykey", } } apex_key { apex_key { Loading @@ -94,7 +94,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { return return } } } } t.Fail() t.Errorf("expected path %q not found", path) } } t.Run("VNDK lib doesn't have an apex variant", func(t *testing.T) { t.Run("VNDK lib doesn't have an apex variant", func(t *testing.T) { Loading @@ -106,7 +106,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { } } // VNDK APEX doesn't create apex variant // VNDK APEX doesn't create apex variant files := getFiles(t, ctx, "myapex", "android_common_image") 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.VER_arm_armv7-a-neon_shared/libfoo.so") }) }) Loading @@ -116,7 +116,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { config.TestProductVariables.ProductVndkVersion = proptools.StringPtr("current") config.TestProductVariables.ProductVndkVersion = proptools.StringPtr("current") }) }) files := getFiles(t, ctx, "myapex", "android_common_image") 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.VER_arm_armv7-a-neon_shared/libfoo.so") }) }) Loading @@ -126,10 +126,10 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { config.TestProductVariables.Native_coverage = proptools.BoolPtr(true) config.TestProductVariables.Native_coverage = proptools.BoolPtr(true) }) }) files := getFiles(t, ctx, "myapex", "android_common_image") 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.VER_arm_armv7-a-neon_shared/libfoo.so") files = getFiles(t, ctx, "myapex", "android_common_cov_image") 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.VER_arm_armv7-a-neon_shared_cov/libfoo.so") }) }) } } ui/build/paths/logs_test.go +3 −0 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,9 @@ import ( ) ) func TestSendLog(t *testing.T) { func TestSendLog(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode, sometimes hangs") } t.Run("Short name", func(t *testing.T) { t.Run("Short name", func(t *testing.T) { d, err := ioutil.TempDir("", "s") d, err := ioutil.TempDir("", "s") if err != nil { if err != nil { Loading Loading
apex/apex_test.go +49 −96 Original line number Original line Diff line number Diff line Loading @@ -155,6 +155,7 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr "system/sepolicy/apex/myapex2-file_contexts": nil, "system/sepolicy/apex/myapex2-file_contexts": nil, "system/sepolicy/apex/otherapex-file_contexts": nil, "system/sepolicy/apex/otherapex-file_contexts": nil, "system/sepolicy/apex/com.android.vndk-file_contexts": nil, "system/sepolicy/apex/com.android.vndk-file_contexts": nil, "system/sepolicy/apex/com.android.vndk.current-file_contexts": nil, "mylib.cpp": nil, "mylib.cpp": nil, "mytest.cpp": nil, "mytest.cpp": nil, "mytest1.cpp": nil, "mytest1.cpp": nil, Loading Loading @@ -3204,12 +3205,12 @@ func ensureExactContents(t *testing.T, ctx *android.TestContext, moduleName, var func TestVndkApexCurrent(t *testing.T) { func TestVndkApexCurrent(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3224,7 +3225,7 @@ func TestVndkApexCurrent(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } cc_library { cc_library { Loading @@ -3238,11 +3239,11 @@ func TestVndkApexCurrent(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } `+vndkLibrariesTxtFiles("current")) `+vndkLibrariesTxtFiles("current")) ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{ "lib/libvndk.so", "lib/libvndk.so", "lib/libvndksp.so", "lib/libvndksp.so", "lib/libc++.so", "lib/libc++.so", Loading @@ -3260,12 +3261,12 @@ func TestVndkApexCurrent(t *testing.T) { func TestVndkApexWithPrebuilt(t *testing.T) { func TestVndkApexWithPrebuilt(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3280,7 +3281,7 @@ func TestVndkApexWithPrebuilt(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } cc_prebuilt_library_shared { cc_prebuilt_library_shared { Loading @@ -3299,15 +3300,14 @@ func TestVndkApexWithPrebuilt(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } `+vndkLibrariesTxtFiles("current"), `+vndkLibrariesTxtFiles("current"), withFiles(map[string][]byte{ withFiles(map[string][]byte{ "libvndk.so": nil, "libvndk.so": nil, "libvndk.arm.so": nil, "libvndk.arm.so": nil, })) })) ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{ ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ "lib/libvndk.so", "lib/libvndk.so", "lib/libvndk.arm.so", "lib/libvndk.arm.so", "lib64/libvndk.so", "lib64/libvndk.so", Loading Loading @@ -3344,7 +3344,7 @@ func vndkLibrariesTxtFiles(vers ...string) (result string) { func TestVndkApexVersion(t *testing.T) { func TestVndkApexVersion(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex_v27", name: "com.android.vndk.v27", key: "myapex.key", key: "myapex.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", vndk_version: "27", vndk_version: "27", Loading Loading @@ -3373,7 +3373,7 @@ func TestVndkApexVersion(t *testing.T) { srcs: ["libvndk27_arm64.so"], srcs: ["libvndk27_arm64.so"], }, }, }, }, apex_available: [ "myapex_v27" ], apex_available: [ "com.android.vndk.v27" ], } } vndk_prebuilt_shared { vndk_prebuilt_shared { Loading Loading @@ -3402,70 +3402,22 @@ func TestVndkApexVersion(t *testing.T) { "libvndk27_x86_64.so": nil, "libvndk27_x86_64.so": nil, })) })) ensureExactContents(t, ctx, "myapex_v27", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.v27", "android_common_image", []string{ "lib/libvndk27_arm.so", "lib/libvndk27_arm.so", "lib64/libvndk27_arm64.so", "lib64/libvndk27_arm64.so", "etc/*", "etc/*", }) }) } } func TestVndkApexErrorWithDuplicateVersion(t *testing.T) { testApexError(t, `module "myapex_v27.*" .*: vndk_version: 27 is already defined in "myapex_v27.*"`, ` apex_vndk { name: "myapex_v27", key: "myapex.key", file_contexts: ":myapex-file_contexts", vndk_version: "27", } apex_vndk { name: "myapex_v27_other", key: "myapex.key", file_contexts: ":myapex-file_contexts", vndk_version: "27", } apex_key { name: "myapex.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", } vndk_prebuilt_shared { name: "libvndk", version: "27", vendor_available: true, product_available: true, vndk: { enabled: true, }, srcs: ["libvndk.so"], } `, withFiles(map[string][]byte{ "libvndk.so": nil, })) } func TestVndkApexNameRule(t *testing.T) { func TestVndkApexNameRule(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "myapex.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", } } apex_vndk { apex_vndk { name: "myapex_v28", name: "com.android.vndk.v28", key: "myapex.key", key: "myapex.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", vndk_version: "28", vndk_version: "28", Loading @@ -3484,20 +3436,20 @@ func TestVndkApexNameRule(t *testing.T) { } } } } assertApexName("com.android.vndk.vVER", "myapex") assertApexName("com.android.vndk.vVER", "com.android.vndk.current") assertApexName("com.android.vndk.v28", "myapex_v28") assertApexName("com.android.vndk.v28", "com.android.vndk.v28") } } func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3514,11 +3466,12 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } `+vndkLibrariesTxtFiles("current"), withNativeBridgeEnabled) `+vndkLibrariesTxtFiles("current"), withNativeBridgeEnabled) ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{ "lib/libvndk.so", "lib/libvndk.so", "lib64/libvndk.so", "lib64/libvndk.so", "lib/libc++.so", "lib/libc++.so", Loading @@ -3528,16 +3481,16 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) { } } func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) { func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) { testApexError(t, `module "myapex" .*: 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 { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", native_bridge_supported: true, native_bridge_supported: true, } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3561,7 +3514,7 @@ func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) { func TestVndkApexWithBinder32(t *testing.T) { func TestVndkApexWithBinder32(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex_v27", name: "com.android.vndk.v27", key: "myapex.key", key: "myapex.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", vndk_version: "27", vndk_version: "27", Loading Loading @@ -3604,7 +3557,7 @@ func TestVndkApexWithBinder32(t *testing.T) { srcs: ["libvndk27binder32.so"], srcs: ["libvndk27binder32.so"], } } }, }, apex_available: [ "myapex_v27" ], apex_available: [ "com.android.vndk.v27" ], } } `+vndkLibrariesTxtFiles("27"), `+vndkLibrariesTxtFiles("27"), withFiles(map[string][]byte{ withFiles(map[string][]byte{ Loading @@ -3620,7 +3573,7 @@ func TestVndkApexWithBinder32(t *testing.T) { }), }), ) ) ensureExactContents(t, ctx, "myapex_v27", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.v27", "android_common_image", []string{ "lib/libvndk27binder32.so", "lib/libvndk27binder32.so", "etc/*", "etc/*", }) }) Loading @@ -3629,13 +3582,13 @@ func TestVndkApexWithBinder32(t *testing.T) { func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) { func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", file_contexts: ":myapex-file_contexts", file_contexts: ":myapex-file_contexts", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -3656,7 +3609,7 @@ func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) { "libz.map.txt": nil, "libz.map.txt": nil, })) })) apexManifestRule := ctx.ModuleForTests("myapex", "android_common_image").Rule("apexManifestRule") apexManifestRule := ctx.ModuleForTests("com.android.vndk.current", "android_common_image").Rule("apexManifestRule") provideNativeLibs := names(apexManifestRule.Args["provideNativeLibs"]) provideNativeLibs := names(apexManifestRule.Args["provideNativeLibs"]) ensureListEmpty(t, provideNativeLibs) ensureListEmpty(t, provideNativeLibs) } } Loading
apex/vndk.go +10 −24 Original line number Original line Diff line number Diff line Loading @@ -17,7 +17,6 @@ package apex import ( import ( "path/filepath" "path/filepath" "strings" "strings" "sync" "android/soong/android" "android/soong/android" "android/soong/cc" "android/soong/cc" Loading Loading @@ -60,17 +59,6 @@ type apexVndkProperties struct { Vndk_version *string Vndk_version *string } } var ( vndkApexListKey = android.NewOnceKey("vndkApexList") vndkApexListMutex sync.Mutex ) func vndkApexList(config android.Config) map[string]string { return config.Once(vndkApexListKey, func() interface{} { return map[string]string{} }).(map[string]string) } func apexVndkMutator(mctx android.TopDownMutatorContext) { func apexVndkMutator(mctx android.TopDownMutatorContext) { if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex { if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex { if ab.IsNativeBridgeSupported() { if ab.IsNativeBridgeSupported() { Loading @@ -80,15 +68,6 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) { vndkVersion := ab.vndkVersion(mctx.DeviceConfig()) vndkVersion := ab.vndkVersion(mctx.DeviceConfig()) // Ensure VNDK APEX mount point is formatted as com.android.vndk.v### // Ensure VNDK APEX mount point is formatted as com.android.vndk.v### ab.properties.Apex_name = proptools.StringPtr(vndkApexNamePrefix + vndkVersion) ab.properties.Apex_name = proptools.StringPtr(vndkApexNamePrefix + vndkVersion) // vndk_version should be unique vndkApexListMutex.Lock() defer vndkApexListMutex.Unlock() vndkApexList := vndkApexList(mctx.Config()) if other, ok := vndkApexList[vndkVersion]; ok { mctx.PropertyErrorf("vndk_version", "%v is already defined in %q", vndkVersion, other) } vndkApexList[vndkVersion] = mctx.ModuleName() } } } } Loading @@ -99,9 +78,16 @@ func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) { if vndkVersion == "" { if vndkVersion == "" { vndkVersion = mctx.DeviceConfig().PlatformVndkVersion() vndkVersion = mctx.DeviceConfig().PlatformVndkVersion() } } vndkApexList := vndkApexList(mctx.Config()) if vndkVersion == mctx.DeviceConfig().PlatformVndkVersion() { if vndkApex, ok := vndkApexList[vndkVersion]; ok { vndkVersion = "current" mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApex) } else { vndkVersion = "v" + vndkVersion } vndkApexName := "com.android.vndk." + vndkVersion if mctx.OtherModuleExists(vndkApexName) { mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApexName) } } } else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex { } else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex { vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current") vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current") Loading
apex/vndk_test.go +12 −12 Original line number Original line Diff line number Diff line Loading @@ -11,12 +11,12 @@ import ( func TestVndkApexForVndkLite(t *testing.T) { func TestVndkApexForVndkLite(t *testing.T) { ctx, _ := testApex(t, ` ctx, _ := testApex(t, ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "myapex.key", key: "com.android.vndk.current.key", } } apex_key { apex_key { name: "myapex.key", name: "com.android.vndk.current.key", public_key: "testkey.avbpubkey", public_key: "testkey.avbpubkey", private_key: "testkey.pem", private_key: "testkey.pem", } } Loading @@ -31,7 +31,7 @@ func TestVndkApexForVndkLite(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } cc_library { cc_library { Loading @@ -45,13 +45,13 @@ func TestVndkApexForVndkLite(t *testing.T) { }, }, system_shared_libs: [], system_shared_libs: [], stl: "none", stl: "none", apex_available: [ "myapex" ], apex_available: [ "com.android.vndk.current" ], } } `+vndkLibrariesTxtFiles("current"), func(fs map[string][]byte, config android.Config) { `+vndkLibrariesTxtFiles("current"), func(fs map[string][]byte, config android.Config) { config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("") config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("") }) }) // VNDK-Lite contains only core variants of VNDK-Sp libraries // VNDK-Lite contains only core variants of VNDK-Sp libraries ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{ "lib/libvndksp.so", "lib/libvndksp.so", "lib/libc++.so", "lib/libc++.so", "lib64/libvndksp.so", "lib64/libvndksp.so", Loading @@ -67,7 +67,7 @@ func TestVndkApexForVndkLite(t *testing.T) { func TestVndkApexUsesVendorVariant(t *testing.T) { func TestVndkApexUsesVendorVariant(t *testing.T) { bp := ` bp := ` apex_vndk { apex_vndk { name: "myapex", name: "com.android.vndk.current", key: "mykey", key: "mykey", } } apex_key { apex_key { Loading @@ -94,7 +94,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { return return } } } } t.Fail() t.Errorf("expected path %q not found", path) } } t.Run("VNDK lib doesn't have an apex variant", func(t *testing.T) { t.Run("VNDK lib doesn't have an apex variant", func(t *testing.T) { Loading @@ -106,7 +106,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { } } // VNDK APEX doesn't create apex variant // VNDK APEX doesn't create apex variant files := getFiles(t, ctx, "myapex", "android_common_image") 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.VER_arm_armv7-a-neon_shared/libfoo.so") }) }) Loading @@ -116,7 +116,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { config.TestProductVariables.ProductVndkVersion = proptools.StringPtr("current") config.TestProductVariables.ProductVndkVersion = proptools.StringPtr("current") }) }) files := getFiles(t, ctx, "myapex", "android_common_image") 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.VER_arm_armv7-a-neon_shared/libfoo.so") }) }) Loading @@ -126,10 +126,10 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { config.TestProductVariables.Native_coverage = proptools.BoolPtr(true) config.TestProductVariables.Native_coverage = proptools.BoolPtr(true) }) }) files := getFiles(t, ctx, "myapex", "android_common_image") 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.VER_arm_armv7-a-neon_shared/libfoo.so") files = getFiles(t, ctx, "myapex", "android_common_cov_image") 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.VER_arm_armv7-a-neon_shared_cov/libfoo.so") }) }) } }
ui/build/paths/logs_test.go +3 −0 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,9 @@ import ( ) ) func TestSendLog(t *testing.T) { func TestSendLog(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode, sometimes hangs") } t.Run("Short name", func(t *testing.T) { t.Run("Short name", func(t *testing.T) { d, err := ioutil.TempDir("", "s") d, err := ioutil.TempDir("", "s") if err != nil { if err != nil { Loading