Commit graph

34566 commits

Author SHA1 Message Date
Paul Duffin
7ee6e8fa0f Merge "Add platform_compat_config to sdk" 2021-03-23 11:17:06 +00:00
Paul Duffin
e835389123 Merge "Add TestBasicSdkWithBootImage" 2021-03-23 11:13:12 +00:00
Paul Duffin
713b501017 Merge "Register the propagateRROEnforcementMutator" 2021-03-23 10:46:49 +00:00
Treehugger Robot
c29088b727 Merge "Remove .rustc ELF section from mini-debug-info." 2021-03-23 09:13:53 +00:00
Paul Duffin
e0998ab561 Merge "Add preparer for overlay pre-singleton registration" 2021-03-23 07:21:30 +00:00
Paul Duffin
010bb3c5b3 Merge "Add TestingModule.VariablesForTestsRelativeToTop" 2021-03-23 07:21:01 +00:00
Paul Duffin
a327008e65 Merge "Add TestingBuildParams.RelativeToTop()" 2021-03-23 07:20:33 +00:00
Paul Duffin
332310aac4 Merge "Improve searching for TestingBuildParams using the output file" 2021-03-23 07:20:04 +00:00
Paul Duffin
b09a2d6af4 Merge "Move helper methods that take testBuildProvider into baseTestingComponent" 2021-03-23 07:19:42 +00:00
Paul Duffin
48c21e6454 Merge "Extract functionality common to TestingModule/Singleton" 2021-03-23 07:19:13 +00:00
Treehugger Robot
9b6108f8de Merge "Fix PackagingBase.CopyDepsToZip" 2021-03-23 04:21:38 +00:00
Treehugger Robot
04a2693407 Merge "Fix default value of BoardSepolicyVers" 2021-03-23 03:53:18 +00:00
Paul Duffin
04ba70d665 Register the propagateRROEnforcementMutator
This adds the registration of the mutator to the existing register...
method which will include it in PrepareForTestWithJavaBuildComponents.

Bug: 182885307
Test: m nothing
Change-Id: I6cea716a3ff4d8abdb80543b7e0ddf22246ffa30
2021-03-22 22:09:53 +00:00
Paul Duffin
42da69d784 Add preparer for overlay pre-singleton registration
It appears as though this is the first pre-singleton type to actually
be registered with the InitRegistrationContext as it failed due to an
uninitialized map, so this change also fixes that.

Bug: 182885307
Test: m nothing
Change-Id: Ibbf6d0db5f3c2fcc89291a16aa5f16b8b5009bd3
2021-03-22 22:09:53 +00:00
Paul Duffin
97d8b40fec Add TestingModule.VariablesForTestsRelativeToTop
Bug: 182885307
Test: m nothing
Change-Id: Id1265b07533f226965555e703fb9fa81aea4ec91
2021-03-22 22:09:53 +00:00
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
001b2342f7 Add platform_compat_config to sdk
Bug: 182402754
Test: m nothing
Change-Id: Ife3f4f64fc116d62eb7c3cc10c50e00f19d1d81c
2021-03-22 19:13:40 +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
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
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
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
50e49818a3 Merge "Cleanup the now unused testCustomizer" 2021-03-22 08:06:40 +00:00
Paul Duffin
b535616a84 Merge "Convert test specific customizers to FixturePreparers" 2021-03-22 08:06:26 +00:00
Paul Duffin
7ba0448314 Merge "Convert shared customizer functions to return FixturePreparers" 2021-03-22 08:05:56 +00:00
Paul Duffin
241f547365 Merge "Allow test handlers to be either FixturePreparer or testCustomizer" 2021-03-22 08:05:36 +00:00
Paul Duffin
043427b276 Merge "Convert apex/boot_image_test.go to use test fixtures" 2021-03-22 08:05:21 +00:00
Paul Duffin
32b0e07228 Merge "Switch testApex and related methods to use test fixtures" 2021-03-22 08:04:55 +00:00
Treehugger Robot
5e737ad1d5 Merge "Allow customization of all fixture state at once" 2021-03-21 23:48:43 +00:00
Paul Duffin
3bcdfe8bbb Merge "Add prepareForSdkTestWithJava" 2021-03-21 11:07:03 +00:00
Paul Duffin
d5deba1126 Merge "Java build components require android build components" 2021-03-21 11:06:33 +00:00
Paul Duffin
d14cbc1e69 Add prepareForSdkTestWithJava
Bug: 182638834
Test: m nothing
Change-Id: I86cb08a640c7e39c1eaaf54926699f32a32ccc9b
2021-03-21 11:01:13 +00:00
Paul Duffin
ce5a4547bb Java build components require android build components
Java build components invariably require android build components such
as the arch mutator (to create the common variant) so include them
together.

Bug: 181070625
Test: m nothing
Change-Id: I435b09a34c48c67b890368b37b8da27e8de97c9a
2021-03-21 10:20:25 +00:00
David Srbecky
b474fc0ad6 Remove .rustc ELF section from mini-debug-info.
The section is stripped from binaries (but preserved in /symbols).

However, is it also unintentionally copied into the minidebuginfo
compressed section, which is included in the final shipped binary.
(This does not affect symtab symbols, which are handled as usual)

Removing it from mini-debug-info shrinks some rust binaries by
up to 10x, saving >10MB on the system partition overall (AOSP).

Test: extract minidebuginfo and check it manually with readelf
Change-Id: I462d81455626bb2b5244e1bf3d5f8b71646f3401
2021-03-20 20:31:29 +00:00