aboutsummaryrefslogtreecommitdiff
path: root/java/sdk_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Rename core-current-stubs-system-modules to be more consistentPaul Duffin2021-11-031-4/+4
| | | | | | | | | Renames to core-public-stubs-system-modules so that it is of the format core-<sdk-kind>-stubs-system-modules. Bug: 204189791 Test: m nothing Change-Id: Iac565c940c2ef92be9cc64c0c6b8102a26afe0dd
* Use module-lib system modules when building from prebuiltsPaul Duffin2021-11-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | When building from source the build uses the java system modules for the public or module APIs as needed. However, previously when building from prebuilts it would always use the public API. That difference lead to build failures when building from prebuilts. This change makes the selection of java system modules when building from prebuilts consistent with the selection when building from sources. As API levels 30 and 31 (which are the only previous releases to provide system modules) did not provide separate java system modules for the module-lib API those levels always use the public APIs. Bug: 204189791 Test: - before applying these change m TARGET_BUILD_APPS=framework-connectivity - build fails with compilation error due to missing module APIs m sdk dist cp out/dist/system-modules/module-lib/core-for-system-modules.jar prebuilts/sdk/current/module-lib/core-for-system-modules.jar - apply these changes m TARGET_BUILD_APPS=framework-connectivity - build passes as expected Change-Id: Id113ff014e7892b1009fbcaad89b1ae23a7c3b79
* Run TestClasspath test cases with Always_use_prebuilt_sdks=true/falsePaul Duffin2021-10-291-4/+113
| | | | | | | | | | | | | | | | | | | | | | Previously, the TestClasspath test cases were only run with the default setting of Always_use_prebuilt_sdks=false. That meant that some of the code under test that depended on the setting of that variable was not tested properly. This change runs the test cases m with Always_use_prebuilt_sdks=true as well. Those test cases whose behavior depends on the setting of that variable are split into two separate test cases, each of which only runs with the appropriate setting of that variable. All other test cases are run for both settings of the variable. That revealed a slight issue with the test setup (a missing prebuilts/sdk/public/core/android.jar file) which broke the core_current test when run with Always_use_prebuilt_sdks=true which has also been fixed. Bug: 204189791 Test: m nothing Change-Id: If2ea3fde40c7573262e93691af0b5a57e4d54469
* Refactor TestClasspath to simplify follow up changePaul Duffin2021-10-291-17/+23
| | | | | | | | | Extracts classpathTestCase and extracts the logic for creating the test into a separate testClasspathTestCases func. Bug: 204189791 Test: m nothing Change-Id: I657fbcde23a18f7f5651c174fbf17a9b7b7f1a9a
* Add tests for prebuilts of all API surfacesPaul Duffin2021-10-291-2/+68
| | | | | | | | | | | | | | | Previously, the tests only covered checking the sdk dependencies added when using a prebuilt current (public) and system SDKs, i.e. with sdk_version set to "current_30" or "system_30". This change adds tests to cover other APIs, e.g. "test_30", "module_30" and "system_server_30". It adds tests for "module" and "system-server" up to API level 32 as following changes will give them different behavior as API levels less than or equal to 31 do not have a separate core-for-system-modules.jar file for the module-lib API. Bug: 204189791 Test: m nothing Change-Id: I585a88615439a24abf75250114a86113b5f5da57
* Replace android.BuildOs with Config.BuildOSColin Cross2021-07-201-6/+8
| | | | | | | | | Replace the android.BuildOs constant with Config.BuildOS so that it can vary based on the product config. Bug: 190084016 Test: all Soong tests Change-Id: Ia67f872d8b2ab788747a22e3a9659dc21c9775cd
* "module_current" and "system_server_current" should contain ART's ↵Victor Chang2021-06-291-2/+2
| | | | | | | | | | | | | | | @SystemApi(MODULE_LIBRARIES) Before this fix, compiling a java_library against sdk_version: "module_current" can't use the @SystemApi(MODULE_LIBRARIES) provided by the ART module because the system module "core-current-stubs-system-modules" contains only the public APIs. Use the new system module with module lib APIs. Bug: 183097033 Test: m droid Change-Id: I274e2710d1ff34e896aa620bfafb4481180c53b5
* Remove FixturePreparer.Extend()Paul Duffin2021-04-011-2/+4
| | | | | | | | Use GroupFixturePreparers instead. Bug: 182885307 Test: m nothing Change-Id: Idc01d3cc5a57576a4cf417e9105d1ab851126e10
* Remove extraneous calls to TestingBuildParams.RelativeToTop()Paul Duffin2021-03-301-4/+4
| | | | | | | | Deprecated the method to try and prevent any other uses being added. Bug: 183650682 Test: m nothing Change-Id: Ia6f43851e5a00c9d96af780e3bd21e03175e1a2f
* Remove javaFixtureFactoryPaul Duffin2021-03-241-1/+2
| | | | | | | | | Replaces uses of javaFixtureFactory with prepareForJavaTest and removes the unused javaFixtureFactory. Bug: 182885307 Test: m nothing Change-Id: I809772d14af2af211b9e15ad676fbdc06b07cd46
* Remove uses of buildDir from java/java_test.go and java/sdk_test.goPaul Duffin2021-03-241-18/+15
| | | | | | | | | | Remove any uses, either direct (or indirect via testJavaConfig or similar methods), of the package level buildDir variable from this file. Bug: 182885307 Test: m nothing Change-Id: I4d9dc39d3b1e5c37ba1f9e72da94048949c0fd17
* Fix TestClasspath to work without javaMockFS()Paul Duffin2021-03-181-0/+5
| | | | | | Bug: 182638834 Test: m nothing Change-Id: Icd6fe93cbda418cb4eaf5e99800894d4c4cc5e6f
* Convert TestClasspath to test fixturesPaul Duffin2021-03-181-51/+39
| | | | | | | | | | | 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
* Pass Config to NewTestContext instead of ctx.RegisterColin Cross2020-11-121-4/+4
| | | | | | | | | | | Prepare for using Config when adding singletons by passing Config to NewTestContext and NewContext instead of to ctx.Register. This will enable a followup change to store SingletonMakeVarsProviders registered on the Context in the Config, which is necessary to run multiple tests in parallel without data races. Test: all soong tests Change-Id: Id229629a4e42ff4487d317241673837726c075fc
* Revert "Make lots of tests run in parallel"Colin Cross2020-10-091-1/+0
| | | | | | | | | | This reverts commit 323dc60712491c71ccdc5363c42df61f0a192487. Reason for revert: Possible cause of test instability Bug: 170513220 Test: soong tests Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
* Make lots of tests run in parallelColin Cross2020-10-061-0/+1
| | | | | | | | | | Putting t.Parallel() in each test makes them run in parallel. Additional t.Parallel() could be added to each subtest, although that requires making a local copy of the loop variable for table driven tests. Test: m checkbuild Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
* Remove obsolete PDK build functionalityDan Willemsen2020-08-111-42/+0
| | | | | | | | | | | | This hasn't worked for a couple years, and continues to bitrot. Just remove it. Adds a bpfix rule so that we can eventually remove the product_variables.pdk definition, which is now always a no-op. Test: treehugger Change-Id: I830b54d419b59f6db1d4617b45e61a78234f57a7 Merged-In: I830b54d419b59f6db1d4617b45e61a78234f57a7
* Introduce AlwaysUsePrebuiltSdksJeongik Cha2020-08-071-0/+4
| | | | | | | | | | | | Instead of UnbundledBuild, use AlwaysUsePrebuiltSdks to determine if java modules needs to be built against prebuilt sdks. And rename UnbundledBuildUsePrebuiltSdks to AlwaysUsePrebuiltSdks to express its behavior more correctly.(It can be orthgonal to "Unbundled") Bug: 160390776 Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage Change-Id: I0be7265c1959d8774c295372cd7a9250169f6df9
* Enforce the legacy core/platform API restriction.Pete Gillin2020-07-231-9/+9
| | | | | | | | | | | | | | | This change silently decides whether modules which depend on either sdkPrivate or sdkCorePlatform get the legacy or the stable version of the core/platform API, based on whether the module's name is on a hard-coded list or not. Test: m java Test: make a target from the list when its entry is commented out, which correctly fails Bug: 157640067 Change-Id: I15e5a6c2f07e73718803501d705de0d7ab9bec90 Merged-In: I15e5a6c2f07e73718803501d705de0d7ab9bec90 Merged-In: Iaa97ddaa015e8079fcb3426585c5101c7ec9e22a (cherry picked from commit c0f4373106d6c205d11e3bbd61085736de7ec2df)
* Tidy up the definition of sdkCore.Pete Gillin2020-07-011-5/+4
| | | | | | | | | | | Compared to the effect of the toModule function, this (a) sets noFrameworkLibs to true, which seems logically correct, and (b) stops setting java9Classpath, which was redundant since the same stubs are available in 1.9+ builds via the systemModules setting. (This brings sdkCore into line with sdkCorePlatform in both cases.) Test: m art.module.api.annotations Change-Id: I61a868bc363a3bf174725b78c0a1657021cfe08a
* Rename the Default* constants in java/config.Pete Gillin2020-07-011-10/+10
| | | | | | | | | | | These values are used in two out of the many possible sdk_version configurations, and therefore weren't really defaults in any meaningful sense. Giving them more descriptive names makes the code easier to follow. Bug: 157640067 Test: m nothing Change-Id: Icf38a9c0be2606ad0478929e1b40dfcee36cddef
* Split the core/platform API into stable and legacy versions.Pete Gillin2020-06-081-3/+3
| | | | | | | | For now, everything outside libcore still uses the legacy version. Test: treehugger Bug: 157640067 Change-Id: If5234e9ee533ff537926801a0af045d36b1caf01
* Create a framework.aidl for non-updatable platformAnton Hansson2020-06-051-1/+1
| | | | | | | | | | | | | | | | | | | | framework.aidl includes the parcelables from the non-updatable part of the framework as well as the modules. This causes a dependency cycle when building module stubs: module_stub -> module_sdk -> framework.aidl -> public_sdk -> module_stub The module_sdk only includes the the stubs for the non-updatable part of the framework, so it should also only contain the non-updatable parcelables. This change creates a framework_non_updatable.aidl with those parcelables, and updates module_current to use that. Bug: 144149403 Test: m Test: m && diff out/soong/framework{,_non_updatable}.aidl (the diff contains just TestApi + module parcelables) Change-Id: I224117a0ff695c22d4a4317a51a9b775ed73066b Merged-In: I224117a0ff695c22d4a4317a51a9b775ed73066b (cherry picked from commit 85c151c3f3aa64c140524de23493c39ea5822292)
* Use system modules for prebuilt SDKs >=30Colin Cross2020-05-151-14/+53
| | | | | | | | | | | Prebuilt SDKs >=30 now contain core-for-system-modules.jar, convert them to system modules and use them when compiling against the SDK to allow using javac -source 1.9 -target 1.9. Bug: 117069453 Test: TestClasspath Change-Id: Iebadad5980b952ed91c3ffd56cff1ce1827d3247 Merged-In: Iebadad5980b952ed91c3ffd56cff1ce1827d3247
* Make system_server stubs consistent with other stubsAnton Hansson2020-03-251-2/+2
| | | | | | | | | | | | | Include the module_api stubs in system_server one instead of putting both of these jars on the classpath. Also rename it to be in line with the other stubs. Bug: 149293194 Test: m Exempt-From-Owner-Approval: approved internally Change-Id: Iead5af4152a49cd59a4fd7afc0312c2f0c872c1e Merged-In: Iead5af4152a49cd59a4fd7afc0312c2f0c872c1e (cherry picked from commit bbd78556daf4a7e015f2e3ddfe9539909e9ebf40)
* sdk_version: "system_server_current"Jiyong Park2020-02-121-1/+8
| | | | | | | | | | The new sdk version "system_server_current" is for system server components that needs to use all public APIs, system APIs, module APIs, and the system server APIs. Bug: 146757305 Test: m Change-Id: I24fd5af010532a110393676607dc90889f2ec17e
* sdk_version: "module_current" is supportedJiyong Park2020-01-311-0/+9
| | | | | | | | | | | module_* is a new API surface for OS modules (e.g. APEXes). It has slightly bigger API surface than the system_* SDK. Specifically, APIs with @SystemApi(client=MODULE_LIBRARIES) are added there. Bug: 146757305 Test: m Change-Id: I8980e50c0e3a4cd843048e0de1f638e854384f46
* Move filesystem into ConfigColin Cross2019-12-181-8/+8
| | | | | | | | | | | | The filesystem object was available through ModuleContext.Fs(), but gives too much access to the filesystem without enforicing correct dependencies. In order to support sandboxing the soong_build process move the filesystem into the Config. The next change will make it private. Bug: 146437378 Test: all Soong tests Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
* Use java language 1.9 for sdk_version: "current"Colin Cross2019-10-291-21/+40
| | | | | | | | | | | | | | | | | | | | | | | | Java language was set for 1.8 for anything building against the current SDK because the stubs were not built in Soong, so the system modules could not be built. The stubs have been built in Soong since Iabd32b30954b3f4a6d9a779fde52a032b684807e, but I5e870c34dd0ebc8ae3f888ec627da590c846a76f missed updating this TODO. Use 1.9 when building against the stubs, but continue using 1.8 for unbundled builds until we have prebuilt system modules. Always use the core-current-stubs-system-modules to avoid splitting android.* packages between the system modules and the classpath, which would cause new classes in android.* packages in classpath jars to be ignored. Add a new java9Classpath field to sdkDep that will contain the stubs jar when targeting Java language level 1.9, and plumb it through to javac and turbine. Rename the modules field to bootclasspath. Bug: 142896162 Test: m checkbuild Change-Id: Icfd32d0a863b2303a997c7cf03cb3708aade4724
* Move TestConfig sdk versions forwardColin Cross2019-10-281-20/+20
| | | | | | | | | The SDK version in TestConfig is very old, move it forward to trigger the newer javaVersion code paths. Bug: 142896162 Test: all Soong tests Change-Id: Iaf2a6f6dfef43b006b0a09f193fbc2d2e103d90d
* Split java 8 and 9 classpaths in TestClasspathColin Cross2019-10-281-113/+132
| | | | | | | | | | | In preparation for adding the system modules jars to the classpath for java 9, split the expected java 8 and java 9 classpaths into separate fields. Also replace the system: "bootclasspath" special case with a bool that specifies that the module will always be built using a java 8 style command line. Test: TestClasspath Change-Id: I661ec50d77a039c435c03bc8e6443cc5a57c206e
* Refactor and strengthen sdk_test.go.Pete Gillin2019-10-211-35/+59
| | | | | | | | | | | | | | | | | | | This change: - Removes usage of the EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=false option from tests, since it is going to be removed. The java_version property is used instead. - Commons up some of the assertions between the tests for language levels 8 and 9 in sdk_test.go. - In commoning the code up, some additional assertions are made in the language level 9 cases, strengthening the tests. Test: m nothing Bug: 115604102 Change-Id: I693c5d299b5592b851c44dde4434d92a931f15cd
* Enable Java language level 9 by default.Pete Gillin2019-10-161-5/+6
| | | | | | | | | | | | | | | | | | | | This changes the default Java language level from 8 to 9, i.e. javac invocations now use -source 1.9 -target 1.9. The environment variable EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=false is added to switch back to the language level 8 behaviour. (Previously, setting that variable to true was required to opt in to language level 9.) Test: make droid java tests cts docs Test: javap -v <some class file in output> | grep 'major version' (reports 53, for classes from 'benchmarks' which is in Android.bp and 'ahat' which is in Android.mk) Test: make RunBluetoothRoboTests RunCarSettingsLibRoboTests (two main flavours of robolectric) Test: make cts && cts-tradefed help Test: atest CtsLibcoreTestCases (reasonably low-level device tests) Test: atest CtsHostTzDataTests (arbitrary host test) Bug: 115604102 Change-Id: I9de888e1df021244d5e61c40934178676f09ecc7 Merged-In: I52be1817fa7121fca3bce3d8857cb9ed0825570c
* Shard aidl compiles into srcjarsColin Cross2019-10-041-7/+9
| | | | | | | | | Group aidl files into groups of 50 and compile them together into a srcjar. Bug: 124333557 Test: m checkbuild Change-Id: I18e0858eab434071d3ff0039bb21e07c7311b601
* Add custom SystemModules to bootclasspath to reduce duplicationPaul Duffin2019-09-201-1/+1
| | | | | | | | | | Adds a library dependency to each of the dummy system modules created by testing.go so that any changes in the behavior were detected by the existing tests which were then fixed. Bug: 141359858 Test: m checkbuild Change-Id: Id4442f4aa3931ac93049f3367b96a5b49cc075e1
* Java test code clean-upJaewoong Jung2019-07-171-3/+3
| | | | | | | Remove unused parameters and make testJava return the config. Test: Ran all java tests. Change-Id: Iaa123f3fd93188e2f55452b887e1d340429cc710
* Remove the no_framework_libs propertyPaul Duffin2019-06-241-8/+0
| | | | | | | | | | | | Corrects an error message that refers to no_framework_libs. Removes any tests that use no_framework_libs:true where possible as there are duplicate tests for sdk_version:"core_platform". Otherwise, switches them over to use sdk_version:"core_platform". Bug: 134566750 Test: m droid Change-Id: I41abe1a49f5c744e3393ca9cdf0c41888f810c9f
* Depend on all the files from system modulesDan Willemsen2019-06-181-1/+1
| | | | | | | Instead of just one of the files that we pass into javac. Test: treehugger Change-Id: I8478e88656487c9f667893d7c17839f0ea63c78f
* Add sdk_version:"core_platform" to replace no_framework_libs:truePaul Duffin2019-06-171-0/+8
| | | | | | | | | | | | | | | | | Where possible this duplicates any tests that use no_framework_libs:true with ones that use sdk_version:"core_platform". If not possible (e.g. in the default targets included in java/testing.go) it switches some to use sdk_version:"core_platform" to ensure that there is no regression in the behavior of no_framework_libs:true. Follow up changes will switch all usages of no_framework_libs:true over to use sdk_version:"core_platform" at which point no_framework_libs will be removed. Bug: 134566750 Test: m droid Change-Id: I42cb181f628b723c8f32a158ae4752b4c83365ae
* Remove the no_standard_libs propertyPaul Duffin2019-06-171-22/+0
| | | | | | | | | | | | | | | | | | | Corrects an error message that refers to no_standard_libs. Removes any tests that use no_standard_libs:true where possible as there are duplicate tests for sdk_version:"none". Otherwise, switches them over to use sdk_version:"none". The androidmk mapping from LOCAL_NO_STANDARD_LIBRARIES to no_standard_libs has also been removed. There was little point in updating the tool to map it through to sdk_version:"none" as there are only a couple of places where it is used, in art's test running mk targets and in some unbundled packages to work around some limitation in .mk based build. Bug: 134566750 Test: m droid Change-Id: I6413c9b1fe3e63b93753a6a017d2981e32b7e013
* Add sdk_version:"none" to replace no_standard_libs:truePaul Duffin2019-06-131-3/+25
| | | | | | | | | | | | | | | | Where possible this duplicates any tests that use no_standard_libs:true with ones that use sdk_version:"none". If not possible (e.g. in the default targets included in java/testing.go) it switches some to use sdk_version:"none" to ensure that there is no regression in the behavior of no_standard_libs:true. Follow up changes will switch all usages of no_standard_libs:true over to use sdk_version:"none" at which point no_standard_libs will be removed. Bug: 134566750 Test: m droid Change-Id: I5f0fd3daa980f6b223abe454cba7f25a97a39d7a
* Never allow java_library_host with no_standard_libs: truePaul Duffin2019-06-121-7/+0
| | | | | | | | This combination makes no sense. Bug: 134566750 Test: m droid Change-Id: Ib37bbac165395c003d23225e0469ba60fa6a56ea
* Add test for no_framework_libs:truePaul Duffin2019-06-121-0/+8
| | | | | | Bug: 134566750 Test: m droid Change-Id: Ie3c5c0730d4505c7932952eb20b5ccafd806a73a
* Rename EXPERIMENTAL_USE_OPENJDK9 to EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9.Pete Gillin2019-05-091-5/+5
| | | | | | | | | | | | | | | | | | | | The current EXPERIMENTAL_USE_OPENJDK9 environment variable is a legacy from when the 8 -> 9 toolchain upgrade was happening. That migration is done and the variable only affects the language level, so it should have a name that reflects that. (The current situation would be especially confusing if we started a 9 -> 11 toolchain upgrade, presumably controlled by a variable like EXPERIMENTAL_USE_OPENJDK11, since the two settings look incompatible but are actually orthogonal.) The current variable historically allowed a value or "1.8" which meant "use the OpenJDK 9 toolchain but target language level 8". That value no longer has any meaning and the new variable doesn't allow it. Bug: 131678633 Test: `make` with `EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=true` Test: `javap -v $OUT_DIR/soong/.intermediates/libcore/core-oj/android_common/javac/classes/java/util/List.class | grep 'major version'` shows 53 Test: Audit all mentions of the old string here and downstream Change-Id: Idad808c7f07913baba1a777627322d5452dabcef
* Build framework.aidl in SoongColin Cross2019-04-181-191/+205
| | | | | | | | | | | | | Move the rules to build framework.aidl into Soong, and use it when compiling aidl files with sdk_version: "current". Also fixes incorrectly using the aidl includes exported by the "framework" module when the proguardRaiseDep dependency was added. Bug: 130798034 Test: sdk_test.go Change-Id: I126adf1d9e7b6acb528875ff62b974ba7ad9a337
* Get default sdk_test.go values from configColin Cross2019-04-181-7/+9
| | | | | | | | | This will help avoid merge conflicts between branches that have additional default libraries. Test: sdk_test.go Change-Id: I98d5b8b2ea939df7ef57686f3bd913d6a21edc5d Merged-In: I98d5b8b2ea939df7ef57686f3bd913d6a21edc5d
* Fix sdk_version: "system_current" when Platform_sdk_final=trueColin Cross2019-04-021-14/+52
| | | | | | | | | | | | | When PLATFORM_VERSION_CODENAME is set to REL Platform_sdk_final becomes true, which causes the return value of sdkVersionToNumber for "system_current" to a real version number instead of FutureApiLevel. This enables the check against PlatformSystemSdkVersions, which doesn't contain "current". Use the numeric value instead. Fixes: 129786845 Test: sdk_test.go Change-Id: If7cf211cc01c5fbf3e3ece3c3f604718a13d5a9b
* Use latest SDK version for current in PDK buildsColin Cross2019-01-101-0/+31
| | | | | | | | | PDK builds need to use the latest SDK version instead of "current" to match the behavior of Make. Bug: 118634643 Test: sdk_test.go Change-Id: Ice10d0ccb4066f27ce5839fc96a4026510057121
* Split out sdk.go from java.goColin Cross2019-01-101-0/+260
Split out SDK handling functions from java.go to sdk.go and tests from java_test.go to sdk.go. Test: sdk_test.go Change-Id: I83ef48cbe5230572c1d4ecc0e89021d2f7c71b76