platform_build_soong/tradefed/providers.go

27 lines
708 B
Go
Raw Normal View History

Test_Module_Config soong implementation New soong module type `TestModuleConfig` This module type allows to write: test_module_config { name: "DerivedFrameworks1", base: "FrameworksServicesTests", include_filters: ["com.android.server.accessibility.FingerprintGestureDispatcherTest"], } This goal is to put the test options (include_fitler in this case) in Android.bp rather than TEST_MAPPING to be able to name a set of options and to allow the CI to more precise about which part of a TestModule might be failing. In general, it is recommended to split up tests rather than use this approach, but that isn't always feasible. More details on project here:  https://docs.google.com/document/d/1MpA4BS6mTr-1D-K9MVmzdHkSufAvIkkM4gPEUglNodk/edit?tab=t.0 Migration plan here: https://docs.google.com/document/d/1x3w-BvKO3E-GbY8YOSBuzJC6-pkLkuhfjSyZ1hJQBYM/edit?tab=t.0 Some details of final output: * All the [data] files from Derived are the same as base. * The apk names is changed to be the Module name * The test options are added to .config file * test-file-name in the .config file (for base.apk) is changed to be new apk. * module-info.json is hand inspected between base and derived. * I added a .manifest file so future tools know what base is, if they need it. We are working a mechanism to use a CAS so the zip of the testcases won't explode. (however the trident disk image will get bigger) % tree -ls out/target/product/shiba/testcases/DerivedFrameworks1 out/target/product/shiba/testcases/FrameworksServicesTests [ 4096] out/target/product/shiba/testcases/DerivedFrameworks1 ├── [ 4096] arm64 │   └── [ 72346281] DerivedFrameworks1.apk ├── [ 20887] BstatsTestApp.apk ├── [ 4096] data │   └── [ 851] broken_shortcut.xml ├── [ 3157] DerivedFrameworks1.config ├── [ 12695] JobTestApp.apk ├── [ 8599] MediaButtonReceiverHolderTestHelperApp.apk ├── [ 16791] SimpleServiceTestApp1.apk ├── [ 16791] SimpleServiceTestApp2.apk ├── [ 16791] SimpleServiceTestApp3.apk ├── [ 1017540] SuspendTestApp.apk └── [ 36] test_module_config.manifest [ 4096] out/target/product/shiba/testcases/FrameworksServicesTests ├── [ 4096] arm64 │   └── [ 72346281] FrameworksServicesTests.apk ├── [ 20887] BstatsTestApp.apk ├── [ 4096] data │   └── [ 851] broken_shortcut.xml ├── [ 2866] FrameworksServicesTests.config ├── [ 12695] JobTestApp.apk ├── [ 8599] MediaButtonReceiverHolderTestHelperApp.apk ├── [ 16791] SimpleServiceTestApp1.apk ├── [ 16791] SimpleServiceTestApp2.apk ├── [ 16791] SimpleServiceTestApp3.apk └── [ 1017540] SuspendTestApp.apk Fixes: 314148134 Test: atest DerivedFrameworks1 DerivedFrameworks2 Test: m blueprint_tests Change-Id: Ib73a3404557e0bd583b065f0cf2fd55fba9ccdbe
2024-02-02 21:37:20 +01:00
package tradefed
import (
"android/soong/android"
"github.com/google/blueprint"
)
// Output files we need from a base test that we derive from.
type BaseTestProviderData struct {
// data files and apps for android_test
InstalledFiles android.Paths
// apk for android_test
OutputFile android.Path
// Either handwritten or generated TF xml.
TestConfig android.Path
// Other modules we require to be installed to run tests. We expect base to build them.
HostRequiredModuleNames []string
Add test_module_config_host This pairs with `test_module_config` but also works on the base is a `java_test_host` module. e.g. test_module_config_host { name: "CtsOsHostTestCases_DERIVED_2566", base: "CtsOsHostTestCases", test_suites: ["general-tests"], include_filters: [ "android.os.cts.StaticSharedLibsHostTests" ], exclude_annotations: [ "androidx.test.filters.FlakyTest","org.junit.Ignore" ], } The new module is composed of the previous and shares much of the same code. With respect to build size, Without this change, if you build CtsAppSecurityHostTestCases, there will be several copies of the jar (and related apks) : *) 1 in framework out/host/linux-x86/framework/CtsAppSecurityHostTestCases.jar *) 1 in testcases for the test out/host/linux-x86/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar *) 1 per compatibility suite testcases out/host/linux-x86/mts-documentsui/android-mts-documentsui/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar out/host/linux-x86/mts-mediaprovider/android-mts-mediaprovider/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar out/host/linux-x86/mts/android-mts/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar out/host/linux-x86/cts/android-cts/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar out/host/linux-x86/mts-mainline-infra/android-mts-mainline-infra/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar A dervived test using CtsAppSecurityHostTestCases as base adds one more to its testcases dir: *) derived testcase. out/host/linux-x86/testcases/CtsAppSecurityHostTestCases_presubmit_ExternalStorageApp/CtsAppSecurityHostTestCases.jar Fixes: b/327280990 Test: m clean && m CtsOsHostTestCases_DERIVED_2566# as above Test: atest CtsOsHostTestCases_DERIVED_2566 --collect-tests-only Test: migrated the 71 TestMapping instances to Android.bp and build them. Ran tests on some of them. Ran some original `test_module_config` tests derived from `android_test` as well TODO: Add actions to validate the given filters are valid for the given test apks/jars. Change-Id: I115eedb6ff6ba8e72bb49e71867daf49d25ca0f1
2024-03-14 22:14:39 +01:00
RequiredModuleNames []string
// List of test suites base uses.
TestSuites []string
// Used for bases that are Host
IsHost bool
Test_Module_Config soong implementation New soong module type `TestModuleConfig` This module type allows to write: test_module_config { name: "DerivedFrameworks1", base: "FrameworksServicesTests", include_filters: ["com.android.server.accessibility.FingerprintGestureDispatcherTest"], } This goal is to put the test options (include_fitler in this case) in Android.bp rather than TEST_MAPPING to be able to name a set of options and to allow the CI to more precise about which part of a TestModule might be failing. In general, it is recommended to split up tests rather than use this approach, but that isn't always feasible. More details on project here:  https://docs.google.com/document/d/1MpA4BS6mTr-1D-K9MVmzdHkSufAvIkkM4gPEUglNodk/edit?tab=t.0 Migration plan here: https://docs.google.com/document/d/1x3w-BvKO3E-GbY8YOSBuzJC6-pkLkuhfjSyZ1hJQBYM/edit?tab=t.0 Some details of final output: * All the [data] files from Derived are the same as base. * The apk names is changed to be the Module name * The test options are added to .config file * test-file-name in the .config file (for base.apk) is changed to be new apk. * module-info.json is hand inspected between base and derived. * I added a .manifest file so future tools know what base is, if they need it. We are working a mechanism to use a CAS so the zip of the testcases won't explode. (however the trident disk image will get bigger) % tree -ls out/target/product/shiba/testcases/DerivedFrameworks1 out/target/product/shiba/testcases/FrameworksServicesTests [ 4096] out/target/product/shiba/testcases/DerivedFrameworks1 ├── [ 4096] arm64 │   └── [ 72346281] DerivedFrameworks1.apk ├── [ 20887] BstatsTestApp.apk ├── [ 4096] data │   └── [ 851] broken_shortcut.xml ├── [ 3157] DerivedFrameworks1.config ├── [ 12695] JobTestApp.apk ├── [ 8599] MediaButtonReceiverHolderTestHelperApp.apk ├── [ 16791] SimpleServiceTestApp1.apk ├── [ 16791] SimpleServiceTestApp2.apk ├── [ 16791] SimpleServiceTestApp3.apk ├── [ 1017540] SuspendTestApp.apk └── [ 36] test_module_config.manifest [ 4096] out/target/product/shiba/testcases/FrameworksServicesTests ├── [ 4096] arm64 │   └── [ 72346281] FrameworksServicesTests.apk ├── [ 20887] BstatsTestApp.apk ├── [ 4096] data │   └── [ 851] broken_shortcut.xml ├── [ 2866] FrameworksServicesTests.config ├── [ 12695] JobTestApp.apk ├── [ 8599] MediaButtonReceiverHolderTestHelperApp.apk ├── [ 16791] SimpleServiceTestApp1.apk ├── [ 16791] SimpleServiceTestApp2.apk ├── [ 16791] SimpleServiceTestApp3.apk └── [ 1017540] SuspendTestApp.apk Fixes: 314148134 Test: atest DerivedFrameworks1 DerivedFrameworks2 Test: m blueprint_tests Change-Id: Ib73a3404557e0bd583b065f0cf2fd55fba9ccdbe
2024-02-02 21:37:20 +01:00
}
var BaseTestProviderKey = blueprint.NewProvider[BaseTestProviderData]()