From 61b73b444a5923b934799aa7acd541cd6086c1ae Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Fri, 11 Apr 2025 17:09:44 +0900 Subject: [PATCH] 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 --- tests/cts/net/Android.bp | 24 ++++++++++++++++++++++++ tests/cts/net/AndroidTestTemplate.xml | 14 +++----------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/tests/cts/net/Android.bp b/tests/cts/net/Android.bp index 50b131e9bf..a7eca21385 100644 --- a/tests/cts/net/Android.bp +++ b/tests/cts/net/Android.bp @@ -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 { diff --git a/tests/cts/net/AndroidTestTemplate.xml b/tests/cts/net/AndroidTestTemplate.xml index cb0e57539a..de21efc2ce 100644 --- a/tests/cts/net/AndroidTestTemplate.xml +++ b/tests/cts/net/AndroidTestTemplate.xml @@ -47,18 +47,10 @@