summaryrefslogtreecommitdiff
path: root/luni/src/test/java/dalvik/system
Commit message (Collapse)AuthorAgeFilesLines
* create_test_jar.sh, loading-test{,2}-jar.sh: Migrate dx -> d8Tobias Thierer2018-12-211-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is attempt 2. Attempt at http://r.android.com/849531 was missing a resource2.txt file that had previously been part of parent.jar. This attempt 2 fixes create_test_jar.sh to add resource2.txt to parent.jar (the previous version of parent.jar appears to have been created some way other than through create_test_jar.sh). I must have missed this difference when verifying the previous CL. This CL also addresses a minor code review comment that had remained unaddressed on the last attempt. Original commit message follows: These .sh scripts created .dex files using the dx command. Since dx is no longer used for Android builds, this CL updates those scripts to use d8 instead. This CL also updates the files generated by those scripts. Since the loading-test* stuff was added in 2011 and barely touched since then, I had a quick look to see if the jars are still used. I've found that {,Base}DexClassLoaderTest.java refers to them. Test: Ran "unzip -l" on each affected .jar to ensure that the set of file paths in them is the same before/after this CL. The only difference in set of jar entries was that all of the new but not all of the old files had an entry for the folder META-INF/ itself rather than only for the file META-INF/MANIFEST.MF. I'm guessing that the old files were created with an old version of the jar tool. I did not examine the *contents* of the files inside the .jars or of the .dex files. Test: atest CtsLibcoreTestCases:libcore.dalvik.system.DexClassLoaderTest Test: atest CtsLibcoreTestCases:libcore.dalvik.system.BaseDexClassLoaderTest Test: atest CtsLibcoreTestCases:libcore.dalvik.system.DelegateLastClassLoaderTest Fixes: 119865052 Change-Id: I20541a2846fa69ce7f976cad6dcf1fb2666a66bf
* Revert "create_test_jar.sh, loading-test{,2}-jar.sh: Migrate dx -> d8"Tobias Thierer2018-12-171-7/+7
| | | | | | | | | | | | | | | | This reverts commit bf470a4674993c90fa04ccb5c941c9f80efba025. Reason for revert: Broke BaseDexClassLoaderTest and DelegateLastClassLoaderTest: libcore.dalvik.system.BaseDexClassLoaderTest#testGetResourceSharedLibraries1 libcore.dalvik.system.BaseDexClassLoaderTest#testGetResourceSharedLibraries2 libcore.dalvik.system.BaseDexClassLoaderTest#testGetResourceSharedLibraries3 libcore.dalvik.system.BaseDexClassLoaderTest#testGetResourceSharedLibraries4 libcore.dalvik.system.DelegateLastClassLoaderTest#testLookupOrderNoDelegate_getResources libcore.dalvik.system.DelegateLastClassLoaderTest#testLookupOrderNodelegate_getResource libcore.dalvik.system.DelegateLastClassLoaderTest#testLookupOrder_getResource libcore.dalvik.system.DelegateLastClassLoaderTest#testLookupOrder_getResources2 Change-Id: Ifb0ea117ea712b5122c10ee46a8b86be4a3a9727
* create_test_jar.sh, loading-test{,2}-jar.sh: Migrate dx -> d8Tobias Thierer2018-12-131-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | These .sh scripts created .dex files using the dx command. Since dx is no longer used for Android builds, this CL updates those scripts to use d8 instead. This CL also updates the files generated by those scripts. Since the loading-test* stuff was added in 2011 and barely touched since then, I had a quick look to see if the jars are still used. I've found that {,Base}DexClassLoaderTest.java refers to them. Test: Ran "unzip -l" on each affected .jar to ensure that the set of file paths in them is the same before/after this CL. The only difference in set of jar entries was that all of the new but not all of the old files had an entry for the folder META-INF/ itself rather than only for the file META-INF/MANIFEST.MF. I'm guessing that the old files were created with an old version of the jar tool. I did not examine the *contents* of the files inside the .jars or of the .dex files. Test: atest CtsLibcoreTestCases:libcore.dalvik.system.DexClassLoaderTest Bug: 119865052 Change-Id: I94314c47d05752e6328a7b1774298a09118e7270
* create_test_jar.sh: Clean out tmp directories.Tobias Thierer2018-12-131-0/+3
| | | | | | | | | | | | | | | This script creates tmp directories /tmp/delegate_last_* where it creates some files before copying them to their final destination. This CL adds commands to remove each of those tmp directories immediately before it is created, to ensure that nothing remains in them from a previous run. The directories are NOT cleaned up at the end since they could be useful for debugging the script. Test: Ran create_test_jar.sh more than once in a row. Change-Id: I5acaaa4f7b17155f769c68770cde5af02dd58ff4
* Fix create_test_jar.sh for compilation with OpenJDK 9 javac.Tobias Thierer2018-12-131-1/+1
| | | | | | | | | | Because there is already a class java.util.HashMap in java.base, compiling such a class requires a --patch-module command line flag. This CL adds it to the build script. Test: ./create_test_jar.sh now completes without error. Change-Id: I7a76d2d79f4b59cd4768598aaddce9f0faaa6c3f
* Move libcore tests to non-libcore packages.Tobias Thierer2017-11-088-2017/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The integration of OpenJDK 9 javac into the Android build system requires non-libcore code to live in non-libcore packages, as long as that code isn't considered part of the same module as libcore at javac time. This CL moves libcore test related classes out of such packages; since libcore tests could already only test public (as opposed to package private APIs), no change other than the package name and imports is necessary. Because many libcore tests already live below a top-level package "libcore" (eg., the tests for java.util are in libcore.java.util), this CL likewise prepends "libcore." to the package names of affected classes. For classes relating to libcore.* packages, this results in a package name of the form "libcore.libcore.*". Alternative considered but not pursued: To compile the test classes without moving the out of a libcore package, javac would need to consider them to be in the same module as libcore. This would likely be possible via javac --patch-module, but this has not been explored in detail because: - Most luni tests are already in a toplevel package libcore.*, so this CL makes the test structure more consistent. - Use of --patch-module would likely cause problems when running tests under a runtime that implements the OpenJDK 9 module system; for example, --patch-module cannot add exported packages to the module, so any new packages added in tests (such as the libcore.* packages of most existing luni tests) would not be visible at test runtime. - Having tests in different packages from code under tests makes it more obvious (including to IDEs in which the code might be edited as a single project) that these tests cannot access package-private identifiers in the code under test. Test: Treehugger Test: "make cts" with EXPERIMENTAL_USE_OPENJDK9=true passes with additional changes present locally that have not yet been exported as CLs. Test: CtsLibcoreTestCases Bug: 68224249 Bug: 68932217 (tracks potential follow-up work) Change-Id: Ib6b8e6f3bc87093bc219d2108e601163c6e334cd
* Implement DelegateLastClassLoader.Narayan Kamath2017-06-084-52/+404
| | | | | | | | | | | | | | A classloader that implements the following lookup order : - The boot classpath is always searched first. - The list of dex files associated with the classloader is searched second. - Finally, parents of the classloader are searched. Bug: 37966546 Test: vogar DelegateLastClassLoaderTest. Change-Id: Ic5e95d132f30beb9b8b4499cdbec0e7dd00f9eb4
* DexClassLoader: Properly get rid of optimizedDirectory argument.Narayan Kamath2017-06-051-16/+1
| | | | | | | | | No point constructing a File object out of it and requiring non-null if we're going to ignore it anyway. Also update the test to reflect this change. Test: vogar --mode=host DexClassLoaderTest Change-Id: I0119787f05750d9fe61b085c5f91d6fa4741bc3e
* BlockguardTest: add test for Os.openNarayan Kamath2017-03-011-0/+19
| | | | | | Bug: 35752299 Test: vogar --mode=host BlockGuardTest Change-Id: I0443c8c3df3602e00e1dee590311f69f64619d15
* Stop optimizing dex files when class loaders are createdCalin Juravle2017-02-021-47/+0
| | | | | | | | | | | | The background compilation job will take care of optimizing the loaded dex files. Test: m test-art-host ART_TEST_RUN_TEST_NO_PREBUILD=true m test-art-host-run-test art/toos/run-libcore-tests --mode=host Bug: 32871170 Change-Id: Iab3a933f90bf5fea2240e9df09f932fa017a7905
* MethodHandles: Implement array accessors / identities & constants.Narayan Kamath2016-11-071-0/+209
| | | | | | | | | | | | | | | These transforms need typed access to the arguments of the handle, which has been implemented in EmulatedStackFrame (along with tests). These implementations favour simplicity. If required, we can gain more performance by writing them as critical JNI functions or via additional ugliness. Tests added in 7ba2827e6d34023c78206972a1c3c7915be6f828. Bug: 30550796 Test: make test-art-host Change-Id: I8c13ca19b907e84bd31e82925191b4fcb1099904
* Enable dalvik.system.BlockGuardTest#testFileInputStream testShubham Ajmera2016-11-031-14/+22
| | | | | | | | | | | As /proc/version is no longer accessible to CTS tests, the test now creates and uses a temporary file instead. Bug: 29495646 Test: cts-tradefed run cts -m CtsLibcoreTestCases -t \ dalvik.system.BlockGuardTest#testFileInputStream Change-Id: I1cc4b89f885e906218f5a706cd8cbbeedde70393
* Set warnings for unbuffered I/OShubham Ajmera2016-09-291-3/+126
| | | | | | | | | | | | | | | | | | | The change introduces a new BlockGuard policy to track unbuffered I/O. Policy can be set in the following way: StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectUnbufferedIO().build()); IoTracker generates warnings for unbuffered I/O if the operation could be replaced with a buffered I/O. The change also removes IoTrace class which was called each time an I/O operation was invoked. Bug: 3018772 Test: vogar BlockGuardTest Change-Id: I18d42c3b3ceaf0b4b98cf15914716b20a48e50c8 (cherry picked from commit 7b05c367448843d7e62db4e87a1ac8fae9b0176c )
* Support loading a DEX file from a ByteBuffer.Orion Hodson2016-09-022-0/+302
| | | | | | | | | | Introduces a new class InMemoryDexClassLoader taking a ByteBuffer to load DEX files from memory. Bug: http://b/26878838 Test: JUnit tests in InMemoryDexClassLoaderTest. Change-Id: Ia0bfbd849e716f17a70e54154bd5c5817f79a9e8
* Add CTS test for mixed Dex and Path class loader.Richard Uhler2016-05-031-1/+40
| | | | | | | | The test verifies you can use a DexClassLoader to generate optimized code that will be picked up by a PathClassLoader. Bug: 19937016 Change-Id: Ic977bd0db8275ef032d6e14c704f276d31cc6b1c
* Reinstate blockguard checks for file reads / writes.Narayan Kamath2016-01-081-0/+198
| | | | | | | | Also adds a simple unit-test for file based checks. bug: 25861497 Change-Id: I886321eae657af6531b21eb90c4749de7aec20d7
* Fix JniTest#testGetSuperclassBrian Carlstrom2015-06-091-3/+1
| | | | | Bug: 5652725 Change-Id: I2a6896659351f3e722492bad8866c2dc5b01eb11
* Fix problems with DexClassLoaderTest.Richard Uhler2015-05-281-285/+163
| | | | | | | | | | | | | | | This fixes a problem with the DexClassLoaderTest where oat files from previous tests were being cached and reused for later tests. Now each test uses its own directory for loading-test.dex and friends so they are treated as separate dex files from test to test. As part of this fix, the helper functions for the tests were reorganized. Bug: 21033982 (cherry picked from commit 5f81ff794e9e4f480bd0011a870afc2b08060e42) Change-Id: I4e35914dc365042ea2f71ad20933381f34502b9a
* Fix init test cases from DexClassLoaderTest.Calin Juravle2014-08-191-32/+52
| | | | | | | | | | Because the tests cases are executed in the same runtime and the class linker may cache generated optimized files, init tests need to use their own optimized directories (so that they can reliable test the number of generated files). Bug: 16806146 Change-Id: I8e784397c0d1e71a5e89eac8adc7796283c0e635
* Fix the expected failure when an array of void is attempted to be created.Ian Rogers2014-05-181-2/+2
| | | | | | NoClassDefFoundError is the RI behavior. Change-Id: Ia03b585def9f772aeb17f1cdec4da2d0c807ede3
* Add unpadded array allocations.Ian Rogers2014-02-281-0/+135
| | | | | | | | | | | | | | | Unpadded array allocations avoid unused bytes following arrays. API conventions follow those of newNonMovableArray. Dalvik implementation assume dlmalloc allocation properties, ART implementation is handled by resizing the array post-allocation: https://android-review.googlesource.com/83670 Add VMRuntimeTest to check the properties of the array allocation routines. Change java.lang.reflect.Array.newInstance to compare more probable array types before less probable ones. Bug: 13028925. Change-Id: Icf6bfb1aa5ad4faa062b393082c689b6118a84b5
* Use a diretory cts can write to for DexClassLoaderTest.jeffhao2013-11-071-3/+14
| | | | | | | | | Vogar will use a different directory if it can't find the directory that cts uses. (cherry picked from commit b1bf327890ba2e44f9681f9b5baa3cced6f46a03) Change-Id: Idb94822c5d7628bd44d86d28ecf271a7dbf0ee9b
* Tests for getting the superclass of an interface.Jesse Wilson2013-11-051-0/+11
| | | | | | | | | | | Dalvik has always gotten this wrong in JNI. The JNI test validates this bogus behavior. When we fix bug 5652725 we should flip this test. Bug: http://b/5652725 (cherry picked from commit 869d688ff420133d88647c375fd225920ffcecda) Change-Id: I44b7b53eb9704ddebdae0c824a4fc4234b7fbe03
* A simple set of JNI argument passing tests.Ian Rogers2013-11-051-0/+357
| | | | | | Change-Id: Ibf2051fae4b5026a4a14fcdc27be71415520d117 (cherry picked from commit cd8016c67b7f215bf374467257ede53197c44423)Conflicts:
* DexClassLoaderTest.setUp should clean optimized directoryBrian Carlstrom2011-10-141-1/+6
| | | | | Bug: 5410715 Change-Id: Ifde74c42105e8c408e0073953e5b0bf91ec86414
* am a186c233: I meant assertEquals().Dan Bornstein2011-02-101-1/+1
|\ | | | | | | | | * commit 'a186c233345c9cc0c7864dc5bd466c4d8413de6c': I meant assertEquals().
| * I meant assertEquals().Dan Bornstein2011-02-101-1/+1
| | | | | | | | Change-Id: I37c5859dea0bc33eb7271446eddf9548fbbe180a
* | am 6f42688f: Clean up test and expand slightly.Dan Bornstein2011-02-101-24/+35
|\| | | | | | | | | * commit '6f42688fdc1389ed10d611c51aabc6034174db5a': Clean up test and expand slightly.
| * Clean up test and expand slightly.Dan Bornstein2011-02-101-24/+35
| | | | | | | | | | | | | | | | | | | | | | | | In particular: * Added a test to make sure that optimized dex files are being generated where expected. * Made all the helper methods private. * Removed the "static" declaration from two test methods. Bug: 3439372 Change-Id: I7d67169304072330f504bb90af3bf4ac09eeb165
* | am ec80ed70: Fix the test.Dan Bornstein2011-02-101-1/+3
|\| | | | | | | | | * commit 'ec80ed70b9790785bd70b9482ec94e7dea09fd48': Fix the test.
| * Fix the test.Dan Bornstein2011-02-091-1/+3
| | | | | | | | | | | | | | | | | | | | It now uses an explicit "optimized" directory for optimized dex files, so that there is no danger of trampling an unoptimized dex file during the course of the test. Bug: 3439372 Change-Id: Ie45ab5fde5e55dda06cdf5a23831abc80f8aab18
* | resolved conflicts for merge of 6186821c to dalvik-devJesse Wilson2011-02-071-2/+1
|\| | | | | | | Change-Id: Ic6f0172767d6feedb188d3a5e7488a67702ef8c4
| * Move libcore.base classes to libcore.util and libcore.io.Jesse Wilson2011-02-071-2/+1
| | | | | | | | Change-Id: I2340a9dbad3561fa681a8ab47d4f406e72c913e3
* | Tweak this test to not re(re...)copy files.Dan Bornstein2011-01-251-1/+6
|/ | | | | | | | | The test was sporadically failing, because the VM doesn't ever unload dex files, and the same file would get truncated and rewritten. If the VM got asked the right question at the right time, it would find itself staring at a truncated dex file. Change-Id: Id9f2ea791b6974a40ce6937d6e54137c78dc7f98
* Finish fleshing out the basic coverage.Dan Bornstein2011-01-171-22/+171
| | | | | | | There are now several tests for each combo in the cross-product of {dex, jar} x {one file, two files}. Change-Id: I18057471d51a118af6861b4da7d9e42c9f6fda9e
* Naming: Reduce confusion, increase consistency.Dan Bornstein2011-01-171-18/+18
| | | | Change-Id: I25e5fccac4c025e35d45d4920d9f2308c658ec53
* Copy the second jar/dex files in setUp().Dan Bornstein2011-01-171-8/+13
| | | | | | | (My last patch demonstrated this deficit in the test, not an actual bug in resource handling.) Change-Id: Ia4f6a2e747af870e362a0f41e4e641a4ef488a31
* Start to use the second jar/dex file in DexClassLoaderTest.Dan Bornstein2011-01-171-49/+133
| | | | | | This demonstrates that there is an issue with resource handling. Change-Id: I2a33b6fd6f2be2e1d1879d539c86ecbb8e5b198c
* Clean up and slightly expand this test.Dan Bornstein2011-01-161-28/+31
| | | | | | | * Added a same-loader resource reading test. * Rearranged the main test class to be a little clearer. Change-Id: I7e85685245800dbdf6e3925390840d18e5ae4222
* This test is now bona fide nontrivial.Dan Bornstein2011-01-141-14/+139
| | | | | | | It also demonstrates that loading from a raw dex file doesn't yet work! Change-Id: I2b0ccd517edd052d374af8d0762c8f1f8734720f
* Make the test even yet a little less trivial.Dan Bornstein2011-01-141-0/+15
| | | | | | (How do you eat an elephant? One bite at a time.) Change-Id: Ibf2fd6794e05133642c7426fe4608d2b5a4b7592
* Make the test a little less trivial.Dan Bornstein2011-01-141-12/+32
| | | | Change-Id: Ic00cbcdbda15a151b0080e097e74e39ca32d0a32
* Trivial test for DexClassLoader.Dan Bornstein2011-01-121-0/+64
To be expanded, soon! Change-Id: Iecdcc9ff8cc8560c7e3bd9720b2fbe9c1e9ed8a9