summaryrefslogtreecommitdiff
path: root/java/java_test.go
AgeCommit message (Collapse)Author
2021-06-02Move java_sdk_library tests to sdk_library_test.goColin Cross
Seperate the java_sdk_library tests into their own file. Bug: 186723288 Test: go test ./java/... Change-Id: I899c2946cb2234dc595a4281e64bbb239b89bda8 Merged-In: I899c2946cb2234dc595a4281e64bbb239b89bda8 (cherry picked from commit 1d2b6b3b2ecc6dac49b1a8be697d7374dbed5d79)
2021-04-22Merge changes Ia74a2b83,I30a46c8f,Iac7c0149Jaewoong Jung
* changes: Add lint.strict_updatability_linting Move Java lint tests to lint_test.go Forbid bypassing updatability lint checks.
2021-04-22Add new stub_only_static_libs attr for sdk_libraryAnton Hansson
Allow java_sdk_libraries to include libraries statically into their stubs. The immediate use-case of this is to embed libcore notice files into their stubs. Also extend the java_sdk_library tests for impl/stub-only-libs, plus some not assert utils. Bug: 173186484 Bug: 184839599 Test: soong tests Change-Id: I1ebf2f35c048eab5cec5125482a0304fe660f188
2021-04-21Move Java lint tests to lint_test.goJaewoong Jung
Test: lint_test.go Bug: 182349282 Change-Id: I30a46c8f704e66cd04541c78d3f22a140d3284ef
2021-04-19Reland: Add jni_libs property to java testsColin Cross
Add jni_libs property to java tests and treat it as test data that should be copied to the lib or lib64 directory in the test directory. This relands I3a118b933ab30dcd731c6dc2708da9bc63ab5520 with fixes for the test on mac. Fixes: 176593487 Test: java_test.go Change-Id: I2f8c46643cff7a7ae6dc4d4dbad58f0396e45f09
2021-04-17Merge "Revert "Add jni_libs property to java tests""Colin Cross
2021-04-17Revert "Add jni_libs property to java tests"Colin Cross
This reverts commit 246164a055a529e081a7690cc9043b496757a30c. Reason for revert: broke the mac build Bug: 176593487 Change-Id: Id0242e37aa40d84d291bf7b8ee46dfe98c4d5905
2021-04-17Merge changes from topic "tvts-test-host-jni"Treehugger Robot
* changes: Add jni_libs property to java tests Add Target to cc.SharedLibraryInfo
2021-04-16Add jni_libs property to java testsColin Cross
Add jni_libs property to java tests and treat it as test data that should be copied to the lib or lib64 directory in the test directory. Fixes: 176593487 Test: java_test.go Change-Id: I3a118b933ab30dcd731c6dc2708da9bc63ab5520
2021-04-13Introduce NewApi lint checksPedro Loureiro
We are enabling NewApi lint check where the min sdk != compile sdk. At the same time, we are introducing baseline files for existing projects that fail this check in order to keep the build running. At the very least we stop introducing new problems and teams might realise of risks in their projects they were not aware of. Bug: 150847901 Test: m lint-check Change-Id: Icfa5eb98cc6b6708149f0c52fac8fc1440d9c3b0 Merged-In: Icfa5eb98cc6b6708149f0c52fac8fc1440d9c3b0
2021-03-31Merge "Remove unused java testing methods"Paul Duffin
2021-03-31Remove unused java testing methodsPaul Duffin
Also, stops exporting methods that are no longer used outside the java package. Bug: 181070625 Test: m nothing Change-Id: I23d35bbc21f82f2dae802aa53badda4c58b41024
2021-03-31Remove varargs from RunTest(t *testing.T)Paul Duffin
Use GroupFixturePreparers instead. Bug: 182885307 Test: m nothing Change-Id: Iaedb0ddc9d6a704f4d41363e705f3025a1291dc8
2021-03-30Remove extraneous calls to TestingBuildParams.RelativeToTop()Paul Duffin
Deprecated the method to try and prevent any other uses being added. Bug: 183650682 Test: m nothing Change-Id: Ia6f43851e5a00c9d96af780e3bd21e03175e1a2f
2021-03-30Automatically call TestingBuildParams.RelativeToTop()Paul Duffin
Fixes the few tests that break due to this and which cannot easily be separated into their own changes. Bug: 183650682 Test: m nothing Change-Id: Ia2f31213a1f114a78e66a81d89279ecde9f4c465
2021-03-25Split droidstubs out of droiddoc.goColin Cross
Split part of droiddoc.go into droidstubs.go. Also split droiddoc_test.go and droidstubs_test.go out of java_test.go. Test: go test ./java Change-Id: Iea742e75b6925b135016f7bbf3a168c696a6c433
2021-03-25Support multiple rsp files in RuleBuilderColin Cross
The lint rule is manually creating a second rsp file because Ninja only supports on per rule. Move the support into RuleBuilder so that it can apply the same rewrites that it does to the primary one. Test: TestRuleBuilder_Build Change-Id: Iec250a2d60e74ccf1b4ad085a960fec6867ea559
2021-03-25Fix TestDroiddoc's reliance on absolute pathsPaul Duffin
TestDroiddoc compares the value returned by OutputFiles(""), which will usually be absolute paths including the temporary buildDir, against paths returned from TestingBuildParam.RelativeToTop(), which does not currently change the Path contents and so will include absolute temporary paths. However, a follow up change to this will make the TestingBuildParam.RelativeToTop() also change the Path contents at which point this test would be comparing relative to absolute paths. So, this change makes sure that they are all converted to relative to top paths before comparison. Bug: 183650682 Test: m droid Change-Id: Ia4478f527af27a920945f5849525e5031cc5b8b6
2021-03-24Convert test that disallows non existent paths to use fixturesPaul Duffin
This change needed to add some additional files to the registered files for PrepareForTestWithJavaDefaultModules because otherwise they would fail when "TestAllowNonExistentPaths = false". Those files were being added by the TestJavaLintRequiresCustomLintFileToExist (albeit in some cases in different locations to that required by the default modules but as the files are needed by the modules defined in PrepareForTestWithJavaDefaultModules they should be defined in it. A couple of other places also provided some files so moving them into PrepareForTestWithJavaDefaultModules caused some conflicts which needed to be resolved. Bug: 183184375 Test: m nothing Change-Id: I76ce9f1673c1c1c4000635b76b8377d582224bf1
2021-03-24Fix "filename too long" issue on Luci caused by test namePaul Duffin
Stop including fields in the test name for TestJavaSdkLibraryEnforce to reduce its length to avoid the filename too long limit. Test: m nothing Check the lengths before (~240) and after (~74) to make sure there was a sizeable reduction. Change-Id: I275a1110e5102b8ea8376759f28c7c6333a5efee
2021-03-24Group all the preparations needed for testing dexpreoptPaul Duffin
Make it easier to test dexpreopt functionality by grouping all the fixture preparations together. Bug: 177892522 Test: m nothing Change-Id: I94f66e3ec82efc4fd791f4fdab678d298565e452
2021-03-24Remove javaFixtureFactoryPaul Duffin
Replaces uses of javaFixtureFactory with prepareForJavaTest and removes the unused javaFixtureFactory. Bug: 182885307 Test: m nothing Change-Id: I809772d14af2af211b9e15ad676fbdc06b07cd46
2021-03-24Remove unused test methods and buildDirPaul Duffin
Bug: 182885307 Test: m nothing Change-Id: I251145a82479428a82f19cbde6b415d149acd619
2021-03-24Remove uses of buildDir from java/java_test.go and java/sdk_test.goPaul Duffin
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
2021-03-24Register java_plugin in PrepareForTestWithJavaBuildComponentsPaul Duffin
Bug: 182885307 Test: m nothing Change-Id: I550d39ba46c548b6b099d8dc6a9c458ca931b2fa
2021-03-22Register the propagateRROEnforcementMutatorPaul Duffin
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-22Add preparer for overlay pre-singleton registrationPaul Duffin
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-22Remove emptyFixtureFactory from apex and javaPaul Duffin
Bug: 183235980 Test: m nothing Change-Id: I350b45e2f57430fb158f4141a566e75de17208cd
2021-03-19Merge changes Iab4e09d9,Icf2f24dd,I15be5ef1,Ic0db9619Colin Cross
* changes: Run lint actions in sbox Support sbox-in-RBE Move android package on top of remotexec Support sandboxing inputs in RuleBuilder
2021-03-19Merge "Remove javaMockFS()"Paul Duffin
2021-03-19Merge "Fix TestTurbine to work without javaMockFS()"Paul Duffin
2021-03-19Merge "Convert TestClasspath to test fixtures"Paul Duffin
2021-03-18Run lint actions in sboxColin Cross
Run lint actions in sbox with RuleBuilder.SandboxInputs. This copies all input files into the sandbox, which prevents the lint tool from finding nearby source files that were not presented to it. Using SandboxInputs requires use of PathForInput or PathForOutput anywhere a path is used outside of the RuleBuilderCommand methods that take paths so that they can be translated to the paths that will be used in the sandbox. Bug: 181681346 Test: lint_test.go Test: m lint-check dist Test: m USE_RBE=true RBE_LINT=true lint-check dist Test: m USE_RBE=true RBE_LINT=true RBE_LINT_EXEC_STRATEGY=remote lint-check dist Change-Id: Iab4e09d961891ef182643583d4d456e413bc5e39
2021-03-18Merge "Clean up java package use of python build components"Paul Duffin
2021-03-18Remove javaMockFS()Paul Duffin
Also, removes the workaround that allowed preparers to override files added in javaMockFS(). The performance of the java tests was determined by running: m nothing rm -fr out/soong/.bootstrap/soong-java/test/ time m nothing Prior to starting this work that returned: real 1m30.060s user 33m3.028s sys 13m25.413s Immediately prior to this change that returned: real 1m2.777s user 14m14.352s sys 9m40.745s After applying this change that returned: real 0m20.282s user 3m7.429s sys 0m43.601s So, this reduced the real time cost of running the java tests from 90 seconds to 20 seconds. Bug: 182638834 Test: m nothing Change-Id: I30490fd40ddb0684a5a4975ce1811bab5dc79e4e
2021-03-18Fix TestTurbine to work without javaMockFS()Paul Duffin
Bug: 182638834 Test: m nothing Change-Id: Idf400b5f0d171a504acf006425cbfc514b391e74
2021-03-18Convert TestClasspath to test fixturesPaul Duffin
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
2021-03-17Clean up java package use of python build componentsPaul Duffin
Bug: 182885307 Test: m nothing Change-Id: I206ebc075c568a09008ec8b63122922dd87ba318
2021-03-17Add emptyFixtureFactory in java packagePaul Duffin
Bug: 182402754 Test: m nothing Change-Id: I6a01b846a8aee5a0ace9e6ac056ee439bf6f12f7
2021-03-17Merge "Export a few utility methods"Yuexi Ma
2021-03-16Export a few utility methodsYuexi Ma
Add a few utility methods to support generating TradeFed test plan in C-Suite Test: go test . Change-Id: I86a505068b5d5aa0f5a37b3e3a2465839a7480ef
2021-03-16Fix TestJavaSdkLibrary... tests to work without javaMockFS()Paul Duffin
Bug: 182638834 Test: m nothing Change-Id: I140b88b3fdf2c532d266a196fee84675c518d859
2021-03-16Convert JavaSdkLibrary... tests in java package to test fixturesPaul Duffin
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
2021-03-15Convert TestJavaSdkLibraryEnforce to test fixturesPaul Duffin
Bug: 182638834 Test: m nothing Change-Id: I99efe76008f9ca0996177f47923274ca594a6858
2021-03-15Create sub tests for each test in TestJavaSdkLibraryEnforcePaul Duffin
Bug: 182638834 Test: m nothing Change-Id: I509b071ee4e470da45159b2174aae7acf1b0eb1a
2021-03-14Extract PrepareForTestWithJavaSdkLibraryFiles from javaMockFS()Paul Duffin
Needed for tests in both java and sdk packages. Bug: 182638834 Test: m nothing Change-Id: Ia8c5e7db47d8b63bf8dcf2965b3af60a4d35a9e5
2021-03-14Convert testJavaError to test fixturesPaul Duffin
Bug: 182638834 Test: m nothing Change-Id: If6de91cd60fea36c945f2b0d51a04e26c838e4af
2021-03-11Separate system modules tests into their own filePaul Duffin
java_test.go is getting too big. Bug: 182402568 Test: m nothing Change-Id: I9c3818f1d747a230fcb66687319a3a14d557a57c
2021-03-10Support test fixtures in java packagePaul Duffin
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
2021-03-05Clean up cc.RegisterRequiredBuildComponentsForTest()Paul Duffin
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