Add tests for prebuilts of all API surfaces

Previously, the tests only covered checking the sdk dependencies added
when using a prebuilt current (public) and system SDKs, i.e. with
sdk_version set to "current_30" or "system_30". This change adds tests
to cover other APIs, e.g. "test_30", "module_30" and
"system_server_30". It adds tests for "module" and "system-server" up
to API level 32 as following changes will give them different behavior
as API levels less than or equal to 31 do not have a separate
core-for-system-modules.jar file for the module-lib API.

Bug: 204189791
Test: m nothing
Change-Id: I585a88615439a24abf75250114a86113b5f5da57
This commit is contained in:
Paul Duffin
2021-10-28 17:42:16 +01:00
parent c874504988
commit 12e311d958
2 changed files with 69 additions and 3 deletions

View File

@@ -128,7 +128,6 @@ func TestClasspath(t *testing.T) {
aidl: "-pprebuilts/sdk/30/public/framework.aidl",
},
{
name: "test_current",
properties: `sdk_version: "test_current",`,
bootclasspath: []string{"android_test_stubs_current", "core-lambda-stubs"},
@@ -136,6 +135,15 @@ func TestClasspath(t *testing.T) {
java9classpath: []string{"android_test_stubs_current"},
aidl: "-pout/soong/framework.aidl",
},
{
name: "test_30",
properties: `sdk_version: "test_30",`,
bootclasspath: []string{`""`},
system: "sdk_public_30_system_modules",
java8classpath: []string{"prebuilts/sdk/30/test/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
java9classpath: []string{"prebuilts/sdk/30/test/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
aidl: "-pprebuilts/sdk/30/public/framework.aidl",
},
{
name: "core_current",
@@ -223,6 +231,33 @@ func TestClasspath(t *testing.T) {
java9classpath: []string{"android_module_lib_stubs_current"},
aidl: "-pout/soong/framework_non_updatable.aidl",
},
{
name: "module_30",
properties: `sdk_version: "module_30",`,
bootclasspath: []string{`""`},
system: "sdk_public_30_system_modules",
java8classpath: []string{"prebuilts/sdk/30/module-lib/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
java9classpath: []string{"prebuilts/sdk/30/module-lib/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
aidl: "-pprebuilts/sdk/30/public/framework.aidl",
},
{
name: "module_31",
properties: `sdk_version: "module_31",`,
bootclasspath: []string{`""`},
system: "sdk_public_31_system_modules",
java8classpath: []string{"prebuilts/sdk/31/module-lib/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
java9classpath: []string{"prebuilts/sdk/31/module-lib/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
aidl: "-pprebuilts/sdk/31/public/framework.aidl",
},
{
name: "module_32",
properties: `sdk_version: "module_32",`,
bootclasspath: []string{`""`},
system: "sdk_public_32_system_modules",
java8classpath: []string{"prebuilts/sdk/32/module-lib/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
java9classpath: []string{"prebuilts/sdk/32/module-lib/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
aidl: "-pprebuilts/sdk/32/public/framework.aidl",
},
{
name: "system_server_current",
properties: `sdk_version: "system_server_current",`,
@@ -231,6 +266,33 @@ func TestClasspath(t *testing.T) {
java9classpath: []string{"android_system_server_stubs_current"},
aidl: "-pout/soong/framework.aidl",
},
{
name: "system_server_30",
properties: `sdk_version: "system_server_30",`,
bootclasspath: []string{`""`},
system: "sdk_public_30_system_modules",
java8classpath: []string{"prebuilts/sdk/30/system-server/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
java9classpath: []string{"prebuilts/sdk/30/system-server/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
aidl: "-pprebuilts/sdk/30/public/framework.aidl",
},
{
name: "system_server_31",
properties: `sdk_version: "system_server_31",`,
bootclasspath: []string{`""`},
system: "sdk_public_31_system_modules",
java8classpath: []string{"prebuilts/sdk/31/system-server/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
java9classpath: []string{"prebuilts/sdk/31/system-server/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
aidl: "-pprebuilts/sdk/31/public/framework.aidl",
},
{
name: "system_server_32",
properties: `sdk_version: "system_server_32",`,
bootclasspath: []string{`""`},
system: "sdk_public_32_system_modules",
java8classpath: []string{"prebuilts/sdk/32/system-server/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
java9classpath: []string{"prebuilts/sdk/32/system-server/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
aidl: "-pprebuilts/sdk/32/public/framework.aidl",
},
}
for _, testcase := range classpathTestcases {
@@ -299,7 +361,9 @@ func TestClasspath(t *testing.T) {
system = "--system=none"
} else if testcase.system != "" {
dir := ""
if strings.HasPrefix(testcase.system, "sdk_public_") {
// If the system modules name starts with sdk_ then it is a prebuilt module and so comes
// from the prebuilt directory.
if strings.HasPrefix(testcase.system, "sdk_") {
dir = "prebuilts/sdk"
} else {
dir = defaultJavaDir
@@ -356,6 +420,8 @@ func TestClasspath(t *testing.T) {
FixtureWithPrebuiltApis(map[string][]string{
"29": {},
"30": {},
"31": {},
"32": {},
"current": {},
}),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {