Merge "Revert "Fix missing headers of vendor snapshot""

This commit is contained in:
Anton Hansson 2020-05-29 16:18:08 +00:00 committed by Gerrit Code Review
commit ae9170cdd0
2 changed files with 20 additions and 47 deletions

View File

@ -258,7 +258,9 @@ func checkVndkModule(t *testing.T, ctx *android.TestContext, name, subDir string
} }
} }
func checkSnapshot(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string) { func checkSnapshot(t *testing.T, ctx *android.TestContext, singletonName, moduleName, snapshotFilename, subDir, variant string) {
snapshotSingleton := ctx.SingletonForTests(singletonName)
mod, ok := ctx.ModuleForTests(moduleName, variant).Module().(android.OutputFileProducer) mod, ok := ctx.ModuleForTests(moduleName, variant).Module().(android.OutputFileProducer)
if !ok { if !ok {
t.Errorf("%q must have output\n", moduleName) t.Errorf("%q must have output\n", moduleName)
@ -271,7 +273,7 @@ func checkSnapshot(t *testing.T, ctx *android.TestContext, singleton android.Tes
} }
snapshotPath := filepath.Join(subDir, snapshotFilename) snapshotPath := filepath.Join(subDir, snapshotFilename)
out := singleton.Output(snapshotPath) out := snapshotSingleton.Output(snapshotPath)
if out.Input.String() != outputFiles[0].String() { if out.Input.String() != outputFiles[0].String() {
t.Errorf("The input of snapshot %q must be %q, but %q", moduleName, out.Input.String(), outputFiles[0]) t.Errorf("The input of snapshot %q must be %q, but %q", moduleName, out.Input.String(), outputFiles[0])
} }
@ -396,18 +398,16 @@ func TestVndk(t *testing.T) {
variant := "android_vendor.VER_arm64_armv8-a_shared" variant := "android_vendor.VER_arm64_armv8-a_shared"
variant2nd := "android_vendor.VER_arm_armv7-a-neon_shared" variant2nd := "android_vendor.VER_arm_armv7-a-neon_shared"
snapshotSingleton := ctx.SingletonForTests("vndk-snapshot") checkSnapshot(t, ctx, "vndk-snapshot", "libvndk", "libvndk.so", vndkCoreLibPath, variant)
checkSnapshot(t, ctx, "vndk-snapshot", "libvndk", "libvndk.so", vndkCoreLib2ndPath, variant2nd)
checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", vndkCoreLibPath, variant) checkSnapshot(t, ctx, "vndk-snapshot", "libvndk_sp", "libvndk_sp-x.so", vndkSpLibPath, variant)
checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", vndkCoreLib2ndPath, variant2nd) checkSnapshot(t, ctx, "vndk-snapshot", "libvndk_sp", "libvndk_sp-x.so", vndkSpLib2ndPath, variant2nd)
checkSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLibPath, variant)
checkSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLib2ndPath, variant2nd)
snapshotConfigsPath := filepath.Join(snapshotVariantPath, "configs") snapshotConfigsPath := filepath.Join(snapshotVariantPath, "configs")
checkSnapshot(t, ctx, snapshotSingleton, "llndk.libraries.txt", "llndk.libraries.txt", snapshotConfigsPath, "") checkSnapshot(t, ctx, "vndk-snapshot", "llndk.libraries.txt", "llndk.libraries.txt", snapshotConfigsPath, "")
checkSnapshot(t, ctx, snapshotSingleton, "vndkcore.libraries.txt", "vndkcore.libraries.txt", snapshotConfigsPath, "") checkSnapshot(t, ctx, "vndk-snapshot", "vndkcore.libraries.txt", "vndkcore.libraries.txt", snapshotConfigsPath, "")
checkSnapshot(t, ctx, snapshotSingleton, "vndksp.libraries.txt", "vndksp.libraries.txt", snapshotConfigsPath, "") checkSnapshot(t, ctx, "vndk-snapshot", "vndksp.libraries.txt", "vndksp.libraries.txt", snapshotConfigsPath, "")
checkSnapshot(t, ctx, snapshotSingleton, "vndkprivate.libraries.txt", "vndkprivate.libraries.txt", snapshotConfigsPath, "") checkSnapshot(t, ctx, "vndk-snapshot", "vndkprivate.libraries.txt", "vndkprivate.libraries.txt", snapshotConfigsPath, "")
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{ checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
"LLNDK: libc.so", "LLNDK: libc.so",
@ -849,9 +849,6 @@ func TestVendorSnapshot(t *testing.T) {
snapshotDir := "vendor-snapshot" snapshotDir := "vendor-snapshot"
snapshotVariantPath := filepath.Join(buildDir, snapshotDir, "arm64") snapshotVariantPath := filepath.Join(buildDir, snapshotDir, "arm64")
snapshotSingleton := ctx.SingletonForTests("vendor-snapshot")
var jsonFiles []string
for _, arch := range [][]string{ for _, arch := range [][]string{
[]string{"arm64", "armv8-a"}, []string{"arm64", "armv8-a"},
@ -864,42 +861,23 @@ func TestVendorSnapshot(t *testing.T) {
// For shared libraries, only non-VNDK vendor_available modules are captured // 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.VER_%s_%s_shared", archType, archVariant)
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared") sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
checkSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant) checkSnapshot(t, ctx, "vendor-snapshot", "libvendor", "libvendor.so", sharedDir, sharedVariant)
checkSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant) checkSnapshot(t, ctx, "vendor-snapshot", "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant)
jsonFiles = append(jsonFiles,
filepath.Join(sharedDir, "libvendor.so.json"),
filepath.Join(sharedDir, "libvendor_available.so.json"))
// For static libraries, all vendor:true and vendor_available modules (including VNDK) are captured. // For static libraries, all vendor:true and vendor_available modules (including VNDK) are captured.
staticVariant := fmt.Sprintf("android_vendor.VER_%s_%s_static", archType, archVariant) staticVariant := fmt.Sprintf("android_vendor.VER_%s_%s_static", archType, archVariant)
staticDir := filepath.Join(snapshotVariantPath, archDir, "static") staticDir := filepath.Join(snapshotVariantPath, archDir, "static")
checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.a", staticDir, staticVariant) checkSnapshot(t, ctx, "vendor-snapshot", "libvndk", "libvndk.a", staticDir, staticVariant)
checkSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.a", staticDir, staticVariant) checkSnapshot(t, ctx, "vendor-snapshot", "libvendor", "libvendor.a", staticDir, staticVariant)
checkSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.a", staticDir, staticVariant) checkSnapshot(t, ctx, "vendor-snapshot", "libvendor_available", "libvendor_available.a", staticDir, staticVariant)
jsonFiles = append(jsonFiles,
filepath.Join(staticDir, "libvndk.a.json"),
filepath.Join(staticDir, "libvendor.a.json"),
filepath.Join(staticDir, "libvendor_available.a.json"))
// For binary libraries, all vendor:true and vendor_available modules are captured. // For binary libraries, all vendor:true and vendor_available modules are captured.
if archType == "arm64" { if archType == "arm64" {
binaryVariant := fmt.Sprintf("android_vendor.VER_%s_%s", archType, archVariant) binaryVariant := fmt.Sprintf("android_vendor.VER_%s_%s", archType, archVariant)
binaryDir := filepath.Join(snapshotVariantPath, archDir, "binary") binaryDir := filepath.Join(snapshotVariantPath, archDir, "binary")
checkSnapshot(t, ctx, snapshotSingleton, "vendor_bin", "vendor_bin", binaryDir, binaryVariant) checkSnapshot(t, ctx, "vendor-snapshot", "vendor_bin", "vendor_bin", binaryDir, binaryVariant)
checkSnapshot(t, ctx, snapshotSingleton, "vendor_available_bin", "vendor_available_bin", binaryDir, binaryVariant) checkSnapshot(t, ctx, "vendor-snapshot", "vendor_available_bin", "vendor_available_bin", binaryDir, binaryVariant)
jsonFiles = append(jsonFiles,
filepath.Join(binaryDir, "vendor_bin.json"),
filepath.Join(binaryDir, "vendor_available_bin.json"))
} }
// For header libraries, all vendor:true and vendor_available modules are captured.
headerDir := filepath.Join(snapshotVariantPath, archDir, "header")
jsonFiles = append(jsonFiles, filepath.Join(headerDir, "libvendor_headers.json"))
}
for _, jsonFile := range jsonFiles {
// verify all json files exist
snapshotSingleton.Output(jsonFile)
} }
} }

View File

@ -443,7 +443,7 @@ func isVendorSnapshotModule(m *Module, moduleDir string) bool {
return false return false
} }
// the module must be installed in /vendor // the module must be installed in /vendor
if !m.IsForPlatform() || m.isSnapshotPrebuilt() || !m.inVendor() { if !m.installable() || m.isSnapshotPrebuilt() || !m.inVendor() {
return false return false
} }
// exclude test modules // exclude test modules
@ -457,17 +457,12 @@ func isVendorSnapshotModule(m *Module, moduleDir string) bool {
// Libraries // Libraries
if l, ok := m.linker.(snapshotLibraryInterface); ok { if l, ok := m.linker.(snapshotLibraryInterface); ok {
// header libraries are not installable, but captured.
if (l.static() || l.shared()) && !m.installable() {
return false
}
if l.static() { if l.static() {
return proptools.BoolDefault(m.VendorProperties.Vendor_available, true) return proptools.BoolDefault(m.VendorProperties.Vendor_available, true)
} }
if l.shared() { if l.shared() {
return !m.IsVndk() return !m.IsVndk()
} }
return true return true
} }