Commit Graph

34653 Commits

Author SHA1 Message Date
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
Ulya Trafimovich fa2b1cf1d8 Split functions for compiling boot jars to allow future code reuse.
This CL adds no functional changes, it only splits a few functions into
parts that will be reused in a follow-up CL.

Bug: 178467404
Test: lunch aosp_cf_x86_64_phone-userdebug && m
Change-Id: I2bcb3c03d51175130da29fdfaf6dd747e3aea964
2021-03-22 12:37:10 +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 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
Kousik Kumar 2081052592 Print the output from RBE bootstrap shutdown
The output from bootstrap would contain the a one-line summary of RBE
download / upload stats.

Bug: b/183007125
Change-Id: I90082a8433504e40bbf92992c3c8d1d656c49429
2021-03-21 22:39:04 -04: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
Treehugger Robot f2be52c4dc Merge "Revert "[strip.sh] Move remaining GNU binutils usage to llvm binutils"" 2021-03-20 19:25:23 +00:00
Jaewoong Jung 2406d689bf Merge "Take Module implementations out of java/java.go." 2021-03-20 15:29:32 +00:00
David Srbecky 33dfba1d9c Revert "[strip.sh] Move remaining GNU binutils usage to llvm binutils"
This reverts commit ad50ce8349.

Bug: 183237575
Reason for revert: Breaks stack unwinding

Change-Id: I256dc77525687fb3e670355587b1eac72158b274
2021-03-20 14:46:15 +00:00
Treehugger Robot 8cc04e59e1 Merge "manifest_check.py: translate library names using dexpreopt configs." 2021-03-20 12:12:52 +00:00
Paul Duffin 80f4cea1ad Prevent invalid paths being added to mock file system
Bug: 182885307
Test: m nothing
Change-Id: Ie9f60fd02e2a2bc44811dbcadf0eada4e52c9749
2021-03-20 12:11:20 +00:00
Paul Duffin 9f4b3bbb7c Replace AssertPanic with AssertPanicMessageContains
Bug: 182885307
Test: m nothing
Change-Id: Idffa314285c90080796cc3df391de9c314eaa422
2021-03-20 12:08:51 +00:00
Paul Duffin 40b6257dc1 Cleanup the now unused testCustomizer
Bug: 181070625
Test: m nothing
Change-Id: I825e0da53b7fd82f4ef33d7183351c1f2ed8ee23
2021-03-20 11:42:48 +00:00
Paul Duffin 0a49fdca0b Convert test specific customizers to FixturePreparers
Bug: 181070625
Test: m nothing
Change-Id: I1c4b7303a1153b040b7266e95b06d172554dc52a
2021-03-20 11:39:23 +00:00
Paul Duffin 810f33d9ee Convert shared customizer functions to return FixturePreparers
Bug: 181070625
Test: m nothing
Change-Id: I8d09f91a3db23eb36cd73a13e418df98949ec72d
2021-03-20 11:33:03 +00:00
Paul Duffin 2be9dcd3aa Allow test handlers to be either FixturePreparer or testCustomizer
This allows the testCustomizers to be switched to FixturePreparers
incrementally rather than in one go.

Bug: 181070625
Test: m nothing
Change-Id: Idd9d2e28abf9b17fc46b5566ab8d3affa330287e
2021-03-20 10:25:45 +00:00
Paul Duffin 34d433ad7e Convert apex/boot_image_test.go to use test fixtures
Bug: 181070625
Test: m nothing
Change-Id: I940353e32233317d9e932b2d61908125e4c33766
2021-03-20 10:25:45 +00:00
Paul Duffin e05480ac47 Switch testApex and related methods to use test fixtures
Bug: 181070625
Test: m nothing
Change-Id: Icdd9c3d807d5497ef85946a877c6cd4b4af045bc
2021-03-20 10:25:45 +00:00
Paul Duffin ae542a58af Allow customization of all fixture state at once
Adds FixtureCustomPreparer.

Bug: 181070625
Test: m nothing
Change-Id: I310e16661a0f032f778481d9b69da2e0e9a084cf
2021-03-20 10:25:45 +00:00
Jaewoong Jung 263426431a Take Module implementations out of java/java.go.
Test: TreeHugger
Change-Id: I5c39915ad2cadf5981c201a2b412916524d4c3e2
2021-03-19 15:46:38 -07:00