summaryrefslogtreecommitdiff
path: root/sdk/cc_sdk_test.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2019-12-13 19:50:38 +0000
committer Paul Duffin <paulduffin@google.com> 2019-12-20 15:45:17 +0000
commita0843f6a6f051617053d187fbdb217205264fb27 (patch)
tree43b71f420ed395cca227385a541d5b8f9f1e1c54 /sdk/cc_sdk_test.go
parent6c26dc73920eaeff6ad800891af046075ad46d28 (diff)
Differentiate between cc library and binary
The cc library and cc binary (and other cc module types) are all instances of cc.Module. So, to differentiate between them and make sure that only appropriate library instances can be added to native_shared/static_libs this adds a special sdkMemberTypes field to Module which if set specifies the SdkMemberTypes the module supports. If it is not set then the module type cannot be used in the sdk at all. Corrects an issue with one of the tests where a prebuilt cc library was added to the sdk instead of a source cc library. Adds a new test to ensure that cc_library_(shared|static)_host module types work with the sdk as well and another test to ensure that cc_library can be used as either. Bug: 142918168 Test: m checkbuild Change-Id: I359cdbdd15328ca571f276d2b6ce9a229ebb2c86
Diffstat (limited to 'sdk/cc_sdk_test.go')
-rw-r--r--sdk/cc_sdk_test.go64
1 files changed, 64 insertions, 0 deletions
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index 08751e444..f477445fd 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -73,6 +73,10 @@ func TestBasicSdkWithCc(t *testing.T) {
native_shared_libs: ["sdkmember"],
}
+ cc_library_shared {
+ name: "sdkmember",
+ }
+
sdk_snapshot {
name: "mysdk@1",
native_shared_libs: ["sdkmember_mysdk_1"],
@@ -143,6 +147,66 @@ func TestBasicSdkWithCc(t *testing.T) {
ensureListContains(t, pathsToStrings(cpplibForMyApex2.Rule("ld").Implicits), sdkMemberV2.String())
}
+// Make sure the sdk can use host specific cc libraries static/shared and both.
+func TestHostSdkWithCc(t *testing.T) {
+ testSdkWithCc(t, `
+ sdk {
+ name: "mysdk",
+ device_supported: false,
+ host_supported: true,
+ native_shared_libs: ["sdkshared"],
+ native_static_libs: ["sdkstatic"],
+ }
+
+ cc_library_host_shared {
+ name: "sdkshared",
+ system_shared_libs: [],
+ stl: "none",
+ }
+
+ cc_library_host_static {
+ name: "sdkstatic",
+ system_shared_libs: [],
+ stl: "none",
+ }
+ `)
+}
+
+// Make sure the sdk can use cc libraries static/shared and both.
+func TestSdkWithCc(t *testing.T) {
+ testSdkWithCc(t, `
+ sdk {
+ name: "mysdk",
+ native_shared_libs: ["sdkshared", "sdkboth1"],
+ native_static_libs: ["sdkstatic", "sdkboth2"],
+ }
+
+ 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",
+ }
+ `)
+}
+
func TestSnapshotWithCcDuplicateHeaders(t *testing.T) {
result := testSdkWithCc(t, `
sdk {