Add support for standalone ART gtests to MTS.
This change:
- adds standalone ART gtests to test suite `mts-art`;
- adds `MainlineTestModuleController` support to standalone ART
gtests. This in order to have these tests run in a Mainline context
only when the ART Module (either `com.google.android.art` or
`com.android.art`) is installed on the test device.
(cherry picked from commit 6a2e6893290eac83f59dac4ec5bc10abf985ae10)
Test: m mts && mts-tradefed run commandAndExit mts-art
Test: m mts && mts-tradefed run commandAndExit mts-art-shard-00
Bug: 193218514
Bug: 167385698
Change-Id: I97d9c00b7c10debff8c63e4ae75f90da02be271c
Merged-In: I97d9c00b7c10debff8c63e4ae75f90da02be271c
diff --git a/compiler/art_standalone_compiler_tests.xml b/compiler/art_standalone_compiler_tests.xml
index 0e67022..bf450a5 100644
--- a/compiler/art_standalone_compiler_tests.xml
+++ b/compiler/art_standalone_compiler_tests.xml
@@ -33,4 +33,13 @@
<option name="ld-library-path-32" value="/apex/com.android.art/lib" />
<option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>
diff --git a/dex2oat/art_standalone_dex2oat_tests.xml b/dex2oat/art_standalone_dex2oat_tests.xml
index 8cc8926..672066a 100644
--- a/dex2oat/art_standalone_dex2oat_tests.xml
+++ b/dex2oat/art_standalone_dex2oat_tests.xml
@@ -55,4 +55,13 @@
<option name="ld-library-path-32" value="/apex/com.android.art/lib" />
<option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>
diff --git a/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml b/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml
index 800dec1..ae112d4 100644
--- a/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml
+++ b/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml
@@ -41,4 +41,13 @@
<option name="ld-library-path-32" value="/apex/com.android.art/lib" />
<option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index 4f15ba9..31cf197 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -447,6 +447,10 @@
suffix: "64",
},
},
+
+ test_suites: [
+ "mts-art",
+ ],
}
cc_library_static {
diff --git a/libdexfile/art_standalone_libdexfile_tests.xml b/libdexfile/art_standalone_libdexfile_tests.xml
index f8c0019..57987fd 100644
--- a/libdexfile/art_standalone_libdexfile_tests.xml
+++ b/libdexfile/art_standalone_libdexfile_tests.xml
@@ -35,4 +35,13 @@
<option name="ld-library-path-32" value="/apex/com.android.art/lib" />
<option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>
diff --git a/libprofile/art_standalone_libprofile_tests.xml b/libprofile/art_standalone_libprofile_tests.xml
index 60f8a8a..069f203 100644
--- a/libprofile/art_standalone_libprofile_tests.xml
+++ b/libprofile/art_standalone_libprofile_tests.xml
@@ -33,4 +33,13 @@
<option name="ld-library-path-32" value="/apex/com.android.art/lib" />
<option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>
diff --git a/oatdump/art_standalone_oatdump_tests.xml b/oatdump/art_standalone_oatdump_tests.xml
index 64f911a..e83d2a2 100644
--- a/oatdump/art_standalone_oatdump_tests.xml
+++ b/oatdump/art_standalone_oatdump_tests.xml
@@ -31,4 +31,13 @@
<option name="ld-library-path-32" value="/apex/com.android.art/lib" />
<option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>
diff --git a/profman/art_standalone_profman_tests.xml b/profman/art_standalone_profman_tests.xml
index 478e587..31bee91 100644
--- a/profman/art_standalone_profman_tests.xml
+++ b/profman/art_standalone_profman_tests.xml
@@ -42,4 +42,13 @@
<option name="exclude-filter" value="ProfileAssistantTest.TestProfileRoundTrip" />
<option name="exclude-filter" value="ProfileAssistantTest.TestProfileRoundTripWithAnnotations" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>
diff --git a/runtime/art_standalone_runtime_compiler_tests.xml b/runtime/art_standalone_runtime_compiler_tests.xml
index 9591cb4..0f6bb4b 100644
--- a/runtime/art_standalone_runtime_compiler_tests.xml
+++ b/runtime/art_standalone_runtime_compiler_tests.xml
@@ -33,4 +33,13 @@
<option name="ld-library-path-32" value="/apex/com.android.art/lib" />
<option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>
diff --git a/runtime/art_standalone_runtime_tests.xml b/runtime/art_standalone_runtime_tests.xml
index ced2335..1267213 100644
--- a/runtime/art_standalone_runtime_tests.xml
+++ b/runtime/art_standalone_runtime_tests.xml
@@ -99,4 +99,13 @@
<option name="exclude-filter" value="ExecUtilsTest.ExecSuccess" />
<option name="exclude-filter" value="ExecUtilsTest.ExecTimeout" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>
diff --git a/test/Android.bp b/test/Android.bp
index 1916711..fbef1ff 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -221,7 +221,10 @@
"art_defaults",
],
- test_suites: ["general-tests"],
+ test_suites: [
+ "general-tests",
+ "mts-art",
+ ],
// Support multilib variants (using different suffix per sub-architecture), which is needed on
// build targets with secondary architectures, as the MTS test suite packaging logic flattens
diff --git a/test/art-gtests-target-standalone-template.xml b/test/art-gtests-target-standalone-template.xml
index d7bad46..4b2bdc1 100644
--- a/test/art-gtests-target-standalone-template.xml
+++ b/test/art-gtests-target-standalone-template.xml
@@ -27,4 +27,13 @@
<option name="ld-library-path-32" value="/apex/com.android.art/lib" />
<option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
</test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
</configuration>