summaryrefslogtreecommitdiffstats
path: root/harmony-tests
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate use of BrokenTest and SideEffectBrett Chabot2014-05-214-15/+7
| | | | | | | | | Use expectations files instead. (cherry picked from commit 6a6b612286976cc185c898803fe51e4e062bd9eb) Bug: 12924356 Change-Id: I9b7e71805a80176c873cffe46bed65f81de1903d
* Fix tests that relied on ReferenceQueue ordering semantics.Narayan Kamath2014-05-131-5/+6
| | | | | | | Commit eb3e5888d4b3 changed ReferenceQueue from LIFO to FIFO. Fix tests that were expecting it to be LIFO. Change-Id: I222513ddb091755fb27294939beb6565b661dd3d
* Merge "Fix Hashtable CTS test"Neil Fuller2014-05-121-88/+18
|\
| * Fix Hashtable CTS testNeil Fuller2014-05-121-88/+18
| | | | | | | | | | | | | | | | | | | | The test assumed that the Enumeration returned from element() and keys() could be cast to Iterator. Even if it was previously ok, it isn't now and it is not part of the public API. Bug: 13747624 Change-Id: I552a886711178708cbe7b6d87a976b6c1a839467
* | Remove test for unsupported GregorianCalendar functionality.Narayan Kamath2014-05-121-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also adds an explanatory comment and makes the intent of the implementation clearer without changing any of the functionality. TL;DR - there doesn't appear to be any sensible way to provide any sort of consisent semantics if we plan on supporting these fields. bug: 12778197 Change-Id: Iadaaaa5d4bdddec4aceca498ffc870edf2cbefed
* | Fix UnicodeBlockTest.Narayan Kamath2014-05-121-81/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove negative tests for blocks that weren't assigned in Java6 but are currently assigned. Those tests weren't very useful anyway, since this class must serve as a test of our ICU glue and not of the underlying ICU data. Also removes a test for the deprecated SURROGATES_AREA member which we don't support to remain consistent with ICU's treatment of blocks in patterns. bug: 12491302 Change-Id: I9301cab55913df635128fe77f820729c34aa6fe3
* | Blacklist a known failure in GregorianCalendarTest.Narayan Kamath2014-05-121-5/+7
|/ | | | | | | | | | | | | The issues here relate to how we deal with ambiguous wall clock times, i.e, wall clock values that we "skip" when we move the clock forward when transitioning into daylight savings, and wall clock times that occur twice when we move the clock backward This isn't a regression. We've never handled this correctly. bug: 12778197 Change-Id: Ida79583c02c6895096a8afdd8f59b1002b282d32
* Fix various errors in FileURLConnectionTest.Narayan Kamath2014-05-091-19/+52
| | | | | | | | | | | | | | | | | | | | - First, the test was broken pretty badly. It would pass a Jar style URL to a FileURLConnection and expect it to work, this is out of spec and seems wrong in general (file:///foo.apk!resources/foo.txt). - The RI supports various "headers" on file URL connections (sigh). As if the getHeaderField(int) and getHeaderFieldKey(int) APIs weren't bad enough. This has now been implemented with a naive implementation. - Fixes FileURLConnection to populate a header map for information it provides (content length, content type etc.) bug: 11664881 Change-Id: I7a3e9aaa79bf125abbcfe8367574115ce54718e3
* 1.7 interoperability changes for FileLockNeil Fuller2014-04-292-0/+16
| | | | | | | Adding acquiredBy(). This method is effectively a synonym for channel(). Change-Id: Ifa0b89debb42a7181f1f5f188ae7175970286adb
* SSLEngine: update harmony testsKenny Root2014-04-251-465/+193
| | | | | | | The old tests were broken and difficult to debug because of catching exceptions and calling fail() Change-Id: Idad6774e5f0839242b0667be1a25784b7ec70aef
* Merge "Removal of a broken CTS test"Neil Fuller2014-04-231-29/+0
|\
| * Removal of a broken CTS testNeil Fuller2014-04-231-29/+0
| | | | | | | | | | | | | | | | | | | | | | The cause of the failure is that the test asserts that the entrySet() Set from an UnmodifiableMap is Serializable, when it is not. The test fails under the RI as well so I have removed it. Bug: 11668227 Change-Id: Ife3ce848f77d6f63931852792e0f6f0db83382a8
* | Fix for ThreadGroup CTS test.Neil Fuller2014-04-231-527/+212
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed the test for UncaughtExceptionHandler. This was actually several tests in one. Each has been broken out. The ones that were failing were a result of the CTS test runner executing as an instrumented Android app. The default behavior (configured in com.android.internal.os.RuntimeInit) is to kill an app if an uncaught exception reaches the top-most handler. The solution was to set an alternative default UncaughtExceptionHandler on Thread to suppress this behavior for the duration of the test by installing an alternative handler. This handler could also then be used to confirm the ThreadGroup behavior of "if an exception is handled by the ThreadGroup hierarchy, use the Thread default UncaughtExceptionHandler". The functionality changes are in: 1) setUp()/tearDown() - installing, uninstalling the handler and removing a Thread.sleep(50). 2) test_uncaughtException_* methods split out. Additional tests were added and one was removed. 3) Tidied up test_list(), which was relying on particular thread names and would have used Thread.stop() (which is unimplemented) if those threads were found. The remaining changes were refactorings to pull out common code, remove unneccessary newlines / comments / semi-colons, reformat to 100 chars width, remove == true / == false conditions, delete dead code. All pure functions have been made static to make it clearer they have no side-effects. What remains is still not nice, but is improved and ~300 lines shorter. Bug: 13748422 Change-Id: I995553a909974cb0bb6b9521a6a39fd0d6014a3f
* Merge "Change DecimalFormat.setRoundingMode() behavior to stay in spec"Neil Fuller2014-04-221-2/+2
|\
| * Change DecimalFormat.setRoundingMode() behavior to stay in specNeil Fuller2014-04-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The serialization tests revealed that some DecimalFormat instances could not be round-tripped. The reason is that the setRoundingMode() method was setting a non-zero rounding increment, which cannot be persisted, and also creates patterns that are outside of the DecimalFormat spec. Addressed the fact that ICU4C appears to support RoundingMode.UNNECESSARY now by deleting special-case code. Changed SerializationStressTest to use canonical DecimalFormat patterns: The ones chosen had a couple things that were not ideal: 1) Putting '-' in quotes causes ICU (for non-obvious reasons) treat the negative pattern prefix as not being default. Default in this case means "the positive prefix with a preceding '-'. Removing the quotes meant it would recognize the pattern as not needing everything after ;., so the pattern would be shrunk. 2) The positive pattern was also not one ICU could deal with fully. ICU changed "#.#" to "#0.#" at parse time (which can be corrected with a setMinimumIntegerDigits(0)). It's not clear why ICU cannot deal with parsing "#.#" when it can produce it, but there is a long comment in decimfmt.cc suggesting it is intentional and to avoid format producing empty strings. The pattern has been changed to one that ICU can handle and would choose when the various serialized fields are read back. This is necessary because NativeDecimalFormat compares the patterns and not just the serialized fields. Leaving the pattern check part of equals() means that two non-spec patterns will not be considered equal(), which is important while Android allows non-spec patterns. Restricting support in DecimalFormat to the documented subset of characters is not worth the effort and may cause problems elsewhere. Change-Id: I2de588458b86619733c0dc1692d526f179059910 Bug: 11668227
* | Allow empty rules in a RuleBasedCollator.Elliott Hughes2014-04-211-9/+4
| | | | | | | | | | | | | | This is allowed by the CLDR specification, and we were already allowing most forms of empty rules, just not the zero-length string. Change-Id: I3c2a020aac23e54f8044defbfe2e2a5b600e454c
* | Update collation tests for icu4c 53.ccornelius2014-04-213-58/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of ICU 53, rule strings must begin with a reset '&'. http://www.unicode.org/reports/tr35/tr35-35/tr35-collation.html#Rules Also, fewer collation elements exist in ICU 53 because ae-ligature maps to two rather than three logical collation elements. Now the last one yields only one CollationElementIterator value rather than two. Finally, it's no longer possible to switch from forward to backward iteration without calling reset/setOffset/setText. This used to be undefined behavior but is now checked. Change-Id: I663a2b229e551cd6f5753ddae0660f813dbbf866
* | Fix broken CTS testNeil Fuller2014-04-161-303/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix is in test_isJavaIdentifierPartC() and reverses the assertion for Character.isJavaIdentifierPart('\u200b') from false to true. The test method below it (isIdentifierPart(int)) was already asserting this and the behavior has been confirmed against the RI. Other changes made: Uncommented some assertions that now pass, removed unnecessary / incorrect comments, added missing braces, some reformatting to 100 chars to improve readability, removed empty lines at the beginning of methods . Converted all assertTrue(msg, !condition); to assertFalse(msg, condition). Change-Id: I0a339df3cd594252a13083e4d4319260ce43fa5d Bug: 13748395
* | Merge "Fix for ClassLoaderTest under CTS"Neil Fuller2014-04-072-61/+140
|\ \
| * | Fix for ClassLoaderTest under CTSNeil Fuller2014-04-072-61/+140
| |/ | | | | | | | | | | | | | | | | | | The tests could not work given the arrangement of classloaders in Android apps. This also fixes a known failure case in ClassLoaderTest which was due to missing resources. Also updated ClassTest. Change-Id: I114aa9b1a177911aed0aef87819d93a260f0b8d1 Bug: 12491655
* | Fix broken CTS HttpCookie testNeil Fuller2014-04-071-2/+10
|/ | | | | | | | Added some test cases and corrected the test to conform to the RI behavior. Change-Id: Ib32baf2e923c50fca1a5a4cb7cbd7f55ed70e760 Bug: 13748507
* Fix test failures due to the ICU-52 update.Narayan Kamath2014-03-203-76/+48
| | | | | | | | | Some of the failures were due to the fact that we stopped parsing numbers like "36-" for RTL locales, and others were due to the fact that we were using reference equality for comparing minusSign. Change-Id: I239e6b8b77165a4665c554e46e6fb652beec2ec2
* Merge "Add 1.7 methods to HttpCookie."Neil Fuller2014-03-101-0/+36
|\
| * Add 1.7 methods to HttpCookie.Neil Fuller2014-03-071-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | Adding isHttpOnly() and setHttpOnly(). Added more documentation around the specifications supported since the HttpOnly attribute was added by RFC 6265. Improved documentation around toString() because I found the method confusing, plus RFC 6265 goes back to a simpler format than the RFC it obsoletes meaning callers should use version 0 not version 1. Change-Id: Ie52ea80dc5bd7d1575fcaccde70976ed29729817
* | Implementation of MulticastChannel.Neil Fuller2014-02-281-80/+58
|/ | | | | | | | | | | | | | Note: ProtocolFamily / StandardProtocolFamily / DatagramChannel.open(ProtocolFamily) have not been implemented. There is a related change to libnativehelper that must be merged at the same time to avoid build breakage. See https://android-review.googlesource.com/#/c/81371/ Bug: 12464155 Change-Id: I07fc049b429a2d373e9bd7b07149632f5cd69f9d
* Improve error message when attempting to open an empty zipPaul Duffin2014-02-261-7/+0
| | | | | | | | | | | | | | The bug report states that the behaviour of ZipFile has changed between 4.3 and 4.4 when opening an empty zip file. I did some investigation and it appears as though the reference implementation also throws an exception in that case so I decided that 4.4 is working as designed. However, to make it clearer I made a minor change to explicitly check for an empty zip file so that we can report a slightly improved message explaining that they are not supported. I added a test for various forms of empty streams and zip files and removed part of an older test from harmony tests as it is no longer necessary. Bug: https://code.google.com/p/android/issues/detail?id=65380 Change-Id: I1f2fcbf6bbaedb7dbccf8dd4f1cec4e330274524
* Fix remaining file related CTS Test failures.Narayan Kamath2014-02-248-210/+84
| | | | | | | | | | | | Most failures were because tests were trying to open files relative to the current working directory, instead of in a temp directory. FileTest was failing because it didn't construct paths correctly. It would add an additional separator char even if the path already ended with one. Change-Id: Ie90aed84f81275924558e9dba43d71748dbb4076
* Addition of 1.7 methods to URLConnection.Neil Fuller2014-02-191-1/+4
| | | | | | | | | | | | | | | | | | URLConnection.getHeaderLong() and URLConnection.getContentLengthLong(). These methods are required by okhttp. Changed JarURLConnectionImpl.getContentLength() to return -1 when the size of an entry cannot be represented as an int. Previously it would have returned a corrupted, possibly negative, value due to a cast. Changed FileURLConnection.getContentLength() to return -1 when the size of the file cannot be represented as an int. Previously it would have returned a corrupted, possibly negative, value due to a cast. Change-Id: Ib43e68a2536c2602b4c7ee0cda68fa1f90045f57
* Merge "Fix another set of file related tests."Narayan Kamath2014-02-1912-401/+377
|\
| * Fix another set of file related tests.Narayan Kamath2014-02-1912-401/+377
| | | | | | | | | | | | | | | | | | | | | | | | - Get rid of Support_PlatformFile, use File.createTempFile instead. - Replace numerous uses of "user.dir" / "user.home" etc. with File.createTempFile - Replace calls to Process / chmod with Libcore.os.chmod. The calls wouldn't have worked anyway, since chmod on android doesn't understand the incremental (+w, -x) syntax. Change-Id: Ic6944568bbee6a548da6dcb4364b882636f2959f
* | Fix PropertiesTest.Narayan Kamath2014-02-171-4/+3
|/ | | | | | | | | | | | | | | A test case was using HashTable.get instead of Properties.getProperty. The problem is that Properties.propertyNames will enumerate all properties from the object as well as from the "default" Properties object it was constructed with. The get method derived from HashTable isn't aware of default properties though, so it will fail. Using composition instead of inheritance would've resulted in a cleaner design. Change-Id: I58323767e6872ed1722167d2a4a6d89a98d26ec7
* Merge "Tidy up Console, fix ConsoleTest"Narayan Kamath2014-02-141-4/+0
|\
| * Tidy up Console, fix ConsoleTestNarayan Kamath2014-02-131-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use a more specific exception type. The use of IOException led me to believe that the constructor was performing i/o ops on the underlying file descriptors. (They were not.) - Delete a test that asserted that System.console() was always non-null. It will be non-null only for command line apps (tests run from vogar), and not for "regular" android apps (tests run from CTS) because stdin / stdout will not be TTY devices regular apps. bug: 12490236 Change-Id: I8c1e37bcb21de5862dc8ea198852995a020437a7
* | Merge "Fix GregorianCalendarTest#test_addII."Narayan Kamath2014-02-141-5/+5
|\ \
| * | Fix GregorianCalendarTest#test_addII.Narayan Kamath2014-02-131-5/+5
| |/ | | | | | | | | | | | | | | | | We're going through the trouble of accounting for DST changes in GregorianCalendar.add(int, int) (as per the spec), so adjust our tests to agree. bug: 12778197 Change-Id: Ie98cc11c2a2f7f6d9c7be8d725960552309f4f5d
* | Partially fix GregorianCalendarTest.Narayan Kamath2014-02-131-1/+1
|/ | | | | | | | | | | | | | ICU4C data (see icu4c/data/misc/supplementalData.txt) as well as the RI agree that the minimum number of days in the first week of the year should be 1 in canada. (I'm not a 100% convinced that this is correct, the canadian standards board claims to have implemented ISO 8601, which requires a 4 day minimum. However, that site links to several documents such as CSA Z234.5 that are not publicly accessible). Change-Id: I1d62c7f94d5f059b6ba2ad60bcf8434cdea0d9ce
* Implementing bind() and getLocalAddress() for NIO2.Neil Fuller2014-02-113-103/+458
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces NetworkChannel, but only bind() and getLocalAddress() methods. To avoid breaking existing Android applications that extend ServerSocketChannel, DatagramChannel and SocketChannel the methods have been added with concrete implementations that throw exceptions rather than leaving them abstract. In channel tests, usages of channel.socket().bind() and channel.socket().getLocalSocketAddress() have been changed to channel.bind() and channel.getLocalAddress(), since the behavior is close enough and the tests should be written against the channel APIs as much as possible. Tests have been added for new methods. Removed further overriding in DatagramChannelImpl.DatagramSocketAdapter and SocketChannelImpl.SocketAdapter which revealed some bugs and lack of clarity in the docs for the socket methods: Improved the documentation for DatagramSocket.getLocalAddress(), DatagramSocket.getLocalSocketAddress(), ServerSocket.getInetAddress(), ServerSocket.getLocalPort(), ServerSocket.getLocalSocketAddress(), Socket.getLocalAddress(), Socket.getLocalPort(), Socket.getLocalSocketAddress(). These methods treat special cases differently. Fixed a bug in DatagramSocket.getLocalSocketAddress() where it would incorrect throw an exception if the socket has been closed, which contradicts the (updated) documentation and the RI. It now returns null. Added tests. Fixed a bug in Socket.close(): a closed socket would still report as being connected. Added tests. Fixed a bug in Socket.startupSocket() - the socket was recording it was being bound, but was not updating the cached local address. This method is called during ServerSocketChannel.accept() and would cause the socket to report its local address as being the wildcard address, when it is not. Added a test. Change-Id: Ibec8527e1c72597e268d23e6c1f03eb16e46cdc4 Bug: 12464155
* Fixed incorrect class names in golden serialized files for EnumSetTest and ↵Paul Duffin2014-02-042-0/+0
| | | | | | | EnumMapTest Bug: 12780442 Change-Id: Ib5fe88a1fad7e181ead68d281c04a22110697d48
* Merge "Refactoring in preparation for NIO2 changes."Neil Fuller2014-01-307-185/+276
|\
| * Refactoring in preparation for NIO2 changes.Neil Fuller2014-01-297-185/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making the various Socket/Channel classes more consistent with each other for synchronizing state between the Channel, Socket and the OS. This is in preparation for NetworkChannel.bind(). Synchronizing state revealed a test that relied upon a Socket from a channel not reporting isConnected() properly after a connect(). Tests have been updated. Reading the local address back from the OS revealed that Android is using IPv6 and reports the string equivalent of IPv4's 0.0.0.0 as "::". Updated a test that was relying on the string form. Calling connect() twice on a DatagramSocket appears inconsistent with itself and Channel and other Sockets. A pure DatagramSocket switches over to the new remote address. I have changed the Channel-backed DatagramSocket to throw an IllegalStateException exception, and have created a bug to discuss making the calls more consistent. Socket has been modified to avoid using the address field to store the local address after a bind(). This field is documented as holding the remote address, not the local. Changed implementation of SocketChannelImpl.socket().getInputStream() and SocketChannelImpl.socket().getOutputStream() to use the one that is implemented by Socket and not a custom NIO-based implementation. The use of NIO provided two parallel implementations for the same thing. This change alters behavior when attempting to read zero bytes and when a Channel is in non-blocking mode: now it throws IllegalBlockingModeException rather than ArrayIndexOutOfBoundsException. The tests have been updated. Various tidying up changes to introduce @Override, remove unnecessarily initialized local variables, fields, semi-colons, javadocs and imports. Added close() calls for objects during tests that were cluttering the logs. Modified IoBridge.connect() to be void. Adjusted SocketChannelImpl accordingly and tidied up impossible cases. Modified SocketChannel.connect() so that it always returns false in non-blocking mode. This looks like an existing bug: it would previously have returned true, even though the connection was potentially still pending. Tests have been added. Also tidied up SocketChannelImpl.finishConnect() - it was potentially resetting the isBound state. Change-Id: Ic7943615b4b763f77e74397e0e91a62edc7d7017 bug: 12464155
* | Fix ComputeSerialVersionUIDTest.Narayan Kamath2014-01-227-180/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | The old golden files were referring to the wrong class, and contained serial version UIDs that didn't match those generated by any version of android (or the RI). This change deletes the golden files and switches to direct assertions in the test. All tests pass on aosp-master, v4.xx of android and the RI. bug: 12490445 Change-Id: Ia65b6d65bc9a3d4cbc62a7a0f7bdfc004e7315e2
* | Fixed broken EnumTestPaul Duffin2014-01-216-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous file move changed the class name for various classes used in the EnumTest. That broke the tests as they relied on files containing serialized forms of those classes and so had hard coded references to the old class names which no longer existed. The fix was two part: - Use the correct class names in the serialized files - Remove duplicate serialized files that are no longer used Bug: 12491225 Change-Id: I60b503bb2509071ccac5fec7b05dd5160d9dd7d0
* | Fix encodings in X500PrincipalTestKenny Root2014-01-141-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As said in AttributeValue, DC and emailAddress should be encoded in IA5String as specified by RFC5280. Also the canonical encoding of a T61String could be PrintableString when the string is only 'A' according to b/2102191 but this could be a mistake. Consecutive spaces and leading and trailing runs of spaces should be escaped for RFC 1779. Also the RFC 2259 doesn't specify anything other than the beginning or end spaces, but the RI escapes the beginning and ending runs of spaces. Bug: 12490346 Bug: 12490876 Change-Id: I6591156ba0a27a894241b039570488f89c885242
* | Merge "Fix SerializationStressTest1#test_18_33_writeObject"Narayan Kamath2014-01-141-6/+2
|\ \
| * | Fix SerializationStressTest1#test_18_33_writeObjectNeil Fuller2014-01-141-6/+2
| |/ | | | | | | | | | | | | | | | | | | Since commit 086002299f96dbbec18a061e812dc1cb79cb1f10 ObjectOutputStream.writeObject() no longer throws StreamCorruptedException when encountering an IOException during serialization. It now throws the actual IOException. bug: 6447733 Change-Id: I2b4add330cbb67d6d1db159940cb2e1fe2216bcc
* | Fix test breakage in Harmony SSLSessionTest.Alex Klyubin2014-01-131-2/+16
|/ | | | | | | | The breakage was caused by the SSLSessionTest assuming that TLS/SSL connections by default handshake to the SSL_RSA_WITH_RC4_128_MD5 cipher suite. Bug: 11220570 Change-Id: Ib1ac44f83c968ec3dc7432339e1fc0f64d63733f
* Delete Support_PortManager & OldDatagramSocketTestNarayan Kamath2014-01-069-1954/+864
| | | | | | | | | | | | | Support_PortManager didn't really work, so rewrite all tests that use it. Also, dedup OldDatagramSocketTest with the harmony DatagramSocketTest. Fix various broken test cases and terribly written tests. bug: 11689863 Change-Id: I4efb9e02eb88517273fff50a0dec1d0262feafb2
* Fix test breakages due to TLSv1.2 enabled and FS preferred.Alex Klyubin2013-12-191-1/+1
| | | | | Bug: 11220570 Change-Id: Ic918e806ae1d8ea9b98c690cfabd9c3245886525
* Fix broken test cases in DeflaterTest & InflaterTestNarayan Kamath2013-12-192-40/+4
| | | | | | | | | | We explicitly disallow setLevel or setStrategy after setInput. (It's clearly documented in the method docs). Presumably, this is to prevent users from shooting themselves in the foot & causing issues by changing the strategy / level after we've started deflating. Change-Id: Ifd65728ff0ec7e47aeec716aeb6f44242573c491
* Fix broken assumption in a unit test.Narayan Kamath2013-12-191-3/+7
| | | | Change-Id: I15c25ff373b1ca4acb5e530f75d028b971779549