Clean up the CtsNetTestCasesMaxTargetSdk filters
Instead of relying on the test runner ignoring "include-annotation" if the annotation class is not part of the APK, and on the module name matching the annotation name, specify the annotation in the build rule. This makes the test setup easier to understand and less likely to break with test runner behavior changes or annotation/test renames. Test: atest Bug: 410435307 Flag: TEST_ONLY Change-Id: I2db905a65729adaca508eefcc0c06e5427b1bb98
This commit is contained in:
parent
8a7ea6fde6
commit
61b73b444a
2 changed files with 27 additions and 11 deletions
|
|
@ -135,6 +135,14 @@ android_test {
|
|||
target_sdk_version: "33",
|
||||
package_name: "android.net.cts.maxtargetsdk33",
|
||||
instrumentation_target_package: "android.net.cts.maxtargetsdk33",
|
||||
test_options: {
|
||||
test_runner_options: [
|
||||
{
|
||||
name: "include-annotation",
|
||||
value: "com.android.testutils.filters.CtsNetTestCasesMaxTargetSdk33",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
android_test {
|
||||
|
|
@ -143,6 +151,14 @@ android_test {
|
|||
target_sdk_version: "31",
|
||||
package_name: "android.net.cts.maxtargetsdk31", // CTS package names must be unique.
|
||||
instrumentation_target_package: "android.net.cts.maxtargetsdk31",
|
||||
test_options: {
|
||||
test_runner_options: [
|
||||
{
|
||||
name: "include-annotation",
|
||||
value: "com.android.testutils.filters.CtsNetTestCasesMaxTargetSdk31",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
android_test {
|
||||
|
|
@ -151,6 +167,14 @@ android_test {
|
|||
target_sdk_version: "30",
|
||||
package_name: "android.net.cts.maxtargetsdk30", // CTS package names must be unique.
|
||||
instrumentation_target_package: "android.net.cts.maxtargetsdk30",
|
||||
test_options: {
|
||||
test_runner_options: [
|
||||
{
|
||||
name: "include-annotation",
|
||||
value: "com.android.testutils.filters.CtsNetTestCasesMaxTargetSdk30",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
android_test_helper_app {
|
||||
|
|
|
|||
|
|
@ -47,18 +47,10 @@
|
|||
<option name="hidden-api-checks" value="false" />
|
||||
<option name="isolated-storage" value="false" />
|
||||
<option name="instrumentation-arg" key="test-module-name" value="{MODULE}" />
|
||||
<!-- Test filter that allows test APKs to select which tests they want to run by annotating
|
||||
those tests with an annotation matching the name of the APK.
|
||||
|
||||
This allows us to maintain one AndroidTestTemplate.xml for all CtsNetTestCases*.apk,
|
||||
and have CtsNetTestCases run all tests, but have CtsNetTestCasesMaxTargetSdk31 run only
|
||||
tests that require target SDK 31.
|
||||
|
||||
This relies on the fact that if the class specified in include-annotation exists, then
|
||||
the runner will only run the tests annotated with that annotation, but if it does not,
|
||||
the runner will run all the tests. -->
|
||||
<option name="include-annotation" value="com.android.testutils.filters.{MODULE}" />
|
||||
<option name="device-listeners" value="com.android.testutils.ConnectivityDiagnosticsCollector" />
|
||||
<!-- Extra configuration specified in the build rules (.bp). In particular, they may specify
|
||||
include-annotation filters to only run a subset of the test cases. -->
|
||||
{EXTRA_TEST_RUNNER_CONFIGS}
|
||||
</test>
|
||||
<metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
|
||||
<!-- Pattern matching the fileKey used by ConnectivityDiagnosticsCollector when calling addFileMetric -->
|
||||
|
|
|
|||
Loading…
Reference in a new issue