aboutsummaryrefslogtreecommitdiff
path: root/java/java_test.go
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Fix TestTurbine to work without javaMockFS()Paul Duffin2021-03-181-22/+14
| | | | | | | | | | | | | | | | | | | | | | | | Bug: 182638834 Test: m nothing Change-Id: Idf400b5f0d171a504acf006425cbfc514b391e74
* | | | Merge "Convert TestClasspath to test fixtures"Paul Duffin2021-03-191-1/+8
|\| | | | |/ / |/| |
| * | Convert TestClasspath to test fixturesPaul Duffin2021-03-181-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main complication with this change was that many of the tests check paths that are provided by the default java modules. The location of them is different in the test fixtures that it is when using testConfig() and so the test needed to be changed. Bug: 182638834 Test: m nothing Change-Id: I6d325dbd3ba39e5de7e53c576d7cfe07bd95a965
* | | Merge "Clean up java package use of python build components"Paul Duffin2021-03-181-4/+1
|\ \ \
| * | | Clean up java package use of python build componentsPaul Duffin2021-03-171-4/+1
| |/ / | | | | | | | | | | | | | | | Bug: 182885307 Test: m nothing Change-Id: I206ebc075c568a09008ec8b63122922dd87ba318
* / / Add emptyFixtureFactory in java packagePaul Duffin2021-03-171-2/+3
|/ / | | | | | | | | | | Bug: 182402754 Test: m nothing Change-Id: I6a01b846a8aee5a0ace9e6ac056ee439bf6f12f7
* | Merge "Export a few utility methods"Yuexi Ma2021-03-171-0/+13
|\ \
| * | Export a few utility methodsYuexi Ma2021-03-161-0/+13
| | | | | | | | | | | | | | | | | | | | | Add a few utility methods to support generating TradeFed test plan in C-Suite Test: go test . Change-Id: I86a505068b5d5aa0f5a37b3e3a2465839a7480ef
* | | Fix TestJavaSdkLibrary... tests to work without javaMockFS()Paul Duffin2021-03-161-12/+58
| | | | | | | | | | | | | | | | | | Bug: 182638834 Test: m nothing Change-Id: I140b88b3fdf2c532d266a196fee84675c518d859
* | | Convert JavaSdkLibrary... tests in java package to test fixturesPaul Duffin2021-03-161-136/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These tests rely on files provided by javaMockFS() so need to are being converted to test fixtures to allow them to remove that dependency which will allow javaMockFS() to be removed. Bug: 182638834 Test: m nothing Change-Id: If736b95d134fe73c0a0ccd438ec31e93568fb929
* | | Convert TestJavaSdkLibraryEnforce to test fixturesPaul Duffin2021-03-151-16/+16
| | | | | | | | | | | | | | | | | | Bug: 182638834 Test: m nothing Change-Id: I99efe76008f9ca0996177f47923274ca594a6858
* | | Create sub tests for each test in TestJavaSdkLibraryEnforcePaul Duffin2021-03-151-18/+28
| | | | | | | | | | | | | | | | | | Bug: 182638834 Test: m nothing Change-Id: I509b071ee4e470da45159b2174aae7acf1b0eb1a
* | | Extract PrepareForTestWithJavaSdkLibraryFiles from javaMockFS()Paul Duffin2021-03-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Needed for tests in both java and sdk packages. Bug: 182638834 Test: m nothing Change-Id: Ia8c5e7db47d8b63bf8dcf2965b3af60a4d35a9e5
* | | Convert testJavaError to test fixturesPaul Duffin2021-03-141-1/+5
| | | | | | | | | | | | | | | | | | Bug: 182638834 Test: m nothing Change-Id: If6de91cd60fea36c945f2b0d51a04e26c838e4af
* | | Separate system modules tests into their own filePaul Duffin2021-03-111-64/+0
| | | | | | | | | | | | | | | | | | | | | | | | java_test.go is getting too big. Bug: 182402568 Test: m nothing Change-Id: I9c3818f1d747a230fcb66687319a3a14d557a57c
* | | Support test fixtures in java packagePaul Duffin2021-03-101-14/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restructures the java package test setup code to create FixturePreparer instances for setting up a test fixture and converts some tests to use it. The goal with this change is not to switch all the java tests over to directly using the new model but instead to ensure that the majority of the java tests run with the new model, to allow existing tests to easily switch to the new model when needed and to allow dependent packages to be switched to the new model. Bug: 181070625 Test: m nothing Change-Id: I1c9d96ddbc973aaf9733dcd7fa0479f79b0f471f
* | | Clean up cc.RegisterRequiredBuildComponentsForTest()Paul Duffin2021-03-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Avoid hiddenapi ignoring prebuilt with missing dex implementation jarPaul Duffin2021-03-011-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when a prebuilt was preferred but did not provide a suitable boot dex jar both the source and the prebuilt were silently ignored which meant that the "hiddenapi list" command was not given a complete set of boot dex jars. That could either lead to incorrect hiddenapi flags being set or the "hiddenapi list" command failing if it could not find a class. Debugging the cause of either of those cases can be very time consuming so this change fails early and makes the cause very explicit. Bug: 181267622 Test: m nothing Change-Id: I6763ddb9ba90ed2e501d0cf7984f6655237e905d
* | | Allow pre-singleton types to be registered in RegistrationContextPaul Duffin2021-02-241-2/+2
| | | | | | | | | | | | | | | | | | Bug: 181070625 Test: m droid Change-Id: I708b78ed0b42ec55b0442307f40531cfe1233c2b
* | | Merge "Add ctx to AndroidMkExtraEntriesFunc"Treehugger Robot2021-02-221-2/+2
|\ \ \
| * | | Add ctx to AndroidMkExtraEntriesFuncColin Cross2021-02-191-2/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to access providers. Test: m checkbuild Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc Merged-In: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
* / / Add support for lint baseline filesPedro Loureiro2021-02-181-1/+104
|/ / | | | | | | | | | | | | Test: m droid Test: go test ^TestJavaLint # (from soong/build/java) Change-Id: I249a0a0597b0bf8495460ed283b476ad2eb36edc
* / Make dexpreopt tools available for all java testsPaul Duffin2021-01-251-4/+0
|/ | | | | | Bug: 177892522 Test: m nothing Change-Id: I594bddae692ef76dc8c3da504934d0151b13d4c9
* Allow createGlobalSoongConfig() to be used from testsPaul Duffin2021-01-211-7/+1
| | | | | | | | | | | | | | | | Previously, the createGlobalSoongConfig() function was explicitly prevented from being used in tests because it would fail. However, it turns out that is no longer the case and it does now work. That allows the following changes to be made: * Tests no longer need to use GlobalSoongConfigForTests() to prepopulate the cache. * GlobalSoongConfigForTests() is only needed in the dexpreopt package. Bug: 177892522 Test: m nothing Change-Id: Ifcbb1a44254c5d2d10c1d02ab23227488d1d1ed1
* Add java.RegisterRequiredBuildComponentsForTest functionPaul Duffin2021-01-211-12/+1
| | | | | | | | | | | | | | | | | | Insulate tests that exercise code in the java package from having to register the build components provided by the java package by providing a single function that registers them all. This follows the pattern currently used in the cc and rust packages. This change is in preparation for switching the dex_bootjars singleton from a singleton, which does not require a module definition in order to be instantiated, to a singleton module which does. That will require adding a module definition into java.GatherRequiredDepsForTest() and this change ensures that the required components will have been registered in every test. Bug: 177892522 Test: m nothing Change-Id: I6475db8240894947dd07c89a940a3e4f201aa598
* Make TestJavaSdkLibraryEnforce fasterJaeMan Park2021-01-151-73/+59
| | | | | | | | | | TestJavaSdkLibraryEnforce is too slow because it tests all combinations of options. Change TestJavaSdkLibraryEnforce to run test on specific test cases, not all combinations. Bug: 177323052 Test: go test -timeout 10s -run ^TestJavaSdkLibraryEnforce$ android/soong/java Change-Id: Ie7fe4e22b570a3e25259a6ad4bd37936805c6604
* Add "aidl.flags:" property for cc_/java_ modulesJooyung Han2021-01-051-0/+16
| | | | | | | | | | | | | | | | | | | | The property can be used to pass additional flags to the AIDL compiler. For example, cc_library { .. srcs: ["Foo.aidl"], aidl: { flags: [ "-Werror", // warnings as error "-Weverything", // turn on all warnings ], }, } Bug: 168028537 Test: soong test Change-Id: I8120eeae7cd7b1acdd34c554af996a29e760a368
* Merge "Break up app.go."Jaewoong Jung2020-12-281-0/+3
|\
| * Break up app.go.Jaewoong Jung2020-12-211-0/+3
| | | | | | | | | | Test: m nothing + TreeHugger Change-Id: I64c6d7f10530c424bc282d8111dfaf9159426f00
* | Add attribute to disable last-api compat trackingAnton Hansson2020-12-211-5/+4
|/ | | | | | | | | | | | | Setting this to true by default is dangerous as it can mask bugs. Create a dedicated attribute for java_sdk_library to enable this behavior instead. The default will be flipped in a future CL when all the current offenders have been fixed. Fix all the tests to have the right API files. Bug: 176092454 Test: m nothing Change-Id: Ieab94bcb74abf8d018365a56fb447fe3dbd46957
* Merge "Add java sdk library enforcement flag"JaeMan Park2020-12-021-0/+159
|\
| * Add java sdk library enforcement flagJaeMan Park2020-11-241-0/+159
| | | | | | | | | | | | | | | | | | | | Add java sdk library enforcement for inter-partition library dependency, for ensuring backward-compatible libraries for inter-partition dependencies. Test: m nothing Bug: 168180538 Change-Id: I6bfac54c3499b03003a3bc6c2bb62b165b4ce5f9
* | Merge "Annotate dependency tags for dependencies of installed files"Colin Cross2020-11-241-2/+0
|\ \
| * | Annotate dependency tags for dependencies of installed filesColin Cross2020-11-231-2/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Relands Ic22603a5c0718b5a21686672a7471f952b4d1017 with a minor change to track libc++ dependencies for python hosts and after a fix to an internal genrule that depended on transitively installed java libraries (ag/13068670). Soong currently assumes that installed files should depend on installed files of all transitive dependencies, which results in extra installed file dependencies through genrules, static libs, etc. Annotate dependency tags for dependencies for which the installed files are necessary such as shared libraries and JNI libraries. This avoids extra installed files, and is also a first step towards genrules using their own copy of tools instead of the installed copy. Bug: 124313442 Test: m checkbuild Test: java.TestBinary Test: cc.TestInstallSharedLibs Test: deptag_test.go Change-Id: I725871249d561428e6f67bba6a7c65b580012b72
* / Remove restriction on exported plugins that generate APIsColin Cross2020-11-231-2/+25
|/ | | | | | | | | | | | | | | hilt_android requires seven separate annotation processors, which is only feasible to support using exported_plugins to avoid having to list all seven in every module that uses it. Unfortunately they all set generates_api: true. Turbine is already disabled for modules that directly use a plugin that sets generates_api: true, because turbine doesn't run annotation processors. Also add support for disabling turbine if a module transitively uses a plugin that generates APIs via exported_plugins. Bug: 173397767 Test: TestExportedPlugins Change-Id: If70354a3dd67efb4ce88bc9c934d41ccb6241b28
* Merge changes from topic "fix-stubs-source-snapshot"Paul Duffin2020-11-191-0/+30
|\ | | | | | | | | | | * changes: Fix prebuilt_stubs_sources to work with no stubs sources Revert "Use glob for java_sdk_library_import stub_srcs"
| * Fix prebuilt_stubs_sources to work with no stubs sourcesPaul Duffin2020-11-191-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The framework-sdkextension java_sdk_library module defines an API for public, system and module_lib API surfaces but the public API is empty. The empty public API results in an empty .srcjar being repackaged and merged into the sdkextension-sdk snapshot and results in no directory for the public API stubs sources being created. Unfortunately, the Android.bp file in the snapshot is created by Soong and it does not know that the public API will be empty and so it creates an Android.bp file that references the directory into which the stubs sources should be added but which ends up not existing in the snapshot. Referencing a non-existent directory causes a build failure. This change fixes that issue by using PathForModuleSrc with no path components to get the path to the module directory (which must exist) and then resolving the module relative local src directory against that. The local src directory is globbed to find all the files, which will return an empty set of paths if the directory does not exist. Finally, the file paths are passed as an rsp file to soong_zip to avoid exceeding any command line limits. Many other different approaches were considered: * Adding a property to the java_sdk_library to indicate that the public API was actually empty. That would require extra maintenance by developers and would require some extra checks to be performed after generating the stubs source to ensure that it was empty which would complicate the build process. * Creating a directory with some placeholder file (empty directories don't work well with git) that would force the creation of the directory. That file would most likely be created whether the API was empty or not, would need to be stored in git alongside the source and could be quite confusing to reviewers. Bug: 173508731 Test: m nothing - to run new tests Build sdkextension-sdk, unpack it and then build the .srcjar files for the public, system and module_lib API surfaces. Without this change the build failed, reporting that the stubs_sources directory for the public API did not exist. With this change the build succeeded. Checked the contents of the resulting .srcjar files and made sure that the public one was empty and the others contained the SdkExtensions.java class and a package-info.java file. Change-Id: Ia468a3f37349f2dbc21db67744bda6461498d515
* | Merge "java link time error improve"Treehugger Robot2020-11-191-2/+2
|\ \ | |/ |/|
| * java link time error improveSteven Moreland2020-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | Asked about error message including "against private API.Adjust sdk_version", which is a bit hard to parse due to missing space. Also tried to make error message less verbose, so that it is more clear what to do, and fixed a grammar mistake. Bug: N/A Test: N/A Change-Id: Ib9a30d86b5cb0e9b3b7d5576ecb9498a9b316042
* | Merge changes Iba57c949,Ief43ff51,Ib1809a4d,I2ab64f36Treehugger Robot2020-11-181-2/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | * changes: Store ndkKnownLibs in the config Register the kythe singleton on the Context instead of globally Store ninja file deps from PackageVarContext in the config Store SingletonMakeVarsProviders in the config
| * | Store SingletonMakeVarsProviders in the configColin Cross2020-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Store SingletonMakeVarsProviders in the config instead of a global variable to avoid races between tests running in parallel. Test: all soong tests Change-Id: I2ab64f368b5ac673fd985399d4421ed018abc562
* | | Move genrule on top of RuleBuilderColin Cross2020-11-171-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | In preparation for more complicated sandboxing support in sbox, use a single implementation of the sbox sandboxing by moving genrule to use RuleBuilder's sbox support instead of creating an sbox rule directly. Also move genrule's input list hash support into RuleBuilder. Test: genrule_test.go Test: rule_builder_test.go Change-Id: I292184d02743c7e6887ebbcd232ba565db2ab0cc
* | Merge changes Iebfbf2ff,Ibd974268Ulyana Trafimovich2020-11-171-1/+1
|\ \ | | | | | | | | | | | | | | | * changes: Rename fields and methods to reflect class loader context changes. Do not add dependencies of shared SDK libraries to manifest_fixer.
| * | Rename fields and methods to reflect class loader context changes.Ulya Trafimovich2020-11-161-1/+1
| | | | | | | | | | | | | | | | | | Test: lunch aosp_cf_x86_phone-userdebug && m Bug: 132357300 Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
* | | Merge "Revert "Annotate dependency tags for dependencies of installed files""Colin Cross2020-11-171-0/+2
|\ \ \ | |_|/ |/| |
| * | Revert "Annotate dependency tags for dependencies of installed files"Colin Cross2020-11-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 62a0cfd05460d0e760ce9133690e48861bb57eee. Reason for revert: b/173475545 Change-Id: I4e834200c8e68dfa1b8144dfd1fa95ca68554980
* | | Merge changes Ic22603a5,I5330b571Colin Cross2020-11-161-2/+0
|\| | | | | | | | | | | | | | | | | * changes: Annotate dependency tags for dependencies of installed files Use the the preferred architecture symlink as the tool path if it exists
| * | Annotate dependency tags for dependencies of installed filesColin Cross2020-11-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Soong currently assumes that installed files should depend on installed files of all transitive dependencies, which results in extra installed file dependencies through genrules, static libs, etc. Annotate dependency tags for dependencies for which the installed files are necessary such as shared libraries and JNI libraries. This avoids extra installed files, and is also a first step towards genrules using their own copy of tools instead of the installed copy. Bug: 124313442 Test: m checkbuild Test: java.TestBinary Test: cc.TestInstallSharedLibs Test: deptag_test.go Change-Id: Ic22603a5c0718b5a21686672a7471f952b4d1017
* | | Merge "Rework class loader context implementation."Ulyana Trafimovich2020-11-161-2/+2
|\ \ \ | |/ / |/| / | |/
| * Rework class loader context implementation.Ulya Trafimovich2020-11-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old representation consisted of a list of libraries (UsesLibraries), a list of optional libraries (OptionalUsesLibraries) and a mapping from library name to its build/install paths (LibraryPaths). The separation into lists and map was necessary because of special handling of compatibility libraries, which is now unified with normal libraries. The new representation is a mapping from target SDK version to a tree structure ClassLoaderContext. Each node of the tree represents a library and contains library name, build/install paths and a slice of subcontexts for dependencies. The same library may occur in the tree multiple times in case it is a dependency of multiple libraries. The order in which libraries are added matters (the resulting tree shape may be different). Test results have to be updated, as the resulting <uses-library> list is reodered (previously it was a sorted list of map keys, and now it is formed by a depth-first preorder traversal of the class loader tree). Test: lunch aosp_cf_x86_phone-userdebug && m Bug: 132357300 Bug: 168686456 Change-Id: I11be8cd2967f004fd58753d7c5fb99fed179cd63