summaryrefslogtreecommitdiff
path: root/support
AgeCommit message (Collapse)Author
2020-04-01Add tests for SSLContextSpi base class methods.Pete Bentley
Also refactor the existing tests for readabilioty and Junit4. Bug: 150645191 Test: atest org.apache.harmony.tests.javax.net.ssl.SSLContextSpiTest Change-Id: I70b8522222108f9497867ada83ec15693f8c15ac Merged-In: I70b8522222108f9497867ada83ec15693f8c15ac (cherry picked from commit 46a3e9f6f83bf888b4e5656532d0ced82b22ed22)
2020-02-13Make test for hardware AES support explicit.Pete Bentley
Various test expectations in StandardNames are determined by CpuFeatures.isAESHardwareAccelerated(). Currently this also acts as a test for AES not being available when expected because assorted tests will fail in that scenario. This change makes CpuFeatures.isAESHardwareAccelerated() return the actual state of hardware acceleration as determined by BoringSSL and adds a test for AES being enabled on platforms where we know we should expect it. Once this change lands I propose to make the equivalent change in Conscrypt's copy of CpuFeatures.isAESHardwareAccelerated() but only run the test for expected acceleration on non-Android platforms where there is no need to handle emulated environments. This is intended as a cleaner replacement for https://r.android.com/1214558 to avoid adding native test code. Test results: Taimen: ABI arm64-v8a: PASSED ABI armeabi-v7a: PASSED Cuttlefish: ABI x86: ASSUMPTION_FAILED x86 AVD: ABI x86: ASSUMPTION_FAILED x86_64 AVD: ABI x86_64: PASSED ABI x86: ASSUMPTION_FAILED ABI in the above results is the ABI reported by atest. ASSUMPTION_FAILED means that isKnownToSupportHardwareAes() returned false for this ABI/hardware combination and so isAesHardwareAccelerated() was not tested. PASSED means isKnownToSupportHardwareAes() and isAesHardwareAccelerated() both returned true. Not tested: Physical x86_64 hardware or 32 bit only ARM, but the results above demonstrate that our test expectations are correct. Bug: 144885685 Test: atest -a CtsLibcoreTestCases:libcore.javax.crypto.HardwareAesTest (See above for results on different platforms) Change-Id: Ifec9b8f95eb71d4aa26fd0dc6df295a213b43a0b
2019-09-25Work around is64BitInstructionSet non-SDK apibohu
isAESHardwareAccelerated is calling platform api is64BitInstructionSet, on x86 and x86_64 platforms. This leads to CtsVerifier apk to crash during the KeyChain Storage Test. This CL simply does the same thing that is64BitInstructionSet is doing, without calling that api. The impact is only limited to x86 and x86_64 architecture. Test: lunch sdk_phone_x86_64-userdebug install CtsVerifier.apk and run the KeyChain Storage Test, and it should not crash. BUG: 139022588 Change-Id: I311b961abe73e71b5c004ba66b920b9bb714ffd0 Merged-In: I311b961abe73e71b5c004ba66b920b9bb714ffd0
2019-08-23Revert "Add an example of an annotation-based TEST_MAPPING."Pete Gillin
This proof-of-concept isn't needed any more as real mappings are about to be committed. This reverts commit 5d994b9169d9f3bda15a7b8154c48ba08c4b0e42. Bug: 130283485 Test: Treehugger
2019-08-01Merge "Update to support Conscrypt sync"Adam Vartanian
2019-07-31Update to support Conscrypt syncAdam Vartanian
Update StandardNames to add new cipher. Update intra-core API definition due to refactoring in Conscrypt. This is safe because the classes that libcore will access are supplied by Conscrypt via the Provider system, so libcore's use of classes will always be consistent with which classes are in fact present. Test: cts -m CtsLibcoreTestCases Test: cts -m CtsLibcoreOkHttpTestCases Change-Id: I7558cb91ba30b98728e723fea209cea12370e88e
2019-07-30Add an example of an annotation-based TEST_MAPPING.Pete Gillin
This change should be reverted once we have real instances of this pattern and no longer need the example. This change causes libcore.java.lang.PackageTest to be run in pre- and post-submit for all libcore/luni changes. It demonstrates three things: 1. Introducing a new annotation-based category of test, @Example in this case. 2. Applying the category to a test. 3. Adding a TEST_MAPPING which runs tests from that category. Note that PackageTest#testGetPackages does not run, because it in expectations/knownfailures.txt. (This is not to be confused with PackageTest#testGetPackage, which does run.) Google-internal: In treehugger run for this change, navigating through aosp-master -> aosp_cf_x86_phone-userdebug -> test status -> suite/test-mapping-presubmit-retry_cloud-tf, there is the test-mapping presubmit run for this change for this change: http://sponge/3531116c-6f5d-46d3-bdae-089c3c37e104. Under x86 CtsLibcoreTestCases it shows the expected four tests from PackageTest, excluding testGetPackages. Test: atest --test-mapping libcore/luni Test: treehugger (see above) Bug: 130283485 Change-Id: I8a3e929af2caf7aa22dd720750f407685d97f7a7
2019-05-01Add field needed by external/apache-harmony testsPaul Duffin
This change is needed to allow the apache-harmony version of Support_Configuration to be removed. Bug: 131738612 Test: atest CtsLibcoreTestCases Change-Id: I18a1df7c529bb2231499bc03c3d9e9d9e4309d85
2019-04-04Remove some usages of IoUtil methodsNeil Fuller
Continuing the long process of shrinking the core platform API by switching users, particularly tests, to alternatives. Bug: 124232146 Test: atest CtsLibcoreTestCases:libcore.android.system.OsTest Change-Id: If1a473f4d7a120723602faa70129ead1bf8ebc64
2019-01-23Cleanup some support test classesPaul Duffin
Preparation for splitting core-tests-support into two parts, one that depends only on core_current and can be used outside libcore and one that can depend on core-all directly. Deletes a lot of classes that are no longer used. Some of the classes were only used by external/conscrypt tests and it has its own copies of them. Some of them were copied over from harmony and are not used in libcore tests. Some of them have been extracted into external/mockwebserver. Moves some classes that are only used internally by a couple of luni tests to am appropriate luni/src/test/java directory to reduce the number of split packages. Tightens up visibility in a couple of classes. Removes some unused members from a couple of classes: * support/src/test/java/libcore/java/security/StandardNames.java * support/src/test/java/libcore/javax/net/ssl/SSLConfigurationAsserts.java Bug: 117547194 Test: make checkbuild && \ atest CtsKeystoreTestCases CtsNetTestCases conscrypt-tests \ FrameworksCoreTests KeyChainTests time_zone_distro-tests \ CtsLibcoreTestCases Change-Id: I8b258e66911ece69d4eaefef56810e17dddb2583
2018-10-25Remove tlswire classesAdam Vartanian
These classes have only ever been used by Conscrypt, so they've been moved to the Conscrypt repo and can be deleted from here. Test: make checkbuild Change-Id: I9c18e18f1ede89a0d882300b5970030042328bf5
2018-10-15Switch core-tests-support to @CorePlatformApiNeil Fuller
Rather than depending on internals, switch core-tests-support to using the core platform API. core-tests-support had a static dependency on the platform bouncycastle target which included a copy of the repackaged bouncycastle in CTS. This copy would then not be used. This looks like a mistake. After this change a copy of bouncycastle is included under its original package. TestIoUtils was relying on a hidden method in java.lang.Math. This has been replaced with public API calls. Bug: 113148576 Test: build Test: Ran CTS: cts -m CtsLibcoreTestCases Change-Id: Ib8045537c2c191aca3f416cc459f265c8d957dfc
2018-10-10Add testing support code: TestIoUtilsNeil Fuller
Add testing support code that CTS can use instead of private platform APIs. Bug: 117535564 Bug: 113148576 Test: Run cts Change-Id: I63ad197744075c14886a639bfba83392ac39854f
2018-10-04Update expectations of CpuFeatures.isAESHardwareAccelerated for 32bit x86.Pete Bentley
Despite its name isAESHardwareAccelerated is used in assertions in StandardNames.java to determine whether to expect hardware AES acceleration is available and so to determine the default list of cyphers to expect from Conscrypt. I haven't renamed it in this CL but it might make sense to do so. b/112830137 was due to this method expecting hardware AES acceleration to be available when running on any x86 CPU where /proc/cpuinfo reports the "aes" flag. However this is *not* the case when running in a 32bit VM, which was causing CTS failures on 32bit x86 builds. Note that 32bit x86 is not a supported platform for Conscrypt, so it doesn't realy make sense to add an equivalent change to the CpuFeatures.java in Conscript's libcore-stub. Bug: 112830137 Test: cts -m CtsLibcoreTestCases on both ARM and x86 targets Change-Id: I4a2643082aa3a638106a77f6916cc3329498e58f
2018-09-13Update tests for Conscrypt updateAdam Vartanian
This mainly updates the tests to account for the existence of TLS 1.3. In particular, add the new TLS 1.3-related constants to StandardNames and update some old harmony tests to handle the fact that we now report TLS 1.3 cipher suites as being supported. Bug: 110403171 Test: cts -m CtsLibcoreTestCases Test: cts -m CtsLibcoreOkHttpTestCases Test: cts -m CtsLibcoreWycheproofConscryptTestCases Change-Id: I1ff6aa5961438527b0eb882488a5dbfaaeaacc6c
2018-08-10Update StandardNames for BoringSSL updateAdam Vartanian
BoringSSL has removed support for some old cipher suites, remove them from the expected set. Test: cts -m CtsLibcoreTestCases Change-Id: Ia1680f357775dc2ea2f5b04974c11b4e991fbdfa
2018-04-17Change test certificates to use SHA-256.Adam Vartanian
We're planning to remove support for SHA-1 signatures in TLS certificates, so change our tests to use SHA-256 signatures instead. Bug: 77901166 Test: cts -m CtsLibcoreTestCases Change-Id: I6c85194a88fb9d0582267ed8e6056b593b9e68de
2018-01-18Drop unused test support class MockOs.Tobias Thierer
This class was introduced for use in libcore.io.DiskLruCacheTest in commit e342455abc6b650f847d931728223411e58831ce (May 2011), but that class was dropped in commit 4f97bfe0d9e6f4bdb43fff91f341f4722af16301 (Apr 2013), after switching to OkHttp. It now appears to be unused. Based on the commit message at http://r.android.com/592273 , core-tests-support (which includes MockOs) should only use public Android API, but MockOs imports libcore-internal classes libcore.io.{Os,Libcore}. Therefore, this CL drops the unused class MockOs. Bug: 69899800 Test: Treehugger Change-Id: I043178ecd482e1ba8bb4d068c03497191e2722eb
2018-01-11Track behavior change in default HostnameVerifier.Tobias Thierer
The default HostnameVerifier now ignores any CommonName in the certificate provided by the server, even when no subjectAltName is present. Bug: 70278814 Test: CtsLibcoreTestCases (ran against an internal build with this CL cherrypicked) Change-Id: Ib6fa0c40d8903352e88d8812bf0c09ec1d8ef6be
2017-12-05Merge "Fix for libcore.java.security.ProviderTest#test_Provider_getServices" ↵Raj Mamadgi
into oreo-cts-dev am: 5956489768 Change-Id: I9b022287e4c7e8c99c7975acef1ad6d87c206282
2017-11-22Fix for libcore.java.security.ProviderTest#test_Provider_getServicesRaj Mamadgi
Just like Android Key Store, creating Samsung Knox Keystore for exception handling. Change-Id: I04ebad92a1065afe8037674eed6d51c913ebbdf8 Signed-off-by: Raj Mamadgi <r.mamadgi@samsung.com>
2017-11-14Update tests for Conscrypt upstream merge.Adam Vartanian
For the most part, this is just adjusting tests to account for the fact that "ChaCha20" now refers to the plain stream cipher instead of ChaCha20+Poly1305. Test: cts -m CtsLibcoreTestCases Change-Id: I5976027811c58910952a186f3580a3f5e561407d
2017-10-26Update tests for Conscrypt upstream merge.Adam Vartanian
Adds basic compliance tests for ChaCha20/Poly1305/NoPadding. Adds test that AES/GCM/NoPadding can be initialized with GCM AlgorithmParameters. Adds reuse test for ChaCha20/Poly1305/NoPadding. Updates StandardNames for new names. Updates SSLSocketTest for changed Conscrypt implementation details. Test: cts -m CtsLibcoreTestCases Change-Id: I608e4bbcced678fdfac8b28d500f7fa8b4599319
2017-08-11Make EVP_has_aes_hardware accessible.Adam Vartanian
Conscrypt changed to limit visibility to EVP_has_aes_hardware, which means that in some circumstances CPUs that have AES hardware will show to tests as not having it, resulting in the wrong expectations in tests. Bug: 64542254 Bug: 64542486 Test: cts -m CtsLibcoreTestCases (on various devices) Change-Id: I90cd5a44f7aa21049528ce44c1ee4d96489c9e61
2017-03-08Remove DHE ciphers from defaults listKenny Root
Since DHE does not allow negotiation of the group used, it is pretty broken. ECDHE at least allows the negotiation of the group which allows its security to be maintained with configuration changes in the client or server. This tracks a change in Conscrypt merged in 906cfad7e08fd339be06441ff42960743f95053c Test: cts-tradefed run cts -m CtsLibcoreOkHttpTestCases -a arm64-v8a Test: cts-tradefed run cts -m CtsLibcoreTestCases -a arm64-v8a Test: make docs Test: visual inspection of docs output in web browser Change-Id: Ic90297bf6b1c82af192a887797238ad250e3d1ce
2017-03-06Automated: Canonicalize spelling of Android-changed across libcoreTobias Thierer
This applies the same regexp replacement across libcore that http://r.android.com/345826 had only applied to ojluni. Most of the previous noncanonical spellings were a lowercased "android-" that should be "Android-". This CL was created by running the following command on top of the above CL. No manual changes were made. find . -name \*\.java | xargs sed -i \ -e 's/Android[- ]changed/Android-changed/ig' \ -e 's/Android-changed :/Android-changed:/g' \ -e 's/Android-changed \(BEGIN\|END\)/\1 Android-changed/g' \ -e 's/Android-changed - /Android-changed: /g' \ -e 's/Android[- ]removed/Android-removed/ig' \ -e 's/Android-removed :/Android-removed:/g' \ -e 's/Android-removed \(BEGIN\|END\)/\1 Android-removed/g' \ -e 's/Android-removed - /Android-removed: /g' \ -e 's/Android[- ]added/Android-added/ig' \ -e 's/Android-added :/Android-added:/g' \ -e 's/Android-added \(BEGIN\|END\)/\1 Android-added/g' \ -e 's/Android-added - /Android-added: /g' \ -e 's/----- \(BEGIN\|END\) android\( -----\)\?/\1 Android-changed/g' \ -e 's/\/\* \(BEGIN\|END\) Android-changed \*\//\/\/ \1 Android-changed/g' Bug: 35841464 Test: make droid cts Change-Id: I060c7236b7607763e5d27d60aa395d2507703a95
2017-02-27Fix InetAddress.getByName testsPaul Duffin
Removes suppression of legacy harmony tests that fail on Android. Changes: 1) Switches libcore InetAddressTest to parameterized Junit4 test framework to make additions of test data easier / clearer. 2) Removes failing harmony test cases. This seemed like the correct approach as the harmony tests expected completely opposite behavior to the libcore tests but while the libcore tests pass the harmony tests have been broken for over 3 years. 3) Adds test cases to libcore InetAddressTest to assert the behavior of addresses removed from the harmony test cases. 4) Removes suppression of harmony test cases. 5) Handles knock-ons in SerializationTester; it assumed that all tests extend TestCase, no longer the case with JUnit 4. Bug: 11689863 Test: with cts and vogar Change-Id: Iea6ba11fda18f058068e4eea1490d98ee7a3eb2d
2017-02-14Conscrypt: Add PBEWithHmacSHAXXXAndAES_XXX cipher aliases.Adam Vartanian
Bug: 29631070 Test: cts run -m CtsLibcoreTestCases -t libcore.java.security.ProviderTest Test: cts run -m CtsLibcoreTestCases -t libcore.javax.crypto.CipherTest Change-Id: I9bd6ed1a17048748cc5006326720dbd6c2012d67
2017-02-14Merge "BouncyCastle: Enable EC AlgorithmParameters."Adam Vartanian
2017-02-13Merge "Reduce number of lint warnings"Kenny Root
2017-02-13Merge "Use the new X.509 cert generator API"Kenny Root
2017-02-10Use the new X.509 cert generator APIKenny Root
The previous API has been deprecated within Bouncycastle for a while. Switch to the newer one to avoid the deprecation warnings. Test: cts-tradefed run cts -m CtsLibcoreTestCases Change-Id: I24b1340185876f90730d362019f202431c94d4a2
2017-02-10Reduce number of lint warningsKenny Root
When compiled against the SDK, junit.framework is noted as deprecated. Changing this to use JUnit4-style asserts doesn't break any users. Test: cts-tradefed run cts -m CtsLibcoreTestCases Change-Id: Ic480b16db8e0ef13b55e7f3c005c7d9c26da0114
2017-02-10Conscrypt: Add key-constrained versions of AES algorithms.Adam Vartanian
Bug: 29631070 Test: run cts -m CtsLibcoreTestCases Change-Id: I7174ec7f6c598d46dce1935385c723b96907d9d1
2017-02-10BouncyCastle: Enable EC AlgorithmParameters.Adam Vartanian
Bug: 29631070 Test: run cts -m CtsLibcoreTestCases Change-Id: Iff5246f9053a8a1691038f5719145a541ebec5e2
2017-01-26Provide SSL SSLContext algorithmChad Brubaker
SSL was rexposed in 3f3b9c8292773841760263f410b74ed0ab7aae6b as an alias to TLS. Bug: 34722987 Test: cts-tradefed run cts -m CtsLibcoreTestCases -t libcore.java.security.ProviderTest Change-Id: Icf784ca30ccec2c5546dc9af6e7a06ae8ffefd56
2017-01-17Expose SSLContext.SSL as an alias for SSLContext.TLSChad Brubaker
SSL was removed with SSLv3 however a lot of callers use SSL instead of Default leading to breakage. Test: libcore/run-libcore-tests libcore/luni/src/test/java/libcore/javax/net/ssl/* Bug:32584776 Bug:30977793 Change-Id: I7ce48488a28e2c62bb0c2a76261a11fbd5bb9da7
2017-01-11Update Libcore's Elliptic Curves to the BoringSSL change:Robert Sloan
https://boringssl-review.googlesource.com/#/c/10923/ Test: CtsLibcoreTestCases Change-Id: Ie13bcce8b1557e55921366643efbf71b7b75314b
2016-12-20Remove StuckServer using backlog and tests relying on itYi Kong
StuckServer uses kernel implementation details that have changed on version > 4.4, and causing tests depending on it to fail. Since we can't find an alternative method to simulate a stuck server without special permission, and the test itself is not reliable in that they don't fail on non-stuck servers, remove them from Libcore tests. Test: CtsLibcoreTestCases Bug: 32551747 Change-Id: I88d837329d65040a9f8550fff790f8703ea773f3
2016-12-08Update java.util.jar to openJdk8u60Przemyslaw Szczepaniak
Attributes.java - header change - Use of generics - Updated documentation links - Deprecated: EXTENSION_INSTALLATION, IMPLEMENTATION_VENDOR_ID, IMPLEMENTATION_URL JarEntry.java - header change - Updated javadoc JarFile.java: - Entry enumerator moved to seperate static inner class - Streams implementation - Non-crucial META-INF/* (not *.SF|*.DSA|*.RSA|*.EC|MANIFEST.MF) files are not passed to JarVerifier in .intializeVerifier() call. Otherwise we could signal the end of META-INF parsing (due to changes in JarVerifier). - Refactoring of hasClassPathAttribute, divided into many methods - Android-changed: Commented out isKnownNotToHaveSpecialAttributes() method that doesn't make sense on android JarOutputStream.java - Header change - Replaced a use of "& 0xff" with a cleaner conversion to unsigned int JarVerifier.java - Use of generics - beginEntry explicitly omits META-INF manifest and index signature check (So they can be passed to beginEntry without side-effects) - beginEntry process properly non-crucial META-INF/ entries (not *.SF|*.DSA|*.RSA|*.EC|MANIFEST.MF) and checks their signatures (added a test for that) - Change from "Enhance signed jar verification": .entryNames treats .findMatchingSigners(c) null result as empty array (probably a bug fix). Manifest.java - Use of generics - Replaced a use of "& 0xff" with a cleaner conversion to unsigned int Pack200.java - Copyright update - javadoc formating changes - addPropertyChangeListener & removePropertyChangeListener gained empty default implementation and deprecated SignatureFileVerifier.java: - uncommented isSigningRelated (requried by JarFile) Test: CtsLibcoreTestCases Change-Id: I56c59fac628c97a8b7c6967a43c0e23c8b068120
2016-11-04SSLSocketTest: TLS client auth with opaque keysKenny Root
AndroidKeyStore can be used with TLS client auth, but we don't test anything similar with SSLSocketTest. Add a PrivateKey wrapper that allows us to closely simulate the conditions which trigger the special code in Conscrypt to do upcalls to Java to generate signatures with the client private key. Test: cts-tradefed run cts -m CtsLibcoreTestCases -a arm64-v8a Test: cts-tradefed run cts -m CtsLibcoreOkHttpTestCases -a arm64-v8a Bug: 31714503 Change-Id: I559db546ddd31f8efbe73fc70a91689ed6d7d7e5
2016-11-04Merge "Make sure BouncyCastleProvider is initialized"Kenny Root
2016-11-04Make sure BouncyCastleProvider is initializedKenny Root
When running these tests against an Android system when we're not built as part of the system image (e.g., we have our own BouncyCastleProvider instance), then we need to make sure our instance of BouncyCastleProvider is initialized properly. The initialization happens in its constructor. In TestKeyStore the included version of BouncyCastleProvider does not need to be inserted as a security provider since it's only used to create X.509 certificates. However, BouncyCastle calls into itself for some things like OID -> key type conversion. This relies on all of its internal data structures being initialized properly. In particular there is a keyInfoConverters field that must be populated to work correctly. If keyInfoConverters is not populated, the generated certificate will have a null PublicKey since it can't figure out what type of key it is. Test: ran outside of CTS Test: cts-tradefed run cts -m CtsLibcoreTestCases -a arm64-v8a Bug: 31119038 Change-Id: I1bcc73a363cb9dac9e9decb9046d386d3394f1d9
2016-11-02Address URLConnectionTest post-commit review commentsYi Kong
This change addresses some post-commit review comments for commit 44c55c5b639d6c1eea6eeae8414ef9df95b67bb7: * Moved SocketTimeoutException into a separate test. * Added more infomative comments regarding setDelay. * Reduced method visibility, being public method is unnecessary. Bug: 32363029 Test: URLConnectionTest#test_setReadTimeoutI_SocketTimeoutException Change-Id: Ia13ba801cfa6e06fc7597f4f665fa2d002b688e1
2016-10-31Fix URLConnectionTest.test_setReadTimeoutI on host testYi Kong
This was failing because the test assumes that read will not complete within 1ms, while it is still possible, especially on host tests. This patch introduces a minimum time delay before the TestWebServer sends data. Bug: 32363029 Test: org.apache.harmony.luni.tests.java.net.URLConnectionTest#test_setReadTimeoutI under host tests Change-Id: Ibb4e2125f99b0544d0f09331b4ab9b0448b14035
2016-10-28sun.security.x509: porting rev/04cda5b7a3c1Sergio Giro
Changes to KeyUsageExtension, NetscapeCerTypeExtension and ReasonFlags as to check as to improve checks of array bounds. sun.security.provider.certpath.DistributionPointFetcher has a similar change concerning array bounds, where the opportunity to improve probably was spotted by the fact that it uses ReasonFlags. Since in the classes in sun.security.x509 the logic for toString changed slightly, tests are added that passed both before and after the change, as to check that the outcome is the same. Bug: 29631070 Test: run cts -m CtsLibcoreTestCases Change-Id: I2a2c10c59509063e648f238f82ac71b4f513cd71
2016-10-20Merge "bouncycastle: add support for PKCS5S2 algorithm parameters"Sergio Giro
2016-10-20Merge "Fix some imports in TestUtils.java"Kenny Root
2016-10-20Fix some imports in TestUtils.javaKenny Root
Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136450318 Test: mmma -j32 libcore Change-Id: I62edce18ddd1ebf46d2488d88376636f566e3f6f
2016-10-20TlsWire: add missing secp224r1 valueKenny Root
This is used by the RI so add it to the list of known values. Test: mmma -j32 libcore Test: cts-tradefed run cts -m CtsLibcoreTestCases -a arm64-v8a Change-Id: Id4792b5f42e309570d5c27accd0e51c432df5289