Commit graph

34 commits

Author SHA1 Message Date
Ronald Braunstein
c4cd7a11a1 Implement test-only for python_ rules
Similar to: aosp/3040036 and aosp/3035329, implements a test-only
property for python_library and sets it for python_host.

This combined with aosp/3045317 produces:
	gqui from  "flatten(~/aosp-main-with-phones/out/soong/ownership/all_teams.pb, teams)" proto ~/aosp-main-with-phones/build/soong/android/team_proto/team.proto:AllTeams 'select teams.kind, count(*) total, sum(teams.test_only) as test_only, sum(teams.top_level_target) as top_level, where teams.kind like "%py%"  group by teams.kind'
	+-----------------------------+-------+-----------+-----------+
	|         teams.kind          | total | test_only | top_level |
	+-----------------------------+-------+-----------+-----------+
	| cpython3_cc_defaults        |     1 |         0 |         0 |
	| cpython3_cc_prebuilt_binary |     4 |         0 |         0 |
	| python_binary_host          |   222 |         0 |         0 |
	| python_defaults             |    27 |         0 |         0 |
	| python_library              |    38 |         0 |         0 |
	| python_library_host         |   131 |         0 |         0 |
	| python_test                 |     5 |         5 |         5 |
	| python_test_host            |   172 |       172 |       172 |
	+-----------------------------+-------+-----------+-----------+

Change-Id: Iea14fcdbfd782d37ac0a3c780820deeed5f1923d
Test: m blueprint_tests
Test: go test ./python
2024-04-16 17:09:43 -07:00
Ziwei Zhang
3dfec5a2c6 Generate ATS 2.0 config for Mobly test.
- Support test_config and test_config_template
- The `config` file extension is widly used by TF. Use `configv2` for
  ATS 2.0 tests to avoid configuration errors in TF.
- Add `mobly` tag to support atest

Test: m CtsBluetoothMultiDevicesTestCases (with `runner = "mobly"`)
Bug: 299850687
Change-Id: Idbed90ab30e35aeed8cdeeb0aa0aa7adb75a3cd9
2024-02-07 10:29:29 +08:00
LaMont Jones
afe7baf47d Propagate aconfig providers for more modules.
Bug: 308625757
Test: manual
Change-Id: Iaf6d45a4259f1c6c34476c34c431344283ae2830
2024-01-10 14:03:30 +00:00
Colin Cross
402130276c Convert SetProvider to generic providers API
Convert all of the callers of SetProvider to use the type-safe
android.SetProvider API.

Bug: 316410648
Test: builds
Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
2023-12-14 16:12:20 -08:00
Colin Cross
8ff105860d Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-08 13:51:05 -08:00
Colin Cross
5c1d5fb21b Move test data installation to Soong
To generate module-info.json in Soong for b/309006256 Soong needs to
know the test data paths. Moving test data installation into Soong will
also help later for test suite packaging.

Add ModuleContext.InstallTestData that installs the files listed in a
[]DataPath alongside the test.  The files will also be passed to Make
to allow it to continue packaging them into the test suites for now.

Update the module types that are producing LOCAL_TEST_DATA entries
in their Android.mk files to go through InstallTestData instead.

Bug: 311428265
Test: atest --host toybox-gtests --test-timeout=120000
Change-Id: Ia8b964f86e584ea464667fd86a48d754d118bead
2023-11-30 13:38:49 -08:00
Aditya Choudhary
9b59352a82 Add proto for Test ownership metadata.
This Cl adds a new rule to Soong to generate test spec metadata. Also, this CL adds a provider in various test module to provide test spec related data to the Soong rule.
Will add providers and test code to other Module in the future changes.
Provider added for the following test modules in this change: android_robolectric_test, android_test, bootclasspath_fragment_test, java_test, java_test_host, python_test, python_test_host, sh_test,and sh_test_host.

Bug: 296873595

Change-Id: I5f89f72d5874bb7838ae357efdb8c6ca208e18a7
2023-11-15 09:08:02 +00:00
Zi Wang
bbb1b74cbf Add data_device_bins_both properties for python_test_host
Test: presubmits and manual verification

Bug: 274930471
Change-Id: Iafc85526afdb8264526e8a5a33319fa33a23c66b
2023-05-19 10:32:49 -07:00
Colin Cross
e8c70c5bd5 Enable host cross python test builds
Ic37c8db918873ddf324c86b12b5412952b0f2be2 converted python_binary_host
and python_library_host from HostSupportedNoCross to HostSupported,
but left python_test_host.  Do the same for python_test_host.

Fixes dependencies between java_test_host modules that create
host cross variants and python_test_host modules that were missing
host cross variants.

Bug: 282918027
Test: builds
Change-Id: Iae687aa3aa0f0b005f2dd27469f631145247a008
2023-05-18 11:51:56 -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
4d247e6f21 Refactor python rules
The goal of this cl is to simplify the python rules,
mostly by removing the "decorator" pattern that they
currently use, and instead making separate module
types for libraries, binaries, and tests that inherit
from each other.

Bug: 259718110
Test: Verified ninja files are unchanged (they only change in the list of soong sources because I added/deleted files)
Change-Id: I1e836e2cc4782c7818f91db7df7895de3b8db7ca
2023-01-25 10:40:59 -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
Zhenhuang Wang
0ac5a431a9 Move common test_options properties into the android package
Multiple modules (e.g. java, cc, python, rust) define the `test_options`
field. Extract the common properties in test_options to share across
different test rules.

Bug: 240928948
Test: `refreshmod` and diff with original module-info.json
Change-Id: I404a7a157b4ccaa53d800ee2217559ff695bd825
2022-08-17 01:19:15 +08:00
Rupert Shuttleworth
ffc4cc41a3 Revert "Fix python_binary_host module in mixed build."
Revert submission 1861755-fix_python_binary_host_in_mixed_build

Reason for revert: Broke Bazel CI, please see https://android-build.googleplex.com/builds/submitted/7879108/mixed_droid-clean/latest/view/logs/build_error.log and https://android-build.googleplex.com/builds/submitted/7879108/mixed_droid-incremental/latest/view/logs/build_error.log
Reverted Changes:
Ica457ee71:Add platform needed by python_binary_host.
Ibc8b99a92:Fix python_binary_host module in mixed build.

Change-Id: I3d6c4f6edee2d00bdc78efd5cee64f4c915baeaa
2021-11-03 09:07:26 +00:00
Wei Li
664a4fd0af Fix python_binary_host module in mixed build.
Test: USE_BAZEL_ANALYSIS=1 m genfunctosyscallnrs
Test: USE_BAZEL_ANALYSIS=1 m func_to_syscall_nrs
Test: USE_BAZEL_ANALYSIS=1 m libseccomp_policy
Bug: 201094425, 197135289

Change-Id: Ibc8b99a92149410c8a879b7a4facf6c8961a7b9f
2021-11-02 17:04:38 +00:00
Julien Desprez
66534a0144 Switch python_test_host default to unit_test:true
Test: presubmit
Bug: 183730987
Change-Id: Ib54c30c751731aaae8a46af96e809c46469659d1
2021-05-27 20:49:13 +00:00
Paul Duffin
d0890452e3 Add preparers for python
Bug: 181070625
Test: m nothing
Change-Id: I590ad62db6fd62719c83286780563cf6d55e3e17
2021-03-17 23:56:29 +00:00
Liz Kammer
d737d02f16 Add comments/refactor for python.go
Test: all soong tests
Test: m nothing
Change-Id: Ib3b95d7c2831b97026e76a39af515fd51c6cb2c7
2020-12-01 13:18:47 -08:00
Colin Cross
1bc63938f0 Add java_data parameter to python modules
csuite has a python module that wants to embed the outputs of java
modules.  This has caused issues with mismatched variants bewteen
the arch-specific python module and the common java modules.  Add
a java_data property that is similar to the data property but
uses the common arch variant.

Bug: 173977903
Test: m checkbuild
Change-Id: I0f2f0e4159650cd5d42b510d5177678e7ee91b4d
2020-11-23 18:35:55 +00:00
Dan Shi
d79572f73e Add unit_test test option in test configs
This change allows a test (native, java, rust or python) to be included
in host-unit-tests suite when test option `unit_test` is set to true.

Bug: 172006742
Test: m host-unit-tests
Change-Id: I69d3eb5b51198c549e2e6914ceac3a4fc33c3cf2
2020-11-16 11:05:00 -08:00
Dan Shi
3194912150 Add support of test data to python_host_test
Bug: none
Test: m -j vts_vndk_abi_test
confirm abi_dump.zip found next to test binary

Change-Id: I834dddfc13eb9e7addd234307b085b16124db234
2020-09-21 14:36:43 -07:00
Colin Cross
a6384821f9 Fix using generated test configs for sh_test, python_test and rust_test modules
Annotate the test config properties with android:"path", and always
use LOCAL_FULL_TEST_CONFIG to pass the path to Make.

Bug: 157621988
Test: manual
Change-Id: I1c020e642f83d994d63c9e9cb56e686086d5acaa
2020-06-10 22:48:16 -07: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
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
Julien Desprez
e146e39fa6 Support 'test_config' into soong modules
Test: make general-tests
Bug: 110982517
Change-Id: Ib2eab2653fdfce6f699b85c9fbc64558b6d40363
2018-08-07 15:51:21 -07:00
Nan Zhang
d9ec5e7dea Revert "Revert "Change Python in Soong to support device side build.""
This reverts commit 0a32e5936b.

Reason for revert: <libsqlite was missing for darwin_x86_64 before>

Change-Id: I2e13e849a503a705ffad425df292380f2f73954e
2017-12-01 20:00:31 +00:00
Nan Zhang
0a32e5936b Revert "Change Python in Soong to support device side build."
This reverts commit 3bba05962d.

Reason for revert: <revert mac builds>

Change-Id: I25f1380573d69f7e111287624a2d4a3d95fdd86b
2017-12-01 06:19:27 +00:00
Nan Zhang
3bba05962d Change Python in Soong to support device side build.
Add python_test to generate executables for both host and device side.
And change python_library_host to python_library.

installation for python device test will be under
target/product/generic_arm[64]/data/nativetest[64].

Bug: b/69114465
Test: m clean && m -j
Device Test:
adb root; adb push nan_devicetest /data;
adb shell; ./nan_devicetest
print(sys.path)
['/data/nan_devicetest/runfiles', '/data/nan_devicetest', '/data/nan_devicetest/internal', '/data/nan_devicetest/internal/stdlib']

Change-Id: If8317070a3aa1b6dab2e84b8df2d037f495d7247
2017-11-30 13:55:49 -08:00
Nan Zhang
d4e641b6e9 <Hermetic> Replace Soong Python bootstrap process with embedded
launcher.

For Python2, we bundle embedded launcher as bootstrapper within every
.par file. This feature is only enabled for linux_x86_64 for now. We
provide a user flag: hermetic_enabled within bp file. By default, Pyhon2
still use classic bootstrapping way to construct .par file and relys on
host interpreter. Once embedded_launcher is enabled, launcher will be
used to bootstrap .par file and execute user program.

For Python3, the launcher will be ready soon, and for now it still relys
on classic bootstrapping.

Test: Real example is used to test.

Bug: b/63018041

Change-Id: I28deba413d8ad3af407595e46f77d663e79a3705
2017-09-05 17:26:57 -07:00
Colin Cross
36242850fd Refactor factories
Change module factories from returning a blueprint.Module and a list
of property structs to returning an android.Module, which holds the
list of property structs.

Test: build.ninja identical except for Factory: comment lines
Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
2017-06-30 21:08:36 +00:00
Nan Zhang
5323f8e32f Add python_test_host module.
bug: 31676493
Test: created py_test modules in real folder. and ran 'mma'.
Change-Id: I22aa2fad74b11e4a31ea7a4c4a4f0ea64cd3fc94
2017-05-17 11:26:00 -07:00