Propagate empty vs unspecified system_shared_libs correctly.

Necessary to get correct prebuilts for many Bionic libs.

Cleaned up numerious "system_shared_libs: []" from test fixtures, since
they otherwise would need correction in the expected results, and it is
better to have a single test focused on testing system_shared_libs
propagation.

Test: m nothing
Bug: 152255951
Change-Id: If2e8a5296223e6281d833312660e8e9e4cd184c0
This commit is contained in:
Martin Stjernholm
2020-03-24 01:19:52 +00:00
parent b358ebb759
commit 10566a035f
6 changed files with 235 additions and 31 deletions

View File

@@ -48,7 +48,6 @@ func TestSdkIsCompileMultilibBoth(t *testing.T) {
cc_library_shared {
name: "sdkmember",
srcs: ["Test.cpp"],
system_shared_libs: [],
stl: "none",
}
`)
@@ -178,13 +177,11 @@ func TestHostSdkWithCc(t *testing.T) {
cc_library_host_shared {
name: "sdkshared",
system_shared_libs: [],
stl: "none",
}
cc_library_host_static {
name: "sdkstatic",
system_shared_libs: [],
stl: "none",
}
`)
@@ -201,25 +198,21 @@ func TestSdkWithCc(t *testing.T) {
cc_library_shared {
name: "sdkshared",
system_shared_libs: [],
stl: "none",
}
cc_library_static {
name: "sdkstatic",
system_shared_libs: [],
stl: "none",
}
cc_library {
name: "sdkboth1",
system_shared_libs: [],
stl: "none",
}
cc_library {
name: "sdkboth2",
system_shared_libs: [],
stl: "none",
}
`)
@@ -295,7 +288,6 @@ func TestSnapshotWithCcDuplicateHeaders(t *testing.T) {
"Test.cpp",
],
export_include_dirs: ["include"],
system_shared_libs: [],
stl: "none",
}
@@ -305,7 +297,6 @@ func TestSnapshotWithCcDuplicateHeaders(t *testing.T) {
"Test.cpp",
],
export_include_dirs: ["include"],
system_shared_libs: [],
stl: "none",
}
`)
@@ -342,7 +333,6 @@ func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) {
export_system_include_dirs: ["arm64/include"],
},
},
system_shared_libs: [],
stl: "none",
}
`)
@@ -410,7 +400,6 @@ func TestSnapshotWithCcBinary(t *testing.T) {
"Test.cpp",
],
compile_multilib: "both",
system_shared_libs: [],
stl: "none",
}
`)
@@ -485,7 +474,6 @@ func TestMultipleHostOsTypesSnapshotWithCcBinary(t *testing.T) {
"Test.cpp",
],
compile_multilib: "both",
system_shared_libs: [],
stl: "none",
target: {
windows: {
@@ -586,7 +574,6 @@ func TestSnapshotWithCcSharedLibrary(t *testing.T) {
aidl: {
export_aidl_headers: true,
},
system_shared_libs: [],
stl: "none",
}
`)
@@ -673,7 +660,6 @@ func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) {
srcs: [
"Test.cpp",
],
system_shared_libs: [],
stl: "none",
}
@@ -714,7 +700,6 @@ func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) {
},
},
},
system_shared_libs: [],
stl: "none",
}
`)
@@ -864,7 +849,6 @@ func TestHostSnapshotWithCcSharedLibrary(t *testing.T) {
aidl: {
export_aidl_headers: true,
},
system_shared_libs: [],
stl: "none",
sdk_version: "minimum",
}
@@ -960,7 +944,6 @@ func TestMultipleHostOsTypesSnapshotWithCcSharedLibrary(t *testing.T) {
srcs: [
"Test.cpp",
],
system_shared_libs: [],
stl: "none",
target: {
windows: {
@@ -1050,7 +1033,6 @@ func TestSnapshotWithCcStaticLibrary(t *testing.T) {
aidl: {
export_aidl_headers: true,
},
system_shared_libs: [],
stl: "none",
}
`)
@@ -1137,7 +1119,6 @@ func TestHostSnapshotWithCcStaticLibrary(t *testing.T) {
aidl: {
export_aidl_headers: true,
},
system_shared_libs: [],
stl: "none",
}
`)
@@ -1219,7 +1200,6 @@ func TestSnapshotWithCcLibrary(t *testing.T) {
"Test.cpp",
],
export_include_dirs: ["include"],
system_shared_libs: [],
stl: "none",
}
`)
@@ -1322,7 +1302,6 @@ func TestHostSnapshotWithMultiLib64(t *testing.T) {
aidl: {
export_aidl_headers: true,
},
system_shared_libs: [],
stl: "none",
}
`)
@@ -1393,7 +1372,6 @@ func TestSnapshotWithCcHeadersLibrary(t *testing.T) {
cc_library_headers {
name: "mynativeheaders",
export_include_dirs: ["include"],
system_shared_libs: [],
stl: "none",
}
`)
@@ -1444,7 +1422,6 @@ func TestHostSnapshotWithCcHeadersLibrary(t *testing.T) {
device_supported: false,
host_supported: true,
export_include_dirs: ["include"],
system_shared_libs: [],
stl: "none",
}
`)
@@ -1498,7 +1475,6 @@ func TestDeviceAndHostSnapshotWithCcHeadersLibrary(t *testing.T) {
cc_library_headers {
name: "mynativeheaders",
host_supported: true,
system_shared_libs: [],
stl: "none",
export_system_include_dirs: ["include"],
target: {
@@ -1561,3 +1537,202 @@ include-host/HostTest.h -> include/include-host/HostTest.h
`),
)
}
func TestSystemSharedLibPropagation(t *testing.T) {
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
native_shared_libs: ["sslnil", "sslempty", "sslnonempty"],
}
cc_library {
name: "sslnil",
host_supported: true,
}
cc_library {
name: "sslempty",
system_shared_libs: [],
}
cc_library {
name: "sslnonempty",
system_shared_libs: ["sslnil"],
}
`)
result.CheckSnapshot("mysdk", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
name: "mysdk_sslnil@current",
sdk_member_name: "sslnil",
installable: false,
arch: {
arm64: {
srcs: ["arm64/lib/sslnil.so"],
},
arm: {
srcs: ["arm/lib/sslnil.so"],
},
},
}
cc_prebuilt_library_shared {
name: "sslnil",
prefer: false,
arch: {
arm64: {
srcs: ["arm64/lib/sslnil.so"],
},
arm: {
srcs: ["arm/lib/sslnil.so"],
},
},
}
cc_prebuilt_library_shared {
name: "mysdk_sslempty@current",
sdk_member_name: "sslempty",
installable: false,
system_shared_libs: [],
arch: {
arm64: {
srcs: ["arm64/lib/sslempty.so"],
},
arm: {
srcs: ["arm/lib/sslempty.so"],
},
},
}
cc_prebuilt_library_shared {
name: "sslempty",
prefer: false,
system_shared_libs: [],
arch: {
arm64: {
srcs: ["arm64/lib/sslempty.so"],
},
arm: {
srcs: ["arm/lib/sslempty.so"],
},
},
}
cc_prebuilt_library_shared {
name: "mysdk_sslnonempty@current",
sdk_member_name: "sslnonempty",
installable: false,
system_shared_libs: ["mysdk_sslnil@current"],
arch: {
arm64: {
srcs: ["arm64/lib/sslnonempty.so"],
},
arm: {
srcs: ["arm/lib/sslnonempty.so"],
},
},
}
cc_prebuilt_library_shared {
name: "sslnonempty",
prefer: false,
system_shared_libs: ["sslnil"],
arch: {
arm64: {
srcs: ["arm64/lib/sslnonempty.so"],
},
arm: {
srcs: ["arm/lib/sslnonempty.so"],
},
},
}
sdk_snapshot {
name: "mysdk@current",
native_shared_libs: [
"mysdk_sslnil@current",
"mysdk_sslempty@current",
"mysdk_sslnonempty@current",
],
}
`))
result = testSdkWithCc(t, `
sdk {
name: "mysdk",
host_supported: true,
native_shared_libs: ["sslvariants"],
}
cc_library {
name: "sslvariants",
host_supported: true,
target: {
android: {
system_shared_libs: [],
},
},
}
`)
result.CheckSnapshot("mysdk", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
name: "mysdk_sslvariants@current",
sdk_member_name: "sslvariants",
host_supported: true,
installable: false,
target: {
android: {
system_shared_libs: [],
},
android_arm64: {
srcs: ["android/arm64/lib/sslvariants.so"],
},
android_arm: {
srcs: ["android/arm/lib/sslvariants.so"],
},
linux_glibc_x86_64: {
srcs: ["linux_glibc/x86_64/lib/sslvariants.so"],
},
linux_glibc_x86: {
srcs: ["linux_glibc/x86/lib/sslvariants.so"],
},
},
}
cc_prebuilt_library_shared {
name: "sslvariants",
prefer: false,
host_supported: true,
target: {
android: {
system_shared_libs: [],
},
android_arm64: {
srcs: ["android/arm64/lib/sslvariants.so"],
},
android_arm: {
srcs: ["android/arm/lib/sslvariants.so"],
},
linux_glibc_x86_64: {
srcs: ["linux_glibc/x86_64/lib/sslvariants.so"],
},
linux_glibc_x86: {
srcs: ["linux_glibc/x86/lib/sslvariants.so"],
},
},
}
sdk_snapshot {
name: "mysdk@current",
host_supported: true,
native_shared_libs: ["mysdk_sslvariants@current"],
}
`))
}