Auto-generate test config from template
This change fixes the way the test configs for CTS/VTS/GTS variants are
generated. Instead of using a custom genrule, we now use the
test_config_template and tradefed_options properties to instantiate test
configs from the template.
Also add a new variant for GTS.
Bug: N/A
Test: build
Change-Id: I1a3a335ec340ac05da0f8cbc962879c25b3cabd4
diff --git a/tests/hostside/Android.bp b/tests/hostside/Android.bp
index 0966c20..6d7c25e 100644
--- a/tests/hostside/Android.bp
+++ b/tests/hostside/Android.bp
@@ -59,7 +59,8 @@
java_test_host {
name: "MicrodroidHostTestCases",
defaults: ["MicrodroidHostTestCases.default"],
- test_config: "AndroidTest.xml",
+ test_config_template: "AndroidTestTemplate.xml",
+ auto_gen_config: true,
test_suites: [
"general-tests",
"pts",
@@ -71,8 +72,21 @@
java_test_host {
name: "MicrodroidHostTestCases.CTS",
defaults: ["MicrodroidHostTestCases.default"],
- test_config: ":MicrodroidHostTestCases.CTS.config",
+ test_config_template: "AndroidTestTemplate.xml",
test_suites: ["cts"],
+ auto_gen_config: true,
+ test_options: {
+ tradefed_options: [
+ {
+ name: "include-annotation",
+ value: "com.android.compatibility.common.util.CddTest",
+ },
+ {
+ name: "test-suite-tag",
+ value: "cts",
+ },
+ ],
+ },
device_common_data: DEVICE_DATA,
data_native_bins: BINS,
}
@@ -80,30 +94,43 @@
java_test_host {
name: "MicrodroidHostTestCases.VTS",
defaults: ["MicrodroidHostTestCases.default"],
- test_config: ":MicrodroidHostTestCases.VTS.config",
+ test_config_template: "AndroidTestTemplate.xml",
test_suites: ["vts"],
+ auto_gen_config: true,
+ test_options: {
+ tradefed_options: [
+ {
+ name: "include-annotation",
+ value: "com.android.compatibility.common.util.VsrTest",
+ },
+ {
+ name: "test-suite-tag",
+ value: "vts",
+ },
+ ],
+ },
device_common_data: DEVICE_DATA,
data_native_bins: BINS,
}
-genrule {
- name: "MicrodroidHostTestCases.CTS.config",
- srcs: ["AndroidTest.xml"],
- out: ["out.xml"],
- cmd: "sed " +
- "-e 's/<!-- PLACEHOLDER_FOR_ANNOTATION -->/" +
- "<option name=\"include-annotation\" value=\"com.android.compatibility.common.util.CddTest\" \\/>/' " +
- "-e 's/MicrodroidHostTestCases.jar/MicrodroidHostTestCases.CTS.jar/' " +
- "$(in) > $(out)",
-}
-
-genrule {
- name: "MicrodroidHostTestCases.VTS.config",
- srcs: ["AndroidTest.xml"],
- out: ["out.xml"],
- cmd: "sed " +
- "-e 's/<!-- PLACEHOLDER_FOR_ANNOTATION -->/" +
- "<option name=\"include-annotation\" value=\"com.android.compatibility.common.util.VsrTest\" \\/>/' " +
- "-e 's/MicrodroidHostTestCases.jar/MicrodroidHostTestCases.VTS.jar/' " +
- "$(in) > $(out)",
+java_test_host {
+ name: "MicrodroidHostTestCases.GTS",
+ defaults: ["MicrodroidHostTestCases.default"],
+ test_config_template: "AndroidTestTemplate.xml",
+ test_suites: ["gts"],
+ auto_gen_config: true,
+ test_options: {
+ tradefed_options: [
+ {
+ name: "include-annotation",
+ value: "com.android.compatibility.common.util.GmsTest",
+ },
+ {
+ name: "test-suite-tag",
+ value: "gts",
+ },
+ ],
+ },
+ device_common_data: DEVICE_DATA,
+ data_native_bins: BINS,
}
diff --git a/tests/hostside/AndroidTest.xml b/tests/hostside/AndroidTestTemplate.xml
similarity index 91%
rename from tests/hostside/AndroidTest.xml
rename to tests/hostside/AndroidTestTemplate.xml
index c277865..ac066bc 100644
--- a/tests/hostside/AndroidTest.xml
+++ b/tests/hostside/AndroidTestTemplate.xml
@@ -14,7 +14,6 @@
limitations under the License.
-->
<configuration description="Host driven tests for Microdroid">
- <option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="component" value="security" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
@@ -26,12 +25,12 @@
</target_preparer>
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
- <option name="jar" value="MicrodroidHostTestCases.jar" />
+ <option name="jar" value="{MODULE}.jar" />
</test>
<!-- Controller that will skip the module if a native bridge situation is detected -->
<!-- For example: module wants to run arm and device is x86 -->
<object type="module_controller" class="com.android.tradefed.testtype.suite.module.NativeBridgeModuleController" />
- <!-- PLACEHOLDER_FOR_ANNOTATION -->
+ {EXTRA_CONFIGS}
</configuration>