Commit graph

32 commits

Author SHA1 Message Date
Cole Faust
0cec5ea146 Fix missing test name after aosp/2372150
The test name defaulting to ctx.ModuleName() was
accidentally removed, readd it

Bug: 184895128
Fixes: 264423240
Fixes: 264433459
Test: Verified ninja files produced with this cl and aosp/2372150 are the same as with aosp/2372150 reverted
Change-Id: I23ab8ab39132b93719cc6f797d92b1cabce5eae9
2023-01-04 11:24:28 -08:00
Cole Faust
216805457c Allow adding extra tradefed options in the Android.bp file
Some tests need to add custom tradefed options, but still want to
keep most of the soong autogenerated tradefed xml file.

Expose a test_options: { tradefed_options: [...] } property that
will allow tests to add more options to the autogenerated xml file.

Fixes: 184895128
Test: go test, and verified that the ninja files did not change for aosp_arm64
Change-Id: I50d4ad139322e9e207202f1e1a50f5bbb424aa6f
2023-01-03 12:47:11 -08:00
Tahsin Loqman
77dc7d0839 Revert "Allow adding extra tradefed options in the Android.bp file"
This reverts commit 8ec823cba1.

Reason for revert: DroidMonitor: Potential culprit for Bug b/262965953 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: I236cc36981d8b30527ca286632727f8ca267e969
2022-12-19 16:27:25 +00:00
Cole Faust
8ec823cba1 Allow adding extra tradefed options in the Android.bp file
Some tests need to add custom tradefed options, but still want to
keep most of the soong autogenerated tradefed xml file.

Expose a test_options: { tradefed_options: [...] } property that
will allow tests to add more options to the autogenerated xml file.

Fixes: 184895128
Test: go test, and verified that the ninja files did not change for aosp_arm64
Change-Id: I75f7eb002c8325ce7cdc76e12e76e16195320620
2022-12-09 15:23:26 -08:00
Sam Delmerico
b3342ce580 build device binary for java_test_host
This commit adds support for a java_host_test that requires a target
binary to run. If the binary has host and target variants and is added
as a dependency in the `data` attribute, then the host variant is used.
Instead, we need a way to force the use of the target variant.

Bug: 182919153
Test: add code from aosp/1647282/1 && atest AuthFsHostTest
Change-Id: I68a6259b41a5e6809e1b82eec3122ffdf5067f56
2022-01-26 19:57:27 +00:00
Ivan Lozano
ba2226164c rust: Add require_root and vendor install base
Adds the require_root property to rust_test modules so that tests can
run as root. Also adds an install base to allow vendor tests to install
to a different path, otherwise installs to 'unrestricted' like cc_test.

Bug: 200602232
Test: test with require_root: true runs as root
Test: test installed to new base directory
Change-Id: Ifa716871ff87471f0c0caff7af558d47db85ccd1
2021-09-21 11:01:11 -04:00
Jakub Kotur
546ccd5614 Attach rust_benchmark to atest and tradefed.
Automatically generate required tradefed configs for rust benchmarks so
that they're available in atest.

Test: atest <module with rust_benchmark defined>
Bug: 155309706
Change-Id: I6002100367a66b6b0555614acc6cebb00dbf435d
2021-04-06 12:40:34 +02:00
Julien Desprez
70898c4006 Use java host unit tests template for unit tests
Test: make aoa-helper-tests
Bug: 172961860
Change-Id: I2eaee277961f29adfd22e7c65248c9403bd69b81
2020-11-19 09:44:39 -08:00
yangbill
5ec4555d22 AutoGen: Support NativeTest with vendor namespace.
Set the TEST_ROOT to /data/local/tmp/tests/vendor if LOCAL_VENDOR_MODULE or
LOCAL_USE_VNDK be set, if not, set to /data/local/tmp.

Bug: 138450837
Test: atest binderVendorDoubleLoadTest
Change-Id: I04acf12976dd24b9bf880a6775fa4f043a221001
2020-09-01 10:33:12 +08:00
Colin Cross
8eebb135b3 Package robolectric tests for tradefed
Package a slightly modified copy of the robolectric tests with
the dependencies statically included into the testcases directory
and into a robolectric-tests.zip.

Test: m robolectric-tests
Change-Id: I73f51727695136d2a849d36af1683e93f7e156a3
2020-07-19 19:33:40 -07:00
Chih-hung Hsieh
000aef69b5 Merge "Fix module name when autogenerating test config" 2020-06-12 18:06:42 +00:00
Stephen Crane
b7fd37cb08 Fix module name when autogenerating test config
c5b8749853 broke specifying a name via the
`autogenTemplateWithName` function by hard-coding
`ctx.ModuleName()`. This restores that functionality.

Bug: 158784626
Test: atest rustBinderTest_integration
Change-Id: I05674e85defb363aa3cdf3e2dd895d1174e6b48f
2020-06-11 23:22:09 +00:00
Ivan Lozano
fc80fe7f2f Make rust_test file output more similar to cc_test.
This changes the way the output filename is calculated for rust_test
binaries to be more similar to cc_test.

This also removes the option to define multiple test binaries in a
single rust_test module via the TestPerSrc mutator. Now each rust_test
module corresponds to a single test binary.

Bug: 158500462
Test: m -j pin-utils_tests_pin_utils
Test: m -j unicode-xid_device_tests_unicode_xid
Change-Id: I6e0f79dcb4e49fa49d6ebb36abeef67a9eb180a0
2020-06-11 17:12:19 -04:00
frankfeng
c5b8749853 Implement test config auto-gen for sh_test.
Supports the following properties:
- Require_root
- Test_config_template
- Auto_gen_config

Test config template is in a separate CL.

Bug: 148805488
Bug: 151761373

Test: make
Test: unit tests
Test: verified with bc_test & toybox-tests
Change-Id: I63d60a153a6abda4ce30b74d3eb915fbf6389cb8
2020-06-04 10:37:14 -07:00
easoncylee
5bcff5d1fd Add test_mainline_modules to the auto-gen test config(AndroidJUnitTest only).
To support parameterized mainline modules in Test Mapping, we plan to
add a new parameter called test_mainline_modules in build system to
auto-generate the test config based on the parameter.

For detailed information: go/test-mapping-mainline-gcl
(search for auto-generated pattern)

Bug: 155238134
Test: add "test_mainline_modules: [some.apk]" to TetheringTests,
and build the modules, confirm the parameterized option is added
in the test config.

Change-Id: I41ba8749ce46da62db402a8b8a555d4874e1cfc0
2020-05-15 12:50:48 +08:00
easoncylee
1e3fdcd182 Add test_mainline_modules to the auto-gen test config(GTest only).
To support parameterized mainline modules in Test Mapping, we plan to
add a new parameter called test_mainline_modules in build system to
auto-generate the test config based on the parameter.

For detailed information: go/test-mapping-mainline-gcl
(serach for auto-generated pattern)

Bug: 155238134
Test: add "test_mainline_modules: [some.apk]" to libstatspull_test,
and build the modules, confirm the parameterized option is added
in the test config.

Change-Id: I31d6dfbb71881d7a7026cf2f36ba6ca6a97870ad
2020-05-07 12:35:14 +08:00
Lorenzo Colitti
e29c21e830 Allow using test_config_template for CTS tests.
Currently, soong will not autogenerate AndroidTest.xml files for
CTS tests. The comment says that this is because they can be used
for test data (in which case, autogenerating an AndroidTest.xml
file would not be correct).

Allow autogeneration of test files in the case that the buid rule
explicitly requests it using a test_config_template. This allows
CTS tests to use test_config_template.

Also remove a TODO that was already addressed by aosp/903934.

Test: patching aosp/1235232 and running "m CtsNetTestCases" results in test config
Change-Id: Ic3450b67c47745af5932edd82452fdf16d937ea7
2020-02-14 18:42:06 +09:00
Chih-Hung Hsieh
ede57ae812 Generate tradefed config for rust device tests.
* The RustBinaryTest runner and device test config template
  are derived from GTest. Device tests are pushed to /data/local/tmp.

Bug: 140938178
Test: make unicode-xid projects; run atest
Change-Id: Idb4cab7872b48c6e25bc59b85aa6d9dece4383ec
2019-12-02 17:44:53 +00:00
Chih-Hung Hsieh
41805bedbf Add TestProperties, gen test config, fix names
* Rename testBinaryDecorator to testDecorator
* Add TestProperties
  * Add install function for testDecorator to install config files
  * Add tradefed.AutoGenRustHostTestConfig
  * Depend on new build/make/core/rust_host_test_config_template.xml
    and new tradefed.testtype.rust.RustBinaryHostTest class
* Add autogenTemplateWithName in tradefed/autogen.go
  to generate config files with customized(mutated) executable name.
* Make rust_test module names more robust and easy to use.
  * Use crate name instead of source file name as the Stem
    for single source file modules, to match original user
    specified output file name in Cargo.toml.
  * Do not set up test module SubName when Stem is empty
    or when the module name already contains Stem suffix.
    That happens when TestPerSrcMutator is disabled or when
    there is only one source file with renamed output file name.
  * In TEST_MAPPING, references to mutated rust_test modules should be
    (1) <module_name> for single source file modules without mutation, or
    (2) <module_name>_<crate_name> for single source file modules, or
    (3) <module_name>_<source_file_base_name> for multi-file modules.

Bug: 140938178
Test: mm in rust projects, check output test file names
Change-Id: Ifdbfa14d5eed4f10b4fb983f82c93bbb9be3f899
2019-11-14 15:16:26 -08:00
Dan Shi
6ffaaa830d Allow test to specify whether or not to auto-generate test config
Attribute `auto_gen_config` is added to test modules.
Test config will be generated if:
the attribute is not set and AndroidTest.xml doesn't exists
or
the attribute is set to true, whether or not AndroidTest.xml exists.

Test config will NOT be auto-generated if:
the attribute is not set and AndroidTest.xml exists
or
the attribute is set to false, whether or not AndroidTest.xml exists.

Bug: 141684102
Test: build test module with auto_gen_config set to true
Change-Id: I64fb003a83d8c32a967835e5f8d12fe4476043be
2019-09-26 13:29:28 -07:00
nelsonli
0d7111ec0f Add option test_min_api_level and test_min_sdk_version for auto-generated test config
The new option will allow the auto-generated test config for cc_test to
include MinApiLevelModuleController and check the api-level before test.

Bug: 140912549
Test: 1. $vi platform_testing/tests/example/native/Android.bp
      2. add
          test_min_api_level: 29,
          or
          test_min_sdk_version: 29,
      3. $m -j hello_world_test
      4. check hello_world_test.config

Change-Id: Ic742d41898928df1637890bec87796d90e886516
2019-09-19 12:14:16 +08:00
Dan Shi
20ccd2125d Add option disable_framework for auto-generated test config
The new option will allow the auto-generated test config for cc_test to
include RunCommandTargetPreparer to disable framework before the test
run and re-enable it after the test run.

Bug: 140065309
Test: test hello_world_test with the new option.
Change-Id: If2189e9474f5b11bd0d0471e231a2cae14155389
2019-08-28 15:53:43 -07:00
Dan Shi
37ee3b8f49 Support require_root in auto-gen test configs
require_root is added to allow auto-generated test config to include
RootTargetPreparer so the test runs with root permission.

Bug: 134509111
Test: add "require_root: true" to init_benchmarks and libpower_test
  build the modules, confirm the extra target preparer is added in the
  test configs.

Change-Id: Ia07503e338935d6aa92560e7cf7b18d2a4c51243
2019-06-14 11:10:13 -07:00
Colin Cross
0b9f31fb08 Replace *Escape with *EscapeList
Follow the change to blueprint to make *Escape take and return a string
and add *EscapeList that take and return slices of strings.  Fix up
a few places that were unnecessarily converting a string to a slice
and back to a string.

Test: m nothing
Change-Id: I3fa87de175522205f36544ef76aa2f04aef1b936
2019-03-04 18:11:53 +00:00
Julien Desprez
eb7398ea79 Autogenerate some extra_options based on some build properties
If an Android.bp specifies Isolated=true, make sure
it's tagged as not-shardable, since b/126376458 is not
resolved.

Test: make bionic-benchmarks-tests (with and without isolated=true)
Bug: 124024827
Change-Id: I2210c15b84f9b30e1cc23b426d463b34cf9ef94f
2019-03-01 11:42:17 -08:00
yangbill
4f41bc2bed [SOONG] Not auto-generate test config if test_suite is cts
Current soong use source code's under cts as the rule for judgement.
Should change to use test_suites define instead.

Bug: 124313692
Test: m hello_world_test, make sure test config be auog-enerated.
      Modified platform_testing/tests/example/native/Android.bp
      m hello_world_test, make sure test config not be auto-generatetd.

Change-Id: I1bc5216f73329d2a82d9ff29ccbede436dd2976c
2019-02-19 22:25:50 +08:00
yelinhsieh
80880a3460 Autogen python test config.
Feature request from developer, autogen python test config.

Bug:118442443

Test: $source build/envsetup.sh ; lunch
      $sed -i '/test_config/d' tools/acloud/Android.bp
      $make acloud_test
      $[ -f $ANDROID_HOST_OUT_TESTCASES/acloud_test/acloud_test.config ] && echo "Found" || echo "Not found"

Change-Id: I196230581b456afe03e67f9cd84c028d18ba08d9
2019-01-14 03:30:06 +00:00
Bill Yang
fd18c42b37 Revert "ATest: GTest auto gen config support run_test_as in Android.bp ."
This reverts commit d30b940dff.

Reason for revert: sed -i requires an argument on mac, break build on mac.

Change-Id: Iba2db061ae888d265e02b750e50959019cf0f168
2018-10-25 07:10:40 +00:00
yelinhsieh
d30b940dff ATest: GTest auto gen config support run_test_as in Android.bp .
Feature request from developer, support setting uid in Android.bp.

Bug:113359343

Test: source build/envsetup.sh ; lunch
    vim platform_testing/tests/example/native/Android.bp
    add
    test_options: {
        run_test_as: "1234",
    },
    in cc_test
    make hello_world_test
    cat out/target/product/xxxx/testcases/hello_world_test/hello_world_test.config
    Will see  <option name="run-test-as" value="1234" />
    below <test class="com.android.tradefed.testtype.GTest" >

Change-Id: I5604af5f20c45728d19f4c01396a20a74997f8a8
2018-10-22 14:14:29 +08:00
Jack He
3333889da5 TradeFed: Add "test_config_template" flag in Android.bp
* Allow module owner to specify a test_config_template in Android.bp
* The rule goes:
  1. When "test_config" is set, Soong uses specified test config
  2. If 1 is not true, check if "AndroidTest.xml" exist in the
     directory, if so, use "AndroidTest.xml
  3. If 1 and 2 are not true, check if "test_config_template" is set.
     If so, use module specific template to generate test config
  4. Otherwise, use Soong default template for test config for autogen

Bug: 113359343
Test: make
Change-Id: I9fb4b2b266be9e0c7cf23da4a51e1c8ae67cd857
2018-09-26 18:02:55 -07:00
Colin Cross
91606c016e Fix template for native benchmark test config
Bug: 112851515
Test: rm libcore/AndroidTest.xml && atest libjavacore-benchmarks
Change-Id: I126550b6a90b06483e3ee1acec07659fa00fa8af
2018-08-20 13:45:32 -07:00
Colin Cross
303e21f695 Move autogenerated test config into Soong
Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.

Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
2018-08-14 15:44:08 -07:00