Commit graph

34240 commits

Author SHA1 Message Date
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
Lukacs T. Berki
7d613bfe2c Make it possible to debug soong_ui.
This works by setting the SOONG_UI_DELVE= environment variable to the
port on which soong_ui should accept a Delve connection on.

This is achieved by reusing the Delve execution logic between soong_ui
and soong_build.

Test: Manual.
Change-Id: Id2c1d4b6faac1a4a3918c91030ce2239f7daf54f
2021-03-08 08:27:58 +01:00
bralee
c117f6fc00 AIDEGen: Add "-fprofile-sample-use" parameter into category.
"-fprofile-sample-use" parameter needs to be added to
categorizeParameter function.

Bug: 181817731
Test: 1. aidegen -a -i c art build bootable frameworks/base/core libnativehelper external/protobuf external/gflags external/googletest hardware/interfaces/health packages/modules/Gki system/apex system/core/fastboot system/core/fs_mgr system/core/healthd system/core/init system/core/libbinderwrapper system/core/libcutils system/core/liblog system/core/libprocessgroup system/core/libutils system/core/property_service system/core/rootdir system/core/storaged system/extras system/gsid system/hwservicemanager system/libbase system/libhidl system/libhwbinder system/libvintf system/sepolicy system/update_engine test tools
      2. CLion launched without errors in 'CMake' tag.
Change-Id: I4e9b0fd19fe00d23a9aa535b1ab7ade9c4a46f69
2021-03-08 09:33:23 +08:00
Jiyong Park
5e914b286f sysprop_library correctly supports apex_available and min_sdk_version
This fixes a bug that apex_available and min_sdk_version properties of a
sysprop_library module are not forwarded to the generated cc or java
modules.

Bug: 181942475
Bug: 181940232
Test: m nothing

Change-Id: I03bcb5836f080aecd452021a3ffe003f36eb652e
2021-03-08 10:11:00 +09:00
Paul Duffin
c05b034e95 Separate the collation of mutators from registration
This separates the collation of mutators from the registration of them
to allow the test infrastructure to sort the mutator order to match
that used at runtime.

Bug: 181953909
Test: m nothing
Change-Id: I01a073289d44417f327b0815c09eb1c033d464f2
2021-03-07 12:33:07 +00:00
Paul Duffin
1d2d42f8e9 Add sortableComponent abstraction
In preparation for following changes that will ensure the order of
registration (and so execution) for mutators, singletons and
pre-singletons in tests match the order in runtime this change creates
the sortableComponent interface to allow those to be sorted in the same
way without having to resort to reflection.

By moving the registration code into each component type this change
also eliminates some unnecessary duplication of that code.

Bug: 181953909
Test: m nothing
Change-Id: I597b461b966c84faaeb13e7dff765f1fadd99981
2021-03-07 12:33:07 +00:00
Paul Duffin
6d3e726887 Merge "Fix build break caused by registering genrules twice" 2021-03-06 10:09:15 +00:00
Paul Duffin
cdcd2be1ff Fix build break caused by registering genrules twice
Two separate changes that passed presubmits separately and did not
conflict when merged together unfortunately clashed at runtime. The
changes are:
* Ic00c7e480dc738d7a88d038aca6ab95a1502a24a
* Ic98fdc29a63155174a3227e7e918b26f0a8763bb

Test: m nothing
Change-Id: I7b5704c22cc2ea2095f5fb92c59f0526bb445f13
2021-03-06 10:03:22 +00:00
Paul Duffin
77bfa3e792 Merge "Do not ignore error when writing environment file" 2021-03-06 09:57:36 +00:00
Paul Duffin
6bd87750ae Merge "Add Errs to TestResult" 2021-03-06 08:46:38 +00:00
Paul Duffin
059f7f1ff3 Merge "Make error handlers treat any failures as fatal" 2021-03-06 08:45:54 +00:00
Paul Duffin
87d7dd918a Merge "Avoid SetErrorHandler mutating FixtureFactory" 2021-03-06 08:44:51 +00:00
Paul Duffin
0805d4ebdd Merge "Clean up cc.RegisterRequiredBuildComponentsForTest()" 2021-03-06 08:43:56 +00:00
Paul Duffin
166a488efe Merge "Rename FixturePreparers to GroupFixturePreparers" 2021-03-06 08:42:53 +00:00
Paul Duffin
97c8128eea Merge "Fix mutator ordering issue in apex tests" 2021-03-06 08:38:14 +00:00
Treehugger Robot
d8570b3077 Merge "Remove wired corpus name, use the one from the environment" 2021-03-06 08:09:25 +00:00
Julien Desprez
b1778a42cb Merge "Revert "Revert "Attempt to run all java_test_host that look unit..."" 2021-03-06 02:40:44 +00:00
Colin Cross
997f27aa03 Fix nested properties in soong config structs
Fix recursing into nested properties when creating the structs for
affectable properties in soong config modules.

Fixes: 181156850
Test: Test_createAffectablePropertiesType
Change-Id: I4fb645d7e334977d0bbf192c3b43a7bba8289f49
2021-03-05 17:26:37 -08:00
Colin Cross
cd2df5dec6 Merge "Exempt framework-res from UseApiFingerprint" 2021-03-05 23:34:37 +00:00
Colin Cross
3903d401d0 Merge changes from topic "lint_repackage"
* changes:
  Remove lint outputs to prevent showing old lint results on error
  Make common dependencies of lint use restat
  Use repackaged lint binary
2021-03-05 23:34:14 +00:00
Sasha Smundak
5a27bdad7e Remove wired corpus name, use the one from the environment
Bug: 181825150
Test: run build/soong/build_kzip.bash, verify that the 'corpus' field
is still present and correct

Change-Id: I66cf44af9927d52c8fc014d93240d29c0e91c7ae
2021-03-05 15:23:04 -08:00
Colin Cross
382ba06c27 Pass ANDROID_SDK_HOME to metalava so it doesn't write to ~/.android
Give metalava an ANDROID_SDK_HOME directory in the out tree so it
doesn't write to ~/.android.

Bug: 181908035
Test: mv ~/.android ~/.android.bak && m car-doc-stubs
Change-Id: I63064ece62ff4aa1eb93cbb6c9e33038c1e8a19d
2021-03-05 14:01:44 -08:00
Paul Duffin
eaadd67a99 Reinstate the enforcement of stable core platform API usage
It appears as though change I3a39be5f0b8736de4822c6a14072c78d4e4ad89d
accidentally stopped enforcing the use of the stable core platform
API in AOSP when the changes from rvc-dev-plus-aosp-without-vendor were
merged in.

Unfortunately, since then some additional usages of legacy core
platform APIs have crept in so this adds the affected modules to the
list of modules allowed to use the legacy core platform APIs.

Bug: 180399951
Test: m checkbuild
Change-Id: Ieddaf859f568bc8ee486692474a4dec48b3d25e6
Merged-In: I15e5a6c2f07e73718803501d705de0d7ab9bec90
Merged-In: Ib084ee6676d4a201f4b60533221036245d3be759
Merged-In: I629ed1454def5cf8164a6079034e2c610ed0a554
Merged-In: Ia7613f35c4392eac51c94b0d1da29ecac82eb103
2021-03-05 21:29:41 +00:00
Jaewoong Jung
083e6cd267 Merge "Clear remains of java.Dependency interface." 2021-03-05 21:11:15 +00:00
Colin Cross
2669e7edf0 Exempt framework-res from UseApiFingerprint
Generating the API fingerpring depends on framework-res, so the
fingerprint cannot be embedded into framework-res.  Hardcode an
exemption to UseApiFingerprint.

Bug: 181978889
Test: TARGET_BUILD_VARIANT=user UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true vendor/google/build/build_mainline_modules.sh
Change-Id: I621f36d5eb157dd97baa132ff109b4df791eedcc
2021-03-05 19:54:31 +00:00
Colin Cross
2787e8e65e Support robolectric prebuilts in android_robolectric_test
The version of robolectric in external/robolectric-shadows is based
on 4.1 and is difficult to update.  Support using the prebuilt versions
in prebuilts/misc/common/robolectric, with the caveat that they won't
support the in-progress SDK version.

Bug: 181886851
Test: manual
Change-Id: Ie3a861cf6d637f97cf00212c02322f92c1043f0a
2021-03-05 19:22:30 +00:00
Colin Cross
31972dc487 Support remoting lint commands with RBE
Bug: 181681346
Bug: 181912787
Test: m USE_RBE=true RBE_LINT=true lint-check
Change-Id: I10596c40dc5e29075ba0cab51ea9a98cc58b3188
2021-03-05 11:13:40 -08:00
Paul Duffin
6d119b804c Fix mutator ordering issue in apex tests
Previously, the override mutators were being run before the prebuilt
mutators that did not match the runtime behavior. This change fixes
that ordering.

In the process it broke TestApexWithAppImportsPrefer. That test tries
to verify that an apex that depends on an android_app will use an
android_app_import if that is preferred. Unfortunately, it only worked
because of the incorrect order of the mutators.

The test worked before this change because the prebuilt mutators were
being run after the overridableModuleDepsMutator. That meant that any
dependencies added by that mutator onto source modules could be
replaced by the PrebuiltPostDepsMutator with the preferred prebuilt
module.

Switching the order to match the runtime meant that the prebuilt
mutators were run before the overrides so never had a chance to replace
the dependencies added by the overrides.

Bug: 181953909
Bug: 181974714
Test: m nothing
Change-Id: Ic98fdc29a63155174a3227e7e918b26f0a8763bb
2021-03-05 18:38:58 +00:00
Paul Duffin
942481b3f5 Add Errs to TestResult
Makes the error handler a little cleaner.

Bug: 181070625
Test: m nothing
Change-Id: I0f9050a98346d7d214eed570957d9810aaf26def
2021-03-05 18:20:33 +00:00
Paul Duffin
ea8a386346 Make error handlers treat any failures as fatal
A lot of existing tests that expect errors to be reported do not check
the returned result. This change treats failures of the error handler
in that situation as fatal.

The default error handler already behaved that way. The others did not.

FixtureExpectsAllErrorsToMatchAPattern uses
CheckErrorsAgainstExpectations and it was safe to just make that func
treat any unmatching errors as fatal as all the existing usages are at
the end of test functions.

FixtureExpectsAtLeastOneErrorMatchingPattern uses the
FailIfNoMatchingErrors function which is used in a number of places
(including CheckErrorsAgainstExpectations) that do not want to treat
a test failure as fatal. So, that was modified to return false if no
matching error was found and the error handler treated that as fatal.

Bug: 181070625
Test: m nothing
Change-Id: I6e4df53f93250348bc050d4ff098134e6314ae30
2021-03-05 18:20:33 +00:00
Paul Duffin
52323b5113 Avoid SetErrorHandler mutating FixtureFactory
A FixtureFactory is supposed to be immutable to allow them to be safely
shared but unfortunately the implementation of SetErrorHandler broke
that constraint. That made it very easy to mistakenly add an error
handler specific to a test to a shared factory breaking other tests
that use that factory.

This change causes SetErrorHandler to create a new instance of the
factory to avoid that.

Bug: 181070625
Test: m nothing
Change-Id: Ia5356a04189099c88880a2a521af29ab72560f30
2021-03-05 18:20:33 +00:00
Paul Duffin
d6ceb8600c Clean up cc.RegisterRequiredBuildComponentsForTest()
Changes this function so it only registers components from the cc
package by pushing the call to genrule.RegisterGenruleBuildComponents()
down into those packages whose tests need it.

This will make it easier to migrate cc package tests to test fixtures
as the RegisterRequiredBuildComponentsForTest() no longer overlaps with
preparers from the genrule packages.

Bug: 181070625
Test: m nothing
Change-Id: Ic00c7e480dc738d7a88d038aca6ab95a1502a24a
2021-03-05 18:20:33 +00:00
Paul Duffin
a560d5a91d Rename FixturePreparers to GroupFixturePreparers
FixturePreparers is a bad name for a method that creates a collection
of FixturePreparers for a couple of reasons:
* Conventionally it would be used as the name for []FixturePreparer if
  it is necessary to add behavior to that.
* There are many different types of collection, particularly when order
  matters.

Bug: 181070625
Test: m nothing
Change-Id: I55394ff369375dcac2d7b72e4d803a4818762d36
2021-03-05 18:20:33 +00:00
Nicolas Geoffray
863f3b9fb4 Stop using '&' for class loader context.
Test: m
Bug: 132357300
Change-Id: I01a5008d5b84820f793c1c23fe2e4c4687cf4acf
2021-03-05 18:14:10 +00:00
Treehugger Robot
b48f9aefea Merge "Correct fmt printf error in bazel_handler" 2021-03-05 18:08:39 +00:00
Julien Desprez
b216661e84 Revert "Revert "Attempt to run all java_test_host that look unit..."
Revert reland the change after tests have been fixed

Reason for revert: relanding after fixes
Reverted Changes:
I89fbce4d7:Revert "Exclude some tests for java_test_host onbo...
Iaa89f9b7e:Revert "Attempt to run all java_test_host that loo...

Change-Id: Idaa80b2d5a8d3ba026e33b453bd163a4e2d31118
2021-03-05 18:08:36 +00:00
Paul Duffin
5e85c665d0 Do not ignore error when writing environment file
Test: m nothing
Change-Id: I4281e22ae10a649b51b9fbed7f8c1554f18885b9
2021-03-05 17:46:29 +00:00
Hai Zhang
9bb022a4aa Allow PermissionController to set min_sdk_version to 30.
PermissionController is updatable since R, so its minimum SDK version
should be 30.

Bug: 174770904
Test: build
Merged-In: I5c98dc0053687bd4601ab06f6e092aeb851cdba7
Change-Id: I5c98dc0053687bd4601ab06f6e092aeb851cdba7
2021-03-05 17:46:25 +00:00