Separate out module type specific test config
Bug: 143678475 Test: m conscrypt-module-sdk Change-Id: I71433a7c89dfae4c27537f1f66bd677cf9fba0b3
This commit is contained in:
@@ -20,10 +20,22 @@ import (
|
|||||||
"android/soong/cc"
|
"android/soong/cc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func testSdkWithCc(t *testing.T, bp string) *testSdkResult {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
fs := map[string][]byte{
|
||||||
|
"Test.cpp": nil,
|
||||||
|
"include/Test.h": nil,
|
||||||
|
"libfoo.so": nil,
|
||||||
|
"aidl/foo/bar/Test.aidl": nil,
|
||||||
|
}
|
||||||
|
return testSdkWithFs(t, bp, fs)
|
||||||
|
}
|
||||||
|
|
||||||
// Contains tests for SDK members provided by the cc package.
|
// Contains tests for SDK members provided by the cc package.
|
||||||
|
|
||||||
func TestSdkIsCompileMultilibBoth(t *testing.T) {
|
func TestSdkIsCompileMultilibBoth(t *testing.T) {
|
||||||
result := testSdk(t, `
|
result := testSdkWithCc(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
native_shared_libs: ["sdkmember"],
|
native_shared_libs: ["sdkmember"],
|
||||||
@@ -54,7 +66,7 @@ func TestSdkIsCompileMultilibBoth(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBasicSdkWithCc(t *testing.T) {
|
func TestBasicSdkWithCc(t *testing.T) {
|
||||||
result := testSdk(t, `
|
result := testSdkWithCc(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
native_shared_libs: ["sdkmember"],
|
native_shared_libs: ["sdkmember"],
|
||||||
@@ -131,7 +143,7 @@ func TestBasicSdkWithCc(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSnapshotWithCcShared(t *testing.T) {
|
func TestSnapshotWithCcShared(t *testing.T) {
|
||||||
result := testSdk(t, `
|
result := testSdkWithCc(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
native_shared_libs: ["mynativelib"],
|
native_shared_libs: ["mynativelib"],
|
||||||
@@ -226,7 +238,7 @@ func TestHostSnapshotWithCcShared(t *testing.T) {
|
|||||||
// b/145598135 - Generating host snapshots for anything other than linux is not supported.
|
// b/145598135 - Generating host snapshots for anything other than linux is not supported.
|
||||||
SkipIfNotLinux(t)
|
SkipIfNotLinux(t)
|
||||||
|
|
||||||
result := testSdk(t, `
|
result := testSdkWithCc(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
device_supported: false,
|
device_supported: false,
|
||||||
|
@@ -18,10 +18,20 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func testSdkWithJava(t *testing.T, bp string) *testSdkResult {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
fs := map[string][]byte{
|
||||||
|
"Test.java": nil,
|
||||||
|
"aidl/foo/bar/Test.aidl": nil,
|
||||||
|
}
|
||||||
|
return testSdkWithFs(t, bp, fs)
|
||||||
|
}
|
||||||
|
|
||||||
// Contains tests for SDK members provided by the java package.
|
// Contains tests for SDK members provided by the java package.
|
||||||
|
|
||||||
func TestBasicSdkWithJavaLibrary(t *testing.T) {
|
func TestBasicSdkWithJavaLibrary(t *testing.T) {
|
||||||
result := testSdk(t, `
|
result := testSdkWithJava(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
java_libs: ["myjavalib"],
|
java_libs: ["myjavalib"],
|
||||||
@@ -94,7 +104,7 @@ func TestBasicSdkWithJavaLibrary(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSnapshotWithJavaLibrary(t *testing.T) {
|
func TestSnapshotWithJavaLibrary(t *testing.T) {
|
||||||
result := testSdk(t, `
|
result := testSdkWithJava(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
java_libs: ["myjavalib"],
|
java_libs: ["myjavalib"],
|
||||||
@@ -146,7 +156,7 @@ func TestHostSnapshotWithJavaLibrary(t *testing.T) {
|
|||||||
// b/145598135 - Generating host snapshots for anything other than linux is not supported.
|
// b/145598135 - Generating host snapshots for anything other than linux is not supported.
|
||||||
SkipIfNotLinux(t)
|
SkipIfNotLinux(t)
|
||||||
|
|
||||||
result := testSdk(t, `
|
result := testSdkWithJava(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
device_supported: false,
|
device_supported: false,
|
||||||
@@ -202,11 +212,21 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testSdkWithDroidstubs(t *testing.T, bp string) *testSdkResult {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
fs := map[string][]byte{
|
||||||
|
"foo/bar/Foo.java": nil,
|
||||||
|
"stubs-sources/foo/bar/Foo.java": nil,
|
||||||
|
}
|
||||||
|
return testSdkWithFs(t, bp, fs)
|
||||||
|
}
|
||||||
|
|
||||||
// Note: This test does not verify that a droidstubs can be referenced, either
|
// Note: This test does not verify that a droidstubs can be referenced, either
|
||||||
// directly or indirectly from an APEX as droidstubs can never be a part of an
|
// directly or indirectly from an APEX as droidstubs can never be a part of an
|
||||||
// apex.
|
// apex.
|
||||||
func TestBasicSdkWithDroidstubs(t *testing.T) {
|
func TestBasicSdkWithDroidstubs(t *testing.T) {
|
||||||
testSdk(t, `
|
testSdkWithDroidstubs(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
stubs_sources: ["mystub"],
|
stubs_sources: ["mystub"],
|
||||||
@@ -236,7 +256,7 @@ func TestBasicSdkWithDroidstubs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSnapshotWithDroidstubs(t *testing.T) {
|
func TestSnapshotWithDroidstubs(t *testing.T) {
|
||||||
result := testSdk(t, `
|
result := testSdkWithDroidstubs(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
stubs_sources: ["myjavaapistubs"],
|
stubs_sources: ["myjavaapistubs"],
|
||||||
@@ -281,7 +301,7 @@ func TestHostSnapshotWithDroidstubs(t *testing.T) {
|
|||||||
// b/145598135 - Generating host snapshots for anything other than linux is not supported.
|
// b/145598135 - Generating host snapshots for anything other than linux is not supported.
|
||||||
SkipIfNotLinux(t)
|
SkipIfNotLinux(t)
|
||||||
|
|
||||||
result := testSdk(t, `
|
result := testSdkWithDroidstubs(t, `
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
device_supported: false,
|
device_supported: false,
|
||||||
|
@@ -102,13 +102,6 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr
|
|||||||
"myapex.pem": nil,
|
"myapex.pem": nil,
|
||||||
"myapex.x509.pem": nil,
|
"myapex.x509.pem": nil,
|
||||||
"myapex.pk8": nil,
|
"myapex.pk8": nil,
|
||||||
"Test.java": nil,
|
|
||||||
"Test.cpp": nil,
|
|
||||||
"include/Test.h": nil,
|
|
||||||
"aidl/foo/bar/Test.aidl": nil,
|
|
||||||
"libfoo.so": nil,
|
|
||||||
"stubs-sources/foo/bar/Foo.java": nil,
|
|
||||||
"foo/bar/Foo.java": nil,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range fs {
|
for k, v := range fs {
|
||||||
@@ -120,11 +113,6 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr
|
|||||||
return ctx, config
|
return ctx, config
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSdk(t *testing.T, bp string) *testSdkResult {
|
|
||||||
t.Helper()
|
|
||||||
return testSdkWithFs(t, bp, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func testSdkWithFs(t *testing.T, bp string, fs map[string][]byte) *testSdkResult {
|
func testSdkWithFs(t *testing.T, bp string, fs map[string][]byte) *testSdkResult {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
ctx, config := testSdkContext(bp, fs)
|
ctx, config := testSdkContext(bp, fs)
|
||||||
|
Reference in New Issue
Block a user