diff options
author | Victor Chang <vichang@google.com> | 2023-09-06 16:52:08 +0100 |
---|---|---|
committer | Victor Chang <vichang@google.com> | 2023-09-07 13:52:14 +0100 |
commit | 507b4993d03dd619fe64e2594dd007f605a5c6c0 (patch) | |
tree | 33730de33a20b077b07358b03f4e310def66dbcf | |
parent | a0bb6e17004d1078ebf38ef1ad1bca6c2ccc5fac (diff) | |
download | bouncycastle-507b4993d03dd619fe64e2594dd007f605a5c6c0.tar.gz |
Move BouncyCastle test into its own test suite.
BouncyCastle isn't a public API on Android, and thus we are
moving the test away from CTS
Bug: 283789481
Test: atest MtsLibcoreBouncyCastleTestCases
Change-Id: Id1265713b0780f59d66b29c845b60e8433352d92
-rw-r--r-- | Android.bp | 12 | ||||
-rw-r--r-- | mts/Android.bp | 44 | ||||
-rw-r--r-- | mts/AndroidManifest.xml | 31 | ||||
-rw-r--r-- | mts/MtsLibcoreBouncyCastleTestCases.xml | 61 |
4 files changed, 142 insertions, 6 deletions
@@ -116,14 +116,14 @@ java_library { java_library_static { name: "bouncycastle-test-lib", visibility: [ - "//libcore", "//packages/modules/ArtPrebuilt", + "//external/bouncycastle/mts", ], srcs: [ "repackaged/bcprov/src/test/java/**/*.java", ], - libs: [ - "bouncycastle", + libs: ["bouncycastle"], + static_libs: [ "junit", "platform-test-annotations", ], @@ -259,14 +259,14 @@ java_test_host { srcs: [ "bcprov/src/test/java/**/*.java", ], - test_options: { - unit_test: true, - }, static_libs: [ "bouncycastle-unbundled", "junit", "platform-test-annotations", ], + test_options: { + unit_test: true, + }, test_suites: ["general-tests"], } diff --git a/mts/Android.bp b/mts/Android.bp new file mode 100644 index 00000000..be0378fd --- /dev/null +++ b/mts/Android.bp @@ -0,0 +1,44 @@ +// +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package { + default_visibility: ["//visibility:private"], + default_applicable_licenses: ["external_bouncycastle_license"], +} + +// Tests used in ART MTS. +android_test { + name: "MtsLibcoreBouncyCastleTestCases", + platform_apis: true, + min_sdk_version: "31", + manifest: "AndroidManifest.xml", + static_libs: [ + "bouncycastle-test-lib", + "cts-core-test-runner-axt", + ], + dex_preopt: { + enabled: false, + }, + optimize: { + enabled: false, + }, + test_suites: [ + "general-tests", + "mts-art", + ], + host_required: ["cts-dalvik-host-test-runner"], + test_config: "MtsLibcoreBouncyCastleTestCases.xml", +} diff --git a/mts/AndroidManifest.xml b/mts/AndroidManifest.xml new file mode 100644 index 00000000..135a8611 --- /dev/null +++ b/mts/AndroidManifest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.libcore.mts.bouncycastle"> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-sdk android:minSdkVersion="31" /> + <application android:usesCleartextTraffic="true"></application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="android.libcore.mts.bouncycastle" + android:label="Bouncy Castle test cases"> + <meta-data android:name="listener" + android:value="com.android.cts.runner.CtsLibcoreTestRunListener" /> + </instrumentation> + +</manifest> diff --git a/mts/MtsLibcoreBouncyCastleTestCases.xml b/mts/MtsLibcoreBouncyCastleTestCases.xml new file mode 100644 index 00000000..541731c3 --- /dev/null +++ b/mts/MtsLibcoreBouncyCastleTestCases.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2023 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Config for MTS Libcore Bouncy Castle test cases"> + <option name="config-descriptor:metadata" key="component" value="libcore" /> + <option name="config-descriptor:metadata" key="parameter" value="multi_abi" /> + <!-- Test is eligible to run on Android Multiuser users other than SYSTEM. + See source.android.com/devices/tech/admin/multi-user#user_types --> + <option name="config-descriptor:metadata" key="parameter" value="secondary_user" /> + <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" /> + <option name="config-descriptor:metadata" key="mainline-param" value="com.google.android.art.apex" /> + <option name="config-descriptor:metadata" key="mainline-param" value="com.android.art.apex" /> + <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> + <!-- This MTS test module requires wifi, ensure wifi is on --> + <option name="run-command" value="settings put global wifi_on 1" /> + <option name="run-command" value="svc wifi enable" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true" /> + <!-- this has just the instrumentation which acts as the tests we want to run --> + <option name="test-file-name" value="MtsLibcoreBouncyCastleTestCases.apk" /> + </target_preparer> + <test class="com.android.compatibility.testtype.LibcoreTest" > + <option name="package" value="android.libcore.mts.bouncycastle" /> + <option name="instrumentation-arg" key="filter" + value="com.android.cts.core.runner.ExpectationBasedFilter" /> + <option name="core-expectation" value="/knownfailures.txt" /> + <option name="runtime-hint" value="15m"/> + <!-- 20x default timeout of 600sec --> + <option name="shell-timeout" value="12000000"/> + <option name="hidden-api-checks" value="false"/> + </test> + + <object type="module_controller" class="com.android.tradefed.testtype.suite.module.TestFailureModuleController"> + <option name="screenshot-on-failure" value="false" /> + </object> + + <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if + one of the Mainline modules below is present on the device used for testing. --> + <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController"> + <!-- ART Mainline Module (internal version). --> + <option name="mainline-module-package-name" value="com.google.android.art" /> + <!-- ART Mainline Module (external (AOSP) version). --> + <option name="mainline-module-package-name" value="com.android.art" /> + </object> + + <!-- Only run tests if the device under test is SDK version 31 (Android 12) or above. --> + <object type="module_controller" class="com.android.tradefed.testtype.suite.module.Sdk31ModuleController" /> +</configuration> |