Commit graph

53 commits

Author SHA1 Message Date
Jooyung Han
3ae4cca6e1 sh_test: Support per-testcase directories
Similar to cfb0f5e102

Bug: n/a
Test: add a new CTS sh_test_host module with duplicate 'data';
Change-Id: Ie7d183bb5703d616d61d7dcb7c8b44502de429bb
2022-02-22 16:33:24 +09:00
yangbill
22bafec042 Propagate data_bins from Soong to Make
Write the list of a test module's data_bins value to the
`LOCAL_TEST_DATA_BINS` Makefile variable defined for each module.
This enables downstream tools to correctly set up the runtime
environment for execution. And currently only sh_test, cc_tests, and
rust_tests has this attribute in Android.bp.

Bug: 215234071
Test: m out/soong/Android-aosp_cf_x86_64_phone.mk
Change-Id: I8d47f5f9b25afdc5975c6b414405badb38dbde4b
2022-02-17 04:06:34 +00:00
Sundong Ahn
a5c5b9c845 Support installable property
Support not installing sh_binary when installable property is false

Bug: 205065320
Test: m -j
Change-Id: I71a0fd24e8867d6cb2527ecdacc775253f12c9f8
2022-01-12 03:29:17 +00:00
Liz Kammer
48c6ead90d sh_binary: Use pointers for optional attributes
Empty strings for filename and sub_dir were unnecessicarily always being
propagated to BUILD files.

Test: build/bazel/ci/bp2build.sh
Change-Id: I39d6af12b1decd1d3813b92daa862ebc025daa7d
2021-12-21 16:01:53 -05:00
Colin Cross
c68db4b305 Remove InstallBypassMake and ToMakePath
InstallBypassMake and ToMakePath are obsolete, remove them.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
2021-12-15 15:22:53 -08:00
Liz Kammer
be46fccc40 Use one mutator for all bp2build conversion.
Each conversion required defining a separate mutator, which will each
operate on _all_ modules and requires each to repeat checks whether the
mutator should operator. Instead, we introduce a single mutator and
modules can define a ConvertWithBp2build to implement bp2build
conversion for that module.

Test: bp2build.sh
Bug: 183079158
Change-Id: I99d4b51f441c2903879092c5b56313d606d4338d
2021-12-14 09:37:45 -05:00
Yu Liu
b302455879 Support filename and sub_dir attributes in sh_binary
Test: test by building system/timezone/apex:com.android.tzdata
Change-Id: I08114910fccbdacf6750e237d3e80ba37fde7651
2021-12-02 14:42:20 -08:00
Ivan Lozano
d06cc748c1 Use new soong_cc_rust_prebuilt.mk
soong_{cc,rust}_prebuilt.mk has been merged. Use the new file.

Bug: N/A, clean-up
Test: m
Change-Id: I3f03e866815f6394aacd8cb0deba04f381b78c29
2021-11-12 13:27:58 -05:00
Colin Cross
94bf518932 Add symlinks to Soong-installed sh_binary
I3f9928c6d6993c381859b80c335b800b1a9769ee moved sh_binary installation
to Soong, but the Soong install rules didn't include the symlinks.

Bug: 204136549
Test: m checkbuild
Change-Id: I8dd663c7d6a3259b397a11787e0869f32d0530cd
2021-11-09 17:25:57 -08:00
Colin Cross
7e07e20723 Move sh_binary module installation into Soong
Move sh_binary module installation rules into Soong by overriding
InstallBypassMake.

Bug: 204136549
Bug: 205530905
Test: m checkbuild
Test: m && acloud create --local-instance --local-image
Change-Id: I3f9928c6d6993c381859b80c335b800b1a9769ee
2021-11-08 13:32:02 -08:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
447f6c99c9 Bp2Build common properties auto-handling
Introduce `commonAttributes` & `fillCommonBp2BuildModuleAttrs used in
CreateBazelTargetModule

Adapt `bp2BuildInfo` to use `commonAttrs` instead of `Name`.
And thus also all downstream users of `CreateBazelTargetModule`.

As initial user, the Soong `required` property will be
translated to Bazel's `data`.

Bug: 198146582, 196091467
Test: build_converstion_test.go:TestCommonBp2BuildModuleAttrs
Test: go test
Test: mixed_{libc,droid}.sh
Change-Id: Ib500e40f7e2cb48c459f1ebe3188962fc41ec124
2021-10-04 14:43:04 +00:00
Rob Seymour
f6c37cc87d Merge "Add module based host-tools snapshot" 2021-09-14 14:47:03 +00:00
Rob Seymour
925aa09ea1 Add module based host-tools snapshot
Add new module:
host_snapshot {
    name: "host-snapshot"
    deps: [
      (list of host tools)
    ],
    ...
}

Package host tools using android.PackagingBase to capture host tools and transitive packaging data.
Add JSON meta data to snapshot that allows snapshot to be installed via development/vendor_snapshot/update.py

Add support to generate a fake host snapshot of all host modules that is used to detect required
modules via development/vendor_snapshot/update.py.

Bug: 192556798
Bug: 194799048
Bug: 192896149
Test: m HOST_FAKE_SNAPSHOT_ENABLE=true host-fake-snapshot dist -- check snapshot exists in dist

Change-Id: I849c4db801cd858408f6fe6a3ce69262a23a5be9
2021-09-13 21:29:14 +00:00
Liz Kammer
2ada09a546 Don't create a new module for bp2build conversion.
A performance improvement for bp2build as Blueprint/Soong no longer have
the overhead of additional modules. The creation of these modules
results in:
* traversal of additional modules for each subsequent mutator
* synchronization over a go channel to collect newly created modules:
https://cs.android.com/android/platform/superproject/+/master:build/blueprint/context.go;l=2594,2600;drc=1602226f23181b8c3fbfcaf3358f0297e839d7d3

We avoid both of these by storing the information directly in the
underlying module.

Also as a fringe benefit, removes some necessary boilerplate for
conversion.

For benchmarks, reduces runtime ~1% for 1% converted, ~24% for 100%
converted. See more: go/benchmarks-for-https:-r.android.com-1792714

Test: ran benchmarks/tests in bp2build
Test: build/bazel/ci/bp2build.sh
Change-Id: Ie9273b8cbab5bc6edac1728067ce184382feb211
2021-08-17 15:57:09 -04:00
Julien Desprez
06f1399d5f [WIP] Switch sh_test_host to unit_tests=true by default
Test: presubmit
Bug: 192278266
Change-Id: Ief6f8fa753f13f0a4944a0a183a12497f138e1e8
2021-06-28 13:41:43 -07:00
Dan Shi
b40deac018 Add unit_test test option in sh_test_host
This change allows sh_test_host to be included
in host-unit-tests suite when test option `unit_test` is set to true.

Bug: 183209767
Test: m host-unit-tests
Change-Id: I5b441d5f49468cb681eb414dade8a1309c6e810a
2021-05-24 12:06:23 -07:00
Inseob Kim
08758f08e9 Add debug ramdisk variant.
A module will be installed to /debug_ramdisk if debug_ramdisk is set to
true.

This is a reland of f84e9c05e2, with a fix
that removes /first_stage_ramdisk.

Bug: 184004542
Test: soong test
Change-Id: I739de63cfec6b0fec5a90f7c4741fc4d884d209c
2021-04-29 22:58:17 +09:00
Inseob Kim
aeb6bad073 Revert^3 "Add debug ramdisk variant"
836a8f3d61

Change-Id: If59529238e26a197bc33b10245b88f538f280ed0
2021-04-22 23:14:58 +00:00
Florian Mayer
836a8f3d61 Revert^2 "Add debug ramdisk variant"
78ea2f5eac

Change-Id: I6a6a2ee82e2807045364bab105ec03a1934b411f
2021-04-22 16:38:47 +00:00
Bowgo Tsai
78ea2f5eac Revert "Add debug ramdisk variant"
This reverts commit f84e9c05e2.

Because this breaks the usage of boot-debug.img and
vendor_boot-debug.img

Bug: 185970130
Bug: 185990198
Test: make bootimage_debug
Change-Id: I7886c971982faae1d5bc34688643de8d94d6e201
2021-04-22 09:49:24 +08:00
Inseob Kim
f84e9c05e2 Add debug ramdisk variant
A module will be installed to debug_ramdisk (or
debug_ramdisk/first_stage_ramdisk if recovery as boot is true) if
debug_ramdisk is set to true.

Bug: 184004542
Test: soong test
Change-Id: Ic5a4d27407e506fffa462de2149e0785f11b2ac7
2021-04-15 00:56:30 +00:00
Jingwen Chen
0702791a99 bp2build: arch-configurable selects for label list attrs.
This CL adds the configurable LabelListAttribute support to bp2build.

Test: go test
Change-Id: I2ef9e385d9cf1b1845988128eca1d8cda1ecb5e8
2021-03-30 13:22:48 +00:00
Jingwen Chen
12b4c2706d bp2build: add allowlist for package-level conversions.
This CL adds the support for specifying lists of directories in
build/soong/android/bazel.go, which are then written into
out/soong/bp2build/MANIFEST. Using this configuration,
modules/directories can either default to bp2build_available: true or
false, while still retaining the ability to opt-in or out at the module level.

It also ensures that ConvertWithBp2Build returns true iff the module
type has a registered bp2build converter.

Test: go tests
Test: demo.sh full
Test: TreeHugger presubmits for bp2build and mixed builds.

Change-Id: I0e0f6f4b1b2ec045f2f1c338f7084defc5d23a55
2021-03-24 02:27:19 -04:00
Paul Duffin
56fb8ee920 Support test fixtures in sh package
Restructures the sh package test setup code to create FixturePreparer
instances for setting up a test fixture and converts some tests to
use it.

The goal with this change is not to switch all the sh tests over to
directly using the new model but instead to ensure that the majority of
the sh tests run with the new model, to allow existing tests to easily
switch to the new model when needed and to allow dependent packages to
be switched to the new model.

Bug: 181070625
Test: m nothing
Change-Id: Ib2c6ac2842d6fafde5663d3ee63c3f934913a00e
2021-03-09 23:07:22 +00:00
Treehugger Robot
bbfd5ab606 Merge "Move bazel.Properties to a BazelModuleBase" 2021-02-24 05:53:25 +00:00
Liz Kammer
ea6666fba9 Move bazel.Properties to a BazelModuleBase
This allows more direct access to the bazel label and whether the module
is bp2build available.

Test: go test *
Change-Id: I23375835d20fa53d7d94127b2dc2d5bb20487bfb
2021-02-23 10:58:57 -05:00
Liz Kammer
fc46bc1ee4 Refactor BazelTargetModule
This eliminates the need to remove quotes, delete attributes, and
re-checking that name has correct prefix. Additionally, this allows
assignment directly to the BazelTargetModuleProperties struct, which
allows defaulting unused fields and clarity of which field is being set.

Test: go test soong tests
Test: ran ./build/bazel/scripts/milestone-2/demo.sh
Change-Id: Ia9bfcce76234c793a4ddd5f29a661150f83341c9
2021-02-23 08:29:40 -05:00
Colin Cross
aa2555387d Add ctx to AndroidMkExtraEntriesFunc
Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to
access providers.

Test: m checkbuild
Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
Merged-In: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
2021-02-19 23:05:40 +00:00
Rupert Shuttleworth
a1a56e8f82 Add sh_binary support to bp2build converter.
Test: Added a unit test in this CL.
Change-Id: I6e9b3c833a257414daf82e603b733e459535d206
2021-02-09 11:53:00 +00:00
Liz Kammer
356f7d45c1 bp2build: convert paths/module refs to Bazel label
This currently expands all globs, still need to support converting glob
syntax.

Test: go build_conversion_test
Test: GENERATE_BAZEL_FILES=true m nothing
Test: m nothing
Bug: 165114590
Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
2021-02-04 13:45:56 -05:00
Anton Hansson
2f6422cb1e Support python binaries in sh_test_host
Make the code for data_bins/data_device_binds module-type agnostic.

Bug: 176581143
Test: m gen_sdk_test
Change-Id: I40e8d4c06f583cae523d97ce63822960872907db
2021-01-07 09:46:48 +00:00
Jaewoong Jung
18aefc1977 Remove unnecessary snake case variables.
Test: m nothing + TreeHugger
Change-Id: I99f7162944daa6c57c6ae4763261e108bb5cb6b1
2020-12-22 12:38:35 -08:00
Liz Kammer
57f5b33ad3 Add test suite handling to central androidmk code
MTS is introducing partial MTS test suites that are per-module, with
names of the format: mts-${MODULE}. By centralizing the code for test
suites, we can automatically add "mts" test suite when an
"mts-${MODULE}" test suite is specified, reducing duplication.

Test: m mts
Bug: 170318013
Change-Id: I8ce9d3c252fcc0a937bb5f2826d21cb6c6932d82
2020-12-01 12:23:56 -08:00
Yifan Hong
39143a941f Fix path conflict for vendor_ramdisk_available
... and ramdisk_available modules. If a module is both
vendor_ramdisk_available and ramdisk_available, on a device
that mark recovery_as_boot and move_recovery_resources_to_vendor_boot
simultaneously (and incorrectly),
both will be installed to recovery/root/first_stage_ramdisk. Fix the
path conflict of the two variants by moving the vendor_ramdisk variant
to vendor-ramdisk/first_stage_ramdisk instead.

Also update comments for Vendor_ramdisk_available.

Test: m nothing -j
Bug: 156098440

Change-Id: I2b776b6fd8f5a2c361c0f6a89231e3cebc2646f0
2020-10-26 12:50:05 -07:00
Yifan Hong
60e0cfb5cb Add vendor-ramdisk image to Soong.
Add vendor_ramdisk_available and vendor_ramdisk attribute to
various rules. When a vendor_ramdisk variant of a module is
generated, it is installed to $OUT/vendor-ramdisk.

It is similar to a ramdisk image.
Test: m nothing -j

Change-Id: Ib2d16459f3094dbe21c3bdb7c016cb4b2bf62765
2020-10-22 10:26:26 -07:00
Jaewoong Jung
642916f20a Add config.AndroidFirstDeviceTarget.
Targets[Android][0] is not always the first, preferred target. Add a new
field to config to provide the correct target and begin to use it.

Test: m nothing
Test: build/soong/scripts/build-ndk-prebuilts.sh
Fixes: 156980228
Change-Id: Ib56f52424ebf47f3eee6ac62b9fd9eca2919d63a
2020-10-12 14:15:19 +00:00
frankfeng
be6ae776e5 Support auto-push of data_device_bins to device in test config auto-gen for sh-test
Bug: 148805488
Test: m
Test: ziptool-tests:
Change-Id: Iee4e8550dc77220ea576c5c33ade5d3b770573f0
2020-09-28 13:22:57 -07:00
Colin Cross
cc83efbb18 Create image variations for sh_binary
AddFarVariationDependencies was broken, which allowed apex modules
to depend on sh_binary even though they were requesting an image
variation and sh_binary did not have one.  Create image variations
for sh_binary.

Test: TestApexWithShBinary
Change-Id: I1ff35ea9967edafbb7812a5e56667e4385af7e2f
2020-08-21 14:27:34 -07:00
Jaewoong Jung
6e0eee522d Add data bin and lib properties to sh_test
This attempts to reland I7b64de4b06e9bba3fba3712b25dd9f9d112e1625
by fixing Mac-related test issues, yet again.

Test: sh_binary_test.go
Test: Modified ziptool-tests
Bug: 156980228
Change-Id: Id3952e136c1dabfcd34048b6c9f31d0125a623df
2020-08-18 09:25:34 -07:00
Jaewoong Jung
105699aee2 Revert "Add data bin and lib properties to sh_test"
This reverts commit a41a8877cb.

Reason for revert: Broke Darwin builds

Change-Id: I4371d735ffea51f7c349b4d223bc91c103163015
2020-08-18 15:34:45 +00:00
Jaewoong Jung
a41a8877cb Add data bin and lib properties to sh_test
This attempts to reland I7b64de4b06e9bba3fba3712b25dd9f9d112e1625
by fixing Mac-related test issues.

Test: sh_binary_test.go
Test: Modified ziptool-tests
Bug: 156980228
Change-Id: Icb7bfb183f6a1d429caefc05b0550aff292d7633
2020-08-17 10:01:41 -07:00
Jaewoong Jung
cc1bfd6aa0 Revert "Add data bin and lib properties to sh_test"
This reverts commit 91dbd520de.

Reason for revert: Fix CLs didn't completely fix the builds.

Test: sh_binary_test.go
Bug: 156980228
Bug: 164465992
Change-Id: I1ed214c2ea6cd460db909a103c4b3a9a895ad9f7
2020-08-14 18:11:23 -07:00
Jaewoong Jung
91dbd520de Add data bin and lib properties to sh_test
Test: sh_binary_test.go
Test: Modified ziptool-tests
Bug: 156980228
Change-Id: I7b64de4b06e9bba3fba3712b25dd9f9d112e1625
2020-08-13 15:36:44 -07:00
Jaewoong Jung
4aedc86c6c Add module name to sh_test install path.
This relands Ibb1d774709ea421e18d5350009c203f83c5b2d60 after fixing
a backward compatibility issue where some test configs rely on sh_tests
not having a module name in their paths when sub_dir is specified.

Bug: 156980228
Test: m ziptool-tests
Test: sh_binary_test.go
Change-Id: If0521a008e7170d94b601f3df9dd0c12d1c96d21
2020-06-18 17:15:48 -07:00
Jaewoong Jung
fe25dc9f3b Merge "Revert "Add module name to sh_test install path."" 2020-06-12 04:08:28 +00:00
Michael Butler
0c55445b72 Revert "Add module name to sh_test install path."
This reverts commit 2d4f1a2f7e.

Reason for revert: Droidcop: Potential culprit for Bug 158778263 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Bug: 158778263
Change-Id: I5287b3c9331b08925dd22b32c84e4c3b6f71b58a
2020-06-11 21:17:30 +00:00
Jaewoong Jung
9e90e61ffd Merge "Add module name to sh_test install path." 2020-06-11 16:45:56 +00:00
Treehugger Robot
f2d19b5f34 Merge "Fix using generated test configs for sh_test, python_test and rust_test modules" 2020-06-11 08:11:16 +00: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
Jaewoong Jung
2d4f1a2f7e Add module name to sh_test install path.
Bug: 156980228
Test: m ziptool-tests
Test: sh_binary_test.go
Change-Id: Ibb1d774709ea421e18d5350009c203f83c5b2d60
2020-06-10 17:23:46 -07:00