Commit graph

34329 commits

Author SHA1 Message Date
Paul Duffin
02a3d65402 Support test fixtures in cc package
Restructures the cc 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 cc tests over to
directly using the new model but instead to ensure that the majority of
the cc 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: I00415f10fb44c1b9e78e1317e7f50bb61984d3a4
2021-03-09 23:06:00 +00:00
Paul Duffin
72018ad136 Add temporary RunTestWithConfig method to simplify migration
Bug: 181070625
Test: m nothing
Change-Id: I4be2a16cff750bbe05010ff427cec1831e260267
2021-03-09 23:06:00 +00:00
Paul Duffin
8edc99c803 Simplify TestSdkInstall
Test: m nothing
Change-Id: Iff59c8c331402b8d53323072213579ed9956cd90
2021-03-09 23:03:48 +00:00
Paul Duffin
6d9108f047 Extract sdk registration code into function for reuse
Test: m nothing
Change-Id: I0d0e36324808831deb9a32f07ca3696125703873
2021-03-09 23:03:45 +00:00
Paul Duffin
667893c657 Extract apex registration code into function for reuse
Test: m nothing
Change-Id: Id2c918891ecd9e874004f6828f71374bf0cdb9e4
2021-03-09 23:03:40 +00:00
Paul Duffin
9c35c5d2a6 Merge "Simplify preparers now that tests use consistent registration order" 2021-03-09 23:00:57 +00:00
Paul Duffin
8bd286590b Convert license tests to use test fixtures
Used to exercise the new functions to allow the env configuration of a
test fixture to be customized.

Bug: 181070625
Test: m nothing
Change-Id: Iea1d7b20498d690fcade4b6699a70773ea9175c2
2021-03-09 21:19:22 +00:00
Paul Duffin
672cb9fbc7 Convert genrule tests to use test fixtures
Bug: 181070625
Test: m nothing
Change-Id: I7dae0aa0e493e2073286360038ddaafa2d90093c
2021-03-09 21:15:40 +00:00
Colin Cross
41ad6b632f Revert "Skip old file cleanup for non-full builds."
This reverts commit 6e49493dac.

FULL_BUILD is not set during the config stage, so this never calls
cleanOldInstalledFiles.

Bug: 168105598
Bug: 182008128
Test: manual
Change-Id: I58a54f167763cdb77b3c1bd4f18f519fcaf8751a
2021-03-09 12:04:17 -08:00
Treehugger Robot
2046a0c1c7 Merge "Add stats directory to Rust allowed list." 2021-03-09 19:13:49 +00:00
Martin Stjernholm
4f0f3f01d9 Build heapprofd_client_api for use in the ART chroot.
Test: build/soong/scripts/build-mainline-modules.sh
Bug: 179915934
Change-Id: I4653bf705563ad2ddb077ecae7938c2dd1b818e9
2021-03-09 17:13:51 +00:00
Jooyung Han
77e7d7769e Merge "Run "prebuilt_postdeps" mutator again" 2021-03-09 16:21:33 +00:00
Jaewoong Jung
05ebca4f7f Merge "Add additional_certificates to android_app_import." 2021-03-09 14:55:24 +00:00
Lukács T. Berki
5037e09ca0 Merge "Remove the special-casing of /dev from test path normalization." 2021-03-09 14:32:51 +00:00
Paul Duffin
46e37741a9 Rename SetErrorHandler to ExtendWithErrorHandler
Bug: 181070625
Test: m nothing
Change-Id: Iacab525cb47fbd7ff54e5a95ec230ac6c71f20eb
2021-03-09 14:14:48 +00:00
Paul Duffin
2e0323dd1b Allow customization of product variables in a test fixture
Adds FixtureModifyProductVariables.

Bug: 181070625
Test: m nothing
Change-Id: Iad7e125ed722d99dc1e62479b04b625075b89d58
2021-03-09 14:14:48 +00:00
Paul Duffin
bbccfcfb70 Allow customization of the env configuration in a test fixture
Adds FixtureModifyEnv and FixtureMergeEnv.

Bug: 181070625
Test: m nothing
Change-Id: I1b6eb88907efa2476d96912961fea2df2d902659
2021-03-09 14:14:48 +00:00
Paul Duffin
ec3292bebe Distinguish between integration test and other tests
This change tries to distinguish between the preparations needed for an
integration test and the preparations needed for more unit-testy tests.

Integration tests exercise most, if not all of Soong (at least the
parts that are available when running tests in a specific package) and
as a result can take a long time. Other tests, while being as realistic
as possible, should only use a subset of the preparations in order to
reduce run time.

Registering module types has very little overhead so it is simplest to
try and register those all together. However, care needs to be taken
for singletons and mutators as they can do a lot of work. Especially
with tests that include lots of default module definitions such as are
created by java.GatherRequiredDepsForTest().

Once it is possible to use test fixtures in tests it will be much
easier to customize tests individually and so avoid just adding new
test specific content to the common deps.

Bug: 181070625
Test: m nothing
Change-Id: Ia0a676297224d90df947054746e7f99563ffb323
2021-03-09 14:14:48 +00:00
Paul Duffin
530483c61e Simplify preparers now that tests use consistent registration order
It is no longer necessary to use preparers in a specific order now that
the test infrastructure enforces a consistent registration order.

So, this change:
* Sorts preparers alphabetically to make them easier to maintain.
* Creates a single visiblity preparer for all the visibility mutators.
* Adds PrepareForTestWithPackageModule

Bug: 181070625
Bug: 181953909
Test: m nothing
Change-Id: I9e65dd182be664d8d0d5db7ccc0b63fa315129c8
2021-03-09 14:14:48 +00:00
Lukács T. Berki
706cb6f344 Merge "Really fix queryview." 2021-03-09 11:41:12 +00:00
Jiyong Park
b0eb3192c5 bootimg and logical_partition are OutputFileProducer
The two module types now implement OutputFileProducer so that we can add
them to the data dependencies of tests.

Bug: 181860941
Test: atest MicrodroidHostTestCase
Change-Id: If263fefb1e5cdb5b57c17eb389c6ecc11d8356f4
2021-03-09 20:31:51 +09:00
Treehugger Robot
c285125110 Merge "Introduce derive_classpath service." 2021-03-09 10:23:49 +00:00
Lukacs T. Berki
c5723e3af7 Remove the special-casing of /dev from test path normalization.
Test: "m nothing"
Change-Id: Ib88f1632792dc9351bcf52dbe78822acf94fad27
2021-03-09 10:50:47 +01:00
Lukacs T. Berki
b14ad7b5dc Run Ninja in a clean environment.
This sandboxes Soong's tests better.

Setting "TOP" is slightly ugly, but doing it properly would conflict
with aosp/1609218.

Test: Manual ("m nothing")
Change-Id: Ie3d3cd17f116a5fe0ad25c670fc5ed9c33f8123b
2021-03-09 10:43:57 +01:00
Ulyana Trafimovich
35570c14ce Merge "Disable verify_uses_libraries check if dexpreopt is globally disabled." 2021-03-09 08:40:23 +00:00
Lukacs T. Berki
47a9d0cd98 Really fix queryview.
In addition, make the Ninja command nicer by using backticks instead of
backslash-quoting double quotes.

Test: Manual: "m queryview"
Change-Id: I5d6e1d41424e0229bfe08e2e7eaf2fb025ed48c2
2021-03-09 09:37:53 +01:00
Paul Duffin
40786119af Merge "Store order of the components used by the tests" 2021-03-09 07:53:07 +00:00
Alexander Smundak
0fa5f78714 Merge "Workaround for b/182183061: generate corpus-specific rule file" 2021-03-09 04:02:09 +00:00
Paul Duffin
7160699044 Merge "Avoid accidentally sharing preparers slice across factories" 2021-03-09 02:42:19 +00:00
Jooyung Han
86feead0d5 Run "prebuilt_postdeps" mutator again
Because OverridablePropertiesDepsMutator is run after prebuilt_postdeps,
prebuilt's replacement doesn't affect to those deps added by overridable
properties.

By running prebuilt_postdeps again after
OverridablePropertiesDepsMutator, replacing source with prebuilts is
applied to those deps.

Bug: 152155285
Bug: 181953909
Bug: 181974714
Test: m nothing
Change-Id: I24acc02785c9580c2beca096042f1173eb28ba9a
2021-03-09 11:23:46 +09:00
Jaewoong Jung
25ae8dec91 Add additional_certificates to android_app_import.
Bug: 182175153
Test: app_import_test,go
Change-Id: I467e98065945b59dcc574a18144756edccdea441
2021-03-08 17:37:46 -08:00
Jiyong Park
acb7aeb9a8 Merge "sysprop_library correctly supports apex_available and min_sdk_version" 2021-03-09 01:37:32 +00:00
Paul Duffin
f5de6684fd Store order of the components used by the tests
Previously, the TestContext.Register() method stored all the components
that were available, rather than just the ones that were used by the
tests. That was practically useless for debugging. This change just
stores the ones used by the test.

Bug: 181953909
Test: m nothing
Change-Id: I8589b9b4423133709ab0cfd763bd284a7f47a24a
2021-03-09 01:34:41 +00:00
Paul Duffin
062d9338d1 Merge "Ensure test/runtime order of singletons/pre-singletons is consistent" 2021-03-09 01:34:07 +00:00
Treehugger Robot
2034187aa5 Merge changes I22f90c90,I2d965212,Ib7d421f5
* changes:
  Separate the collation of singletons from registration
  Defer registration of singletons and pre-singletons in TestContext
  Ensure mutators used in tests are in the same order as at runtime
2021-03-09 01:20:37 +00:00
Sasha Smundak
7049266392 Workaround for b/182183061: generate corpus-specific rule file
Bug: 182183061
Test: run build_kzip.bash, verify Go compilation units have corpus set
Change-Id: I26e034eb9bbb8fbb3902404ce72f7e223b9a5972
2021-03-08 16:29:31 -08:00
Paul Duffin
fa29885380 Avoid accidentally sharing preparers slice across factories
Previously, there was a bug that caused tests which ran successfully on
their own to fail when run together in parallel. They each extended the
same factory and ended up sharing the preparers slice which meant that
they overwrote each other's preparers causing the tests to fail.

This change fixes that by creating a new slice for each factory.

Bug: 181070625
Test: m nothing
Change-Id: If340c125c5b03a9d5c36a59ff4da4ec189808f9b
2021-03-08 22:45:09 +00:00
Paul Duffin
41d77c76ae Ensure test/runtime order of singletons/pre-singletons is consistent
Bug: 181953909
Test: m nothing
Change-Id: I77e0106ceb04b44b6559630f4a8a510f1a66378b
2021-03-08 22:40:32 +00:00
Paul Duffin
42d0b93177 Separate the collation of singletons from registration
That is to allow the order in which singletons are registered at
runtime, including the ones added by default, to be used to define the
order in which singletons must be registered in tests.

Bug: 181953909
Test: m nothing
Change-Id: I22f90c90100a8d52a572d4451a1a5d256784b57a
2021-03-08 22:40:32 +00:00
Paul Duffin
d182fb3907 Defer registration of singletons and pre-singletons in TestContext
In preparation for allowing the TestContext to enforce an ordering on
the registration of singletons and pre-singletons in the same way as it
does for mutators this defers the registration of them into the
underlying Context.

Bug: 181953909
Test: m nothing
Change-Id: I2d9652122bb6387b6b47ca4761e811885d15c2b6
2021-03-08 22:40:25 +00:00
Paul Duffin
281deb2c6e Ensure mutators used in tests are in the same order as at runtime
This change uses the order in which mutators are registered at runtime
to define the order in which mutators must be registered in tests to
improve test reliability and prevent issues like bug 181974714.

Generally, it simply sorts the test mutators into the same order as
used at runtime. However, if the test includes a mutator that is not
used at runtime then it cannot sort them because it does not have
enough information to know where it should appear in that order. So,
instead it simply checks the order and makes sure that it matches.

Allowing relationships between mutators to be explicitly defined, e.g.
mutator X should come after mutator Y but before mutator A would fix
that information gap and allow them to be sorted but that is outside
the scope of this piece of work.

The code here is written generically for a sortableComponent as
follow up changes will sort singletons and pre-singletons in the same
way.

Bug: 181953909
Test: m nothing
Change-Id: Ib7d421f578e25f6dccaaff4f73b69838d1b54b00
2021-03-08 22:24:11 +00:00
Colin Cross
6950702b93 Merge "Fix nested properties in soong config structs" 2021-03-08 22:12:56 +00:00
Paul Duffin
5a5eeace54 Merge "Separate the collation of mutators from registration" 2021-03-08 21:44:10 +00:00
Paul Duffin
4160a071d6 Merge "Add sortableComponent abstraction" 2021-03-08 21:43:54 +00:00
Colin Cross
7314fedd37 Merge "Support robolectric prebuilts in android_robolectric_test" 2021-03-08 19:08:10 +00:00
Colin Cross
110bca5bd1 Merge "Remove extra return value from testApex" 2021-03-08 18:16:23 +00:00
Artur Satayev
74030452b6 Introduce derive_classpath service.
go/updatable-classpath

Bug: 180105615
Test: manual + boot test
Merged-In: If0a3cb00754834133abea12caff3fdc5b7cff696
Change-Id: If0a3cb00754834133abea12caff3fdc5b7cff696
2021-03-08 18:06:59 +00:00
Lukacs T. Berki
89071b08c7 Fix queryview.
This got broken by aosp/1610785 which changed the assumptions
soong_build makes about its environment.

At that time, I didn't know that queryview also invokes soong_build
through another pathway.

Test: Manual: "m queryview && m nothing"
Change-Id: I06ed42aee0d97e18f634eeeaca37108009b29d78
2021-03-08 13:05:20 +01:00
Anton Hansson
921a89e376 Merge "Allow PermissionController to set min_sdk_version to 30." 2021-03-08 11:18:16 +00:00
Nicolas Geoffray
b4f9d5c837 Merge "Stop using '&' for class loader context." 2021-03-08 11:16:09 +00:00