Commit graph

46 commits

Author SHA1 Message Date
Yu Liu
d136a6aa01 Support dynamic config file for cc_test.
Bug: 280028705
Test: local build
Change-Id: Ife445f6a7642bf08651ed7a9501a60950f05f9c4
2023-08-22 17:33:20 +00:00
Yu Liu
574e35365d Fix a bug where the default AndroidTest.xml was not picked up.
Bug: 280028705
Test: local build
Change-Id: Ie7510c6a07505d6d6139407cd9b9920f870ef753
2023-08-19 00:38:15 +00:00
Dan Shi
9b4835c360 Remove unnecessary variable
Bug: 284179405
Test: m
Change-Id: I1b5b2559837d27e8e380bb700b2b7ad674d8b079
2023-06-15 23:22:39 +00:00
Dan Shi
ec7314336a Support test runnner option in auto generated test configs
Bug: 284179405
Bug: 236980335
Test: unittest
Change-Id: Ifae3d556ff79153ca6c3067347fc259b665fb2e1
2023-05-26 21:34:22 +00:00
Julien Desprez
3895c286ff Merge "Remove jar target not used" 2023-04-26 15:19:35 +00:00
Julien Desprez
45bd092132 Remove jar target not used
Test: presubmit
Bug: 279638202
Change-Id: I21d6f699d665a42d84a1dd899bcfc054c2454879
2023-04-25 13:41:29 -07:00
Ziwei Zhang
c3bb83a57b Add python template for mobly tests.
Mobly is a Python-based test framework that specializes in supporting
test cases that require multiple devices. There are some Mobly based
Android tests, but these tests cannot be added to xTS since they are
not using TF. Currently TF provides a 2-device Mobly test runner.
This change is a short-term solution to help teams (eg. bluetooth) to
add their multi-device Mobly tests to xTS without writing TF configs.
For long-term, device infra team and xTS infra team will provide a
solution for more complex multi-device tests in xTS and deprecate this
TF template.

Test: manually check the generated mobly xml config
Bug: 272239365
Change-Id: I252cc774094eebbd9264243d30023ace4839c2cd
2023-03-08 21:37:58 +08:00
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
Jigar Thakkar
1d174b185f Merge "Revert "Allow adding extra tradefed options in the Android.bp file"" 2022-12-20 16:24:20 +00: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
Kevin Dagostino
32edd1a608 Add tradefed attributes to cc_test bazel macro
The BUILD file will now have the needed attributes to run the tradefed
test rules.

Test: b test //packages/modules/adb:adbd_test --platforms=//build/bazel/platforms:android_target
Change-Id: I5cb84ccdde27a7fadbef479269df594344a29187
2022-12-18 04:38:16 +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
Bob Badour
02040de891 Add LOCAL_LICENSE_KINDS to build/soong
Added SPDX-license-identifier-Apache-2.0 to:
  Android.bp
  android/Android.bp
  android/soongconfig/Android.bp
  androidmk/Android.bp
  apex/Android.bp
  bazel/Android.bp
  bp2build/Android.bp
  bpf/Android.bp
  bpfix/Android.bp
  cc/Android.bp
  cc/config/Android.bp
  cc/libbuildversion/Android.bp
  cc/libbuildversion/tests/Android.bp
  cc/ndk_api_coverage_parser/Android.bp
  cc/ndkstubgen/Android.bp
  cc/symbolfile/Android.bp
  cmd/dep_fixer/Android.bp
  cmd/diff_target_files/Android.bp
  cmd/extract_apks/Android.bp
  cmd/extract_jar_packages/Android.bp
  cmd/extract_linker/Android.bp
  cmd/fileslist/Android.bp
  cmd/host_bionic_inject/Android.bp
  cmd/javac_wrapper/Android.bp
  cmd/merge_zips/Android.bp
  cmd/multiproduct_kati/Android.bp
  cmd/path_interposer/Android.bp
  cmd/pom2bp/Android.bp
  cmd/pom2mk/Android.bp
  cmd/sbox/Android.bp
  cmd/soong_build/Android.bp
  cmd/soong_env/Android.bp
  cmd/soong_ui/Android.bp
  cmd/zip2zip/Android.bp
  cmd/zipsync/Android.bp
  cuj/Android.bp
  dexpreopt/Android.bp
  dexpreopt/dexpreopt_gen/Android.bp
  env/Android.bp
  etc/Android.bp
  filesystem/Android.bp
  finder/Android.bp
  finder/cmd/Android.bp
  genrule/Android.bp
  jar/Android.bp
  java/Android.bp
  java/config/Android.bp
  kernel/Android.bp
  linkerconfig/Android.bp
  linkerconfig/proto/Android.bp
  makedeps/Android.bp
  partner/Android.bp
  phony/Android.bp
  python/Android.bp
  python/tests/Android.bp
  remoteexec/Android.bp
  rust/Android.bp
  rust/config/Android.bp
  scripts/Android.bp
  sdk/Android.bp
  sh/Android.bp
  shared/Android.bp
  symbol_inject/Android.bp
  symbol_inject/cmd/Android.bp
  sysprop/Android.bp
  tradefed/Android.bp
  ui/build/Android.bp
  ui/logger/Android.bp
  ui/metrics/Android.bp
  ui/metrics/proc/Android.bp
  ui/status/Android.bp
  ui/terminal/Android.bp
  ui/tracer/Android.bp
  xml/Android.bp
  zip/Android.bp
  zip/cmd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  finder/fs/Android.bp
  third_party/zip/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work

Change-Id: Ia47ca14f16b8c9f84f9d533a07e5b00e2c04e8d4
2021-02-06 04:23:21 +00: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
Julien Desprez
95ea917f86 Remove hosttestlib from suite dependencies
Test: make cts
Bug: 171326035
Change-Id: I2bfdbbb0e90d7b88002901141635f6733cae49f1
2020-10-20 13:23:27 -07:00
Jooyung Han
1e611b858f Move tradefed_binary.go into subdir
Having two packages in the same directory makes it harder for go tools
to understande the directory structure.

For example, in build/soong, "go test ./cc/..." fails with cyclic
package imports.

Bug: n/a
Test: go test ./cc/... (in build/soong)
Change-Id: I7a040bf30b1e001680dd43fed9747e9651372274
2020-10-19 01:55:06 +00:00
Julien Desprez
37de54ea11 Add the Tradefed binary (suite) rules to soong
Test: make cts
Bug: 170967708
Change-Id: Ia9303dd1fd137e227b22db1a433bcf7140f083a5
2020-10-15 19:07:55 -07: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
Jaewoong Jung
4b79e98a6e Soong package structure refactoring
Give prebuilt_etc and sh_binary their own packages and split the
gigantic main Android.bp up to small, per-package ones.

Test: m nothing, TreeHugger
Bug: 156980228
Change-Id: I7b00cd344b9f16861f1ff39edf0029f016b853d0
2020-06-01 13:44:48 -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