summaryrefslogtreecommitdiffstats
path: root/luni/src/test
Commit message (Collapse)AuthorAgeFilesLines
* Add math tests in csv format for libcore math functionsMichael Chen2014-07-216-0/+10328
| | | | | | | | | The goal here is to have a csv file with math tests that different parts of Android can all use the same math tests. This change provides these initial csv files as well as the corresponding testing framework for libcore. Change-Id: I56430bd9224d92853aefa5024d6fdd1d10dfb255
* Merge "CipherTest: check multiple calls to doFinal work"Kenny Root2014-07-171-0/+8
|\
| * CipherTest: check multiple calls to doFinal workKenny Root2014-07-141-0/+8
| | | | | | | | | | | | | | | | | | | | In existing implementations of JSSE Cipher providers, calling "doFinal" resets the cipher to the state it was at when "init" was called. Note that this is dangerous to do, but it appears some people do it. Bug: 16298401 Bug: http://code.google.com/p/android/issues/detail?id=73339 Change-Id: I32e26fde660dc7c50fdac0d74d5d97801f1da9f9
* | Revert "Revert "Add a cache for ZoneInfo objects in Java""Neil Fuller2014-07-171-0/+23
| | | | | | | | | | | | | | | | | | This reverts commit 01b6a878d10ee68db87c3d85d137e81a5257a78a. Contains a fix for when the timezone ID is not found. This includes a new test. Change-Id: I2e5e669782ea6caf4e97153ed6b63ca6ee4ef50d
* | Revert "Add a cache for ZoneInfo objects in Java"Neil Fuller2014-07-171-18/+0
| | | | | | | | | | | | This reverts commit a6e8689807f5a8bb9470ce7c26a47455d2d0608d. Change-Id: I17a0262d169db3418f2f8888195381f778975dc4
* | Add a cache for ZoneInfo objects in JavaNeil Fuller2014-07-161-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This mirrors the single-item cache in localtime.c. This is in preparation for an upcoming change to migrate android.format.text.Time over to Java. It will be making use of the Java ZoneInfo instead of the native equivalent. The Java cache has a size of 1 like the bionic one, though this can easily be increased. Given the default TimeZone / ZoneInfo was always pinned, in many cases the memory usage will not go up noticeably. In scenarios where applications load timezones besides the default a cache size of 1 potentially increases pinned memory usage by one ZoneInfo plus the overhead of the prototype object held by the cache (which is never returned to callers). An example ZoneInfo is "Europe/London", which has ~190 transitions (1 int + 1 byte) and ~6 types (1 int + 1 byte). Overhead of other fields is ~ 13 bytes, plus the ID string. 190 * (4 + 1) + 6 * (4 + 1) + 13 = 993 bytes. The prototypes held by the cache share the majority of their memory with their clones returned from ZoneInfo.makeTimeZone() and so the overhead of introducing the cache itself should be in the order of a few tens of bytes at most. In future we may want to increase the cache size to 2 in order to support apps that compare / switch timezones to increase the odds of the default remaining in the cache. Sizes above 2 look increasingly specialist. Change-Id: I0b7daa8ad5d334c8d421dfaa6e0421d3c181a915
* | Tidy up OldAndroidLocaleTest#testICULocales.Narayan Kamath2014-07-161-6/+11
| | | | | | | | | | | | | | Construct the locale object directly instead of having a list of strings and parsing them by hand. Change-Id: Ia26ab30cbe7c5e6e10aca81a0d55b213879b5112
* | TLS-PSK cipher suites enabled when PSKKeyManager is provided.Alex Klyubin2014-07-141-0/+108
|/ | | | | | | | This documents and tests that TLS-PSK cipher suites are enabled if a PSKKeyManager is provided to SSLContext during its initialization. Bug: 15073623 Change-Id: I8e2bc3e7a1ea8a986e468973b6bad19dc6b7bc3c
* Merge "Invalidate cache of default SocketFactory"Kenny Root2014-07-101-0/+174
|\
| * Invalidate cache of default SocketFactoryKenny Root2014-06-271-0/+174
| | | | | | | | | | | | | | | | | | | | | | Currently the default SocketFactory is set once and never invalidated. Use the Services cache version number to know when to invalidate our cache. This increases the time to get the default implementation from 63ns to 97ns on a Nexus 7 (2013) aka deb. Change-Id: I5d46f02fccaa25e5bcea69d5ca0e4924290cf0e1
* | Merge "KeyPairGeneratorTest: add back some DH tests"Kenny Root2014-07-101-6/+23
|\ \
| * | KeyPairGeneratorTest: add back some DH testsKenny Root2014-07-101-6/+23
| |/ | | | | | | | | | | | | | | | | Add back the DH tests that uses a pre-defined Diffie-Hellman prime and generator. Keep the tests that try to find safe prime disabled. Bug: 5513723 Bug: 16188130 Change-Id: If77b14287855528964665e7782be45c5f57434db
* | Merge "Fix unit tests now that the "tl" -> "fil" hack is gone."Narayan Kamath2014-07-091-11/+27
|\ \
| * | Fix unit tests now that the "tl" -> "fil" hack is gone.Narayan Kamath2014-07-071-11/+27
| |/ | | | | | | | | bug: 15873165 Change-Id: I2ffe1f384e2140b31adb72d1f4eaa029a70428f0
* | Remove more.Elliott Hughes2014-07-071-47/+0
| | | | | | | | | | | | (cherry-pick of f39b5ca3c6378c3c36c63889577004b9693ea9c6.) Change-Id: Idaf030cd369e728ec37df7107cd30062db899b7c
* | Remove.Elliott Hughes2014-07-0710-2257/+30
| | | | | | | | | | | | (cherry-pick of 63744c884dd4b4f4307f2b021fb894af164972af.) Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
* | RemoveBrian Carlstrom2014-07-072-109/+0
|/ | | | | | (cherry picked from commit 36214feb86a0963b23f34c8c63584252bd757e19) Change-Id: I96d5109c01e39255b9970f7a515ddd3575a50e56
* Merge "Fix a faulty Julian day computation."Elliott Hughes2014-06-261-0/+42
|\
| * Fix a faulty Julian day computation.Elliott Hughes2014-06-261-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The use of Calendar.MILLISECONDS was wrong, as was the use of ZONE_OFFSET without DST_OFFSET. The existing code pretty much only works for the values tested in the unit test! This patch adds new tests to make up for that. I've also added calls to Calendar.clear to ensure we're not leaking SECONDS and MILLISECONDS from the Calendar instances (which get initialized to the current wall clock) into our test values. This hasn't mattered in the past, but actually does matter here because tests like isMidnight measure down to the millisecond. Bug: https://code.google.com/p/android/issues/detail?id=72356 Signed-off-by: jasper tsai <jasper3_tsai@asus.com> Signed-off-by: hellena shih <hellena_shih@asus.com> Change-Id: I7d57590a95d3f026bdf1b991e0b1ddb47ba9af37
* | Merge "Clarify the String.compareTo contract and add tests."Elliott Hughes2014-06-261-0/+67
|\ \
| * | Clarify the String.compareTo contract and add tests.Elliott Hughes2014-06-261-0/+67
| |/ | | | | | | | | | | | | | | | | | | | | Our use of vague terms like "negative" and "positive" led VM engineers to assume they had more leeway than they actually do. While we're here, let's fix all the ambiguous use of 'character' and add a warning and link to Collator anywhere the non-standard (and non-locale-specific) case folding is used. Change-Id: I0a0fb2a493861d32fac0bc4e28ae9634f8ac342c
* | Assert that setEnabledProtocols/CipherSuites copy their inputs.Alex Klyubin2014-06-193-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SSLSocket, SSLServerSocket, and SSLEngine offer setEnabledProtocols and setEnabledCipherSuites methods which take an array of protocols or cipher suites as input. If these methods store references to the input arrays, then the internal state (lists of enabled protocols and cipher suites) of SSLSocket, SSLServerSocket, and SSLEngine could be modified without going through the setter methods of these classes. Correct implementations of these methods should store copies of the input arrays. Bug: 15753142 Change-Id: Ia5248050d81320ed1da99892278bd60872605f52
* | Fix for currency symbol coming from the default localeNeil Fuller2014-06-191-10/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NumberFormat.setCurrency() (actually DecimalFormat) was using currency.getSymbol() without passing the format's locale. This caused the default Locale to be used to look up the symbol. The fix uses the format locale, not the default. A test has been added to demonstrate the problem / fix. To avoid having the NativeDecimalFormat know about the locale class, the symbol is passed as an argument rather than the Currency object. This is an internal API. Making this change showed an issue with Currency.getSymbol(): For Locales without a country the currency code would be returned and not a symbol. ICU provides language-level symbols so this was not the best we could do. Since the code was previously using the default Locale, and the default locale usually has a country it was not previously obvious. testBug71369 broke because of this second issue. The code is also fixed here. This was discovered while investigating bug 71369 but is not related. Change-Id: If0ce280aefb042fe8f7ca126cced090b9268a866
* | Merge "Fix CurrencyTest.test_getSymbol for unknown variants"Neil Fuller2014-06-171-0/+35
|\ \
| * | Fix CurrencyTest.test_getSymbol for unknown variantsNeil Fuller2014-06-181-0/+35
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The behavior of CurrencyTest.getSymbol has changed since K for unrecoginzed locales. Commit de0eb683370d789e7bb25673b350b8dbf2ba5d69 now means the ICU default locale is set when the Java default locale is changed. Previously it would have been left unset and would have fallen back to using the system settings (most likely US or UK English during tests). The test is setting the Java default locale to "kr-KR" (a locale unrecognized by ICU) and requesting the currency symbol for USD for locale "kr-KR" (still unrecognized by ICU). Before the commit: Because the kr-KR argument is unrecognized ICU tries the ICU default (which was unset and so picked system setting of en). It returned "$". After the commit: As above, but now the ICU default is set to kr-KR. Since there is no entry for USD in the default it falls back to "root", and returns the value found there: "US$". Behavior when the default locale is unrecognized is edge-case and arguably it is no more / less correct before or after this commit. The test has been updated to reflect the new value + some tidy up of the test generally. This change also contains a more focused test that demonstrates the behavior in ICU and adds documentation to make ICU slightly clearer. Arguably neither the new ICUTest nor the existing CurrencyTest code should exist because they assert edge-case behavior that Android may wish to change in future. Bug: 14821275 Change-Id: I8beb6004b0c37d2fe59855d13d2c8e2e6fe1c530
* | Merge "Removing tests that test the SqlLite API directly."Neil Fuller2014-06-1712-3152/+145
|\ \
| * | Removing tests that test the SqlLite API directly.Neil Fuller2014-06-1712-3152/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many of the tests were testing that the SqlLite Java API works. Android does not ship with the SQLLite code as a public API so these have been removed. Some of the tests were testing JDBC APIs associated with Connection, Driver and DriverManager behavior so these have been retained and moved to libcore/java/sql/DriverTest.java / ConnectionTest.java Change-Id: I97ec05591019505f527ee134177c5637bbd08538
* | | Merge "CTS fix: Signature2Test.test_clone()"Neil Fuller2014-06-171-0/+10
|\ \ \
| * | | CTS fix: Signature2Test.test_clone()Neil Fuller2014-06-181-0/+10
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Previously it would throw a NullPointerException. Fixing that rendered the Signature cloneable and the test assertions failing. The test now passes but is of questionable value except to prove the absence of RuntimeException. Change-Id: I2a5b160f0914837b37b801e16b8a3717d00fd94e
* | | Merge "Fix getISO3Country and getISO3Language."Narayan Kamath2014-06-171-0/+8
|\ \ \
| * | | Fix getISO3Country and getISO3Language.Narayan Kamath2014-06-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For backward compatibility, locales constructed with 3 letter countries and languages must return those languages and countries from these methods. With our strict language tag interpretation, these were being omitted or transformed to und. We fix this by passing only the language code (or the country code with a fixed language) down to ICU, which will then deal with it correctly. bug: 15638049 Change-Id: I517a82496a2a4c36b1ae9234f7d2d4eb89b34ffe
* | | | Merge "Relax KeyPairGeneratorTest"Neil Fuller2014-06-171-8/+43
|\ \ \ \
| * | | | Relax KeyPairGeneratorTestNeil Fuller2014-06-181-8/+43
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | Changing KeyPairGeneratorTest to handle different number of providers. Bug: 5513723 Change-Id: I74ba53d9ebe8197bf4aeeb8f5742b961d5285bfb
* | | | Alter regression test for bug 71369 now the issue is understoodNeil Fuller2014-06-181-3/+10
|/ / / | | | | | | | | | | | | | | | | | | | | | The code was most likely fixed by an ICU update. This was added to prevent regression. See the bug for details. Bug: 71369 Change-Id: I8896334dfeac3a1dcb6379ac58510ede60f6b7c7
* | | Merge "Add a test for bug 71369"Neil Fuller2014-06-171-0/+15
|\ \ \ | |/ / |/| |
| * | Add a test for bug 71369Neil Fuller2014-06-171-0/+15
| |/ | | | | | | | | | | The bug appears not to be present any more. Change-Id: I83999e7ded4818048c386b41dd879d56edad18e7
* | Merge "Pass BCP-47 tags and not Locale.toString results to ICU."Narayan Kamath2014-06-102-12/+118
|\ \
| * | Pass BCP-47 tags and not Locale.toString results to ICU.Elliott Hughes2014-06-162-12/+118
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ICU can't handle the new toString forms for scripts etc. and it's also guaranteed to deal with BCP-47 tags correctly. Most of the changes in this patch are required to keep backwards compatibility for getDisplayCountry string etc. in the face of the transformations toLanguageTag performs. A few tests were changed, but for the better. The tagalog -> filipino charlie foxtrot will be dealt with in a follow up change. Co-Authored-By: Narayan Kamath <narayan@google.com> Change-Id: Ia7f26d92a0e38c4bbb1d839c0fbd8ad16a473bf5
* | Fix bogus define checks and a typo.Narayan Kamath2014-06-131-0/+31
|/ | | | | | | | | | | | | | | RT_* constants are enum members in the UAPI so we can't use #define checks for them. Also fix a typo in the define check for an IFA_ constant. More generally, we should get rid of all these conditional checks for target builds because we know what version of the UAPI we have in bionic. We should move these conditional checks under #if HOST_BUILD or something similar. bug: 15602893 Change-Id: I3affc10773ade4dac68c176f79962ca8ad312579
* Implement Locale.toLanguageTag without ICU support.Narayan Kamath2014-06-121-1/+1
| | | | | | | | | | | | This is the first part of an effort to avoid having to construct and parse ICU locale IDs and to instead use language tags as inputs to all ICU APIs. Only one minor unit test adjustment was required, and that change brings the test closer in line with the spec. Change-Id: I8abc0e3b868dd73e4fb9e36b6db19853eb99e6ac
* Merge "Extract non-API locale tests into a separate test class."Narayan Kamath2014-06-102-106/+129
|\
| * Extract non-API locale tests into a separate test class.Narayan Kamath2014-06-112-106/+129
| | | | | | | | | | | | | | | | | | Several ICU tests and tests of ICU related internal methods have snuck into LocaleTest. Split them into a separate class to make it easier to run this test against older branches and across refactorings. Change-Id: I16db4a930b39e5dd4af16d99aa4ecd1be7cf948f
* | Merge "Tests for Runtime.*Memory()"Neil Fuller2014-06-101-26/+0
|\ \
| * | Tests for Runtime.*Memory()Neil Fuller2014-06-101-26/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The docs describe a condition we do not test for. The freeMemory / totalMemory tests have been consolidated into a single test and joined by an additional assertion for maxMemory(). The test for freeMemory from OldRuntimeTest has been tidied up and moved to RuntimeTest. Bug: 15507122 Change-Id: I4343215fb7f6b441613e25d3844d67812f5b5e94
* | | Fix DatagramMulticastChannelTest so it works better on hammerheadNeil Fuller2014-06-101-345/+392
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some android devices have a WiFi-direct interface (p2p0) that probably shares underlying hardware with the standard wireless interface (wlan0). On hammerhead, when Wifi-direct is disconnected this interface appears to (only) have an IPv6 address and is "up" and "support multicast". The test was not tested on this hardware when it was written. Mako devices have the same behavior but the wlan0 interface most likely discovered first. The ordering of interfaces may also not be stable. The other breakages were due to implicit assumptions that the device supports both IPv4 and IPv6 on a single interface. The tests also rely on the IP_MULTICAST_LOOP option to receive packets sent out. There were some other bugs that were probably the result of assuming that when the interface was left unspecified the device would route outgoing packets via the interface the test was listening on. With multiple interfaces available those tests were flaky. Bug: 15509450 Change-Id: I33f71e26379a53334dce9991043c3a9a21000d02
* | Shard the _getInstance test and skip the DH tests.Neil Fuller2014-06-091-50/+70
|/ | | | | | | | | | The _getInstance test was suppressed previously because it took too long to complete. This re-enables parts of the test but temporarily skips the DH algorithm until it can be investigated further. Bug: 5513723 Change-Id: Ia211de51f8def5b710c1d2a164f1ec70e474fc7a
* Merge "Fix ZoneInfoDBTest.testGoodOverride"Neil Fuller2014-06-031-15/+17
|\
| * Fix ZoneInfoDBTest.testGoodOverrideNeil Fuller2014-06-021-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When executed under the CTS environment some of the tests in ZoneInfoDBTest assumed: 1) The device was booted with all tzinfo files present and that they don't change (i.e. so the runtime's static TimeZone singleton reflects the contents of the file system at the time the test is executed). 2) The number of timezone IDs in /data/misc/zoneinfo/tzdata, /system/usr/share/zoneinfo/tzdata are the same (if assumption 1 holds). This change modifies the tests to only use the (unchanging) /system/usr/share/zoneinfo/tzdata file and avoid use of the TimeZone class. Bug: 15382201 Change-Id: I8d3b1ea52a2147e7afaa302803c834539bd01db9
* | Merge "Fix for flakiness in URLConnectionTest.testServerShutdownOutput"Neil Fuller2014-05-301-0/+6
|\ \
| * | Fix for flakiness in URLConnectionTest.testServerShutdownOutputNeil Fuller2014-05-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | Flakiness reported by Junjie.Hu <junjie.hu@mediatek.com> This fix relies on changes to MockWebServer to provide deterministic ordering of responses. Change-Id: I4f296fa2f8d227876f52c69e22001f4e0d7b4ffd