Commit Graph

35462 Commits

Author SHA1 Message Date
Paul Duffin
709e0e32c2 Add TestingBuildParams.RelativeToTop()
The methods returns a copy of TestingBuildParams with every usage of a
path that is relative to the temporary test build directory with a path
relative to a notional top. Similar to how PathRelativeToTop does.

Bug: 182885307
Test: m nothing
Change-Id: I6ec20fc52ed76748138f0d48b4df80f765dfcfdc
2021-03-22 22:09:53 +00:00
Paul Duffin
4e6e35c561 Improve searching for TestingBuildParams using the output file
When searching for an TestingBuildParams this change will compare the
supplied path against the value returned by PathRelativeToTop() as well
as the String() and Rel() values. In the event that it cannot find the
file it also formats the available outputs, one per line with both rel
and path relative to top.

Bug: 182885307
Test: m nothing
Change-Id: Icbd37018b9a028abf37e27d1bea12a407316e031
2021-03-22 22:09:53 +00:00
Paul Duffin
0eda26b96b Move helper methods that take testBuildProvider into baseTestingComponent
Allows the removal of the provider parameter and makes it easier to add
new functionality to baseTestingComponent.

Bug: 182885307
Test: m nothing
Change-Id: Ie8ac600cbce982f2c5fc24a22968efe0c2a29d0c
2021-03-22 22:09:53 +00:00
Paul Duffin
31a228846b Extract functionality common to TestingModule/Singleton
Bug: 182885307
Test: m nothing
Change-Id: Ib7c96b34512ad2a190a24c9dd07ea259d1378b44
2021-03-22 22:09:53 +00:00
Paul Duffin
6ff1efbce8 Replace FixturePreparer.visit() with list() am: 4ca6752b21 am: a49442d0d0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647193

Change-Id: I629febe4f9d5f339f04f268158307f9e0efe3e0c
2021-03-22 19:53:41 +00:00
Paul Duffin
dbf3455145 Remove errorHandler from FixtureFactory am: cff464f794 am: 2e831d6ae6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647192

Change-Id: I202f1f85c9afc936b71eaff54764bc264bb66dc6
2021-03-22 19:53:33 +00:00
Paul Duffin
804cf4c09a Allow access to preparers that produced a TestResult am: 592518290f am: 559c073415
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1645675

Change-Id: I2e4b049c1d9463517e23fc634461ab7a251cee50
2021-03-22 19:53:06 +00:00
Paul Duffin
38a15cd52c Merge "Ensure that DepIsInSameApex is not called for ExcludeFromApexContentsTag" am: 6bef6fee3c am: abe8504ce1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1645680

Change-Id: I46347633273789c78545c1ee9501f669135998b8
2021-03-22 19:51:47 +00:00
Pirama Arumuga Nainar
59fed69211 Merge "Switch to clang r416183 12.0.4." am: 679d5308ec am: 042fce9dfd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1640559

Change-Id: I88674b9801a4ad44fe5234e75fb727233896c489
2021-03-22 19:51:37 +00:00
Paul Duffin
a49442d0d0 Replace FixturePreparer.visit() with list() am: 4ca6752b21
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647193

Change-Id: Ic0b097e834c94c879645d88fb43ff857336ed3ec
2021-03-22 19:29:16 +00:00
Paul Duffin
2e831d6ae6 Remove errorHandler from FixtureFactory am: cff464f794
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647192

Change-Id: If8cacd24e66108952219597026c0391b660bc3e9
2021-03-22 19:29:08 +00:00
Paul Duffin
559c073415 Allow access to preparers that produced a TestResult am: 592518290f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1645675

Change-Id: I7bde6493e80db34631ddac77b6405d5034d36886
2021-03-22 19:28:24 +00:00
Paul Duffin
abe8504ce1 Merge "Ensure that DepIsInSameApex is not called for ExcludeFromApexContentsTag" am: 6bef6fee3c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1645680

Change-Id: I2131e494bab389c13499b923618bf62235cb99e9
2021-03-22 19:20:17 +00:00
Paul Duffin
04b4a19fe6 Add TestBasicSdkWithBootImage
Added to reproduce the conditions that lead to the error reported in
the bug so they can be fixed. There were a number of issues that were
fixed in previous changes and this test verifies that they have been
fixed.

Bug: 182992071
Test: m nothing
Change-Id: I2197899b284a99973e698db314b15812f602b141
2021-03-22 19:13:40 +00:00
Paul Duffin
4a1d451405 Convert boot_image_sdk_test.go to fixtures
Bug: 182638834
Test: m nothing
Change-Id: I8c9cb399b15d04ec8465a3b3bb4b43561aef46fd
2021-03-22 19:13:22 +00:00
Pirama Arumuga Nainar
042fce9dfd Merge "Switch to clang r416183 12.0.4." am: 679d5308ec
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1640559

Change-Id: Ic2dce17dec076c412af4b43484dae7239456d533
2021-03-22 19:13:04 +00:00
Paul Duffin
cf3ee2f87e Allow sdk package tests to optimize their test setup
Extracts the setup for apex from prepareForSdkTest to allow it to be
reused without using all of it. That will allow tests to optimize their
test setup.

Bug: 182638834
Test: m nothing
Change-Id: I2056103b15c2737a616ee29ff890c6af0722e6d2
2021-03-22 18:31:53 +00:00
Paul Duffin
c93c98e315 Use test fixtures in CheckSnapshot()
Using the preparer(s) that were used to run the test to verify the
integrity of the generated snapshot ensures that it will be verified in
the same environment as the snapshot was generated. This ensures that
as sdk tests are migrated to use fixtures that are optimized for each
test that they will benefit from those optimizations when checking the
snapshot.

Bug: 183184375
Test: m nothing
Change-Id: I62b383f9a1d9a77d1cabb101d9d1e4a976170fe3
2021-03-22 18:31:53 +00:00
Paul Duffin
70d3bee3e0 Remove emptyFixtureFactory from apex and java
Bug: 183235980
Test: m nothing
Change-Id: I350b45e2f57430fb158f4141a566e75de17208cd
2021-03-22 18:31:53 +00:00
Paul Duffin
89648f98fa Remove usages of FixtureFactory from misc packages
These packages have already been migrated to use per test build
directory so have no need for a FixtureFactory.

Bug: 183235980
Test: m nothing
Change-Id: I667d1d992caaf0f615de91f89efdae11c44986c2
2021-03-22 18:31:53 +00:00
Paul Duffin
30ac3e7ca7 Remove uses of FixtureFactory from android package
Bug: 183235980
Test: m nothing
Change-Id: I72898ada020ee1a73fd534c61afb5c22fa00c1e5
2021-03-22 18:31:53 +00:00
Paul Duffin
ff2aa69a86 Deprecate FixtureFactory in favor of FixturePreparer
Prior to this FixtureFactory was basically a FixturePreparer with the
additional support for buildDirSupplier. This makes that a reality by
moving the functionality of FixtureFactory into FixturePreparer and
making FixtureFactory extend that with buildDirSupplier.

This also deprecates the Extend() method in favour of simply using the
GroupFixturePreparers() method.

Once all usages of buildDir have been removed so the buildDirSupplier
is no longer required then FixtureFactory will be removed altogether.
In the meantime follow up changes will migrate those tests that do not
require a buildDirSupplier to just use FixturePreparers in preparation
for the eventual removal of FixtureFactory.

Bug: 183235980
Test: m nothing
Change-Id: Ibb4e5bfec2f76ee34dd7de6aed6bbbfe27d337b8
2021-03-22 18:31:53 +00:00
Paul Duffin
4ca6752b21 Replace FixturePreparer.visit() with list()
The visit() method was dropped in favor of a list() method as the
latter makes it easier to treat fixtureFactory, simpleFixturePreparer
and compositeFixturePreparer as simple collections of already flattened
and deduped *simpleFixturePreparers. That will be used in a follow up
change.

Bug: 183235980
Test: m nothing
Change-Id: Ia41ae9bd4f9c39c85865ba698e0da6be00519caf
2021-03-22 18:31:53 +00:00
Paul Duffin
cff464f794 Remove errorHandler from FixtureFactory
The ExtendWithErrorHandler method simply wraps the FixtureErrorHandler
in a FixturePreparer that will set the error handler in the fixture.

Bug: 183235980
Test: m nothing

Change-Id: Icf9a5f62cb532efc120300c2f906cd3397aa6763
2021-03-22 18:31:53 +00:00
Paul Duffin
592518290f Allow access to preparers that produced a TestResult
The Preparer() method allows for another test to be run using the same
preparers as were used to create the TestResult. That is useful when
testing functionality like the sdk snapshot mechanism that generates an
Android.bp and a set of files that are intended to be reconsumed by
Soong. This method allows the test to process that output to ensure
that it is valid. A follow up change will migrate the CheckSnapshot()
method to use this as part of the migration of the sdk package to the
test fixture model.

Previously, the dedupAndFlattenPreparers() would not construct a list
containing all the preparers passed to it as it was trying to avoid
constructing such a list unless necessary. However, as every usage of
this method now needs to construct such a list that functionality has
been added to it.

Bug: 181070625
Test: m nothing
Change-Id: Iab34e2c861bdfd05c44e982224f70c5abc19e468
2021-03-22 18:31:53 +00:00
Paul Duffin
6bef6fee3c Merge "Ensure that DepIsInSameApex is not called for ExcludeFromApexContentsTag" 2021-03-22 18:30:10 +00:00
Pirama Arumuga Nainar
679d5308ec Merge "Switch to clang r416183 12.0.4." 2021-03-22 16:26:13 +00:00
Inseob Kim
0c4eec85fa Fix default value of BoardSepolicyVers
PlatformSepolicyVersion and BoardSepolicyVers haven't assigned correctly
so far. Below is the reason why it hasn't been discovered yet.

DeviceConfig.PlatformSepolicyVersion() was added to support mixed
sepolicy build (setting BOARD_SEPOLICY_VERS and building vendor sepolicy
with old plat policy files). Soong compares PlatformSepolicyVersion()
and BoardSepolicyVers(), and used old vendor sources if both are
different. Back then, the only place where such logic played a role was
selinux contexts. Test codes were running as intended: after setting
BOARD_SEPOLICY_VERS the context files were built against old policies.

But there were two mistakes:

1) PlatformSepolicyVersion() was not added to soong_config.mk, so it was
always empty.
2) BOARD_SEPOLICY_VERS was set to default in system/sepolicy/Android.mk,
which was processed after soong_config. So if BOARD_SEPOLICY_VERS was
not set in BoardConfig.mk, BoardSepolicyVers() was empty, not
PLATFORM_SEPOLICY_VERSION.

And there were no issues as Soong only checked equality.

To fix the issue correctly, this commit adds the variable
PlatformSepolicyVersion, and then handles BoardSepolicyVers correctly by
returning PlatformSepolicyVersion if it's empty.

Test: set BOARD_SEPOLICY_VERS and see vendor_file_contexts changes
Change-Id: Ie55827f47d2903e9739eccacc3874d354d5c9f2d
2021-03-22 22:34:56 +09:00
satayev
3c5d96925f Merge changes from topic "move_allowed_deps_txt" am: 2b077baa5e am: 0ee372ad6f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1645088

Change-Id: Ia9e9f9458aaed90d994e6d4454c0c046ed75082a
2021-03-22 12:01:22 +00:00
Artur Satayev
e23b216079 [automerger skipped] Move allowed_deps.txt to packages/modules/common. am: fdb61edf43 am: 8f3caa494f -s ours
am skip reason: skip tag Change-Id I8e8864468b87342c688d001bc5f6e6f8416863ed with SHA-1 f67c06a7f5 is already in history

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1628689

Change-Id: I4fc961bf4e765688f41ee3af87de7a4c37281d9f
2021-03-22 12:01:19 +00:00
satayev
0ee372ad6f Merge changes from topic "move_allowed_deps_txt" am: 2b077baa5e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1645088

Change-Id: Ib8cabdd7d263b1fdea60759a6ce7696e7949aa7b
2021-03-22 11:23:00 +00:00
Artur Satayev
8f3caa494f Move allowed_deps.txt to packages/modules/common. am: fdb61edf43
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1628689

Change-Id: I6d526d5f5b248bf9bd033d8f4797d021d3f0bd9f
2021-03-22 11:22:20 +00:00
satayev
2b077baa5e Merge changes from topic "move_allowed_deps_txt"
* changes:
  Treat allowed_deps.txt source file as optional.
  Move allowed_deps.txt to packages/modules/common.
2021-03-22 10:48:45 +00:00
Paul Duffin
0d09cc34b1 Merge "Prevent invalid paths being added to mock file system" am: 3d5f6a1034 am: ab49f13417
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1640321

Change-Id: I4c182530ed0aff581900b20aeb878c038ddb2083
2021-03-22 10:17:39 +00:00
Paul Duffin
414c7935dc Merge "Replace AssertPanic with AssertPanicMessageContains" am: c737facd2b am: 2d7747336d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647200

Change-Id: I9522a27ad1c7a89e9b7fef73073ba0c8ddb61320
2021-03-22 10:17:32 +00:00
Paul Duffin
ab49f13417 Merge "Prevent invalid paths being added to mock file system" am: 3d5f6a1034
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1640321

Change-Id: I7479355a690b0d0e128c2a52bfcf20e0110f5c0b
2021-03-22 09:36:51 +00:00
Paul Duffin
2d7747336d Merge "Replace AssertPanic with AssertPanicMessageContains" am: c737facd2b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647200

Change-Id: I5865c7845ae1820e55919252c99f612e3ac8f138
2021-03-22 09:36:04 +00:00
Paul Duffin
605946671c Merge "Cleanup the now unused testCustomizer" am: 50e49818a3 am: a1cf464f06
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647199

Change-Id: I5ad22fc23ae556c01adb415d7639efda1bbb23b9
2021-03-22 09:15:22 +00:00
Paul Duffin
3fa8037bde Merge "Convert test specific customizers to FixturePreparers" am: b535616a84 am: b7f2455646
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647198

Change-Id: I71c78c371952d89aa742e07f5f412536c554c4c4
2021-03-22 09:15:14 +00:00
Paul Duffin
85ca23b70e Merge "Convert shared customizer functions to return FixturePreparers" am: 7ba0448314 am: 47e8b9af4e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647197

Change-Id: I3b9cf01007f3cd29bb0e8a363330d3e4ddb960cf
2021-03-22 09:15:07 +00:00
Paul Duffin
d80d2f227a Merge "Allow test handlers to be either FixturePreparer or testCustomizer" am: 241f547365 am: 8381f3c74e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1629633

Change-Id: I0187b3dcb18c4bb465b26c52098fcbc6feec6218
2021-03-22 09:15:00 +00:00
Paul Duffin
8b92fdf019 Merge "Convert apex/boot_image_test.go to use test fixtures" am: 043427b276 am: e20b5ea05e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1626508

Change-Id: I261edc986b7f2489fdab0c7f3798d96f4d124933
2021-03-22 09:14:51 +00:00
Paul Duffin
0cd1c99cbd Merge "Switch testApex and related methods to use test fixtures" am: 32b0e07228 am: 7b1a647d0d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1626507

Change-Id: Ic0de1a6802431c736f963e9843a05693d7cee7d4
2021-03-22 09:14:43 +00:00
Paul Duffin
3d5f6a1034 Merge "Prevent invalid paths being added to mock file system" 2021-03-22 08:58:54 +00:00
Paul Duffin
c737facd2b Merge "Replace AssertPanic with AssertPanicMessageContains" 2021-03-22 08:58:28 +00:00
Paul Duffin
4c3e8e2d67 Ensure that DepIsInSameApex is not called for ExcludeFromApexContentsTag
The ExcludeFromApexContentsTag marker interface was added to avoid
every implementation of DepIsInSameApex() from having to deal with the
special tags, like PrebuiltDepTag. Unfortunately, when adding that
not all calls to DepIsInSameApex() were protected which meant that the
BootImageModule, which panics if it doesn't recognize a tag, was
causing failures. This change documents the need and improves the
consistency.

A follow up change will add a test for this.

Bug: 182992071
Test: m nothing
Change-Id: If0bf9a7447ebf7a0bb0c88e91951a7220d4af45c
2021-03-22 08:43:55 +00:00
Paul Duffin
a1cf464f06 Merge "Cleanup the now unused testCustomizer" am: 50e49818a3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647199

Change-Id: Iffa2449afa5194505b0a8f7656c479bab0523bf0
2021-03-22 08:35:24 +00:00
Paul Duffin
b7f2455646 Merge "Convert test specific customizers to FixturePreparers" am: b535616a84
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647198

Change-Id: If7f5e6d2e84e48693244729ea2fbf070cd44143e
2021-03-22 08:35:15 +00:00
Paul Duffin
47e8b9af4e Merge "Convert shared customizer functions to return FixturePreparers" am: 7ba0448314
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647197

Change-Id: Ib7382f29908fead40c54d73f98edfe9bd71a6ae7
2021-03-22 08:35:06 +00:00
Paul Duffin
8381f3c74e Merge "Allow test handlers to be either FixturePreparer or testCustomizer" am: 241f547365
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1629633

Change-Id: I3980a7bdfbc83d43aa4597da7aa6f3f2f77b6cad
2021-03-22 08:34:56 +00:00