Commit Graph

34174 Commits

Author SHA1 Message Date
Lukacs T. Berki b4ced9d886 Fix the environment of soong_build:
- Incorporate BAZEL_* variables in soong.environment.available
- Set SOONG_DELVE when requested

Test: Manual.
Change-Id: I3ac675f4876220b788cc48d288b402ac6016c37b
2021-03-10 15:43:06 +01:00
Paul Duffin 282671d696 Merge "Rename SetErrorHandler to ExtendWithErrorHandler" 2021-03-10 11:51:29 +00:00
Lukács T. Berki 5ce36b4a96 Merge "Make $PATH available when building soong_build." 2021-03-10 10:04:04 +00:00
Lukacs T. Berki 73ab928daa Make $PATH available when building soong_build.
This is exclusively used by tests so it's awful, but Darwin builds are
currently broken so let's unbreak them first then start thinking.

Test: "m nothing" on Linux (I don't have access to a mac OS machine)
Change-Id: I1ea9ca71a5aff36a3454282a4c87ad368138baaa
2021-03-10 11:02:39 +01:00
Nicolas Geoffray a0acfa8b85 Merge "Reinstate the enforcement of stable core platform API usage" 2021-03-10 09:45:52 +00:00
Paul Duffin 533274a2d3 Merge "Allow customization of product variables in a test fixture" 2021-03-10 08:17:27 +00:00
Paul Duffin 6f3d6df708 Merge "Allow customization of the env configuration in a test fixture" 2021-03-10 08:17:14 +00:00
Paul Duffin df13e97666 Merge "Distinguish between integration test and other tests" 2021-03-10 08:16:55 +00:00
Martin Stjernholm 5fae0ea155 Merge "Build heapprofd_client_api for use in the ART chroot." 2021-03-10 07:50:41 +00:00
Lukács T. Berki 4dc6eaab9a Merge "Run Ninja in a clean environment." 2021-03-10 07:03:28 +00:00
Paul Duffin 9c35c5d2a6 Merge "Simplify preparers now that tests use consistent registration order" 2021-03-09 23:00:57 +00: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
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