summaryrefslogtreecommitdiff
path: root/java/java_test.go
AgeCommit message (Collapse)Author
2020-01-15Added java_system_modules_importPaul Duffin
A prebuilt version of java_system_modules. It does not import the generated system module, it generates the system module from imported java libraries in the same way that java_system_modules does. It just acts as a prebuilt, i.e. can have the same base name as another module type and the one to use is selected at runtime. Bug: 142940300 Test: m nothing Change-Id: I126db49d18294fcd6e2b7ad0237f83e9c2fdef7a
2020-01-15Add basic test for java_system_modulesPaul Duffin
Bug: 142940300 Test: m nothing Change-Id: I8855df0832f93e40d31e457191590458c274bb5c
2019-12-31Add support for java_test in sdkPaul Duffin
Adds java_test_import module type for use by the sdk snapshot and adds java_tests property to the sdk and sdk_snapshot module type. This is needed for the conscrypt test sdk. Bug: 143678475 Test: m nothing Change-Id: Ied4c56c978dac2f92a9b3bc34b3235d7eeba2fd3
2019-12-20Generate .srcjar for prebuilt_stubs_sourcesPaul Duffin
Changes prebuilt_stubs_sources to generate a .srcjar from its input instead of just exposing the srcs it is given. This ensures that it can be used as a drop in replacement for a droidstubs module. Updates the test for prebuilt_stubs_sources to be more representative of the actual use made of it by sdk snapshot which outputs a directory not a glob pattern. Added some documentation of the prebuilts_stubs_sources srcs property to make it clear that it is supposed to be a set of directories. Extracts common code from sdk/testing.go for normalizing path/paths for testing. Bug: 143678475 Test: m conscrypt-module-sdk conscrypt-module-host-sdk conscrypt-module-test-sdk unzip those in place of external/conscrypt build core-current-stubs-source which expects it to provide a .srcjar. Change-Id: I8204a022557a9b0b45e19eac79ecba98ff95213d
2019-12-19Improve cc tests by adding sanitizer mutatorsPaul Duffin
This fixes an issue that arises when deduping cc build component registration code. The sanitize_runtime_deps and sanitize_runtime post deps mutators were not previously added when running cc tests. That meant the tests were not actually testing the same behavior as at runtime. Adding the mutators breaks the TestFuzzTarget test as the mutator adds libclang_rt.ubsan_standalone-aarch64-android as a dependency of libc++ and the former is not available. This fixes the test by adding the missing dependency as a cc prebuilt shared library. Test: m checkbuild Bug: 146540677 Change-Id: Ie13c7e6fcefef7d9cb1cc5364be3dc563ce40de5
2019-12-19Dedup prebuilt mutator registrationPaul Duffin
Test: m checkbuild Bug: 146540677 Change-Id: I9f8a11adf61fe6f352ec1eabc7c5bac332348ba2
2019-12-19Dedup registration for cc default test configPaul Duffin
The cc.GatherRequiredDepsForTest() method returns some default module definitions that are required when using cc module types like cc_library. Previously, the registration of the module types and mutators needed to process those default definitions was duplicated in the test config initialization. This change removes that duplicated code and replaces it with calls to cc.RegisterRequiredBuildComponentsForTest(ctx) which registers all the required build components. Test: m checkbuild Bug: 146540677 Change-Id: I80b6913c5691ff164ce9d308b9e1da24940f2d42
2019-12-19Dedup prebuilt apis module type/mutator registrationPaul Duffin
Test: m checkbuild Bug: 146540677 Change-Id: If5d6fdace2574df6314fbcf6441838cd11df58ae
2019-12-19Dedup system modules and sdk library module type registrationPaul Duffin
Test: m checkbuild Bug: 146540677 Change-Id: I982fcb8d723e8e2f7679434051ddc427d4fbd7be
2019-12-19Dedup java genrule module type registrationPaul Duffin
Test: m checkbuild Bug: 146540677 Change-Id: I17f24fe145b4bb453e82aabaecc9c251f2b9769b
2019-12-19Dedup droiddoc module type registrationPaul Duffin
Some tests were changed as they were using the wrong name for the droiddoc_exported_dir module type. Test: m checkbuild Bug: 146540677 Change-Id: If57404760d2df3757c93e237696359355cf0c96e
2019-12-19Merge "Add updatable_media_stub to framework"Jiyong Park
2019-12-19Dedup registration code for module types and singletonsPaul Duffin
The registration of module types and singletons is duplicated between init() functions that register them for use in the build runtime and test context creation code that registers them for testing. This is a proof of concept for a mechanism that will allow the code to be shared. It defines a RegistrationContext interface that is implemented by both the TestContext and the new initRegistrationContext type. An instance of the the latter is available through the InitRegistrationContext variable. The intent is that the registration of the module types and singleton types will be extracted from the init() function into a separate function that takes a RegistrationContext parameter. That method is called from init() passing in the InitRegistrationContext and from a test passing in the TestContext. Something like this: func init() { RegisterBuildComponents(android.InitRegistrationContext) } func RegisterBuildComponents(ctx android.RegistrationContext) { ctx.RegisterModuleType(....) .... } A test would do something like this: ctx := android.NewTestContext() RegisterBuildComponents(ctx) Test: m nothing Change-Id: I97173cabb6d6cf7ce98fdb5f73418438b1997b35
2019-12-19Add updatable_media_stub to frameworkJiyong Park
The module framework is now a build-only library whose purpose is to provide hidden APIs from the non-updatable part of the platform and APIs from the modules. Merging updatable_media_stub to framework, like the stub libraries from other modules. As a result, updatable_media_stub can be removed from DefaultLibraries. Bug: N/A Test: m Exempt-From-Owner-Approval: cherry-pick from internal Merged-In: I7f80716119ad6ac627e5666def9fe17112dcde3b (cherry picked from commit 4c258d282b15bd0d9ba3de8dfa9762de1bd1adf4) Change-Id: I7f80716119ad6ac627e5666def9fe17112dcde3b
2019-12-18Move filesystem into ConfigColin Cross
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
2019-12-13Use empty string for core image variantColin Cross
Use the empty string for the core image variant so that modules added to imageMutator do not change their build directory. Bug: 142286466 Test: m checkbuild Change-Id: Ida4534d9a4d6176236aaa480fed359ce27acfaa1 Merged-In: Ida4534d9a4d6176236aaa480fed359ce27acfaa1 (cherry picked from commit 72d685ee7f45e5393be44ae4159edf083ac918de)
2019-12-07Merge "Cleanup java.DefaultsFactory()"Treehugger Robot
2019-12-06Move ImageMutator after archMutatorColin Cross
Move the ImageMutator to be registered just after the archMutator in preparation for moving it between osMutator and archMutator. Requries updating variants in a few tests that now run the ImageMutator. Bug: 142286466 Test: no change to build.ninja Test: all soong tests Change-Id: Ia9d2a7bc0e225bedec3c9a83ea04f471a931bf47
2019-12-06Cleanup java.DefaultsFactory()Paul Duffin
This function took a props varargs parameter but it was only ever called with no parameters. The props parameter meant it could not be used directly with RegisterModuleType() so the defaultsFactory() func was added which simply called through to DefaultsFactory(). Removing the props varargs parameter allowed it to be used directly with RegisterModuleType() and so the defaultsFactory() could be removed. This was needed because a follow up change adds a test in another package that uses java_defaults and so it needs the factory method (defaultsFactory()) to be exported. Test: m nothing Change-Id: I33d5c4d4ce8f349b1e6fc706d5e9656faf303b4f
2019-12-07Link type checking for java_libraryJeongik Cha
Link type checking for java_library has not been working unintentionally. So turn on link type checking for these types. And also add tests for link type checking. Bug: 145799020 Test: cherry-pick aosp/1182522 and check if build fails Test: m nothing and there is no error(soong unittest) Change-Id: Ifc347f657885de1028ac0076ddd103c0387b597a
2019-11-26Add exported_plugins to java.Library.Artur Satayev
The behaviour is similar to go/be#java_library.exported_plugins. Plugins added to exported_plugins of library X are not applied to the library itself, but rather to libraries that directly depend on the library X. Test: m checkbuild Bug: 139740873 Change-Id: I4042bd482ad9cb12d6fbaac51f039d38b1b7a428
2019-11-25Make TestContext.RegisterModuleType take an android.ModuleFactoryColin Cross
Avoid having to pass ModuleFactoryAdaptor to every call to RegisterModuleType in a test by wrapping RegisterModuleType. Test: all soong tests Change-Id: If8847d16487de0479cc3020b728256922b3cadba
2019-11-22Adds droidstubs support to sdk modulePaul Duffin
Adds stubs_sources property to sdk and unzips the droidstubs srcjar into the snapshot directory. Adds an UnzipToSnapshot method to the SnapshotBuilder which creates a rule that uses zip2zip to repackage the supplied zip content into a temporary zip file that matches what the required snapshot structure. e.g. if the supplied zip contains foo/Foo.java and that needs to be in the snapshot directory java/foo/stubs then it will create a zip that contains java/foo/stubs/foo/Foo.java. The temporary zip that is the output of that rule is added to the zipsToMerge field for merging later. If the zipsToMerge is empty then the snapshot zip is created as before. Otherwise, a temporary zip file is created. That is then merged with the other zip files in zipsToMerge to create the final snapshot zip. Adds prebuilt_stubs_sources for use by the generated .bp module. Bug: 143678475 Test: added conscrypt sdk module and attempted to build it Change-Id: Ie274263af3a08e36a73c61c0dbf0c341fd6967e2
2019-11-15Add override_android_test.Jaewoong Jung
This change also adds instrumentation_target_package to android_test, so that the target package name in a test manifest can be easily overridden. Fixes: 134624457 Test: app_test.go Change-Id: Ib8dd703da0038ac76210c92d79e133e37c718122
2019-11-11Rearrange import orderJeongik Cha
Bug: 132780927 Test: m Change-Id: I4b2c40bb0fb3dd5ff31f65811a6fef28e946f028
2019-11-06Enforce hidden apis usage in product(soong)Jeongik Cha
Only if PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is set, every app and java library in product cannot use hidden APIs anymore. checkSdkVersion() checks if sdk_version of app and library is narrow enough, checkLinkType() checks every library that app links agianst Bug: 132780927 Test: m Test: set PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE, and check whether build error occurs. Change-Id: Ic630503b875040f730feda4fef826ed6d71da111
2019-10-28Move TestConfig sdk versions forwardColin Cross
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
2019-10-21Refactor and strengthen sdk_test.go.Pete Gillin
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
2019-10-16Enable Java language level 9 by default.Pete Gillin
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
2019-10-04Shard aidl compiles into srcjarsColin Cross
Group aidl files into groups of 50 and compile them together into a srcjar. Bug: 124333557 Test: m checkbuild Change-Id: I18e0858eab434071d3ff0039bb21e07c7311b601
2019-08-28Merge changes Ife12ba69,Ibf910262Jaewoong Jung
am: 7ca5576905 Change-Id: I4e486be727b3be79afac66644cc3e9967e43bd45
2019-08-28Implement android_test_importJaewoong Jung
Test: app_test.go, prebuilt CTS tests Fixes: 132371143 Change-Id: Ife12ba691dfa597dde90faf0957224a6f444e139
2019-08-16Merge "Add arch variant support to android_app_import."Jaewoong Jung
am: a701d9071e Change-Id: I7e20e0a6f4f0adaec0897fee3a371adcf78106d3
2019-08-15Add arch variant support to android_app_import.Jaewoong Jung
Bug: 128610294 Fixes: 138792623 Test: app_test.go Change-Id: I47c80ec283ce58a0ce9b7d0af40844bd73e9d3f1
2019-07-30Merge "Add a rule about platform_apis"Jeongik Cha
am: 8a64f8c907 Change-Id: Ifdd8bd693fee625f63db403ce7a4dbc9209eb398
2019-07-29Add a rule about platform_apisJeongik Cha
As sdk_check.mk checks, soong starts to check every app. If sdk_version is empty, platform_apis must be true. If sdk_version is not empty, platform_apis must be false. Test: soong test Test: m Bug: 132780927 Change-Id: I7ba702d616404d155f8ac40cd008828663ad1488
2019-07-22Merge changes Ic2a585ea,I11ccabc4,Icc932c4a,I020556c7,I08713e91Colin Cross
am: ed9a92c311 Change-Id: I0367335939181566063b777184e864a7afb02308
2019-07-22Merge changes Ic2a585ea,I11ccabc4,Icc932c4a,I020556c7,I08713e91Treehugger Robot
* changes: Fix date on mac builds Convert javadoc modules to android.RuleBuilder Convert droiddoc modules to android.RuleBuilder Add a systemModules utility type Convert droidstubs to android.RuleBuilder
2019-07-19filegroup.path is used to specify the include path for aidl filesJiyong Park
am: 2907459e43 Change-Id: Ibf604d664111401d4bcca20db20c754c6845f05a
2019-07-19filegroup.path is used to specify the include path for aidl filesJiyong Park
filegroup { name: "foo", srcs: ["srcs/aidl/com/android/**/*.aidl"], path: "srcs/aidl", } cc_library { // or java_library, etc. name: "bar", srcs: [":foo"], } automatically adds "-Ipath/to/foo/srcs/aidl" when compiling the aidl files from foo for bar. This allows us to omit aidl include path when using sources in other places via file group. Bug: 135922046 Test: m (unit tests added) Change-Id: I9b42f316f2858fb6da72c2f58a314f391416e809
2019-07-18Convert droiddoc modules to android.RuleBuilderColin Cross
Test: m docs Test: m checkapi Test: m updateapi Change-Id: Icc932c4a9a3fc642c96ab9cbd8df3229b5ab86d3
2019-07-18Merge "Java test code clean-up"Jaewoong Jung
am: 66bb414fb7 Change-Id: I69304bb2b589b5c415a5eb57cadc0833fd1be02e
2019-07-17Java test code clean-upJaewoong Jung
Remove unused parameters and make testJava return the config. Test: Ran all java tests. Change-Id: Iaa123f3fd93188e2f55452b887e1d340429cc710
2019-06-30Merge "Enforce hidden api usage in vendor (soong)" am: e65d84c84cJeongik Cha
am: 7a22534a47 Change-Id: Iffbacc0f98fb208e6f71919bcefa19cb0e57efca
2019-07-01Merge "Enforce hidden api usage in vendor (soong)"Treehugger Robot
2019-06-28Enforce hidden api usage in vendor (soong)Jeongik Cha
From aosp/588578, if vendor app doesn't fill sdk_version, build scirpt overwrites system_current to sdk_version. But there is no similar enforcement in soong. So, as make does, sdkVersion() returns "system_current" if it is device-specific or soc-specific module. and sdk_version is not filled. Test: pass soong test Bug: 132780927 Change-Id: I69bb3d7bfcf7c27c2db4d0efbe046f9c7879b4bc
2019-06-25Optionally embed NOTICE files in apks. am: 5b425e2e20Jaewoong Jung
am: 5d48965fed Change-Id: I533808f0eafb496c34ece9d100784ebb9b5257e6
2019-06-24Optionally embed NOTICE files in apks.Jaewoong Jung
If embed_notices or ALWAYS_EMBED_NOTICES is set, collect NOTICE files from all dependencies of the android_app, merge them with the app's own one (if exists), transform it to HTML, gzip it, and put it as an asset in the final APK output. Bug: 135460391 Test: app_test.go Change-Id: I52d92e2fd19b3f5f396100424665c5cc344190d8
2019-06-17Merge changes I42cb181f,I6413c9b1 am: 33ee25466fPaul Duffin
am: 00c2bbb0e7 Change-Id: Icca90608b256e726a9a1bd79e9cedca1a6b53f84
2019-06-17Remove the no_standard_libs propertyPaul Duffin
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