Merge "resolve merge conflicts of 14afdcf to nougat-cts-dev" into nougat-cts-dev am: 24e2c82765 am: 8e6c1949e4 am: efc4b6e52b am: 76b5c7123d am: 90b9b93022
am: 5514c76384
Change-Id: If482802fa73f47e307d5cb646152dd88d35db8f0
diff --git a/Android.mk b/Android.mk
index 95ef508..2d9856b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -14,7 +14,6 @@
# limitations under the License.
#
-include cts/OldCtsBuild.mk
include cts/CtsCoverage.mk
include $(call all-subdir-makefiles)
diff --git a/OldCtsBuild.mk b/OldCtsBuild.mk
deleted file mode 100644
index c745885..0000000
--- a/OldCtsBuild.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2011 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# Functions to get the paths of the build outputs.
-
-define cts-get-lib-paths
- $(foreach lib,$(1),$(CTS_TESTCASES_OUT)/$(lib).jar)
-endef
-
-define cts-get-ui-lib-paths
- $(foreach lib,$(1),$(CTS_TESTCASES_OUT)/$(lib).jar)
-endef
-
-define cts-get-native-paths
- $(foreach exe,$(1),$(CTS_TESTCASES_OUT)/$(exe)$(2))
-endef
-
-define cts-get-package-paths
- $(foreach pkg,$(1),$(CTS_TESTCASES_OUT)/$(pkg).apk)
-endef
-
-define cts-get-test-xmls
- $(foreach name,$(1),$(CTS_TESTCASES_OUT)/$(name).xml)
-endef
-
-define cts-get-executable-paths
- $(foreach executable,$(1),$(CTS_TESTCASES_OUT)/$(executable))
-endef
-
-define cts-get-deqp-test-xmls
- $(foreach api,$(1),$(CTS_TESTCASES_OUT)/com.drawelements.deqp.$(api).xml)
-endef
diff --git a/OldCtsTestCaseList.mk b/OldCtsTestCaseList.mk
deleted file mode 100644
index 685d9a0..0000000
--- a/OldCtsTestCaseList.mk
+++ /dev/null
@@ -1,333 +0,0 @@
-# Copyright (C) 2010 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.
-
-cts_security_apps_list := \
- CtsAppAccessData \
- CtsAppWithData \
- CtsDocumentProvider \
- CtsDocumentClient \
- CtsEncryptionApp \
- CtsExternalStorageApp \
- CtsInstrumentationAppDiffCert \
- CtsNetSecPolicyUsesCleartextTrafficFalse \
- CtsNetSecPolicyUsesCleartextTrafficTrue \
- CtsNetSecPolicyUsesCleartextTrafficUnspecified \
- CtsNoRestartBase \
- CtsNoRestartFeature \
- CtsUsePermissionApp22 \
- CtsUsePermissionApp23 \
- CtsUsePermissionApp24 \
- CtsPermissionDeclareApp \
- CtsPermissionDeclareAppCompat \
- CtsPrivilegedUpdateTests \
- CtsReadExternalStorageApp \
- CtsSharedUidInstall \
- CtsSharedUidInstallDiffCert \
- CtsShimPrivUpgradePrebuilt \
- CtsShimPrivUpgradeWrongSHAPrebuilt \
- CtsSimpleAppInstall \
- CtsSimpleAppInstallDiffCert \
- CtsSplitApp \
- CtsSplitApp_x86 \
- CtsSplitApp_x86_64 \
- CtsSplitApp_armeabi-v7a \
- CtsSplitApp_armeabi \
- CtsSplitApp_arm64-v8a \
- CtsSplitApp_mips64 \
- CtsSplitApp_mips \
- CtsSplitAppDiffRevision \
- CtsSplitAppDiffVersion \
- CtsSplitAppDiffCert \
- CtsSplitAppFeature \
- CtsTargetInstrumentationApp \
- CtsUsePermissionDiffCert \
- CtsUsesLibraryApp \
- CtsWriteExternalStorageApp \
- CtsMultiUserStorageApp
-
-cts_security_keysets_list := \
- CtsKeySetTestApp \
- CtsKeySetPermDefSigningA \
- CtsKeySetPermDefSigningB\
- CtsKeySetPermUseSigningA \
- CtsKeySetPermUseSigningB \
- CtsKeySetSigningAUpgradeA \
- CtsKeySetSigningBUpgradeA \
- CtsKeySetSigningAUpgradeAAndB \
- CtsKeySetSigningAUpgradeAOrB \
- CtsKeySetSigningAUpgradeB \
- CtsKeySetSigningBUpgradeB \
- CtsKeySetSigningAAndBUpgradeA \
- CtsKeySetSigningAAndCUpgradeB \
- CtsKeySetSigningAUpgradeNone \
- CtsKeySetSharedUserSigningAUpgradeB \
- CtsKeySetSharedUserSigningBUpgradeB \
- CtsKeySetSigningABadUpgradeB \
- CtsKeySetSigningCBadAUpgradeAB \
- CtsKeySetSigningANoDefUpgradeB \
- CtsKeySetSigningAUpgradeEcA \
- CtsKeySetSigningEcAUpgradeA
-
-cts_account_support_packages := \
- CtsUnaffiliatedAccountAuthenticators
-
-cts_support_packages := \
- CtsAbiOverrideTestApp \
- CtsAccountManagementDevicePolicyApp \
- CtsAdminApp \
- CtsAlarmClockService \
- CtsAppRestrictionsManagingApp \
- CtsAppRestrictionsTargetApp \
- CtsAppTestStubs \
- CtsAppUsageTestApp \
- CtsAssistService \
- CtsAssistApp \
- CtsAtraceTestApp \
- CtsBackupApp \
- CtsCertInstallerApp \
- CtsContactDirectoryProvider \
- CtsCustomizationApp \
- CtsCppToolsApp \
- CtsDeviceAdminApp23 \
- CtsDeviceAdminApp24 \
- CtsDeviceAndProfileOwnerApp23 \
- CtsDeviceAndProfileOwnerApp \
- CtsDeviceInfo \
- CtsDeviceOsTestApp \
- CtsDeviceOwnerApp \
- CtsDeviceServicesTestApp \
- CtsDeviceTaskSwitchingAppA \
- CtsDeviceTaskSwitchingAppB \
- CtsDeviceTaskSwitchingControl \
- CtsDragAndDropSourceApp \
- CtsDragAndDropTargetApp \
- CtsExternalServiceService \
- CtsHostsideNetworkTestsApp \
- CtsHostsideNetworkTestsApp2 \
- CtsIntentReceiverApp \
- CtsIntentSenderApp \
- CtsLauncherAppsTests \
- CtsLauncherAppsTestsSupport \
- CtsLeanbackJankApp \
- CtsManagedProfileApp \
- CtsMonkeyApp \
- CtsMonkeyApp2 \
- CtsPackageInstallerApp \
- CtsPermissionApp \
- CtsProfileOwnerApp \
- CtsSimpleApp \
- CtsSimplePreMApp \
- CtsSomeAccessibilityServices \
- CtsSystemUiDeviceApp \
- CtsThemeDeviceApp \
- CtsUsbSerialTestApp \
- CtsVoiceInteractionService \
- CtsVoiceInteractionApp \
- CtsVoiceSettingsService \
- CtsVpnFirewallApp \
- CtsWidgetProviderApp \
- CtsWifiConfigCreator \
- TestDeviceSetup \
- $(cts_account_support_packages) \
- $(cts_security_apps_list) \
- $(cts_security_keysets_list)
-
-cts_external_packages := \
- com.replica.replicaisland \
- com.drawelements.deqp
-
-# Any APKs that need to be copied to the CTS distribution's testcases
-# directory but do not require an associated test package XML.
-CTS_TEST_CASE_LIST := \
- $(cts_support_packages) \
- $(cts_external_packages)
-
-# Test packages that require an associated test package XML.
-cts_test_packages := \
- CtsIcuTestCases \
- CtsAccelerationTestCases \
- CtsAccountManagerTestCases \
- CtsAccessibilityServiceTestCases \
- CtsAccessibilityTestCases \
- CtsAdminTestCases \
- CtsAlarmClockTestCases \
- CtsAnimationTestCases \
- CtsAppTestCases \
- CtsAppWidgetTestCases \
- CtsAssistTestCases \
- CtsBackupTestCases \
- CtsBluetoothTestCases \
- CtsCalendarcommon2TestCases \
- CtsCallLogTestCases \
- CtsCameraTestCases \
- CtsCarTestCases \
- CtsContentTestCases \
- CtsDatabaseTestCases \
- CtsDisplayTestCases \
- CtsDpiTestCases \
- CtsDpiTestCases2 \
- CtsDramTestCases \
- CtsDreamsTestCases \
- CtsDrmTestCases \
- CtsEffectTestCases \
- CtsExternalServiceTestCases \
- CtsFileSystemTestCases \
- CtsGestureTestCases \
- CtsGraphicsTestCases \
- CtsGraphics2TestCases \
- CtsHardwareTestCases \
- CtsJankDeviceTestCases \
- CtsLeanbackJankTestCases \
- CtsJobSchedulerTestCases \
- CtsJniTestCases \
- CtsKeystoreTestCases \
- CtsLibcoreLegacy22TestCases \
- CtsLocationTestCases \
- CtsLocation2TestCases \
- CtsMediaStressTestCases \
- CtsMediaTestCases \
- CtsMidiTestCases \
- CtsMultiUserTestCases \
- CtsNdefTestCases \
- CtsNetSecPolicyUsesCleartextTrafficFalseTestCases \
- CtsNetSecPolicyUsesCleartextTrafficTrueTestCases \
- CtsNetSecPolicyUsesCleartextTrafficUnspecifiedTestCases \
- CtsNetTestCases \
- CtsNetTestCasesLegacyApi22 \
- CtsNetTestCasesLegacyPermission22 \
- CtsNetSecConfigAttributeTestCases \
- CtsNetSecConfigCleartextTrafficTestCases \
- CtsNetSecConfigBasicDebugDisabledTestCases \
- CtsNetSecConfigBasicDebugEnabledTestCases \
- CtsNetSecConfigBasicDomainConfigTestCases \
- CtsNetSecConfigInvalidPinTestCases \
- CtsNetSecConfigNestedDomainConfigTestCases \
- CtsNetSecConfigResourcesSrcTestCases \
- CtsOpenGLTestCases \
- CtsOpenGlPerfTestCases \
- CtsOpenGlPerf2TestCases \
- CtsOsTestCases \
- CtsPermissionTestCases \
- CtsPermission2TestCases \
- CtsPreferenceTestCases \
- CtsPreference2TestCases \
- CtsPrintTestCases \
- CtsProviderTestCases \
- CtsRenderscriptTestCases \
- CtsRenderscriptLegacyTestCases \
- CtsRsBlasTestCases \
- CtsRsCppTestCases \
- CtsSaxTestCases \
- CtsSecurityTestCases \
- CtsSignatureTestCases \
- CtsSimpleCpuTestCases \
- CtsSpeechTestCases \
- CtsSystemUiTestCases \
- CtsTelecomTestCases \
- CtsTelecomTestCases2 \
- CtsTelephonyTestCases \
- CtsTextTestCases \
- CtsTextureViewTestCases \
- CtsThemeDeviceTestCases \
- CtsTransitionTestCases \
- CtsTvProviderTestCases \
- CtsTvTestCases \
- CtsUiAutomationTestCases \
- CtsUiRenderingTestCases \
- CtsUiDeviceTestCases \
- CtsUsageStatsTestCases \
- CtsUtilTestCases \
- CtsVideoTestCases \
- CtsViewTestCases \
- CtsVoiceInteractionTestCases \
- CtsVoiceSettingsTestCases \
- CtsWebkitTestCases \
- CtsWidgetTestCases
-
-# All APKs that need to be scanned by the coverage utilities.
-CTS_COVERAGE_TEST_CASE_LIST := \
- $(cts_support_packages) \
- $(cts_test_packages)
-
-# Host side only tests
-cts_host_libraries := \
- CtsAadbHostTestCases \
- CtsAbiOverrideHostTestCases \
- CtsAppSecurityHostTestCases \
- CtsAppUsageHostTestCases \
- CtsAtraceHostTestCases \
- CtsCppToolsTestCases \
- CtsDevicePolicyManagerTestCases \
- CtsDragAndDropHostTestCases \
- CtsDumpsysHostTestCases \
- CtsHostsideNetworkTests \
- CtsJdwpSecurityHostTestCases \
- CtsMonkeyTestCases \
- CtsOsHostTestCases \
- CtsSecurityHostTestCases \
- CtsServicesHostTestCases \
- CtsThemeHostTestCases \
- CtsUiHostTestCases \
- CtsUsbTests \
- CtsSystemUiHostTestCases
-
-# List of native tests. For 32 bit targets, assumes that there will be
-# one test executable, and it will end in 32. For 64 bit targets, assumes
-# that there will be two executables, one that ends in 32 for the 32
-# bit executable and one that ends in 64 for the 64 bit executable.
-cts_native_tests := \
- CtsNativeMediaSlTestCases \
- CtsNativeMediaXaTestCases \
-
-ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
-cts_native_tests += CtsBionicTestCases
-cts_native_tests += CtsSimpleperfTestCases
-endif
-
-cts_device_jars := \
- CtsJdwpApp
-
-cts_target_junit_tests := \
- CtsJdwp \
- CtsLibcoreOj
-
-cts_deqp_test_apis := \
- egl \
- gles2 \
- gles3 \
- gles31
-
-# All the files that will end up under the repository/testcases
-# directory of the final CTS distribution.
-CTS_TEST_CASES := $(call cts-get-lib-paths,$(cts_host_libraries)) \
- $(call cts-get-package-paths,$(cts_test_packages)) \
- $(call cts-get-ui-lib-paths,$(cts_device_jars)) \
- $(call cts-get-ui-lib-paths,$(cts_target_junit_tests)) \
- $(call cts-get-executable-paths,$(cts_device_executables)) \
- $(call cts-get-native-paths,$(cts_native_tests),32)
-
-ifeq ($(TARGET_IS_64_BIT),true)
-CTS_TEST_CASES += $(call cts-get-native-paths,$(cts_native_tests),64)
-endif
-
-# All the XMLs that will end up under the repository/testcases
-# and that need to be created before making the final CTS distribution.
-CTS_TEST_XMLS := $(call cts-get-test-xmls,$(cts_host_libraries)) \
- $(call cts-get-test-xmls,$(cts_test_packages)) \
- $(call cts-get-test-xmls,$(cts_native_tests)) \
- $(call cts-get-test-xmls,$(cts_target_junit_tests)) \
- $(call cts-get-deqp-test-xmls,$(cts_deqp_test_apis))
-
-# The following files will be placed in the tools directory of the CTS distribution
-CTS_TOOLS_LIST :=
diff --git a/apps/CameraITS/tests/scene5/test_lens_shading_and_color_uniformity.py b/apps/CameraITS/tests/scene5/test_lens_shading_and_color_uniformity.py
index 8e9f740..1307680 100644
--- a/apps/CameraITS/tests/scene5/test_lens_shading_and_color_uniformity.py
+++ b/apps/CameraITS/tests/scene5/test_lens_shading_and_color_uniformity.py
@@ -52,6 +52,7 @@
with its.device.ItsSession() as cam:
props = cam.get_camera_properties()
+ its.caps.skip_unless(its.caps.read_3a(props))
# Converge 3A and get the estimates.
sens, exp, gains, xform, focus = cam.do_3a(get_results=True,
do_af=False,
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index cafb855..364d336 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -51,8 +51,6 @@
LOCAL_DEX_PREOPT := false
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
-
include $(BUILD_PACKAGE)
# Build CTS verifier framework as a libary.
@@ -73,7 +71,6 @@
LOCAL_SRC_FILES := \
$(call java-files-in, src/com/android/cts/verifier) \
$(call java-files-in, src/com/android/cts/verifier/backup) \
- $(call all-java-files-under, src/android) \
$(call all-Iaidl-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 \
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 25d0941..3d7584b 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -155,209 +155,769 @@
android:value="android.software.backup" />
</activity>
- <activity android:name=".bluetooth.BluetoothTestActivity"
- android:label="@string/bluetooth_test"
- android:configChanges="keyboardHidden|orientation|screenSize">
+<!-- CTS Verifier Bluetooth Test Top Screen -->
+ <activity
+ android:name=".bluetooth.BluetoothTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/bluetooth_test" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
+
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
- <meta-data android:name="test_category" android:value="@string/test_category_networking" />
- <meta-data android:name="test_required_features" android:value="android.hardware.bluetooth" />
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/test_category_networking" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth" />
</activity>
- <activity android:name=".bluetooth.BluetoothToggleActivity"
- android:label="@string/bt_toggle_bluetooth"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_control" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- <meta-data android:name="test_excluded_features" android:value="android.software.leanback" />
- </activity>
-
- <activity android:name=".bluetooth.SecureServerActivity"
- android:label="@string/bt_secure_server"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_device_communication" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- </activity>
-
- <activity android:name=".bluetooth.InsecureServerActivity"
- android:label="@string/bt_insecure_server"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_device_communication" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- </activity>
-
- <activity android:name=".bluetooth.SecureClientActivity"
- android:label="@string/bt_secure_client"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_device_communication" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- </activity>
-
- <activity android:name=".bluetooth.InsecureClientActivity"
- android:label="@string/bt_insecure_client"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_device_communication" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- </activity>
-
- <activity android:name=".bluetooth.ConnectionAccessServerActivity"
- android:label="@string/bt_connection_access_server"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_device_communication" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- </activity>
-
- <activity android:name=".bluetooth.ConnectionAccessClientActivity"
- android:label="@string/bt_connection_access_client"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_device_communication" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- </activity>
-
- <activity android:name=".bluetooth.DevicePickerActivity"
- android:label="@string/bt_device_picker"
- android:configChanges="keyboardHidden|orientation|screenSize" />
-
- <service android:name=".bluetooth.BleClientService"
- android:label="@string/ble_client_service_name" />
-
- <service android:name=".bluetooth.BleServerService"
- android:label="ble_server_service_name" />
-
- <service android:name=".bluetooth.BleAdvertiserService"
- android:label="@string/ble_advertiser_service_name" />
-
- <service android:name=".bluetooth.BleScannerService"
- android:label="@string/ble_scanner_service_name" />
-
- <!-- Uncomment until b/15657182, b/18283088 fixed
- <activity android:name=".bluetooth.BleClientStartActivity"
- android:label="@string/ble_client_test_name"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_le" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- <meta-data android:name="test_required_features"
- android:value="android.hardware.bluetooth_le"/>
- </activity>
-
- <activity android:name=".bluetooth.BleServerStartActivity"
- android:label="@string/ble_server_start_name"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_le" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- <meta-data android:name="test_required_features"
- android:value="android.hardware.bluetooth_le"/>
- </activity> -->
-
- <activity android:name=".bluetooth.BleScannerTestActivity"
- android:label="@string/ble_scanner_test_name"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_le" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- <meta-data android:name="test_required_features"
- android:value="android.hardware.bluetooth_le"/>
- </activity>
-
- <activity android:name=".bluetooth.BleScannerPowerLevelActivity"
- android:label="@string/ble_power_level_name"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_le" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BleScannerTestActivity" />
- </activity>
-
- <!-- Comment out until we have a better way to validate the hardware scan filter
- <activity android:name=".bluetooth.BleScannerHardwareScanFilterActivity"
- android:label="@string/ble_scanner_scan_filter_name"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_le" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BleScannerTestActivity" />
- </activity>
+ <!--
+ CTS Verifier Bluetooth Toggle Test Screen
+ test category : bt_control
+ test parent : BluetoothTestActivity
-->
-
- <activity android:name=".bluetooth.BleAdvertiserTestActivity"
- android:label="@string/ble_advertiser_test_name"
- android:configChanges="keyboardHidden|orientation|screenSize">
+ <activity
+ android:name=".bluetooth.BluetoothToggleActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/bt_toggle_bluetooth" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_le" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- <meta-data android:name="test_required_features"
- android:value="android.hardware.bluetooth_le"/>
- </activity>
- <activity android:name=".bluetooth.BleAdvertiserPowerLevelActivity"
- android:label="@string/ble_power_level_name"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_le" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BleAdvertiserTestActivity" />
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_control" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ <meta-data
+ android:name="test_excluded_features"
+ android:value="android.software.leanback" />
</activity>
- <!-- Comment out until we have a better way to validate the hardware scan filter
- <activity android:name=".bluetooth.BleAdvertiserHardwareScanFilterActivity"
- android:label="@string/ble_advertiser_scan_filter_name"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/bt_le" />
- <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BleAdvertiserTestActivity" />
- </activity>
+ <!--
+ CTS Verifier Bluetooth Secure Server Test Screen
+ test category : bt_device_communication
+ test parent : BluetoothTestActivity
-->
+ <activity
+ android:name=".bluetooth.SecureServerActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/bt_secure_server" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_device_communication" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ </activity>
+
+ <!--
+ CTS Verifier Bluetooth Insecure Server Test Screen
+ test category : bt_device_communication
+ test parent : BluetoothTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.InsecureServerActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/bt_insecure_server" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_device_communication" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ </activity>
+
+ <!--
+ CTS Verifier Bluetooth Secure Client Test Screen
+ test category : bt_device_communication
+ test parent : BluetoothTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.SecureClientActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/bt_secure_client" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_device_communication" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ </activity>
+
+ <!--
+ CTS Verifier Bluetooth Insecure Client Test Screen
+ test category : bt_device_communication
+ test parent : BluetoothTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.InsecureClientActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/bt_insecure_client" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_device_communication" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ </activity>
+
+ <!--
+ CTS Verifier Bluetooth Connection Access Server Test Screen
+ test category : bt_device_communication
+ test parent : BluetoothTestActivity
+ -->
+ <!-- ********************* NOT MANUAL TEST! ******************** -->
+ <activity
+ android:name=".bluetooth.ConnectionAccessServerActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/bt_connection_access_server" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_device_communication" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ </activity>
+
+ <!--
+ CTS Verifier Bluetooth Connection Access Client Test Screen
+ test category : bt_device_communication
+ test parent : BluetoothTestActivity
+ -->
+ <!-- ********************* NOT MANUAL TEST! ******************** -->
+ <activity
+ android:name=".bluetooth.ConnectionAccessClientActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/bt_connection_access_client" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_device_communication" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ </activity>
+ <activity
+ android:name=".bluetooth.DevicePickerActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/bt_device_picker" />
+
+<!--
+ *****************************************************************************************
+ ** Begin BLE Test Sub Layer Info ****
+ *****************************************************************************************
+ -->
+ <!-- CTS Verifier BLE Client Test Service -->
+ <service android:name=".bluetooth.BleClientService" />
+ <!-- CTS Verifier BLE Server Test Service -->
+ <service android:name=".bluetooth.BleServerService" />
+
+ <!-- CTS Verifier BLE Advertiser Test Service -->
+ <service android:name=".bluetooth.BleAdvertiserService" />
+ <!-- CTS Verifier BLE Scanner Test Service -->
+ <service android:name=".bluetooth.BleScannerService" />
+
+ <!-- CTS Verifier BLE Server Connection Priority Test Service -->
+ <service android:name=".bluetooth.BleConnectionPriorityServerService" />
+ <!-- CTS Verifier BLE Client Connection Priority Test Service -->
+ <service android:name=".bluetooth.BleConnectionPriorityClientService" />
+
+ <!-- CTS Verifier BLE Client Encrypted Test Service -->
+ <service android:name=".bluetooth.BleEncryptedClientService" />
+
+ <!-- CTS Verifier BLE Server Encrypted Test Service -->
+ <service android:name=".bluetooth.BleEncryptedServerService" />
+
+ <!--
+ =================================================================================
+ == BLE Insecure Client Test Info ==
+ =================================================================================
+ -->
+ <!--
+ CTS Verifier BLE Insecure Client Test Top Screen
+ test category : bt_le
+ test parent : BluetoothTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleInsecureClientTestListActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_insecure_client_test_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+
+ <!--
+ CTS Verifier BLE Insecure Client Test List Screen
+ test category : bt_le
+ test parent : BleInsecureClientTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleInsecureClientStartActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_client_test_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleInsecureClientTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Insecure Client Connection Priority Test Screen
+ test category : bt_le
+ test parent : BleInsecureClientTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleInsecureConnectionPriorityClientTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_connection_priority_client_name"
+ android:windowSoftInputMode="stateAlwaysHidden" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleInsecureClientTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Insecure Client Encrypted Test Screen
+ test category : bt_le
+ test parent : BleInsecureClientTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleInsecureEncryptedClientTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_encrypted_client_name"
+ android:windowSoftInputMode="stateAlwaysHidden" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleInsecureClientTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ =================================================================================
+ == BLE Insecure Server Test Info ==
+ =================================================================================
+ -->
+ <!--
+ CTS Verifier BLE Insecure Server Test Top Screen
+ test category : bt_le
+ test parent : BluetoothTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleInsecureServerTestListActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_insecure_server_test_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Insecure Server Test List Screen
+ test category : bt_le
+ test parent : BleInsecureServerTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleInsecureServerStartActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_server_start_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleInsecureServerTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Insecure Server Connection Priority Test Screen
+ test category : bt_le
+ test parent : BleInsecureServerTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleInsecureConnectionPriorityServerTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_connection_priority_server_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleInsecureServerTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Insecure Server Encrypted Test Screen
+ test category : bt_le
+ test parent : BleInsecureServerTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleInsecureEncryptedServerTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_encrypted_server_name"
+ android:windowSoftInputMode="stateAlwaysHidden" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleInsecureServerTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ =================================================================================
+ == BLE Secure Client Test Info ==
+ =================================================================================
+ -->
+ <!--
+ CTS Verifier BLE Secure Client Test Top Screen
+ test category : bt_le
+ test parent : BluetoothTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleSecureClientTestListActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_secure_client_test_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Secure Client Test List Screen
+ test category : bt_le
+ test parent : BleSecureClientTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleSecureClientStartActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_client_test_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleSecureClientTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Secure Client Connection Priority Test Screen
+ test category : bt_le
+ test parent : BleSecureClientTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleSecureConnectionPriorityClientTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_connection_priority_client_name"
+ android:windowSoftInputMode="stateAlwaysHidden" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleSecureClientTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Secure Client Encrypted Test Screen
+ test category : bt_le
+ test parent : BleSecureClientTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleSecureEncryptedClientTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_encrypted_client_name"
+ android:windowSoftInputMode="stateAlwaysHidden" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleSecureClientTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ =================================================================================
+ == BLE Secure Server Test Info ==
+ =================================================================================
+ -->
+ <!--
+ CTS Verifier BLE Secure Server Test Top Screen
+ test category : bt_le
+ test parent : BluetoothTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleSecureServerTestListActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_secure_server_test_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Secure Server Test List Screen
+ test category : bt_le
+ test parent : BleSecureServerTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleSecureServerStartActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_server_start_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleSecureServerTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Secure Server Connection Priority Test Screen
+ test category : bt_le
+ test parent : BleSecureServerTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleSecureConnectionPriorityServerTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_connection_priority_server_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleSecureServerTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Secure Server Encrypted Test Screen
+ test category : bt_le
+ test parent : BleSecureServerTestListActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleSecureEncryptedServerTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_encrypted_server_name"
+ android:windowSoftInputMode="stateAlwaysHidden" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleSecureServerTestListActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ =================================================================================
+ == BLE Scanner Test Info ==
+ =================================================================================
+ -->
+ <!--
+ CTS Verifier BLE Client Scanner Screen
+ test category : bt_le
+ test parent : BluetoothTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleScannerTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_scanner_test_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Scanner PowerLevel Test Screen
+ test category : bt_le
+ test parent : BleScannerTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleScannerPowerLevelActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_power_level_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleScannerTestActivity" />
+ </activity>
+
+
+ <!--
+ =================================================================================
+ == BLE Advertiser Test Info ==
+ =================================================================================
+ -->
+ <!--
+ CTS Verifier BLE Advertiser Screen
+ test category : bt_le
+ test parent : BluetoothTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleAdvertiserTestActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_advertiser_test_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ <meta-data
+ android:name="test_required_features"
+ android:value="android.hardware.bluetooth_le" />
+ </activity>
+
+ <!--
+ CTS Verifier BLE Advertiser PowerLevel Test Screen
+ test category : bt_le
+ test parent : BleAdvertiserTestActivity
+ -->
+ <activity
+ android:name=".bluetooth.BleAdvertiserPowerLevelActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/ble_power_level_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+
+ <meta-data
+ android:name="test_category"
+ android:value="@string/bt_le" />
+ <meta-data
+ android:name="test_parent"
+ android:value="com.android.cts.verifier.bluetooth.BleAdvertiserTestActivity" />
+ </activity>
+
<activity android:name=".security.FingerprintBoundKeysTest"
android:label="@string/sec_fingerprint_bound_key_test"
@@ -2182,6 +2742,28 @@
</intent-filter>
</activity-alias>
+ <activity android:name=".voicemail.VoicemailBroadcastActivity"
+ android:label="@string/voicemail_broadcast_test">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.DIAL" />
+ <data android:scheme="tel" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.DIAL" />
+ </intent-filter>
+ <meta-data android:name="test_category" android:value="@string/test_category_telephony"/>
+ </activity>
+
+ <receiver android:name=".voicemail.VoicemailBroadcastReceiver">
+ <intent-filter>
+ <action android:name="android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION" />
+ </intent-filter>
+ </receiver>
+
</application>
</manifest>
diff --git a/apps/CtsVerifier/jni/verifier/Android.mk b/apps/CtsVerifier/jni/verifier/Android.mk
index f227ff3..2350085 100644
--- a/apps/CtsVerifier/jni/verifier/Android.mk
+++ b/apps/CtsVerifier/jni/verifier/Android.mk
@@ -33,9 +33,5 @@
LOCAL_SHARED_LIBRARIES := liblog \
libnativehelper_compat_libc++
-LOCAL_CXX_STL := libstdc++
-
-LOCAL_CXX_STL := libstdc++
-
include $(BUILD_SHARED_LIBRARY)
diff --git a/apps/CtsVerifier/res/layout/ble_connection_priority_client_test.xml b/apps/CtsVerifier/res/layout/ble_connection_priority_client_test.xml
new file mode 100644
index 0000000..6dafbbe
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/ble_connection_priority_client_test.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="10dip"
+ >
+ <include android:id="@+id/pass_fail_buttons"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ layout="@layout/pass_fail_buttons"
+ />
+ <ListView android:id="@+id/ble_client_connection_tests"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_above="@id/pass_fail_buttons"
+ android:layout_alignParentTop="true"
+ android:padding="10dip"
+ />
+</RelativeLayout>
diff --git a/apps/CtsVerifier/res/layout/ble_connection_priority_server_test.xml b/apps/CtsVerifier/res/layout/ble_connection_priority_server_test.xml
new file mode 100644
index 0000000..2772ebe
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/ble_connection_priority_server_test.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="10dip"
+ >
+ <include android:id="@+id/pass_fail_buttons"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ layout="@layout/pass_fail_buttons"
+ />
+ <ListView android:id="@+id/ble_server_connection_tests"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_above="@id/pass_fail_buttons"
+ android:layout_alignParentTop="true"
+ android:padding="10dip"
+ />
+</RelativeLayout>
\ No newline at end of file
diff --git a/apps/CtsVerifier/res/layout/ble_encrypted_client_test.xml b/apps/CtsVerifier/res/layout/ble_encrypted_client_test.xml
new file mode 100644
index 0000000..7d42381
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/ble_encrypted_client_test.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="10dip"
+ >
+ <include android:id="@+id/pass_fail_buttons"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ layout="@layout/pass_fail_buttons"
+ />
+ <ListView android:id="@+id/ble_client_enctypted_tests"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_above="@id/pass_fail_buttons"
+ android:layout_alignParentTop="true"
+ android:padding="10dip"
+ />
+</RelativeLayout>
diff --git a/apps/CtsVerifier/res/layout/ble_encrypted_server_test.xml b/apps/CtsVerifier/res/layout/ble_encrypted_server_test.xml
new file mode 100644
index 0000000..35a8a5e
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/ble_encrypted_server_test.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="10dip"
+ >
+ <include android:id="@+id/pass_fail_buttons"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ layout="@layout/pass_fail_buttons"
+ />
+ <ListView android:id="@+id/ble_server_enctypted_tests"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_above="@id/pass_fail_buttons"
+ android:layout_alignParentTop="true"
+ android:padding="10dip"
+ />
+</RelativeLayout>
diff --git a/apps/CtsVerifier/res/layout/ble_insecure_encrypted_server_test.xml b/apps/CtsVerifier/res/layout/ble_insecure_encrypted_server_test.xml
new file mode 100644
index 0000000..2be5f69
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/ble_insecure_encrypted_server_test.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="10dip"
+ >
+ <include android:id="@+id/pass_fail_buttons"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ layout="@layout/pass_fail_buttons"
+ />
+ <TextView android:id="@+id/ble_insecure_server_enctypted_text"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_above="@id/pass_fail_buttons"
+ android:layout_alignParentTop="true"
+ android:text="@string/ble_insecure_server_enctypted_info"
+ android:padding="10dip"
+ />
+</RelativeLayout>
\ No newline at end of file
diff --git a/apps/CtsVerifier/res/layout/voicemail_broadcast.xml b/apps/CtsVerifier/res/layout/voicemail_broadcast.xml
new file mode 100644
index 0000000..5ce102a
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/voicemail_broadcast.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/voicemail_broadcast_instructions"/>
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/js_padding"
+ android:layout_marginBottom="@dimen/js_padding">
+ <ImageView
+ android:id="@+id/set_default_dialer_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/fs_indeterminate"
+ android:layout_marginRight="@dimen/js_padding"/>
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/voicemail_set_default_dialer_description"
+ android:textSize="16dp"/>
+ </LinearLayout>
+
+ <Button
+ android:id="@+id/set_default_dialer"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/voicemail_set_default_dialer_button"/>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/js_padding"
+ android:layout_marginBottom="@dimen/js_padding">
+ <ImageView
+ android:id="@+id/leave_voicemail_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/fs_indeterminate"
+ android:layout_marginRight="@dimen/js_padding"/>
+ <TextView
+ android:id="@+id/leave_voicemail_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/voicemail_leave_voicemail"
+ android:textSize="16dp"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/js_padding"
+ android:layout_marginBottom="@dimen/js_padding">
+ <ImageView
+ android:id="@+id/restore_default_dialer_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/fs_indeterminate"
+ android:layout_marginRight="@dimen/js_padding"/>
+ <TextView
+ android:id="@+id/restore_default_dialer_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/voicemail_restore_default_dialer_description"
+ android:textSize="16dp"/>
+ </LinearLayout>
+
+ <Button
+ android:id="@+id/restore_default_dialer"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/voicemail_restore_default_dialer_button"/>
+
+ <include layout="@layout/pass_fail_buttons" />
+</LinearLayout>
\ No newline at end of file
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index d74c30b..a2da24d 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -38,6 +38,7 @@
<string name="test_category_features">Features</string>
<string name="test_category_deskclock">Clock</string>
<string name="test_category_jobscheduler">Job Scheduler</string>
+ <string name="test_category_telephony">Telephony</string>
<string name="test_category_tv">TV</string>
<string name="test_category_other">Other</string>
<string name="clear">Clear</string>
@@ -194,15 +195,26 @@
<!-- Strings for BluetoothActivity -->
<string name="bluetooth_test">Bluetooth Test</string>
- <string name="bluetooth_test_info">The Bluetooth Control tests check whether or not the device
- can disable and enable Bluetooth properly.\n\nThe Device Communication tests require two
+ <string name="bluetooth_test_info">
+ The Bluetooth Control tests check whether or not the device
+ can disable and enable Bluetooth properly.
+ \n\nThe Bluetooth tests require two devices, and Bluetooth data is exchanged between them.
+ \nThere are two types of connections: Insecure and Secure. There are two types of roles: Server and Client. You must pass all connection and role combinations.
+ \nThis is a list of the tests:
+ \nThis Device x Other Device
+ \n\n\"Bluetooth LE Insecure Client Test\" x \"Bluetooth LE Insecure Server Test\"
+ \n\n\"Bluetooth LE Insecure Server Test\" x \"Bluetooth LE Insecure Client Test\"
+ \n\n\"Bluetooth LE Secure Client Test\" x \"Bluetooth LE Secure Server Test\"
+ \n\n\"Bluetooth LE Secure Server Test\" x \"Bluetooth LE Secure Client Test\"
+ \n\nThe Device Communication tests require two
devices to pair and exchange messages. The two devices must be:
\n\n1. a candidate device implementation running the software build to be tested
- \n\n2. a separate device implementation already known to be compatible</string>
+ \n\n2. a separate device implementation already known to be compatible
+ </string>
<string name="bt_control">Bluetooth Control</string>
<string name="bt_device_communication">Device Communication</string>
- <string name="bt_le">Bluetooth Low Energy</string>
+ <string name="bt_le">Bluetooth LE</string>
<string name="bt_toggle_bluetooth">Toggle Bluetooth</string>
<string name="bt_toggle_instructions">Disable and enable Bluetooth to successfully complete this test.</string>
@@ -250,6 +262,12 @@
<string name="bt_pick_server">Pick Server</string>
<string name="bt_insecure_pairing_error_title">Pairing dialog shown?</string>
<string name="bt_insecure_pairing_error_message">Insecure connections should not show the pairing dialog!</string>
+ <string name="bt_advertise_unsupported_title">Advertising is not supported</string>
+ <string name="bt_advertise_unsupported_message">Advertising is not supported on this device.\nTest finishes.</string>
+ <string name="bt_open_failed_title">BLE open failed</string>
+ <string name="bt_open_failed_message">Cannot open BLE GattService.\nTest finishes.</string>
+ <string name="bt_add_service_failed_title">Add service failed</string>
+ <string name="bt_add_service_failed_message">Failed to add services.\nTest finishes.</string>
<string name="bt_secure_client">Secure Client</string>
<string name="bt_insecure_client">Insecure Client</string>
@@ -265,18 +283,22 @@
<!-- BLE client side strings -->
<string name="ble_client_service_name">Bluetooth LE GATT Client Handler Service</string>
- <string name="ble_client_test_name">BLE Client Test</string>
- <string name="ble_client_connect_name">BLE Client Connect</string>
- <string name="ble_discover_service_name">BLE Discover Service</string>
- <string name="ble_read_characteristic_name">BLE Read Characteristic</string>
- <string name="ble_write_characteristic_name">BLE Write Characteristic</string>
- <string name="ble_reliable_write_name">BLE Reliable Write</string>
- <string name="ble_notify_characteristic_name">BLE Notify Characteristic</string>
- <string name="ble_read_descriptor_name">BLE Read Descriptor</string>
- <string name="ble_write_descriptor_name">BLE Write Descriptor</string>
- <string name="ble_read_rssi_name">BLE Read RSSI</string>
- <string name="ble_client_disconnect_name">BLE Client Disconnect</string>
- <string name="ble_client_test_info">The BLE test must be done simultaneously on two devices. This device is the client. All tests listed here must be done in order.</string>
+ <string name="ble_client_test_name">01 Bluetooth LE Client Test</string>
+ <string name="ble_client_connect_name">Bluetooth LE Client Connect</string>
+ <string name="ble_discover_service_name">Bluetooth LE Discover Service</string>
+ <string name="ble_read_characteristic_name">Bluetooth LE Read Characteristic</string>
+ <string name="ble_write_characteristic_name">Bluetooth LE Write Characteristic</string>
+ <string name="ble_reliable_write_name">Bluetooth LE Reliable Write</string>
+ <string name="ble_reliable_write_bad_resp_name">Bluetooth LE Reliable Write (receive bad response)</string>
+ <string name="ble_notify_characteristic_name">Bluetooth LE Notify Characteristic</string>
+ <string name="ble_read_descriptor_name">Bluetooth LE Read Descriptor</string>
+ <string name="ble_write_descriptor_name">Bluetooth LE Write Descriptor</string>
+ <string name="ble_read_rssi_name">Bluetooth LE Read RSSI</string>
+ <string name="ble_client_disconnect_name">Bluetooth LE Client Disconnect</string>
+ <string name="ble_client_test_info">
+ The Bluetooth LE test must be done simultaneously on two devices. This device is the client.
+ All tests listed here must be done with out pairing.
+ </string>
<string name="ble_client_send_connect_info">Type in the Bluetooth address of the remote device to connect to, and verify that the devices are connected.</string>
<string name="ble_discover_service_info">Verify that the service is discovered when you press the "Discover Service" button.</string>
<string name="ble_read_write_info">Write values to and read values from the server to verify that the write and read functionalities are working correctly.</string>
@@ -299,32 +321,82 @@
<string name="ble_read_rssi">Read RSSI</string>
<string name="ble_disconnect">Disconnect</string>
<string name="ble_test_text">TEST</string>
+ <string name="ble_test_finished">Test finished</string>
+ <string name="ble_test_next">Next</string>
+ <string name="ble_test_running">Test Running</string>
+ <string name="ble_test_running_message">This test requires a few minutes. Don\'t interrupt the test.</string>
+ <string name="ble_mtu_23_name">Bluetooth LE Request MTU(23bytes)</string>
+ <string name="ble_mtu_512_name">Bluetooth LE Request MTU(512bytes)</string>
<!-- BLE server side strings -->
<string name="ble_server_service_name">Bluetooth LE GATT Server Handler Service</string>
- <string name="ble_server_start_name">BLE Server Test</string>
- <string name="ble_server_start_info">The BLE test must be done simultaneously on two devices, a server device and a client device. This device is the server.</string>
- <string name="ble_server_receiving_connect">Waiting on connection from BLE client.</string>
- <string name="ble_server_add_service">Adding service to BLE server.</string>
+ <string name="ble_server_start_name">01 Bluetooth LE Server Test</string>
+ <string name="ble_server_start_info">
+ The Bluetooth LE test must be done simultaneously on two devices, a server device and a client device. This device is the server.
+ </string>
+ <string name="ble_server_receiving_connect">Waiting on connection from Bluetooth LE client.</string>
+ <string name="ble_server_add_service">Adding service to Bluetooth LE server.</string>
<string name="ble_server_write_characteristic">Waiting on write characteristic request</string>
<string name="ble_server_read_characteristic">Waiting on read characteristic request</string>
<string name="ble_server_write_descriptor">Waiting on write descriptor request</string>
<string name="ble_server_read_descriptor">Waiting on read descriptor request</string>
<string name="ble_server_reliable_write">Waiting on reliable write from client</string>
- <string name="ble_server_receiving_disconnect">Waiting on disconnection from BLE client</string>
+ <string name="ble_server_reliable_write_bad_resp">Waiting on reliable write from client (send bad response)</string>
+ <string name="ble_server_receiving_disconnect">Waiting on disconnection from Bluetooth LE client</string>
+ <string name="ble_connection_priority_server_name">02 Bluetooth LE Connection Priority Server Test</string>
+ <string name="ble_connection_priority_server_info">Bluetooth LE Connection Priority Server receive message from message in 3 different priority.</string>
+ <string name="ble_server_notify_characteristic">Waiting on notify characteristic request</string>
+ <string name="ble_server_write_characteristic_without_permission">Waiting on write characteristic request without permission</string>
+ <string name="ble_server_read_characteristic_without_permission">Waiting on read characteristic request without permission</string>
+ <string name="ble_server_write_descriptor_without_permission">Waiting on write descriptor request without permission</string>
+ <string name="ble_server_read_descriptor_without_permission"> Waiting on read descriptor request without permission</string>
+ <string name="ble_server_write_characteristic_need_encrypted">Waiting on write encrypted characteristic request</string>
+ <string name="ble_server_read_characteristic_need_encrypted">Waiting on read encryptedcharacteristic request</string>
+ <string name="ble_server_write_descriptor_need_encrypted">Waiting on write encrypted descriptor request</string>
+ <string name="ble_server_read_descriptor_need_encrypted"> Waiting on read encrypted descriptor request</string>
+ <string name="ble_server_indicate_characteristic">Waiting on indicate characteristic request</string>
+ <string name="ble_server_mtu_23bytes">Waiting on MTU request(23 bytes)</string>
+ <string name="ble_server_mtu_512bytes">Waiting on MTU request(512 bytes)</string>
+ <string name="ble_encrypted_server_name">03 Bluetooth LE Encrypted Server Test</string>
+ <string name="ble_encrypted_server_info">Bluetooth LE Encrypted Server Waiting on read/write characteristic and descriptor request need encrypted.</string>
+ <string name="ble_insecure_server_enctypted_info">Bluetooth LE Server is in operation.\nThis test does not change server state.\n\nIf Bluetooth pairing request was notified by system, you must cancel it.\n\nOnce the client tests are all successful, please change the state of the server-side to the "success".</string>
+ <string name="ble_insecure_server_test_list_name">Bluetooth LE Insecure Server Test</string>
+ <string name="ble_insecure_server_test_list_info">
+ This test is mostly automated, but requires some user interaction.
+ Once the list items below have check marks, the test is complete.
+ \n\nTap \"01 Bluetooth LE Server Test\" on this device, then tap \"01 Bluetooth LE Client Test\" on the other device.
+ \nWhen the test is complete, move to the next item. You must complete all tests.
+ </string>
+ <string name="ble_secure_server_test_list_name">Bluetooth LE Secure Server Test</string>
+ <string name="ble_secure_server_test_list_info">
+ This test is mostly automated, but requires some user interaction.
+ You can pass this test once the list items below are checked.
+ \n\nTap \"01 Bluetooth LE Server Test\" on this device, then tap \"01 Bluetooth LE Client Test \"on other device.
+ \nTest completed, then test next item. You must be done all tests.
+ </string>
<!-- BLE advertiser side strings -->
- <string name="ble_advertiser_test_name">BLE Advertiser Test</string>
- <string name="ble_advertiser_test_info">The BLE test must be done simultaneously on two devices, an advertiser and a scanner. This device is the advertiser.</string>
+ <string name="ble_advertiser_test_name">Bluetooth LE Advertiser Test</string>
+ <string name="ble_advertiser_test_info">
+ The Bluetooth LE Advertiser Test and Scanner Test is a paired test.
+ \nTap \"Bluetooth LE Advertiser Test\" on this device. Once it is passed, tap \"Bluetooth LE Scanner Test\".
+ \nTap \"Bluetooth LE Scanner Test\" on this device. Once it is passed, tap \"Bluetooth LE Advertiser Test\".
+ </string>
<string name="ble_advertiser_service_name">Bluetooth LE Advertiser Handler Service</string>
- <string name="ble_privacy_mac_name">BLE Privacy Mac</string>
- <string name="ble_privacy_mac_info">BLE Advertiser should advertise in non-repeating MAC address.</string>
- <string name="ble_advertiser_privacy_mac_instruction">Click start to start advertising, you can disconnect USB and lock the screen of advertiser. Counts and mac address will show on scanner. You may receive message that this device does not support BLE advertising.</string>
- <string name="ble_power_level_name">BLE Tx Power Level</string>
- <string name="ble_power_level_info">BLE Advertiser advertises in 4 different power levels. Scanner should receive them in different strength of Rssi, cannot receive weak signals beyond several feet.</string>
- <string name="ble_advertiser_power_level_instruction">Click start to start multi-advertising. Data packets are advertised in 4 different power levels. You may receive message that this device does not support multi advertising. If advertiser does not advertise in 4 power levels, neither you receive the error message, you may not stop the advertising in previous test, or this device does not support 4 advertisers at the same time. Try rebooting the device and run the test to free those advertisers in use.</string>
- <string name="ble_advertiser_scan_filter_name">BLE Hardware Scan Filter</string>
- <string name="ble_advertiser_scan_filter_info">BLE Advertiser advertises with 2 different data separately. One can wake up the scanner, the other cannot. This test cares about behavior on scanner only.</string>
+ <string name="ble_privacy_mac_name">Bluetooth LE Privacy Mac</string>
+ <string name="ble_privacy_mac_info">Bluetooth LE Advertiser should advertise in non-repeating MAC address.</string>
+ <string name="ble_advertiser_privacy_mac_instruction">Click start to start advertising, you can disconnect USB and lock the screen of advertiser. Counts and mac address will show on scanner. You may receive message that this device does not support Bluetooth LE advertising.</string>
+ <string name="ble_power_level_name">Bluetooth LE Tx Power Level</string>
+ <string name="ble_power_level_info">Bluetooth LE Advertiser advertises in 4 different power levels. Scanner should receive them in different strength of Rssi, cannot receive weak signals beyond several feet.</string>
+ <string name="ble_advertiser_power_level_instruction">
+ Click start to start multi-advertising. Data packets are advertised in 4 different power levels.
+ You may receive a message that this device does not support multi-advertising.
+ If the advertiser does not advertise in 4 power levels, and you do not receive an error message,
+ you may not have stopped advertising in the previous test, or this device may not support 4 advertisers at the same time.
+ Try rebooting the device and running the test again to free those advertisers in use.
+ </string>
+ <string name="ble_advertiser_scan_filter_name">Bluetooth LE Hardware Scan Filter</string>
+ <string name="ble_advertiser_scan_filter_info">Bluetooth LE Advertiser advertises with 2 different data separately. One can wake up the scanner, the other cannot. This test cares about behavior on scanner only.</string>
<string name="ble_advertiser_scannable">Scannable advertising</string>
<string name="ble_advertiser_scannable_instruction">Start scannable advertising, expect scanner consume more power on Monsoon monitor, or see log of GattService from scanner logcat.</string>
<string name="ble_advertiser_unscannable">Unscannble advertising</string>
@@ -333,9 +405,9 @@
<string name="ble_advertiser_stop">Stop</string>
<!-- BLE scanner side strings -->
- <string name="ble_scanner_test_name">BLE Scanner Test</string>
+ <string name="ble_scanner_test_name">Bluetooth LE Scanner Test</string>
<string name="ble_scanner_service_name">Bluetooth LE Scanner Handler Service</string>
- <string name="ble_scanner_test_info">The BLE test must be done simultaneously on two devices, an advertiser and a scanner. This device is the scanner.</string>
+ <string name="ble_scanner_test_info">The Bluetooth LE test must be done simultaneously on two devices, an advertiser and a scanner. This device is the scanner.</string>
<string name="ble_scanner_privacy_mac">Hold for 15 min to see if receive a different MAC address from advertiser.</string>
<string name="ble_scanner_privacy_mac_instruction">Mac address, counts are shown on screen. It should continuously receive data packet from advertiser. Every 15 min, a new mac address should show up, which prevents mac address disclosure.</string>
<string name="ble_ultra_low">Ultra low</string>
@@ -343,7 +415,7 @@
<string name="ble_medium">Medium</string>
<string name="ble_high">High</string>
<string name="ble_scanner_power_level_instruction">Count: Ultra low < low < medium < high\nRssi: Ultra low < low < medium < high\nDistance to see count freezing: Ultra low < low < medium < high\nA common error is ultra low, low and medium behave similarly, with similar rssi, freeze at similar distance.\n\n All power level receive a different mac address. After 15 mins, a green text "Get a new Mac address" will show up.</string>
- <string name="ble_scanner_scan_filter_name">BLE Hardware Scan Filter</string>
+ <string name="ble_scanner_scan_filter_name">Bluetooth LE Hardware Scan Filter</string>
<string name="ble_scanner_scan_filter_info">Lock the screen of scanner, and connect to monsoon. It will not wake up when advertiser is advertising unscannable, and scanner is scanning with filter.</string>
<string name="ble_scanner_scan_filter_instruction">Scan filter is to scan data with service UUID = 0x6666 only. If you scan without scan filter, data with service UUID = 0x5555 and 0x6666 will show up on screen.\nFor monsoon test:\n\tClick scan with filter, lock the screen, connect to monsoon. It will not wake up when advertiser is advertising unscannable data packets, but will show a peak in power usage when advertiser is advertising scannable data.\nFor logcat test:\n\tClick scan with filter, logcat the scanner. No data will be received by GattService when advertiser is advertising unscannable data.</string>
<string name="ble_scan_with_filter">Scan with filter</string>
@@ -351,6 +423,80 @@
<string name="ble_scan_start">Start scan</string>
<string name="ble_scan_stop">Stop scan</string>
+ <!-- BLE connection priority test strings -->
+ <string name="ble_client_connection_priority">Testing priority: </string>
+ <string name="ble_connection_priority_balanced">BALANCED</string>
+ <string name="ble_connection_priority_high">HIGH</string>
+ <string name="ble_connection_priority_low">LOW</string>
+ <string name="ble_server_connection_priority_result_passed">All test passed</string>
+ <string name="ble_server_connection_priority_result_failed">Test failed.</string>
+ <string name="ble_server_connection_priority_result_intervals">
+ Transfer interval time (msec):\nHIGH=%1$d\nBALANCED=%2$d\nLOW=%3$d\n\nRequirements:\n HIGH <= BALANCED <= LOW
+ </string>
+
+ <!-- BLE Test Name -->
+ <string name="ble_secure_client_test_name">Bluetooth LE Secure Client Test</string>
+ <string name="ble_insecure_client_test_name">Bluetooth LE Insecure Client Test</string>
+ <string name="ble_secure_server_test_name">Bluetooth LE Secure Server Test</string>
+ <string name="ble_insecure_server_test_name">Bluetooth LE Insecure Server Test</string>
+
+ <string name="ble_read_characteristic_nopermission_name">Bluetooth LE Read Characteristic Without Perrmission</string>
+ <string name="ble_write_characteristic_nopermission_name">Bluetooth LE Write Characteristic Without Permission</string>
+ <string name="ble_read_descriptor_nopermission_name">Bluetooth LE Read Descriptor Without Perrmission</string>
+ <string name="ble_write_descriptor_nopermission_name">Bluetooth LE Write Descriptor Without Permission</string>
+ <string name="ble_connection_priority_client_name">02 Bluetooth LE Connection Priority Client Test</string>
+ <string name="ble_connection_priority_client_info">Bluetooth LE Connection Priority Client send message in 3 different priority.</string>
+ <string name="ble_read_authenticated_characteristic_name">Bluetooth LE Read Encrypted Characteristic</string>
+ <string name="ble_write_authenticated_characteristic_name">Bluetooth LE Write Encrypted Characteristic</string>
+ <string name="ble_read_authenticated_descriptor_name">Bluetooth LE Read Encrypted Descriptor</string>
+ <string name="ble_write_authenticated_descriptor_name">Bluetooth LE Write Encrypted Descriptor</string>
+ <string name="ble_connection_priority_client_high">Bluetooth LE Send With CONNECTION_PRIORITY_HIGH</string>
+ <string name="ble_connection_priority_client_low">Bluetooth LE Send With CONNECTION_PRIORITY_LOW_POWER</string>
+ <string name="ble_connection_priority_client_balanced">Bluetooth LE Send With CONNECTION_PRIORITY_BALANCED</string>
+ <string name="ble_indicate_characteristic_name">Bluetooth LE Indicate Characteristic</string>
+ <string name="ble_encrypted_client_name">03 Bluetooth LE Encrypted Client Test</string>
+ <string name="ble_encrypted_client_info">Bluetooth LE Encrypted Client read/write on characteristic and descriptor need encrypted.</string>
+ <string name="ble_insecure_client_test_list_name">Bluetooth LE Insecure Client Test</string>
+ <string name="ble_insecure_client_test_list_info">
+ The Bluetooth LE test must be done simultaneously on two devices. This device is the client.
+ All tests listed here must be done without pairing. Tap \"Bluetooth LE Insecure Server Test\" on the other device.
+ \n\nTap \"01 Bluetooth LE Client Test\" on this device, then tap \"01 Bluetooth LE Server Test\" on the other device.
+ \nWhen the test is complete, move to the next item. You must complete all tests.
+ </string>
+ <string name="ble_secure_client_test_list_name">Bluetooth LE Secure Client Test</string>
+ <string name="ble_secure_client_test_list_info">
+ The Bluetooth LE test must be done simultaneously on two devices.
+ This device is the client. All tests listed here must be done with pairing.
+ \n\nTap \"01 Bluetooth LE Client Test\" on this device, then tap \"01 Bluetooth LE Server Test\" on the other device.
+ \nWhen the test is complete, move to the next item. You must complete all tests.
+ </string>
+ <string name="ble_encrypted_client_no_encrypted_characteristic">Error!\nThe Characteristics unencrypted.</string>
+ <string name="ble_encrypted_client_no_encrypted_descriptor">Error!\nThe Descriptor unencrypted.</string>
+ <string name="ble_encrypted_client_fail_write_encrypted_characteristic">It failed to write to Characteristic.</string>
+ <string name="ble_encrypted_client_fail_write_encrypted_descriptor">It failed to write to Descriptor.</string>
+ <string name="ble_encrypted_client_fail_read_encrypted_characteristic">It failed to read the Characteristic.</string>
+ <string name="ble_encrypted_client_fail_read_encrypted_descriptor">It failed to read the Descriptor.</string>
+ <string name="ble_secure_client_test_info">
+ The Bluetooth LE test must be done simultaneously on two devices. This device is the client.
+ All tests listed here must be done with pairing.
+ </string>
+
+ <string name="ble_bluetooth_disable_title">Bluetooth Disable!</string>
+ <string name="ble_bluetooth_disable_message">Please set bluetooth enable.</string>
+
+ <string name="ble_bluetooth_mismatch_title">Bluetooth pairing state is a mismatch!</string>
+ <string name="ble_bluetooth_mismatch_secure_message">
+ And even though it has already been trying to run a test of Secure, the device has not been paired.
+ \nGo setting mode, set Bluetooth to pair other device.
+ </string>
+ <string name="ble_bluetooth_mismatch_insecure_message">
+ And even though it has already been trying to run a test of Insecure, the device has already been paired.
+ \nGo setting mode, set Bluetooth to unpair other device.
+ </string>
+
+ <string name="ble_mtu_mismatch_message">MTU is not correct.(Request:%1$d, Actual:%2$d)</string>
+ <string name="ble_mtu_fail_message">MTU test: failed to receive data</string>
+
<!-- Strings for FeatureSummaryActivity -->
<string name="feature_summary">Hardware/Software Feature Summary</string>
<string name="feature_summary_info">This is a test for...</string>
@@ -2891,4 +3037,17 @@
<string name="unprocessed_test_global_result">Global Results...</string>
+ <!-- Strings for voicemail broadcast test -->
+ <string name="voicemail_broadcast_test">Voicemail Broadcast Test</string>
+ <string name="voicemail_broadcast_instructions">This test verifies that the default dialer can intercept the voicemail notification. The test must be conducted on a SIM with visual voicemail disabled</string>
+ <string name="voicemail_set_default_dialer_description">Before the test, the CTS verifier should be set to the default dialer</string>
+ <string name="voicemail_set_default_dialer_button">Set CTS verifier as default dialer"</string>
+ <string name="voicemail_leave_voicemail">Send a voicemail to the device, CTS verifier should receive a voicemail notification broadcast</string>
+ <string name="voicemail_broadcast_received">Voicemail broadcast Received</string>
+ <string name="voicemail_restore_default_dialer_description">(Optional) restore the default dialer setting</string>
+ <string name="voicemail_restore_default_dialer_no_default_description">(Optional) restore the default dialer by going to settings-> apps -> cogwheel -> Phone app</string>
+ <string name="voicemail_restore_default_dialer_button">Restore the default dialer"</string>
+ <string name="voicemail_default_dialer_already_set">Default dialer already set</string>
+ <string name="voicemail_default_dialer_already_restored">Default dialer already restored</string>
+
</resources>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleAdvertiserTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleAdvertiserTestActivity.java
index 64c50bc..cd7cf70 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleAdvertiserTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleAdvertiserTestActivity.java
@@ -16,13 +16,16 @@
package com.android.cts.verifier.bluetooth;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.bluetooth.BluetoothAdapter;
+import android.content.DialogInterface;
+import android.os.Bundle;
+
import com.android.cts.verifier.ManifestTestListAdapter;
import com.android.cts.verifier.PassFailButtons;
import com.android.cts.verifier.R;
-import android.bluetooth.BluetoothAdapter;
-import android.os.Bundle;
-
import java.util.ArrayList;
import java.util.List;
@@ -44,5 +47,17 @@
setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(),
disabledTest.toArray(new String[disabledTest.size()])));
+ if (!adapter.isEnabled()) {
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.ble_bluetooth_disable_title)
+ .setMessage(R.string.ble_bluetooth_disable_message)
+ .setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ })
+ .create().show();
+ }
}
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientService.java
index 10f862d..972ba43 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientService.java
@@ -16,10 +16,6 @@
package com.android.cts.verifier.bluetooth;
-import java.util.Arrays;
-import java.util.UUID;
-import java.util.List;
-
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -35,54 +31,109 @@
import android.bluetooth.le.ScanFilter;
import android.bluetooth.le.ScanResult;
import android.bluetooth.le.ScanSettings;
+import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.ParcelUuid;
+import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
+import com.android.cts.verifier.R;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
public class BleClientService extends Service {
public static final boolean DEBUG = true;
public static final String TAG = "BleClientService";
+ // Android N (2016 July 15, currently) BluetoothGatt#disconnect() does not work correct.
+ // (termination signal will not be sent)
+ // This flag switches to turn Bluetooth off instead of BluetoothGatt#disconnect().
+ // If true, test will turn Bluetooth off. Otherwise, will call BluetoothGatt#disconnect().
+ public static final boolean DISCONNECT_BY_TURN_BT_OFF_ON = (Build.VERSION.SDK_INT > Build.VERSION_CODES.M);
+
+ // for Version 1 test
+// private static final int TRANSPORT_MODE_FOR_SECURE_CONNECTION = BluetoothDevice.TRANSPORT_AUTO;
+ // for Version 2 test
+ private static final int TRANSPORT_MODE_FOR_SECURE_CONNECTION = BluetoothDevice.TRANSPORT_LE;
+
public static final int COMMAND_CONNECT = 0;
public static final int COMMAND_DISCONNECT = 1;
public static final int COMMAND_DISCOVER_SERVICE = 2;
public static final int COMMAND_READ_RSSI = 3;
public static final int COMMAND_WRITE_CHARACTERISTIC = 4;
- public static final int COMMAND_READ_CHARACTERISTIC = 5;
- public static final int COMMAND_WRITE_DESCRIPTOR = 6;
- public static final int COMMAND_READ_DESCRIPTOR = 7;
- public static final int COMMAND_SET_NOTIFICATION = 8;
- public static final int COMMAND_BEGIN_WRITE = 9;
- public static final int COMMAND_EXECUTE_WRITE = 10;
- public static final int COMMAND_ABORT_RELIABLE = 11;
- public static final int COMMAND_SCAN_START = 12;
- public static final int COMMAND_SCAN_STOP = 13;
+ public static final int COMMAND_WRITE_CHARACTERISTIC_BAD_RESP = 5;
+ public static final int COMMAND_READ_CHARACTERISTIC = 6;
+ public static final int COMMAND_WRITE_DESCRIPTOR = 7;
+ public static final int COMMAND_READ_DESCRIPTOR = 8;
+ public static final int COMMAND_SET_NOTIFICATION = 9;
+ public static final int COMMAND_BEGIN_WRITE = 10;
+ public static final int COMMAND_EXECUTE_WRITE = 11;
+ public static final int COMMAND_ABORT_RELIABLE = 12;
+ public static final int COMMAND_SCAN_START = 13;
+ public static final int COMMAND_SCAN_STOP = 14;
+ public static final String BLE_BLUETOOTH_MISMATCH_SECURE =
+ "com.android.cts.verifier.bluetooth.BLE_BLUETOOTH_MISMATCH_SECURE";
+ public static final String BLE_BLUETOOTH_MISMATCH_INSECURE =
+ "com.android.cts.verifier.bluetooth.BLE_BLUETOOTH_MISMATCH_INSECURE";
+ public static final String BLE_BLUETOOTH_DISABLED =
+ "com.android.cts.verifier.bluetooth.BLE_BLUETOOTH_DISABLED";
public static final String BLE_BLUETOOTH_CONNECTED =
"com.android.cts.verifier.bluetooth.BLE_BLUETOOTH_CONNECTED";
public static final String BLE_BLUETOOTH_DISCONNECTED =
"com.android.cts.verifier.bluetooth.BLE_BLUETOOTH_DISCONNECTED";
public static final String BLE_SERVICES_DISCOVERED =
"com.android.cts.verifier.bluetooth.BLE_SERVICES_DISCOVERED";
+ public static final String BLE_MTU_CHANGED_23BYTES =
+ "com.android.cts.verifier.bluetooth.BLE_MTU_CHANGED_23BYTES";
+ public static final String BLE_MTU_CHANGED_512BYTES =
+ "com.android.cts.verifier.bluetooth.BLE_MTU_CHANGED_512BYTES";
public static final String BLE_CHARACTERISTIC_READ =
"com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_READ";
public static final String BLE_CHARACTERISTIC_WRITE =
"com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_WRITE";
public static final String BLE_CHARACTERISTIC_CHANGED =
"com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_CHANGED";
+ public static final String BLE_CHARACTERISTIC_INDICATED =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_INDICATED";
public static final String BLE_DESCRIPTOR_READ =
"com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_READ";
public static final String BLE_DESCRIPTOR_WRITE =
"com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_WRITE";
public static final String BLE_RELIABLE_WRITE_COMPLETED =
"com.android.cts.verifier.bluetooth.BLE_RELIABLE_WRITE_COMPLETED";
+ public static final String BLE_RELIABLE_WRITE_BAD_RESP_COMPLETED =
+ "com.android.cts.verifier.bluetooth.BLE_RELIABLE_WRITE_BAD_RESP_COMPLETED";
public static final String BLE_READ_REMOTE_RSSI =
"com.android.cts.verifier.bluetooth.BLE_READ_REMOTE_RSSI";
+ public static final String BLE_CHARACTERISTIC_READ_NOPERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_READ_NOPERMISSION";
+ public static final String BLE_CHARACTERISTIC_WRITE_NOPERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_WRITE_NOPERMISSION";
+ public static final String BLE_DESCRIPTOR_READ_NOPERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_READ_NOPERMISSION";
+ public static final String BLE_DESCRIPTOR_WRITE_NOPERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_WRITE_NOPERMISSION";
+ public static final String BLE_CHARACTERISTIC_READ_NEED_ENCRYPTED =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_READ_NEED_ENCRYPTED";
+ public static final String BLE_CHARACTERISTIC_WRITE_NEED_ENCRYPTED =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_WRITE_NEED_ENCRYPTED";
+ public static final String BLE_DESCRIPTOR_READ_NEED_ENCRYPTED =
+ "com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_READ_NEED_ENCRYPTED";
+ public static final String BLE_DESCRIPTOR_WRITE_NEED_ENCRYPTED =
+ "com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_WRITE_NEED_ENCRYPTED";
+ public static final String BLE_CLIENT_ERROR =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ERROR";
public static final String EXTRA_COMMAND =
"com.android.cts.verifier.bluetooth.EXTRA_COMMAND";
@@ -90,6 +141,56 @@
"com.android.cts.verifier.bluetooth.EXTRA_WRITE_VALUE";
public static final String EXTRA_BOOL =
"com.android.cts.verifier.bluetooth.EXTRA_BOOL";
+
+
+ // Literal for Client Action
+ public static final String BLE_CLIENT_ACTION_CLIENT_CONNECT =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_CLIENT_CONNECT";
+ public static final String BLE_CLIENT_ACTION_CLIENT_CONNECT_SECURE =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_CLIENT_CONNECT_SECURE";
+ public static final String BLE_CLIENT_ACTION_BLE_DISVOCER_SERVICE =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_BLE_DISVOCER_SERVICE";
+ public static final String BLE_CLIENT_ACTION_REQUEST_MTU_23 =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_REQUEST_MTU_23";
+ public static final String BLE_CLIENT_ACTION_REQUEST_MTU_512 =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_REQUEST_MTU_512";
+ public static final String BLE_CLIENT_ACTION_READ_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_READ_CHARACTERISTIC";
+ public static final String BLE_CLIENT_ACTION_WRITE_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_WRITE_CHARACTERISTIC";
+ public static final String BLE_CLIENT_ACTION_RELIABLE_WRITE =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_RELIABLE_WRITE";
+ public static final String BLE_CLIENT_ACTION_RELIABLE_WRITE_BAD_RESP =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_RELIABLE_WRITE_BAD_RESP";
+ public static final String BLE_CLIENT_ACTION_NOTIFY_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_NOTIFY_CHARACTERISTIC";
+ public static final String BLE_CLIENT_ACTION_INDICATE_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_INDICATE_CHARACTERISTIC";
+ public static final String BLE_CLIENT_ACTION_READ_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_READ_DESCRIPTOR";
+ public static final String BLE_CLIENT_ACTION_WRITE_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_WRITE_DESCRIPTOR";
+ public static final String BLE_CLIENT_ACTION_READ_RSSI =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_READ_RSSI";
+ public static final String BLE_CLIENT_ACTION_CLIENT_DISCONNECT =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_CLIENT_DISCONNECT";
+ public static final String BLE_CLIENT_ACTION_READ_CHARACTERISTIC_NO_PERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_READ_CHARACTERISTIC_NO_PERMISSION";
+ public static final String BLE_CLIENT_ACTION_WRITE_CHARACTERISTIC_NO_PERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_WRITE_CHARACTERISTIC_NO_PERMISSION";
+ public static final String BLE_CLIENT_ACTION_READ_DESCRIPTOR_NO_PERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_READ_DESCRIPTOR_NO_PERMISSION";
+ public static final String BLE_CLIENT_ACTION_WRITE_DESCRIPTOR_NO_PERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_WRITE_DESCRIPTOR_NO_PERMISSION";
+ public static final String BLE_CLIENT_ACTION_READ_AUTHENTICATED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_READ_AUTHENTICATED_CHARACTERISTIC";
+ public static final String BLE_CLIENT_ACTION_WRITE_AUTHENTICATED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_WRITE_AUTHENTICATED_CHARACTERISTIC";
+ public static final String BLE_CLIENT_ACTION_READ_AUTHENTICATED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_READ_AUTHENTICATED_DESCRIPTOR";
+ public static final String BLE_CLIENT_ACTION_WRITE_AUTHENTICATED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.BLE_CLIENT_ACTION_WRITE_AUTHENTICATED_DESCRIPTOR";
+
public static final String EXTRA_CHARACTERISTIC_VALUE =
"com.android.cts.verifier.bluetooth.EXTRA_CHARACTERISTIC_VALUE";
public static final String EXTRA_DESCRIPTOR_VALUE =
@@ -99,16 +200,87 @@
public static final String EXTRA_ERROR_MESSAGE =
"com.android.cts.verifier.bluetooth.EXTRA_ERROR_MESSAGE";
+ public static final String WRITE_VALUE_512BYTES_FOR_MTU = createTestData(512);
+ public static final String WRITE_VALUE_507BYTES_FOR_RELIABLE_WRITE = createTestData(507);
+
private static final UUID SERVICE_UUID =
UUID.fromString("00009999-0000-1000-8000-00805f9b34fb");
private static final UUID CHARACTERISTIC_UUID =
UUID.fromString("00009998-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_RESULT_UUID =
+ UUID.fromString("00009974-0000-1000-8000-00805f9b34fb");
private static final UUID UPDATE_CHARACTERISTIC_UUID =
UUID.fromString("00009997-0000-1000-8000-00805f9b34fb");
private static final UUID DESCRIPTOR_UUID =
UUID.fromString("00009996-0000-1000-8000-00805f9b34fb");
- private static final String WRITE_VALUE = "TEST";
+ private static final UUID SERVICE_UUID_ADDITIONAL =
+ UUID.fromString("00009995-0000-1000-8000-00805f9b34fb");
+
+ // Literal for registration permission of Characteristic
+ private static final UUID CHARACTERISTIC_NO_READ_UUID =
+ UUID.fromString("00009984-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_NO_WRITE_UUID =
+ UUID.fromString("00009983-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_NEED_ENCRYPTED_READ_UUID =
+ UUID.fromString("00009982-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_NEED_ENCRYPTED_WRITE_UUID =
+ UUID.fromString("00009981-0000-1000-8000-00805f9b34fb");
+
+ // Literal for registration permission of Descriptor
+ private static final UUID DESCRIPTOR_NO_READ_UUID =
+ UUID.fromString("00009973-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_NO_WRITE_UUID =
+ UUID.fromString("00009972-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_NEED_ENCRYPTED_READ_UUID =
+ UUID.fromString("00009969-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_NEED_ENCRYPTED_WRITE_UUID =
+ UUID.fromString("00009968-0000-1000-8000-00805f9b34fb");
+
+ // Literal for registration upper limit confirmation of Characteristic
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_1 =
+ UUID.fromString("00009989-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_2 =
+ UUID.fromString("00009988-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_3 =
+ UUID.fromString("00009987-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_4 =
+ UUID.fromString("00009986-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_5 =
+ UUID.fromString("00009985-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_6 =
+ UUID.fromString("00009979-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_7 =
+ UUID.fromString("00009978-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_8 =
+ UUID.fromString("00009977-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_9 =
+ UUID.fromString("00009976-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_10 =
+ UUID.fromString("00009975-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_11 =
+ UUID.fromString("00009959-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_12 =
+ UUID.fromString("00009958-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_13 =
+ UUID.fromString("00009957-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_14 =
+ UUID.fromString("00009956-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_15 =
+ UUID.fromString("00009955-0000-1000-8000-00805f9b34fb");
+
+ private static final UUID UPDATE_DESCRIPTOR_UUID =
+ UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
+
+ private static final UUID INDICATE_CHARACTERISTIC_UUID =
+ UUID.fromString("00009971-0000-1000-8000-00805f9b34fb");
+
+ public static final String WRITE_VALUE = "CLIENT_TEST";
+ private static final String NOTIFY_VALUE = "NOTIFY_TEST";
+ public static final String WRITE_VALUE_BAD_RESP = "BAD_RESP_TEST";
+
+ // current test category
+ private String mCurrentAction;
private BluetoothManager mBluetoothManager;
private BluetoothAdapter mBluetoothAdapter;
@@ -117,24 +289,181 @@
private BluetoothLeScanner mScanner;
private Handler mHandler;
private Context mContext;
+ private boolean mSecure;
+ private int mNotifyCount;
+ private boolean mValidityService;
+ private ReliableWriteState mExecReliableWrite;
+ private byte[] mBuffer;
+
+ // Handler for communicating task with peer.
+ private TestTaskQueue mTaskQueue;
+
+ private enum ReliableWriteState {
+ RELIABLE_WRITE_NONE,
+ RELIABLE_WRITE_WRITE_1ST_DATA,
+ RELIABLE_WRITE_WRITE_2ND_DATA,
+ RELIABLE_WRITE_EXECUTE,
+ RELIABLE_WRITE_BAD_RESP
+ }
@Override
public void onCreate() {
super.onCreate();
+ registerReceiver(mBondStatusReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
+
mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
mBluetoothAdapter = mBluetoothManager.getAdapter();
mScanner = mBluetoothAdapter.getBluetoothLeScanner();
mHandler = new Handler();
mContext = this;
- startScan();
+ mNotifyCount = 0;
+
+ mTaskQueue = new TestTaskQueue(getClass().getName() + "_taskHandlerThread");
}
@Override
- public int onStartCommand(Intent intent, int flags, int startId) {
+ public int onStartCommand(final Intent intent, int flags, int startId) {
+ if (!mBluetoothAdapter.isEnabled()) {
+ notifyBluetoothDisabled();
+ } else {
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ onTestFinish(intent.getAction());
+ }
+ }, 1500);
+ }
return START_NOT_STICKY;
}
+ private void onTestFinish(String action) {
+ mCurrentAction = action;
+ if (mCurrentAction != null) {
+ switch (mCurrentAction) {
+ case BLE_CLIENT_ACTION_CLIENT_CONNECT_SECURE:
+ mSecure = true;
+ mExecReliableWrite = ReliableWriteState.RELIABLE_WRITE_NONE;
+ startScan();
+ break;
+ case BLE_CLIENT_ACTION_CLIENT_CONNECT:
+ mExecReliableWrite = ReliableWriteState.RELIABLE_WRITE_NONE;
+ startScan();
+ break;
+ case BLE_CLIENT_ACTION_BLE_DISVOCER_SERVICE:
+ if (mBluetoothGatt != null && mBleState == BluetoothProfile.STATE_CONNECTED) {
+ mBluetoothGatt.discoverServices();
+ } else {
+ showMessage("Bluetooth LE not cnnected.");
+ }
+ break;
+ case BLE_CLIENT_ACTION_REQUEST_MTU_23:
+ case BLE_CLIENT_ACTION_REQUEST_MTU_512: // fall through
+ requestMtu();
+ break;
+ case BLE_CLIENT_ACTION_READ_CHARACTERISTIC:
+ readCharacteristic(CHARACTERISTIC_UUID);
+ break;
+ case BLE_CLIENT_ACTION_WRITE_CHARACTERISTIC:
+ writeCharacteristic(CHARACTERISTIC_UUID, WRITE_VALUE);
+ break;
+ case BLE_CLIENT_ACTION_RELIABLE_WRITE:
+ case BLE_CLIENT_ACTION_RELIABLE_WRITE_BAD_RESP: // fall through
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ reliableWrite();
+ }
+ });
+ break;
+ case BLE_CLIENT_ACTION_INDICATE_CHARACTERISTIC:
+ setNotification(INDICATE_CHARACTERISTIC_UUID, true);
+ break;
+ case BLE_CLIENT_ACTION_NOTIFY_CHARACTERISTIC:
+ // Registered the notify to characteristics in the service
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ mNotifyCount = 16;
+ setNotification(UPDATE_CHARACTERISTIC_UUID, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_1, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_2, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_3, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_4, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_5, true);
+ sleep(1000);
+ setNotification(UPDATE_CHARACTERISTIC_UUID_6, true);
+ sleep(1000);
+ setNotification(UPDATE_CHARACTERISTIC_UUID_7, true);
+ sleep(1000);
+ setNotification(UPDATE_CHARACTERISTIC_UUID_8, true);
+ sleep(1000);
+ setNotification(UPDATE_CHARACTERISTIC_UUID_9, true);
+ sleep(1000);
+ setNotification(UPDATE_CHARACTERISTIC_UUID_10, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_11, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_12, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_13, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_14, true);
+ sleep(1000);
+ setNotification(SERVICE_UUID_ADDITIONAL, UPDATE_CHARACTERISTIC_UUID_15, true);
+ sleep(1000);
+ }
+ });
+ break;
+ case BLE_CLIENT_ACTION_READ_DESCRIPTOR:
+ readDescriptor(DESCRIPTOR_UUID);
+ break;
+ case BLE_CLIENT_ACTION_WRITE_DESCRIPTOR:
+ writeDescriptor(DESCRIPTOR_UUID, WRITE_VALUE);
+ break;
+ case BLE_CLIENT_ACTION_READ_RSSI:
+ if (mBluetoothGatt != null) {
+ mBluetoothGatt.readRemoteRssi();
+ }
+ break;
+ case BLE_CLIENT_ACTION_CLIENT_DISCONNECT:
+ if (mBluetoothGatt != null) {
+ mBluetoothGatt.disconnect();
+ }
+ break;
+ case BLE_CLIENT_ACTION_READ_CHARACTERISTIC_NO_PERMISSION:
+ readCharacteristic(CHARACTERISTIC_NO_READ_UUID);
+ break;
+ case BLE_CLIENT_ACTION_WRITE_CHARACTERISTIC_NO_PERMISSION:
+ writeCharacteristic(CHARACTERISTIC_NO_WRITE_UUID, WRITE_VALUE);
+ break;
+ case BLE_CLIENT_ACTION_READ_DESCRIPTOR_NO_PERMISSION:
+ readDescriptor(DESCRIPTOR_NO_READ_UUID);
+ break;
+ case BLE_CLIENT_ACTION_WRITE_DESCRIPTOR_NO_PERMISSION:
+ writeDescriptor(DESCRIPTOR_NO_WRITE_UUID, WRITE_VALUE);
+ break;
+ case BLE_CLIENT_ACTION_READ_AUTHENTICATED_CHARACTERISTIC:
+ readCharacteristic(CHARACTERISTIC_NEED_ENCRYPTED_READ_UUID);
+ break;
+ case BLE_CLIENT_ACTION_WRITE_AUTHENTICATED_CHARACTERISTIC:
+ writeCharacteristic(CHARACTERISTIC_NEED_ENCRYPTED_WRITE_UUID, WRITE_VALUE);
+ break;
+ case BLE_CLIENT_ACTION_READ_AUTHENTICATED_DESCRIPTOR:
+ readDescriptor(CHARACTERISTIC_RESULT_UUID, DESCRIPTOR_NEED_ENCRYPTED_READ_UUID);
+ break;
+ case BLE_CLIENT_ACTION_WRITE_AUTHENTICATED_DESCRIPTOR:
+ writeDescriptor(CHARACTERISTIC_RESULT_UUID, DESCRIPTOR_NEED_ENCRYPTED_WRITE_UUID, WRITE_VALUE);
+ break;
+ }
+ }
+ }
+
@Override
public IBinder onBind(Intent intent) {
return null;
@@ -143,54 +472,183 @@
@Override
public void onDestroy() {
super.onDestroy();
- mBluetoothGatt.disconnect();
- mBluetoothGatt.close();
- mBluetoothGatt = null;
+ if (mBluetoothGatt != null) {
+ mBluetoothGatt.disconnect();
+ mBluetoothGatt.close();
+ mBluetoothGatt = null;
+ }
stopScan();
+ unregisterReceiver(mBondStatusReceiver);
+
+ mTaskQueue.quit();
}
- private void writeCharacteristic(String writeValue) {
- BluetoothGattCharacteristic characteristic = getCharacteristic(CHARACTERISTIC_UUID);
- if (characteristic == null) return;
- characteristic.setValue(writeValue);
- mBluetoothGatt.writeCharacteristic(characteristic);
+ public static BluetoothGatt connectGatt(BluetoothDevice device, Context context, boolean autoConnect, boolean isSecure, BluetoothGattCallback callback) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ if (isSecure) {
+ if (TRANSPORT_MODE_FOR_SECURE_CONNECTION == BluetoothDevice.TRANSPORT_AUTO) {
+ Toast.makeText(context, "connectGatt(transport=AUTO)", Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(context, "connectGatt(transport=LE)", Toast.LENGTH_SHORT).show();
+ }
+ return device.connectGatt(context, autoConnect, callback, TRANSPORT_MODE_FOR_SECURE_CONNECTION);
+ } else {
+ Toast.makeText(context, "connectGatt(transport=LE)", Toast.LENGTH_SHORT).show();
+ return device.connectGatt(context, autoConnect, callback, BluetoothDevice.TRANSPORT_LE);
+ }
+ } else {
+ Toast.makeText(context, "connectGatt", Toast.LENGTH_SHORT).show();
+ return device.connectGatt(context, autoConnect, callback);
+ }
}
- private void readCharacteristic() {
- BluetoothGattCharacteristic characteristic = getCharacteristic(CHARACTERISTIC_UUID);
- if (characteristic != null) mBluetoothGatt.readCharacteristic(characteristic);
+ private void requestMtu() {
+ if (mBluetoothGatt != null) {
+ // MTU request test does not work on Android 6.0 in secure mode.
+ // (BluetoothDevice#createBond() does not work on Android 6.0.
+ // So devices can't establish Bluetooth LE pairing.)
+ boolean mtuTestExecutable = true;
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
+ mtuTestExecutable = !mSecure;
+ }
+
+ if (mtuTestExecutable) {
+ int mtu = 0;
+ if (BLE_CLIENT_ACTION_REQUEST_MTU_23.equals(mCurrentAction)) {
+ mtu = 23;
+ } else if (BLE_CLIENT_ACTION_REQUEST_MTU_512.equals(mCurrentAction)) {
+ mtu = 512;
+ } else {
+ throw new IllegalStateException("unexpected action: " + mCurrentAction);
+ }
+ mBluetoothGatt.requestMtu(mtu);
+ } else {
+ showMessage("Skip MTU test.");
+ notifyMtuChanged();
+ }
+ }
}
- private void writeDescriptor(String writeValue) {
- BluetoothGattDescriptor descriptor = getDescriptor();
- if (descriptor == null) return;
- descriptor.setValue(writeValue.getBytes());
- mBluetoothGatt.writeDescriptor(descriptor);
+ private void writeCharacteristic(BluetoothGattCharacteristic characteristic, String writeValue) {
+ if (characteristic != null) {
+ characteristic.setValue(writeValue);
+ mBluetoothGatt.writeCharacteristic(characteristic);
+ }
}
- private void readDescriptor() {
- BluetoothGattDescriptor descriptor = getDescriptor();
- if (descriptor != null) mBluetoothGatt.readDescriptor(descriptor);
+ private void writeCharacteristic(UUID uid, String writeValue) {
+ BluetoothGattCharacteristic characteristic = getCharacteristic(uid);
+ if (characteristic != null){
+ writeCharacteristic(characteristic, writeValue);
+ }
+ }
+
+ private void readCharacteristic(UUID uuid) {
+ BluetoothGattCharacteristic characteristic = getCharacteristic(uuid);
+ if (characteristic != null) {
+ mBluetoothGatt.readCharacteristic(characteristic);
+ }
+ }
+
+ private void writeDescriptor(UUID uid, String writeValue) {
+ BluetoothGattDescriptor descriptor = getDescriptor(uid);
+ if (descriptor != null) {
+ descriptor.setValue(writeValue.getBytes());
+ mBluetoothGatt.writeDescriptor(descriptor);
+ }
+ }
+
+ private void readDescriptor(UUID uuid) {
+ BluetoothGattDescriptor descriptor = getDescriptor(uuid);
+ if (descriptor != null) {
+ mBluetoothGatt.readDescriptor(descriptor);
+ }
+ }
+
+ private void writeDescriptor(UUID cuid, UUID duid, String writeValue) {
+ BluetoothGattDescriptor descriptor = getDescriptor(cuid, duid);
+ if (descriptor != null) {
+ descriptor.setValue(writeValue.getBytes());
+ mBluetoothGatt.writeDescriptor(descriptor);
+ }
+ }
+
+ private void readDescriptor(UUID cuid, UUID duid) {
+ BluetoothGattDescriptor descriptor = getDescriptor(cuid, duid);
+ if (descriptor != null) {
+ mBluetoothGatt.readDescriptor(descriptor);
+ }
+ }
+
+ private void setNotification(BluetoothGattCharacteristic characteristic, boolean enable) {
+ if (characteristic != null) {
+ mBluetoothGatt.setCharacteristicNotification(characteristic, enable);
+ BluetoothGattDescriptor descriptor = characteristic.getDescriptor(UPDATE_DESCRIPTOR_UUID);
+ if (enable) {
+ if (characteristic.getUuid().equals(INDICATE_CHARACTERISTIC_UUID)) {
+ descriptor.setValue(BluetoothGattDescriptor.ENABLE_INDICATION_VALUE);
+ } else {
+ descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
+ }
+ } else {
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ }
+ mBluetoothGatt.writeDescriptor(descriptor);
+ }
}
private void setNotification(boolean enable) {
BluetoothGattCharacteristic characteristic = getCharacteristic(UPDATE_CHARACTERISTIC_UUID);
- if (characteristic != null)
- mBluetoothGatt.setCharacteristicNotification(characteristic, enable);
+ if (characteristic != null) {
+ setNotification(characteristic, enable);
+ }
+ }
+
+ private void setNotification(UUID serviceUid, UUID characteristicUid, boolean enable) {
+ BluetoothGattCharacteristic characteristic = getCharacteristic(serviceUid, characteristicUid);
+ if (characteristic != null) {
+ setNotification(characteristic, enable);
+ }
+ }
+
+ private void setNotification(UUID uid, boolean enable) {
+ BluetoothGattCharacteristic characteristic = getCharacteristic(uid);
+ if (characteristic != null) {
+ setNotification(characteristic, enable);
+ }
}
private void notifyError(String message) {
showMessage(message);
+ Log.i(TAG, message);
+
+ Intent intent = new Intent(BLE_CLIENT_ERROR);
+ sendBroadcast(intent);
+ }
+
+ private void notifyMismatchSecure() {
+ Intent intent = new Intent(BLE_BLUETOOTH_MISMATCH_SECURE);
+ sendBroadcast(intent);
+ }
+
+ private void notifyMismatchInsecure() {
+ Intent intent = new Intent(BLE_BLUETOOTH_MISMATCH_INSECURE);
+ sendBroadcast(intent);
+ }
+
+ private void notifyBluetoothDisabled() {
+ Intent intent = new Intent(BLE_BLUETOOTH_DISABLED);
+ sendBroadcast(intent);
}
private void notifyConnected() {
- showMessage("BLE connected");
+ showMessage("Bluetooth LE connected");
Intent intent = new Intent(BLE_BLUETOOTH_CONNECTED);
sendBroadcast(intent);
}
private void notifyDisconnected() {
- showMessage("BLE disconnected");
+ showMessage("Bluetooth LE disconnected");
Intent intent = new Intent(BLE_BLUETOOTH_DISCONNECTED);
sendBroadcast(intent);
}
@@ -201,6 +659,18 @@
sendBroadcast(intent);
}
+ private void notifyMtuChanged() {
+ Intent intent;
+ if (BLE_CLIENT_ACTION_REQUEST_MTU_23.equals(mCurrentAction)) {
+ intent = new Intent(BLE_MTU_CHANGED_23BYTES);
+ } else if (BLE_CLIENT_ACTION_REQUEST_MTU_512.equals(mCurrentAction)) {
+ intent = new Intent(BLE_MTU_CHANGED_512BYTES);
+ } else {
+ throw new IllegalStateException("unexpected action: " + mCurrentAction);
+ }
+ sendBroadcast(intent);
+ }
+
private void notifyCharacteristicRead(String value) {
showMessage("Characteristic read: " + value);
Intent intent = new Intent(BLE_CHARACTERISTIC_READ);
@@ -214,10 +684,39 @@
sendBroadcast(intent);
}
- private void notifyCharacteristicChanged(String value) {
- showMessage("Characteristic changed: " + value);
+ private void notifyCharacteristicReadNoPermission() {
+ showMessage("Characteristic not read: No Permission");
+ Intent intent = new Intent(BLE_CHARACTERISTIC_READ_NOPERMISSION);
+ sendBroadcast(intent);
+ }
+
+ private void notifyCharacteristicWriteNoPermission(String value) {
+ showMessage("Characteristic write: No Permission");
+ Intent intent = new Intent(BLE_CHARACTERISTIC_WRITE_NOPERMISSION);
+ sendBroadcast(intent);
+ }
+
+ private void notifyCharacteristicReadNeedEncrypted(String value) {
+ showMessage("Characteristic read with encrypted: " + value);
+ Intent intent = new Intent(BLE_CHARACTERISTIC_READ_NEED_ENCRYPTED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyCharacteristicWriteNeedEncrypted(String value) {
+ showMessage("Characteristic write with encrypted: " + value);
+ Intent intent = new Intent(BLE_CHARACTERISTIC_WRITE_NEED_ENCRYPTED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyCharacteristicChanged() {
+ showMessage("Characteristic changed");
Intent intent = new Intent(BLE_CHARACTERISTIC_CHANGED);
- intent.putExtra(EXTRA_CHARACTERISTIC_VALUE, value);
+ sendBroadcast(intent);
+ }
+
+ private void notifyCharacteristicIndicated() {
+ showMessage("Characteristic Indicated");
+ Intent intent = new Intent(BLE_CHARACTERISTIC_INDICATED);
sendBroadcast(intent);
}
@@ -234,12 +733,45 @@
sendBroadcast(intent);
}
+ private void notifyDescriptorReadNoPermission() {
+ showMessage("Descriptor read: No Permission");
+ Intent intent = new Intent(BLE_DESCRIPTOR_READ_NOPERMISSION);
+ sendBroadcast(intent);
+ }
+
+ private void notifyDescriptorWriteNoPermission() {
+ showMessage("Descriptor write: NoPermission");
+ Intent intent = new Intent(BLE_DESCRIPTOR_WRITE_NOPERMISSION);
+ sendBroadcast(intent);
+ }
+
+ private void notifyDescriptorReadNeedEncrypted(String value) {
+ showMessage("Descriptor read with encrypted: " + value);
+ Intent intent = new Intent(BLE_DESCRIPTOR_READ_NEED_ENCRYPTED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyDescriptorWriteNeedEncrypted(String value) {
+ showMessage("Descriptor write with encrypted: " + value);
+ Intent intent = new Intent(BLE_DESCRIPTOR_WRITE_NEED_ENCRYPTED);
+ sendBroadcast(intent);
+ }
+
private void notifyReliableWriteCompleted() {
showMessage("Reliable write compelte");
Intent intent = new Intent(BLE_RELIABLE_WRITE_COMPLETED);
sendBroadcast(intent);
}
+ private void notifyReliableWriteBadRespCompleted(String err) {
+ showMessage("Reliable write(bad response) compelte");
+ Intent intent = new Intent(BLE_RELIABLE_WRITE_BAD_RESP_COMPLETED);
+ if (err != null) {
+ intent.putExtra(EXTRA_ERROR_MESSAGE, err);
+ }
+ sendBroadcast(intent);
+ }
+
private void notifyReadRemoteRssi(int rssi) {
showMessage("Remote rssi read: " + rssi);
Intent intent = new Intent(BLE_READ_REMOTE_RSSI);
@@ -247,37 +779,77 @@
sendBroadcast(intent);
}
- private BluetoothGattService getService() {
- if (mBluetoothGatt == null) return null;
+ private BluetoothGattService getService(UUID serverUid) {
+ BluetoothGattService service = null;
- BluetoothGattService service = mBluetoothGatt.getService(SERVICE_UUID);
- if (service == null) {
- showMessage("Service not found");
- return null;
+ if (mBluetoothGatt != null) {
+ service = mBluetoothGatt.getService(serverUid);
+ if (service == null) {
+ showMessage("Service not found");
+ }
}
return service;
}
- private BluetoothGattCharacteristic getCharacteristic(UUID uuid) {
- BluetoothGattService service = getService();
- if (service == null) return null;
+ private BluetoothGattService getService() {
+ BluetoothGattService service = null;
- BluetoothGattCharacteristic characteristic = service.getCharacteristic(uuid);
- if (characteristic == null) {
- showMessage("Characteristic not found");
- return null;
+ if (mBluetoothGatt != null) {
+ service = mBluetoothGatt.getService(SERVICE_UUID);
+ if (service == null) {
+ showMessage("Service not found");
+ }
+ }
+ return service;
+ }
+
+ private BluetoothGattCharacteristic getCharacteristic(UUID serverUid, UUID characteristicUid) {
+ BluetoothGattCharacteristic characteristic = null;
+
+ BluetoothGattService service = getService(serverUid);
+ if (service != null) {
+ characteristic = service.getCharacteristic(characteristicUid);
+ if (characteristic == null) {
+ showMessage("Characteristic not found");
+ }
+ }
+ return characteristic;
+ }
+ private BluetoothGattCharacteristic getCharacteristic(UUID uuid) {
+ BluetoothGattCharacteristic characteristic = null;
+
+ BluetoothGattService service = getService();
+ if (service != null) {
+ characteristic = service.getCharacteristic(uuid);
+ if (characteristic == null) {
+ showMessage("Characteristic not found");
+ }
}
return characteristic;
}
- private BluetoothGattDescriptor getDescriptor() {
- BluetoothGattCharacteristic characteristic = getCharacteristic(CHARACTERISTIC_UUID);
- if (characteristic == null) return null;
+ private BluetoothGattDescriptor getDescriptor(UUID uid) {
+ BluetoothGattDescriptor descriptor = null;
- BluetoothGattDescriptor descriptor = characteristic.getDescriptor(DESCRIPTOR_UUID);
- if (descriptor == null) {
- showMessage("Descriptor not found");
- return null;
+ BluetoothGattCharacteristic characteristic = getCharacteristic(CHARACTERISTIC_UUID);
+ if (characteristic != null) {
+ descriptor = characteristic.getDescriptor(uid);
+ if (descriptor == null) {
+ showMessage("Descriptor not found");
+ }
+ }
+ return descriptor;
+ }
+
+ private BluetoothGattDescriptor getDescriptor(UUID cuid, UUID duid) {
+ BluetoothGattDescriptor descriptor = null;
+
+ BluetoothGattCharacteristic characteristic = getCharacteristic(cuid);
+ if (characteristic != null) {
+ descriptor = characteristic.getDescriptor(duid);
+ if (descriptor == null) {
+ showMessage("Descriptor not found");
+ }
}
return descriptor;
}
@@ -299,141 +871,340 @@
}
private void reliableWrite() {
+ // aborting test
mBluetoothGatt.beginReliableWrite();
sleep(1000);
- writeCharacteristic(WRITE_VALUE);
- sleep(1000);
- if (!mBluetoothGatt.executeReliableWrite()) {
- Log.w(TAG, "reliable write failed");
- }
- sleep(1000);
mBluetoothGatt.abortReliableWrite();
+
+ // writing test
+ sleep(2000);
+ mBluetoothGatt.beginReliableWrite();
+ sleep(1000);
+
+ if (BLE_CLIENT_ACTION_RELIABLE_WRITE.equals(mCurrentAction)) {
+ mExecReliableWrite = ReliableWriteState.RELIABLE_WRITE_WRITE_1ST_DATA;
+ writeCharacteristic(CHARACTERISTIC_UUID, WRITE_VALUE_507BYTES_FOR_RELIABLE_WRITE);
+ } else {
+ mExecReliableWrite = ReliableWriteState.RELIABLE_WRITE_BAD_RESP;
+ writeCharacteristic(CHARACTERISTIC_UUID, WRITE_VALUE_BAD_RESP);
+ }
}
+ private int mBleState = BluetoothProfile.STATE_DISCONNECTED;
private final BluetoothGattCallback mGattCallbacks = new BluetoothGattCallback() {
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
- if (DEBUG) Log.d(TAG, "onConnectionStateChange");
+ if (DEBUG) Log.d(TAG, "onConnectionStateChange: status= " + status + ", newState= " + newState);
if (status == BluetoothGatt.GATT_SUCCESS) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
- notifyConnected();
- stopScan();
- sleep(1000);
- mBluetoothGatt.discoverServices();
+ mBleState = newState;
+ int bond = gatt.getDevice().getBondState();
+ boolean bonded = false;
+ BluetoothDevice target = gatt.getDevice();
+ Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
+ if (pairedDevices.size() > 0) {
+ for (BluetoothDevice device : pairedDevices) {
+ if (device.getAddress().equals(target.getAddress())) {
+ bonded = true;
+ break;
+ }
+ }
+ }
+ if (mSecure && ((bond == BluetoothDevice.BOND_NONE) || !bonded)) {
+ // not pairing and execute Secure Test
+ mBluetoothGatt.disconnect();
+ notifyMismatchSecure();
+ } else if (!mSecure && ((bond != BluetoothDevice.BOND_NONE) || bonded)) {
+ // already pairing nad execute Insecure Test
+ mBluetoothGatt.disconnect();
+ notifyMismatchInsecure();
+ } else {
+ notifyConnected();
+ }
} else if (status == BluetoothProfile.STATE_DISCONNECTED) {
+ mBleState = newState;
+ mSecure = false;
+ mBluetoothGatt.close();
notifyDisconnected();
}
} else {
- showMessage("Failed to connect");
+ showMessage("Failed to connect: " + status + " , newState = " + newState);
+ mBluetoothGatt.close();
+ mBluetoothGatt = null;
}
}
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
- if (DEBUG) Log.d(TAG, "onServiceDiscovered");
- if ((status == BluetoothGatt.GATT_SUCCESS) &&
- (mBluetoothGatt.getService(SERVICE_UUID) != null)) {
+ if (DEBUG){
+ Log.d(TAG, "onServiceDiscovered");
+ }
+ if ((status == BluetoothGatt.GATT_SUCCESS) && (mBluetoothGatt.getService(SERVICE_UUID) != null)) {
notifyServicesDiscovered();
- sleep(1000);
- writeCharacteristic(WRITE_VALUE);
}
}
@Override
- public void onCharacteristicWrite(BluetoothGatt gatt,
- BluetoothGattCharacteristic characteristic, int status) {
+ public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {
+ super.onMtuChanged(gatt, mtu, status);
+ if (DEBUG){
+ Log.d(TAG, "onMtuChanged");
+ }
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ // verify MTU size
+ int requestedMtu;
+ if (BLE_CLIENT_ACTION_REQUEST_MTU_23.equals(mCurrentAction)) {
+ requestedMtu = 23;
+ } else if (BLE_CLIENT_ACTION_REQUEST_MTU_512.equals(mCurrentAction)) {
+ requestedMtu = 512;
+ } else {
+ throw new IllegalStateException("unexpected action: " + mCurrentAction);
+ }
+ if (mtu != requestedMtu) {
+ String msg = String.format(getString(R.string.ble_mtu_mismatch_message),
+ requestedMtu, mtu);
+ showMessage(msg);
+ }
+
+ // test writing characteristic
+ writeCharacteristic(CHARACTERISTIC_UUID, WRITE_VALUE_512BYTES_FOR_MTU);
+ } else {
+ notifyError("Failed to request mtu: " + status);
+ }
+ }
+
+ @Override
+ public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, final int status) {
String value = characteristic.getStringValue(0);
- if (DEBUG) Log.d(TAG, "onCharacteristicWrite: characteristic.val="
- + value + " status=" + status);
- BluetoothGattCharacteristic mCharacteristic = getCharacteristic(CHARACTERISTIC_UUID);
- if ((status == BluetoothGatt.GATT_SUCCESS) &&
- (value.equals(mCharacteristic.getStringValue(0)))) {
- notifyCharacteristicWrite(value);
- sleep(1000);
- readCharacteristic();
+ final UUID uid = characteristic.getUuid();
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicWrite: characteristic.val=" + value + " status=" + status);
+ }
+
+ if (BLE_CLIENT_ACTION_REQUEST_MTU_512.equals(mCurrentAction) ||
+ BLE_CLIENT_ACTION_REQUEST_MTU_23.equals(mCurrentAction)) {
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ notifyMtuChanged();
+ } else {
+ notifyError("Failed to write characteristic: " + status + " : " + uid);
+ }
} else {
- notifyError("Failed to write characteristic: " + value);
+ switch (mExecReliableWrite) {
+ case RELIABLE_WRITE_NONE:
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ if (characteristic.getUuid().equals(CHARACTERISTIC_NEED_ENCRYPTED_WRITE_UUID)) {
+ notifyCharacteristicWriteNeedEncrypted(value);
+ } else if (!characteristic.getUuid().equals(CHARACTERISTIC_RESULT_UUID)) {
+ // verify
+ if (Arrays.equals(BleClientService.WRITE_VALUE.getBytes(), characteristic.getValue())) {
+ notifyCharacteristicWrite(value);
+ } else {
+ notifyError("Written data is not correct");
+ }
+ }
+ } else if (status == BluetoothGatt.GATT_WRITE_NOT_PERMITTED) {
+ if (uid.equals(CHARACTERISTIC_NO_WRITE_UUID)) {
+ writeCharacteristic(getCharacteristic(CHARACTERISTIC_RESULT_UUID), BleServerService.WRITE_NO_PERMISSION);
+ notifyCharacteristicWriteNoPermission(value);
+ } else {
+ notifyError("Not Permission Write: " + status + " : " + uid);
+ }
+ } else if (status == BluetoothGatt.GATT_INSUFFICIENT_AUTHENTICATION) {
+ notifyError("Not Authentication Write: " + status + " : " + uid);
+ } else {
+ notifyError("Failed to write characteristic: " + status + " : " + uid);
+ }
+ break;
+ case RELIABLE_WRITE_WRITE_1ST_DATA:
+ // verify
+ if (WRITE_VALUE_507BYTES_FOR_RELIABLE_WRITE.equals(value)) {
+ // write next data
+ mExecReliableWrite = ReliableWriteState.RELIABLE_WRITE_WRITE_2ND_DATA;
+ writeCharacteristic(CHARACTERISTIC_UUID, WRITE_VALUE_507BYTES_FOR_RELIABLE_WRITE);
+ } else {
+ notifyError("Failed to write characteristic: " + status + " : " + uid);
+ }
+ break;
+ case RELIABLE_WRITE_WRITE_2ND_DATA:
+ // verify
+ if (WRITE_VALUE_507BYTES_FOR_RELIABLE_WRITE.equals(value)) {
+ // execute write
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ mExecReliableWrite = ReliableWriteState.RELIABLE_WRITE_EXECUTE;
+ if (!mBluetoothGatt.executeReliableWrite()) {
+ notifyError("reliable write failed");
+ }
+ }
+ }, 1000);
+ } else {
+ notifyError("Failed to write characteristic: " + status + " : " + uid);
+ }
+ break;
+ case RELIABLE_WRITE_BAD_RESP:
+ mExecReliableWrite = ReliableWriteState.RELIABLE_WRITE_NONE;
+ // verify response
+ // Server sends empty response for this test.
+ // Response must be empty.
+ String err = null;
+ if (!TextUtils.isEmpty(value)) {
+ err = "response is not empty";
+ showMessage(err);
+ }
+ // finish reliable write
+ final String errValue = err;
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ mBluetoothGatt.abortReliableWrite();
+ notifyReliableWriteBadRespCompleted(errValue);
+ }
+ }, 1000);
+ break;
+ }
}
}
@Override
- public void onCharacteristicRead(BluetoothGatt gatt,
- BluetoothGattCharacteristic characteristic, int status) {
- if (DEBUG) Log.d(TAG, "onCharacteristicRead");
- if ((status == BluetoothGatt.GATT_SUCCESS) &&
- (characteristic.getUuid().equals(CHARACTERISTIC_UUID))) {
- notifyCharacteristicRead(characteristic.getStringValue(0));
- sleep(1000);
- writeDescriptor(WRITE_VALUE);
+ public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
+ UUID uid = characteristic.getUuid();
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicRead: status=" + status);
+ }
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ String value = characteristic.getStringValue(0);
+ if (characteristic.getUuid().equals(CHARACTERISTIC_NEED_ENCRYPTED_READ_UUID)) {
+ notifyCharacteristicReadNeedEncrypted(value);
+ } else {
+ // verify
+ if (BleServerService.WRITE_VALUE.equals(value)) {
+ notifyCharacteristicRead(value);
+ } else {
+ notifyError("Read data is not correct");
+ }
+ }
+ } else if (status == BluetoothGatt.GATT_READ_NOT_PERMITTED) {
+ if (uid.equals(CHARACTERISTIC_NO_READ_UUID)) {
+ writeCharacteristic(getCharacteristic(CHARACTERISTIC_RESULT_UUID), BleServerService.READ_NO_PERMISSION);
+ notifyCharacteristicReadNoPermission();
+ } else {
+ notifyError("Not Permission Read: " + status + " : " + uid);
+ }
+ } else if(status == BluetoothGatt.GATT_INSUFFICIENT_AUTHENTICATION) {
+ notifyError("Not Authentication Read: " + status + " : " + uid);
} else {
- notifyError("Failed to read characteristic");
+ notifyError("Failed to read characteristic: " + status + " : " + uid);
}
}
@Override
- public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
- int status) {
- if (DEBUG) Log.d(TAG, "onDescriptorWrite");
- if ((status == BluetoothGatt.GATT_SUCCESS) &&
- (descriptor.getUuid().equals(DESCRIPTOR_UUID))) {
- notifyDescriptorWrite(new String(descriptor.getValue()));
- sleep(1000);
- readDescriptor();
+ public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
+ if (DEBUG) {
+ Log.d(TAG, "onDescriptorWrite");
+ }
+ UUID uid = descriptor.getUuid();
+ if ((status == BluetoothGatt.GATT_SUCCESS)) {
+ if (uid.equals(UPDATE_DESCRIPTOR_UUID)) {
+ Log.d(TAG, "write in update descriptor.");
+ } else if (uid.equals(DESCRIPTOR_UUID)) {
+ // verify
+ if (Arrays.equals(WRITE_VALUE.getBytes(), descriptor.getValue())) {
+ notifyDescriptorWrite(new String(descriptor.getValue()));
+ } else {
+ notifyError("Written data is not correct");
+ }
+ } else if (uid.equals(DESCRIPTOR_NEED_ENCRYPTED_WRITE_UUID)) {
+ notifyDescriptorWriteNeedEncrypted(new String(descriptor.getValue()));
+ }
+ } else if (status == BluetoothGatt.GATT_WRITE_NOT_PERMITTED) {
+ if (uid.equals(DESCRIPTOR_NO_WRITE_UUID)) {
+ writeCharacteristic(getCharacteristic(CHARACTERISTIC_RESULT_UUID), BleServerService.DESCRIPTOR_WRITE_NO_PERMISSION);
+ notifyDescriptorWriteNoPermission();
+ } else {
+ notifyError("Not Permission Write: " + status + " : " + descriptor.getUuid());
+ }
} else {
notifyError("Failed to write descriptor");
}
}
@Override
- public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
- int status) {
- if (DEBUG) Log.d(TAG, "onDescriptorRead");
- if ((status == BluetoothGatt.GATT_SUCCESS) &&
- (descriptor.getUuid() != null) &&
- (descriptor.getUuid().equals(DESCRIPTOR_UUID))) {
- notifyDescriptorRead(new String(descriptor.getValue()));
- sleep(1000);
- setNotification(true);
+ public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
+ if (DEBUG) {
+ Log.d(TAG, "onDescriptorRead");
+ }
+
+ UUID uid = descriptor.getUuid();
+ if ((status == BluetoothGatt.GATT_SUCCESS)) {
+ if ((uid != null) && (uid.equals(DESCRIPTOR_UUID))) {
+ // verify
+ if (Arrays.equals(BleServerService.WRITE_VALUE.getBytes(), descriptor.getValue())) {
+ notifyDescriptorRead(new String(descriptor.getValue()));
+ } else {
+ notifyError("Read data is not correct");
+ }
+ } else if (uid.equals(DESCRIPTOR_NEED_ENCRYPTED_READ_UUID)) {
+ notifyDescriptorReadNeedEncrypted(new String(descriptor.getValue()));
+ }
+ } else if (status == BluetoothGatt.GATT_READ_NOT_PERMITTED) {
+ if (uid.equals(DESCRIPTOR_NO_READ_UUID)) {
+ writeCharacteristic(getCharacteristic(CHARACTERISTIC_RESULT_UUID), BleServerService.DESCRIPTOR_READ_NO_PERMISSION);
+ notifyDescriptorReadNoPermission();
+ } else {
+ notifyError("Not Permission Read: " + status + " : " + descriptor.getUuid());
+ }
} else {
- notifyError("Failed to read descriptor");
+ notifyError("Failed to read descriptor: " + status);
}
}
@Override
- public void onCharacteristicChanged(BluetoothGatt gatt,
- BluetoothGattCharacteristic characteristic) {
- if (DEBUG) Log.d(TAG, "onCharacteristicChanged");
- if ((characteristic.getUuid() != null) &&
- (characteristic.getUuid().equals(UPDATE_CHARACTERISTIC_UUID))) {
- notifyCharacteristicChanged(characteristic.getStringValue(0));
- setNotification(false);
- sleep(1000);
- mBluetoothGatt.readRemoteRssi();
+ public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
+ UUID uid = characteristic.getUuid();
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicChanged: " + uid);
+ }
+ if (uid != null) {
+ if (uid.equals(INDICATE_CHARACTERISTIC_UUID)) {
+ setNotification(characteristic, false);
+ notifyCharacteristicIndicated();
+ } else {
+ mNotifyCount--;
+ setNotification(characteristic, false);
+ if (mNotifyCount == 0) {
+ notifyCharacteristicChanged();
+ }
+ }
}
}
@Override
public void onReliableWriteCompleted(BluetoothGatt gatt, int status) {
- if (DEBUG) Log.d(TAG, "onReliableWriteComplete: " + status);
- if (status == BluetoothGatt.GATT_SUCCESS) {
- notifyReliableWriteCompleted();
- } else {
- notifyError("Failed to complete reliable write: " + status);
+ if (DEBUG) {
+ Log.d(TAG, "onReliableWriteComplete: " + status);
}
- sleep(1000);
- mBluetoothGatt.disconnect();
+
+ if (mExecReliableWrite != ReliableWriteState.RELIABLE_WRITE_NONE) {
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ notifyReliableWriteCompleted();
+ } else {
+ notifyError("Failed to complete reliable write: " + status);
+ }
+ mExecReliableWrite = ReliableWriteState.RELIABLE_WRITE_NONE;
+ }
}
@Override
public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
- if (DEBUG) Log.d(TAG, "onReadRemoteRssi");
+ if (DEBUG) {
+ Log.d(TAG, "onReadRemoteRssi");
+ }
if (status == BluetoothGatt.GATT_SUCCESS) {
notifyReadRemoteRssi(rssi);
} else {
notifyError("Failed to read remote rssi");
}
- sleep(1000);
- reliableWrite();
}
};
@@ -441,7 +1212,33 @@
@Override
public void onScanResult(int callbackType, ScanResult result) {
if (mBluetoothGatt == null) {
- mBluetoothGatt = result.getDevice().connectGatt(mContext, false, mGattCallbacks);
+ // verify the validity of the advertisement packet.
+ mValidityService = false;
+ List<ParcelUuid> uuids = result.getScanRecord().getServiceUuids();
+ for (ParcelUuid uuid : uuids) {
+ if (uuid.getUuid().equals(BleServerService.ADV_SERVICE_UUID)) {
+ mValidityService = true;
+ break;
+ }
+ }
+ if (mValidityService) {
+ stopScan();
+
+ BluetoothDevice device = result.getDevice();
+ if (mSecure) {
+ if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
+ if (!device.createBond()) {
+ notifyError("Failed to call create bond");
+ }
+ } else {
+ mBluetoothGatt = connectGatt(result.getDevice(), mContext, false, mSecure, mGattCallbacks);
+ }
+ } else {
+ mBluetoothGatt = connectGatt(result.getDevice(), mContext, false, mSecure, mGattCallbacks);
+ }
+ } else {
+ notifyError("There is no validity to Advertise servie.");
+ }
}
}
};
@@ -457,6 +1254,40 @@
private void stopScan() {
if (DEBUG) Log.d(TAG, "stopScan");
- mScanner.stopScan(mScanCallback);
+ if (mScanner != null) {
+ mScanner.stopScan(mScanCallback);
+ }
}
+
+ private static String createTestData(int length) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("REQUEST_MTU");
+ int len = length - builder.length();
+ for (int i = 0; i < len; ++i) {
+ builder.append(""+(i%10));
+ }
+ return builder.toString();
+ }
+
+ private final BroadcastReceiver mBondStatusReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) {
+ BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+ int state = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_NONE);
+ switch (state) {
+ case BluetoothDevice.BOND_BONDED:
+ mBluetoothGatt = connectGatt(device, mContext, false, mSecure, mGattCallbacks);
+ break;
+ case BluetoothDevice.BOND_NONE:
+ notifyError("Failed to create bond.");
+ break;
+ case BluetoothDevice.BOND_BONDING:
+ default: // fall through
+ // wait for next state
+ break;
+ }
+ }
+ }
+ };
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientStartActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientStartActivity.java
deleted file mode 100644
index 5a4e327..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientStartActivity.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.cts.verifier.bluetooth;
-
-import com.android.cts.verifier.PassFailButtons;
-import com.android.cts.verifier.R;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class BleClientStartActivity extends PassFailButtons.Activity {
-
- private TestAdapter mTestAdapter;
- private int mAllPassed;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.ble_server_start);
- setPassFailButtonClickListeners();
- setInfoResources(R.string.ble_server_start_name,
- R.string.ble_server_start_info, -1);
- getPassButton().setEnabled(false);
-
- mTestAdapter = new TestAdapter(this, setupTestList());
- ListView listView = (ListView) findViewById(R.id.ble_server_tests);
- listView.setAdapter(mTestAdapter);
-
- mAllPassed = 0;
- startService(new Intent(this, BleClientService.class));
- }
-
- @Override
- public void onResume() {
- super.onResume();
-
- IntentFilter filter = new IntentFilter();
- filter.addAction(BleClientService.BLE_BLUETOOTH_CONNECTED);
- filter.addAction(BleClientService.BLE_BLUETOOTH_DISCONNECTED);
- filter.addAction(BleClientService.BLE_SERVICES_DISCOVERED);
- filter.addAction(BleClientService.BLE_CHARACTERISTIC_READ);
- filter.addAction(BleClientService.BLE_CHARACTERISTIC_WRITE);
- filter.addAction(BleClientService.BLE_CHARACTERISTIC_CHANGED);
- filter.addAction(BleClientService.BLE_DESCRIPTOR_READ);
- filter.addAction(BleClientService.BLE_DESCRIPTOR_WRITE);
- filter.addAction(BleClientService.BLE_RELIABLE_WRITE_COMPLETED);
- filter.addAction(BleClientService.BLE_READ_REMOTE_RSSI);
- registerReceiver(onBroadcast, filter);
- }
-
- @Override
- public void onPause() {
- super.onPause();
- unregisterReceiver(onBroadcast);
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- stopService(new Intent(this, BleClientService.class));
- }
-
- private List<Integer> setupTestList() {
- ArrayList<Integer> testList = new ArrayList<Integer>();
- testList.add(R.string.ble_client_connect_name);
- testList.add(R.string.ble_discover_service_name);
- testList.add(R.string.ble_read_characteristic_name);
- testList.add(R.string.ble_write_characteristic_name);
- testList.add(R.string.ble_reliable_write_name);
- testList.add(R.string.ble_notify_characteristic_name);
- testList.add(R.string.ble_read_descriptor_name);
- testList.add(R.string.ble_write_descriptor_name);
- testList.add(R.string.ble_read_rssi_name);
- testList.add(R.string.ble_client_disconnect_name);
- return testList;
- }
-
- private BroadcastReceiver onBroadcast = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (action == BleClientService.BLE_BLUETOOTH_CONNECTED) {
- mTestAdapter.setTestPass(0);
- mAllPassed |= 0x01;
- } else if (action == BleClientService.BLE_SERVICES_DISCOVERED) {
- mTestAdapter.setTestPass(1);
- mAllPassed |= 0x02;
- } else if (action == BleClientService.BLE_CHARACTERISTIC_READ) {
- mTestAdapter.setTestPass(2);
- mAllPassed |= 0x04;
- } else if (action == BleClientService.BLE_CHARACTERISTIC_WRITE) {
- mTestAdapter.setTestPass(3);
- mAllPassed |= 0x08;
- } else if (action == BleClientService.BLE_RELIABLE_WRITE_COMPLETED) {
- mTestAdapter.setTestPass(4);
- mAllPassed |= 0x10;
- } else if (action == BleClientService.BLE_CHARACTERISTIC_CHANGED) {
- mTestAdapter.setTestPass(5);
- mAllPassed |= 0x20;
- } else if (action == BleClientService.BLE_DESCRIPTOR_READ) {
- mTestAdapter.setTestPass(6);
- mAllPassed |= 0x40;
- } else if (action == BleClientService.BLE_DESCRIPTOR_WRITE) {
- mTestAdapter.setTestPass(7);
- mAllPassed |= 0x80;
- } else if (action == BleClientService.BLE_READ_REMOTE_RSSI) {
- mTestAdapter.setTestPass(8);
- mAllPassed |= 0x100;
- } else if (action == BleClientService.BLE_BLUETOOTH_DISCONNECTED) {
- mTestAdapter.setTestPass(9);
- mAllPassed |= 0x200;
- }
- mTestAdapter.notifyDataSetChanged();
- if (mAllPassed == 0x3FF) getPassButton().setEnabled(true);
- }
- };
-
-}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientTestBaseActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientTestBaseActivity.java
new file mode 100644
index 0000000..f7adc3d
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientTestBaseActivity.java
@@ -0,0 +1,454 @@
+/*
+ * Copyright (C) 2014 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 com.android.cts.verifier.bluetooth;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothManager;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.widget.ListView;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleClientTestBaseActivity extends PassFailButtons.Activity {
+ public static final String TAG = "BleClientTestBase";
+
+ private static final boolean STEP_EXECUTION = false;
+
+ private static final int PASS_FLAG_CONNECT = 0x1;
+ private static final int PASS_FLAG_DISCOVER = 0x2;
+ private static final int PASS_FLAG_READ_CHARACTERISTIC = 0x4;
+ private static final int PASS_FLAG_WRITE_CHARACTERISTIC = 0x8;
+ private static final int PASS_FLAG_RELIABLE_WRITE = 0x10;
+ private static final int PASS_FLAG_NOTIFY_CHARACTERISTIC = 0x20;
+ private static final int PASS_FLAG_READ_DESCRIPTOR = 0x40;
+ private static final int PASS_FLAG_WRITE_DESCRIPTOR = 0x80;
+ private static final int PASS_FLAG_READ_RSSI = 0x100;
+ private static final int PASS_FLAG_DISCONNECT = 0x200;
+ private static final int PASS_FLAG_READ_CHARACTERISTIC_NO_PERMISSION = 0x400;
+ private static final int PASS_FLAG_WRITE_CHARACTERISTIC_NO_PERMISSION = 0x800;
+ private static final int PASS_FLAG_READ_DESCRIPTOR_NO_PERMISSION = 0x1000;
+ private static final int PASS_FLAG_WRITE_DESCRIPTOR_NO_PERMISSION = 0x2000;
+ private static final int PASS_FLAG_MTU_CHANGE_23BYTES = 0x4000;
+ private static final int PASS_FLAG_INDICATE_CHARACTERISTIC = 0x8000;
+ private static final int PASS_FLAG_MTU_CHANGE_512BYTES = 0x10000;
+ private static final int PASS_FLAG_RELIABLE_WRITE_BAD_RESP = 0x20000;
+ private static final int PASS_FLAG_ALL = 0x3FFFF;
+
+ private final int BLE_CLIENT_CONNECT = 0;
+ private final int BLE_BLE_DISVOCER_SERVICE = 1;
+ private final int BLE_READ_CHARACTERISTIC = 2;
+ private final int BLE_WRITE_CHARACTERISTIC = 3;
+ private final int BLE_REQUEST_MTU_23BYTES = 4;
+ private final int BLE_REQUEST_MTU_512BYTES = 5;
+ private final int BLE_READ_CHARACTERISTIC_NO_PERMISSION = 6;
+ private final int BLE_WRITE_CHARACTERISTIC_NO_PERMISSION = 7;
+ private final int BLE_RELIABLE_WRITE = 8;
+ private final int BLE_RELIABLE_WRITE_BAD_RESP = 9;
+ private final int BLE_NOTIFY_CHARACTERISTIC = 9; //10;
+ private final int BLE_INDICATE_CHARACTERISTIC = 10; //11;
+ private final int BLE_READ_DESCRIPTOR = 11; //12;
+ private final int BLE_WRITE_DESCRIPTOR = 12; //13;
+ private final int BLE_READ_DESCRIPTOR_NO_PERMISSION = 13; //14;
+ private final int BLE_WRITE_DESCRIPTOR_NO_PERMISSION = 14; //15;
+ private final int BLE_READ_RSSI = 15; //16;
+ private final int BLE_CLIENT_DISCONNECT = 16; //17;
+
+ private TestAdapter mTestAdapter;
+ private long mPassed;
+ private Dialog mDialog;
+ private Handler mHandler;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.ble_server_start);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_client_test_name,
+ R.string.ble_client_test_info, -1);
+ getPassButton().setEnabled(false);
+
+ mTestAdapter = new TestAdapter(this, setupTestList());
+ ListView listView = (ListView) findViewById(R.id.ble_server_tests);
+ listView.setAdapter(mTestAdapter);
+
+ mPassed = 0;
+ mHandler = new Handler();
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BleClientService.BLE_BLUETOOTH_CONNECTED);
+ filter.addAction(BleClientService.BLE_BLUETOOTH_DISCONNECTED);
+ filter.addAction(BleClientService.BLE_SERVICES_DISCOVERED);
+ filter.addAction(BleClientService.BLE_MTU_CHANGED_23BYTES);
+ filter.addAction(BleClientService.BLE_MTU_CHANGED_512BYTES);
+ filter.addAction(BleClientService.BLE_CHARACTERISTIC_READ);
+ filter.addAction(BleClientService.BLE_CHARACTERISTIC_WRITE);
+ filter.addAction(BleClientService.BLE_CHARACTERISTIC_CHANGED);
+ filter.addAction(BleClientService.BLE_DESCRIPTOR_READ);
+ filter.addAction(BleClientService.BLE_DESCRIPTOR_WRITE);
+ filter.addAction(BleClientService.BLE_RELIABLE_WRITE_COMPLETED);
+ filter.addAction(BleClientService.BLE_RELIABLE_WRITE_BAD_RESP_COMPLETED);
+ filter.addAction(BleClientService.BLE_READ_REMOTE_RSSI);
+ filter.addAction(BleClientService.BLE_CHARACTERISTIC_READ_NOPERMISSION);
+ filter.addAction(BleClientService.BLE_CHARACTERISTIC_WRITE_NOPERMISSION);
+ filter.addAction(BleClientService.BLE_DESCRIPTOR_READ_NOPERMISSION);
+ filter.addAction(BleClientService.BLE_DESCRIPTOR_WRITE_NOPERMISSION);
+ filter.addAction(BleClientService.BLE_CHARACTERISTIC_INDICATED);
+ filter.addAction(BleClientService.BLE_BLUETOOTH_DISABLED);
+ filter.addAction(BleClientService.BLE_BLUETOOTH_MISMATCH_SECURE);
+ filter.addAction(BleClientService.BLE_BLUETOOTH_MISMATCH_INSECURE);
+ filter.addAction(BleClientService.BLE_CLIENT_ERROR);
+
+ registerReceiver(mBroadcast, filter);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ unregisterReceiver(mBroadcast);
+ closeDialog();
+ }
+
+ private synchronized void closeDialog() {
+ if (mDialog != null) {
+ mDialog.dismiss();
+ mDialog = null;
+ }
+ }
+
+ private synchronized void showProgressDialog() {
+ closeDialog();
+
+ ProgressDialog dialog = new ProgressDialog(this);
+ dialog.setTitle(R.string.ble_test_running);
+ dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+ dialog.setMessage(getString(R.string.ble_test_running_message));
+ dialog.setCanceledOnTouchOutside(false);
+ mDialog = dialog;
+ mDialog.show();
+ }
+
+ private List<Integer> setupTestList() {
+ ArrayList<Integer> testList = new ArrayList<Integer>();
+ testList.add(R.string.ble_client_connect_name);
+ testList.add(R.string.ble_discover_service_name);
+ testList.add(R.string.ble_read_characteristic_name);
+ testList.add(R.string.ble_write_characteristic_name);
+ testList.add(R.string.ble_mtu_23_name);
+ testList.add(R.string.ble_mtu_512_name);
+ testList.add(R.string.ble_read_characteristic_nopermission_name);
+ testList.add(R.string.ble_write_characteristic_nopermission_name);
+ testList.add(R.string.ble_reliable_write_name);
+// testList.add(R.string.ble_reliable_write_bad_resp_name);
+ testList.add(R.string.ble_notify_characteristic_name);
+ testList.add(R.string.ble_indicate_characteristic_name);
+ testList.add(R.string.ble_read_descriptor_name);
+ testList.add(R.string.ble_write_descriptor_name);
+ testList.add(R.string.ble_read_descriptor_nopermission_name);
+ testList.add(R.string.ble_write_descriptor_nopermission_name);
+ testList.add(R.string.ble_read_rssi_name);
+ testList.add(R.string.ble_client_disconnect_name);
+
+ return testList;
+ }
+
+ private void showErrorDialog(int titleId, int messageId, boolean finish) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this)
+ .setTitle(titleId)
+ .setMessage(messageId);
+ if (finish) {
+ builder.setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ });
+ }
+ builder.create().show();
+ }
+
+ public boolean shouldRebootBluetoothAfterTest() {
+ return false;
+ }
+
+ private BroadcastReceiver mBroadcast = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ boolean showProgressDialog = false;
+ closeDialog();
+
+ String action = intent.getAction();
+ String newAction = null;
+ String actionName = null;
+ final Intent startIntent = new Intent(BleClientTestBaseActivity.this, BleClientService.class);
+ switch (action) {
+ case BleClientService.BLE_BLUETOOTH_DISABLED:
+ showErrorDialog(R.string.ble_bluetooth_disable_title, R.string.ble_bluetooth_disable_message, true);
+ break;
+ case BleClientService.BLE_BLUETOOTH_CONNECTED:
+ actionName = getString(R.string.ble_client_connect_name);
+ mTestAdapter.setTestPass(BLE_CLIENT_CONNECT);
+ mPassed |= PASS_FLAG_CONNECT;
+ // execute service discovery test
+ newAction = BleClientService.BLE_CLIENT_ACTION_BLE_DISVOCER_SERVICE;
+ break;
+ case BleClientService.BLE_SERVICES_DISCOVERED:
+ actionName = getString(R.string.ble_discover_service_name);
+ mTestAdapter.setTestPass(BLE_BLE_DISVOCER_SERVICE);
+ mPassed |= PASS_FLAG_DISCOVER;
+ // execute MTU requesting test (23bytes)
+ newAction = BleClientService.BLE_CLIENT_ACTION_READ_CHARACTERISTIC;
+ break;
+ case BleClientService.BLE_MTU_CHANGED_23BYTES:
+ actionName = getString(R.string.ble_mtu_23_name);
+ mTestAdapter.setTestPass(BLE_REQUEST_MTU_23BYTES);
+ mPassed |= PASS_FLAG_MTU_CHANGE_23BYTES;
+ // execute MTU requesting test (512bytes)
+ newAction = BleClientService.BLE_CLIENT_ACTION_REQUEST_MTU_512;
+ showProgressDialog = true;
+ break;
+ case BleClientService.BLE_MTU_CHANGED_512BYTES:
+ actionName = getString(R.string.ble_mtu_512_name);
+ mTestAdapter.setTestPass(BLE_REQUEST_MTU_512BYTES);
+ mPassed |= PASS_FLAG_MTU_CHANGE_512BYTES;
+ // execute characteristic reading test
+ newAction = BleClientService.BLE_CLIENT_ACTION_READ_CHARACTERISTIC_NO_PERMISSION;
+ break;
+ case BleClientService.BLE_CHARACTERISTIC_READ:
+ actionName = getString(R.string.ble_read_characteristic_name);
+ mTestAdapter.setTestPass(BLE_READ_CHARACTERISTIC);
+ mPassed |= PASS_FLAG_READ_CHARACTERISTIC;
+ // execute characteristic writing test
+ newAction = BleClientService.BLE_CLIENT_ACTION_WRITE_CHARACTERISTIC;
+ break;
+ case BleClientService.BLE_CHARACTERISTIC_WRITE:
+ actionName = getString(R.string.ble_write_characteristic_name);
+ mTestAdapter.setTestPass(BLE_WRITE_CHARACTERISTIC);
+ mPassed |= PASS_FLAG_WRITE_CHARACTERISTIC;
+ newAction = BleClientService.BLE_CLIENT_ACTION_REQUEST_MTU_23;
+ showProgressDialog = true;
+ break;
+ case BleClientService.BLE_CHARACTERISTIC_READ_NOPERMISSION:
+ actionName = getString(R.string.ble_read_characteristic_nopermission_name);
+ mTestAdapter.setTestPass(BLE_READ_CHARACTERISTIC_NO_PERMISSION);
+ mPassed |= PASS_FLAG_READ_CHARACTERISTIC_NO_PERMISSION;
+ // execute unpermitted characteristic writing test
+ newAction = BleClientService.BLE_CLIENT_ACTION_WRITE_CHARACTERISTIC_NO_PERMISSION;
+ break;
+ case BleClientService.BLE_CHARACTERISTIC_WRITE_NOPERMISSION:
+ actionName = getString(R.string.ble_write_characteristic_nopermission_name);
+ mTestAdapter.setTestPass(BLE_WRITE_CHARACTERISTIC_NO_PERMISSION);
+ mPassed |= PASS_FLAG_WRITE_CHARACTERISTIC_NO_PERMISSION;
+ // execute reliable write test
+ newAction = BleClientService.BLE_CLIENT_ACTION_RELIABLE_WRITE;
+ showProgressDialog = true;
+ break;
+ case BleClientService.BLE_RELIABLE_WRITE_COMPLETED:
+ actionName = getString(R.string.ble_reliable_write_name);
+ mTestAdapter.setTestPass(BLE_RELIABLE_WRITE);
+ mPassed |= PASS_FLAG_RELIABLE_WRITE;
+// newAction = BleClientService.BLE_CLIENT_ACTION_RELIABLE_WRITE_BAD_RESP;
+
+ // skip Reliable write (bad response) test
+ mPassed |= PASS_FLAG_RELIABLE_WRITE_BAD_RESP;
+ newAction = BleClientService.BLE_CLIENT_ACTION_NOTIFY_CHARACTERISTIC;
+ showProgressDialog = true;
+ break;
+ case BleClientService.BLE_RELIABLE_WRITE_BAD_RESP_COMPLETED: {
+ actionName = getString(R.string.ble_reliable_write_bad_resp_name);
+ if(!intent.hasExtra(BleClientService.EXTRA_ERROR_MESSAGE)) {
+ mPassed |= PASS_FLAG_RELIABLE_WRITE_BAD_RESP;
+ mTestAdapter.setTestPass(BLE_RELIABLE_WRITE_BAD_RESP);
+ }
+ // execute notification test
+ newAction = BleClientService.BLE_CLIENT_ACTION_NOTIFY_CHARACTERISTIC;
+ showProgressDialog = true;
+ }
+ break;
+ case BleClientService.BLE_CHARACTERISTIC_CHANGED:
+ actionName = getString(R.string.ble_notify_characteristic_name);
+ mTestAdapter.setTestPass(BLE_NOTIFY_CHARACTERISTIC);
+ mPassed |= PASS_FLAG_NOTIFY_CHARACTERISTIC;
+ // execute indication test
+ newAction = BleClientService.BLE_CLIENT_ACTION_INDICATE_CHARACTERISTIC;
+ showProgressDialog = true;
+ break;
+ case BleClientService.BLE_CHARACTERISTIC_INDICATED:
+ actionName = getString(R.string.ble_indicate_characteristic_name);
+ mTestAdapter.setTestPass(BLE_INDICATE_CHARACTERISTIC);
+ mPassed |= PASS_FLAG_INDICATE_CHARACTERISTIC;
+ // execute descriptor reading test
+ newAction = BleClientService.BLE_CLIENT_ACTION_READ_DESCRIPTOR;
+ break;
+ case BleClientService.BLE_DESCRIPTOR_READ:
+ actionName = getString(R.string.ble_read_descriptor_name);
+ mTestAdapter.setTestPass(BLE_READ_DESCRIPTOR);
+ mPassed |= PASS_FLAG_READ_DESCRIPTOR;
+ // execute descriptor writing test
+ newAction = BleClientService.BLE_CLIENT_ACTION_WRITE_DESCRIPTOR;
+ break;
+ case BleClientService.BLE_DESCRIPTOR_WRITE:
+ actionName = getString(R.string.ble_write_descriptor_name);
+ mTestAdapter.setTestPass(BLE_WRITE_DESCRIPTOR);
+ mPassed |= PASS_FLAG_WRITE_DESCRIPTOR;
+ // execute unpermitted descriptor reading test
+ newAction = BleClientService.BLE_CLIENT_ACTION_READ_DESCRIPTOR_NO_PERMISSION;
+ break;
+ case BleClientService.BLE_DESCRIPTOR_READ_NOPERMISSION:
+ actionName = getString(R.string.ble_read_descriptor_nopermission_name);
+ mTestAdapter.setTestPass(BLE_READ_DESCRIPTOR_NO_PERMISSION);
+ mPassed |= PASS_FLAG_READ_DESCRIPTOR_NO_PERMISSION;
+ // execute unpermitted descriptor writing test
+ newAction = BleClientService.BLE_CLIENT_ACTION_WRITE_DESCRIPTOR_NO_PERMISSION;
+ break;
+ case BleClientService.BLE_DESCRIPTOR_WRITE_NOPERMISSION:
+ actionName = getString(R.string.ble_write_descriptor_nopermission_name);
+ mTestAdapter.setTestPass(BLE_WRITE_DESCRIPTOR_NO_PERMISSION);
+ mPassed |= PASS_FLAG_WRITE_DESCRIPTOR_NO_PERMISSION;
+ // execute RSSI requesting test
+ newAction = BleClientService.BLE_CLIENT_ACTION_READ_RSSI;
+ break;
+ case BleClientService.BLE_READ_REMOTE_RSSI:
+ actionName = getString(R.string.ble_read_rssi_name);
+ mTestAdapter.setTestPass(BLE_READ_RSSI);
+ mPassed |= PASS_FLAG_READ_RSSI;
+ // execute disconnection test
+ newAction = BleClientService.BLE_CLIENT_ACTION_CLIENT_DISCONNECT;
+ break;
+ case BleClientService.BLE_BLUETOOTH_DISCONNECTED:
+ mTestAdapter.setTestPass(BLE_CLIENT_DISCONNECT);
+ mPassed |= PASS_FLAG_DISCONNECT;
+ // all test done
+ newAction = null;
+ break;
+ case BleClientService.BLE_BLUETOOTH_MISMATCH_SECURE:
+ showErrorDialog(R.string.ble_bluetooth_mismatch_title, R.string.ble_bluetooth_mismatch_secure_message, true);
+ break;
+ case BleClientService.BLE_BLUETOOTH_MISMATCH_INSECURE:
+ showErrorDialog(R.string.ble_bluetooth_mismatch_title, R.string.ble_bluetooth_mismatch_insecure_message, true);
+ break;
+ }
+
+ mTestAdapter.notifyDataSetChanged();
+
+ if (newAction != null) {
+ startIntent.setAction(newAction);
+ if (STEP_EXECUTION) {
+ closeDialog();
+ final boolean showProgressDialogValue = showProgressDialog;
+ mDialog = new AlertDialog.Builder(BleClientTestBaseActivity.this)
+ .setTitle(actionName)
+ .setMessage(R.string.ble_test_finished)
+ .setCancelable(false)
+ .setPositiveButton(R.string.ble_test_next,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ closeDialog();
+ if (showProgressDialogValue) {
+ showProgressDialog();
+ }
+ startService(startIntent);
+ }
+ })
+ .show();
+ } else {
+ if (showProgressDialog) {
+ showProgressDialog();
+ }
+ startService(startIntent);
+ }
+ } else {
+ closeDialog();
+ }
+
+ if (mPassed == PASS_FLAG_ALL) {
+ if (shouldRebootBluetoothAfterTest()) {
+ mBtPowerSwitcher.executeSwitching();
+ } else {
+ getPassButton().setEnabled(true);
+ }
+ }
+ }
+ };
+
+ private static final long BT_ON_DELAY = 10000;
+ private final BluetoothPowerSwitcher mBtPowerSwitcher = new BluetoothPowerSwitcher();
+ private class BluetoothPowerSwitcher extends BroadcastReceiver {
+
+ private boolean mIsSwitching = false;
+ private BluetoothAdapter mAdapter;
+
+ public void executeSwitching() {
+ if (mAdapter == null) {
+ BluetoothManager btMgr = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+ mAdapter = btMgr.getAdapter();
+ }
+
+ if (!mIsSwitching) {
+ IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
+ registerReceiver(this, filter);
+ mIsSwitching = true;
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mAdapter.disable();
+ }
+ }, 1000);
+ showProgressDialog();
+ }
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+ int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
+ if (state == BluetoothAdapter.STATE_OFF) {
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mAdapter.enable();
+ }
+ }, BT_ON_DELAY);
+ } else if (state == BluetoothAdapter.STATE_ON) {
+ mIsSwitching = false;
+ unregisterReceiver(this);
+ getPassButton().setEnabled(true);
+ closeDialog();
+ }
+ }
+ }
+ }
+
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityClientBaseActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityClientBaseActivity.java
new file mode 100644
index 0000000..0aa4841
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityClientBaseActivity.java
@@ -0,0 +1,312 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothManager;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleConnectionPriorityClientBaseActivity extends PassFailButtons.Activity {
+
+ private TestAdapter mTestAdapter;
+ private int mPassed = 0;
+ private Dialog mDialog;
+
+ private static final int BLE_CONNECTION_HIGH = 0;
+ private static final int BLE_CONNECTION_BALANCED = 1;
+ private static final int BLE_CONNECTION_LOW = 2;
+
+ private static final int PASSED_HIGH = 0x1;
+ private static final int PASSED_BALANCED = 0x2;
+ private static final int PASSED_LOW = 0x4;
+ private static final int ALL_PASSED = 0x7;
+
+ private boolean mSecure;
+
+ private Handler mHandler;
+ private int mCurrentTest = -1;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.ble_connection_priority_client_test);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_connection_priority_client_name,
+ R.string.ble_connection_priority_client_info, -1);
+ getPassButton().setEnabled(false);
+
+ mHandler = new Handler();
+
+ mTestAdapter = new TestAdapter(this, setupTestList());
+ ListView listView = (ListView) findViewById(R.id.ble_client_connection_tests);
+ listView.setAdapter(mTestAdapter);
+ listView.setEnabled(false);
+ listView.setClickable(false);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BleConnectionPriorityClientService.ACTION_BLUETOOTH_DISABLED);
+ filter.addAction(BleConnectionPriorityClientService.ACTION_CONNECTION_SERVICES_DISCOVERED);
+ filter.addAction(BleConnectionPriorityClientService.ACTION_FINISH_CONNECTION_PRIORITY_HIGH);
+ filter.addAction(BleConnectionPriorityClientService.ACTION_FINISH_CONNECTION_PRIORITY_BALANCED);
+ filter.addAction(BleConnectionPriorityClientService.ACTION_FINISH_CONNECTION_PRIORITY_LOW_POWER);
+ filter.addAction(BleConnectionPriorityClientService.ACTION_BLUETOOTH_MISMATCH_SECURE);
+ filter.addAction(BleConnectionPriorityClientService.ACTION_BLUETOOTH_MISMATCH_INSECURE);
+ filter.addAction(BleConnectionPriorityClientService.ACTION_FINISH_DISCONNECT);
+ registerReceiver(mBroadcast, filter);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ unregisterReceiver(mBroadcast);
+ closeDialog();
+ }
+
+ protected void setSecure(boolean secure) {
+ mSecure = secure;
+ }
+
+ public boolean isSecure() {
+ return mSecure;
+ }
+
+ private synchronized void closeDialog() {
+ if (mDialog != null) {
+ mDialog.dismiss();
+ mDialog = null;
+ }
+ }
+
+ private synchronized void showProgressDialog() {
+ closeDialog();
+
+ ProgressDialog dialog = new ProgressDialog(this);
+ dialog.setTitle(R.string.ble_test_running);
+ dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+ dialog.setMessage(getString(R.string.ble_test_running_message));
+ dialog.setCanceledOnTouchOutside(false);
+ mDialog = dialog;
+ mDialog.show();
+ }
+
+ private void showErrorDialog(int titleId, int messageId, boolean finish) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this)
+ .setTitle(titleId)
+ .setMessage(messageId);
+ if (finish) {
+ builder.setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ });
+ }
+ builder.create().show();
+ }
+
+ private List<Integer> setupTestList() {
+ ArrayList<Integer> testList = new ArrayList<Integer>();
+ testList.add(R.string.ble_connection_priority_client_high);
+ testList.add(R.string.ble_connection_priority_client_balanced);
+ testList.add(R.string.ble_connection_priority_client_low);
+ return testList;
+ }
+
+ private void executeNextTest(long delay) {
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ executeNextTestImpl();
+ }
+ }, delay);
+ }
+ private void executeNextTestImpl() {
+ switch (mCurrentTest) {
+ case -1: {
+ mCurrentTest = BLE_CONNECTION_HIGH;
+ Intent intent = new Intent(this, BleConnectionPriorityClientService.class);
+ intent.setAction(BleConnectionPriorityClientService.ACTION_CONNECTION_PRIORITY_HIGH);
+ startService(intent);
+ String msg = getString(R.string.ble_client_connection_priority)
+ + getString(R.string.ble_connection_priority_high);
+ Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
+ }
+ break;
+ case BLE_CONNECTION_BALANCED: {
+ mCurrentTest = BLE_CONNECTION_LOW;
+ Intent intent = new Intent(this, BleConnectionPriorityClientService.class);
+ intent.setAction(BleConnectionPriorityClientService.ACTION_CONNECTION_PRIORITY_LOW_POWER);
+ startService(intent);
+ String msg = getString(R.string.ble_client_connection_priority)
+ + getString(R.string.ble_connection_priority_low);
+ Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
+ }
+ break;
+ case BLE_CONNECTION_HIGH: {
+ mCurrentTest = BLE_CONNECTION_BALANCED;
+ Intent intent = new Intent(this, BleConnectionPriorityClientService.class);
+ intent.setAction(BleConnectionPriorityClientService.ACTION_CONNECTION_PRIORITY_BALANCED);
+ startService(intent);
+ String msg = getString(R.string.ble_client_connection_priority)
+ + getString(R.string.ble_connection_priority_balanced);
+ Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
+ }
+ break;
+ case BLE_CONNECTION_LOW:
+ // all test done
+ closeDialog();
+ if (mPassed == ALL_PASSED) {
+ Intent intent = new Intent(this, BleConnectionPriorityClientService.class);
+ intent.setAction(BleConnectionPriorityClientService.ACTION_DISCONNECT);
+ startService(intent);
+ }
+ break;
+ default:
+ // something went wrong
+ closeDialog();
+ break;
+ }
+ }
+
+ public boolean shouldRebootBluetoothAfterTest() {
+ return false;
+ }
+
+ private BroadcastReceiver mBroadcast = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ switch (action) {
+ case BleConnectionPriorityClientService.ACTION_BLUETOOTH_DISABLED:
+ new AlertDialog.Builder(context)
+ .setTitle(R.string.ble_bluetooth_disable_title)
+ .setMessage(R.string.ble_bluetooth_disable_message)
+ .setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ })
+ .create().show();
+ break;
+ case BleConnectionPriorityClientService.ACTION_CONNECTION_SERVICES_DISCOVERED:
+ showProgressDialog();
+ executeNextTest(3000);
+ break;
+ case BleConnectionPriorityClientService.ACTION_FINISH_CONNECTION_PRIORITY_HIGH:
+ mTestAdapter.setTestPass(BLE_CONNECTION_HIGH);
+ mPassed |= PASSED_HIGH;
+ executeNextTest(1000);
+ break;
+ case BleConnectionPriorityClientService.ACTION_FINISH_CONNECTION_PRIORITY_BALANCED:
+ mTestAdapter.setTestPass(BLE_CONNECTION_BALANCED);
+ mPassed |= PASSED_BALANCED;
+ executeNextTest(1000);
+ break;
+ case BleConnectionPriorityClientService.ACTION_FINISH_CONNECTION_PRIORITY_LOW_POWER:
+ mTestAdapter.setTestPass(BLE_CONNECTION_LOW);
+ mPassed |= PASSED_LOW;
+ executeNextTest(100);
+ break;
+ case BleConnectionPriorityClientService.ACTION_BLUETOOTH_MISMATCH_SECURE:
+ showErrorDialog(R.string.ble_bluetooth_mismatch_title, R.string.ble_bluetooth_mismatch_secure_message, true);
+ break;
+ case BleConnectionPriorityClientService.ACTION_BLUETOOTH_MISMATCH_INSECURE:
+ showErrorDialog(R.string.ble_bluetooth_mismatch_title, R.string.ble_bluetooth_mismatch_insecure_message, true);
+ break;
+ case BleConnectionPriorityClientService.ACTION_FINISH_DISCONNECT:
+ if (shouldRebootBluetoothAfterTest()) {
+ mBtPowerSwitcher.executeSwitching();
+ } else {
+ getPassButton().setEnabled(true);
+ }
+ break;
+ }
+ mTestAdapter.notifyDataSetChanged();
+ }
+ };
+
+ private static final long BT_ON_DELAY = 10000;
+ private final BluetoothPowerSwitcher mBtPowerSwitcher = new BluetoothPowerSwitcher();
+ private class BluetoothPowerSwitcher extends BroadcastReceiver {
+
+ private boolean mIsSwitching = false;
+ private BluetoothAdapter mAdapter;
+
+ public void executeSwitching() {
+ if (mAdapter == null) {
+ BluetoothManager btMgr = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+ mAdapter = btMgr.getAdapter();
+ }
+
+ if (!mIsSwitching) {
+ IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
+ registerReceiver(this, filter);
+ mIsSwitching = true;
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mAdapter.disable();
+ }
+ }, 1000);
+ showProgressDialog();
+ }
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+ int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
+ if (state == BluetoothAdapter.STATE_OFF) {
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mAdapter.enable();
+ }
+ }, BT_ON_DELAY);
+ } else if (state == BluetoothAdapter.STATE_ON) {
+ mIsSwitching = false;
+ unregisterReceiver(this);
+ getPassButton().setEnabled(true);
+ closeDialog();
+ }
+ }
+ }
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityClientService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityClientService.java
new file mode 100644
index 0000000..28fd023
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityClientService.java
@@ -0,0 +1,435 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.app.Service;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGatt;
+import android.bluetooth.BluetoothGattCallback;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattService;
+import android.bluetooth.BluetoothManager;
+import android.bluetooth.BluetoothProfile;
+import android.bluetooth.le.BluetoothLeScanner;
+import android.bluetooth.le.ScanCallback;
+import android.bluetooth.le.ScanFilter;
+import android.bluetooth.le.ScanResult;
+import android.bluetooth.le.ScanSettings;
+import android.content.Context;
+import android.content.Intent;
+import android.os.DeadObjectException;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.ParcelUuid;
+import android.util.Log;
+import android.widget.Toast;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.UUID;
+
+public class BleConnectionPriorityClientService extends Service {
+ public static final boolean DEBUG = true;
+ public static final String TAG = "BlePriorityClient";
+
+ public static final String ACTION_BLUETOOTH_DISABLED =
+ "com.android.cts.verifier.bluetooth.action.BLUETOOTH_DISABLED";
+
+ public static final String ACTION_CONNECTION_SERVICES_DISCOVERED =
+ "com.android.cts.verifier.bluetooth.action.CONNECTION_SERVICES_DISCOVERED";
+
+ public static final String ACTION_BLUETOOTH_MISMATCH_SECURE =
+ "com.android.cts.verifier.bluetooth.action.ACTION_BLUETOOTH_MISMATCH_SECURE";
+ public static final String ACTION_BLUETOOTH_MISMATCH_INSECURE =
+ "com.android.cts.verifier.bluetooth.action.ACTION_BLUETOOTH_MISMATCH_INSECURE";
+
+ public static final String ACTION_CONNECTION_PRIORITY_BALANCED =
+ "com.android.cts.verifier.bluetooth.action.CONNECTION_PRIORITY_BALANCED";
+ public static final String ACTION_CONNECTION_PRIORITY_HIGH =
+ "com.android.cts.verifier.bluetooth.action.CONNECTION_PRIORITY_HIGH";
+ public static final String ACTION_CONNECTION_PRIORITY_LOW_POWER =
+ "com.android.cts.verifier.bluetooth.action.CONNECTION_PRIORITY_LOW_POWER";
+
+ public static final String ACTION_FINISH_CONNECTION_PRIORITY_BALANCED =
+ "com.android.cts.verifier.bluetooth.action.FINISH_CONNECTION_PRIORITY_BALANCED";
+ public static final String ACTION_FINISH_CONNECTION_PRIORITY_HIGH =
+ "com.android.cts.verifier.bluetooth.action.FINISH_CONNECTION_PRIORITY_HIGH";
+ public static final String ACTION_FINISH_CONNECTION_PRIORITY_LOW_POWER =
+ "com.android.cts.verifier.bluetooth.action.FINISH_CONNECTION_PRIORITY_LOW_POWER";
+
+ public static final String ACTION_CLIENT_CONNECT_SECURE =
+ "com.android.cts.verifier.bluetooth.action.CLIENT_CONNECT_SECURE";
+
+ public static final String ACTION_DISCONNECT =
+ "com.android.cts.verifier.bluetooth.action.DISCONNECT";
+ public static final String ACTION_FINISH_DISCONNECT =
+ "com.android.cts.verifier.bluetooth.action.FINISH_DISCONNECT";
+
+ public static final long DEFAULT_INTERVAL = 100L;
+ public static final long DEFAULT_PERIOD = 10000L;
+
+ // this string will be used at writing test and connection priority test.
+ private static final String WRITE_VALUE = "TEST";
+
+ private static final UUID SERVICE_UUID =
+ UUID.fromString("00009999-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_UUID =
+ UUID.fromString("00009998-0000-1000-8000-00805f9b34fb");
+ private static final UUID START_CHARACTERISTIC_UUID =
+ UUID.fromString("00009997-0000-1000-8000-00805f9b34fb");
+ private static final UUID STOP_CHARACTERISTIC_UUID =
+ UUID.fromString("00009995-0000-1000-8000-00805f9b34fb");
+
+ private BluetoothManager mBluetoothManager;
+ private BluetoothAdapter mBluetoothAdapter;
+ private BluetoothGatt mBluetoothGatt;
+ private BluetoothLeScanner mScanner;
+ private Handler mHandler;
+ private Timer mConnectionTimer;
+ private Context mContext;
+
+ private String mAction;
+ private long mInterval;
+ private long mPeriod;
+ private Date mStartDate;
+ private int mWriteCount;
+ private boolean mSecure;
+
+ private String mPriority;
+
+ private TestTaskQueue mTaskQueue;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ mTaskQueue = new TestTaskQueue(getClass().getName() + "__taskHandlerThread");
+
+ mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+ mBluetoothAdapter = mBluetoothManager.getAdapter();
+ mScanner = mBluetoothAdapter.getBluetoothLeScanner();
+ mHandler = new Handler();
+ mContext = this;
+ mInterval = DEFAULT_INTERVAL;
+ mPeriod = DEFAULT_PERIOD;
+
+ startScan();
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ if (mBluetoothGatt != null) {
+ try {
+ mBluetoothGatt.disconnect();
+ mBluetoothGatt.close();
+ } catch (Exception e) {}
+ finally {
+ mBluetoothGatt = null;
+ }
+ }
+ stopScan();
+
+ mTaskQueue.quit();
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ private void notifyBluetoothDisabled() {
+ Intent intent = new Intent(ACTION_BLUETOOTH_DISABLED);
+ sendBroadcast(intent);
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ if (intent != null) {
+ mAction = intent.getAction();
+ if (mAction != null) {
+ switch (mAction) {
+ case ACTION_CLIENT_CONNECT_SECURE:
+ mSecure = true;
+ break;
+ case ACTION_CONNECTION_PRIORITY_BALANCED:
+ case ACTION_CONNECTION_PRIORITY_HIGH:
+ case ACTION_CONNECTION_PRIORITY_LOW_POWER:
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ startPeriodicTransmission();
+ }
+ });
+ break;
+ case ACTION_DISCONNECT:
+ if (mBluetoothGatt != null) {
+ mBluetoothGatt.disconnect();
+ } else {
+ notifyDisconnect();
+ }
+ break;
+ }
+ }
+ }
+ return START_NOT_STICKY;
+ }
+
+ private void startPeriodicTransmission() {
+ mWriteCount = 0;
+
+ // Set connection priority
+ switch (mAction) {
+ case ACTION_CONNECTION_PRIORITY_BALANCED:
+ mPriority = BleConnectionPriorityServerService.CONNECTION_PRIORITY_BALANCED;
+ mBluetoothGatt.requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_BALANCED);
+ break;
+ case ACTION_CONNECTION_PRIORITY_HIGH:
+ mPriority = BleConnectionPriorityServerService.CONNECTION_PRIORITY_HIGH;
+ mBluetoothGatt.requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_HIGH);
+ break;
+ case ACTION_CONNECTION_PRIORITY_LOW_POWER:
+ mPriority = BleConnectionPriorityServerService.CONNECTION_PRIORITY_LOW_POWER;
+ mBluetoothGatt.requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER);
+ break;
+ default:
+ mPriority = BleConnectionPriorityServerService.CONNECTION_PRIORITY_BALANCED;
+ mBluetoothGatt.requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_BALANCED);
+ break;
+ }
+
+ // Create Timer for Periodic transmission
+ mStartDate = new Date();
+ TimerTask task = new TimerTask() {
+ @Override
+ public void run() {
+ if (mBluetoothGatt == null) {
+ if (DEBUG) {
+ Log.d(TAG, "BluetoothGatt is null, return");
+ }
+ return;
+ }
+
+ Date currentData = new Date();
+ if ((currentData.getTime() - mStartDate.getTime()) >= mPeriod) {
+ if (mConnectionTimer != null) {
+ mConnectionTimer.cancel();
+ mConnectionTimer = null;
+ }
+ // write termination data (contains current priority and number of messages wrote)
+ String msg = "" + mPriority + "," + mWriteCount;
+ writeCharacteristic(STOP_CHARACTERISTIC_UUID, msg);
+ sleep(1000);
+ Intent intent = new Intent();
+ switch (mPriority) {
+ case BleConnectionPriorityServerService.CONNECTION_PRIORITY_BALANCED:
+ intent.setAction(ACTION_FINISH_CONNECTION_PRIORITY_BALANCED);
+ break;
+ case BleConnectionPriorityServerService.CONNECTION_PRIORITY_HIGH:
+ intent.setAction(ACTION_FINISH_CONNECTION_PRIORITY_HIGH);
+ break;
+ case BleConnectionPriorityServerService.CONNECTION_PRIORITY_LOW_POWER:
+ intent.setAction(ACTION_FINISH_CONNECTION_PRIORITY_LOW_POWER);
+ break;
+ }
+ sendBroadcast(intent);
+ }
+
+ if (mConnectionTimer != null) {
+ // write testing data
+ ++mWriteCount;
+ writeCharacteristic(CHARACTERISTIC_UUID, WRITE_VALUE);
+ }
+ }
+ };
+
+ // write starting data
+ writeCharacteristic(START_CHARACTERISTIC_UUID, mPriority);
+
+ // start sending
+ sleep(1000);
+ mConnectionTimer = new Timer();
+ mConnectionTimer.schedule(task, 0, mInterval);
+ }
+
+ private BluetoothGattService getService() {
+ BluetoothGattService service = null;
+
+ if (mBluetoothGatt != null) {
+ service = mBluetoothGatt.getService(SERVICE_UUID);
+ if (service == null) {
+ showMessage("Service not found");
+ }
+ }
+ return service;
+ }
+
+ private BluetoothGattCharacteristic getCharacteristic(UUID uuid) {
+ BluetoothGattCharacteristic characteristic = null;
+
+ BluetoothGattService service = getService();
+ if (service != null) {
+ characteristic = service.getCharacteristic(uuid);
+ if (characteristic == null) {
+ showMessage("Characteristic not found");
+ }
+ }
+ return characteristic;
+ }
+
+ private void writeCharacteristic(UUID uid, String writeValue) {
+ BluetoothGattCharacteristic characteristic = getCharacteristic(uid);
+ if (characteristic != null){
+ characteristic.setValue(writeValue);
+ mBluetoothGatt.writeCharacteristic(characteristic);
+ }
+ }
+
+ private void sleep(int millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "Error in thread sleep", e);
+ }
+ }
+
+ private void showMessage(final String msg) {
+ mHandler.post(new Runnable() {
+ public void run() {
+ Toast.makeText(BleConnectionPriorityClientService.this, msg, Toast.LENGTH_SHORT).show();
+ }
+ });
+ }
+
+ private final BluetoothGattCallback mGattCallbacks = new BluetoothGattCallback() {
+ @Override
+ public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
+ if (DEBUG) Log.d(TAG, "onConnectionStateChange");
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ if (newState == BluetoothProfile.STATE_CONNECTED) {
+ int bond = gatt.getDevice().getBondState();
+ boolean bonded = false;
+ BluetoothDevice target = gatt.getDevice();
+ Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
+ if (pairedDevices.size() > 0) {
+ for (BluetoothDevice device : pairedDevices) {
+ if (device.getAddress().equals(target.getAddress())) {
+ bonded = true;
+ break;
+ }
+ }
+ }
+ if (mSecure && ((bond == BluetoothDevice.BOND_NONE) || !bonded)) {
+ // not pairing and execute Secure Test
+ mBluetoothGatt.disconnect();
+ notifyMismatchSecure();
+ } else if (!mSecure && ((bond != BluetoothDevice.BOND_NONE) || bonded)) {
+ // already pairing nad execute Insecure Test
+ mBluetoothGatt.disconnect();
+ notifyMismatchInsecure();
+ } else {
+ showMessage("Bluetooth LE connected");
+ mBluetoothGatt.discoverServices();
+ }
+ } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
+ showMessage("Bluetooth LE disconnected");
+
+ notifyDisconnect();
+ }
+ } else {
+ showMessage("Failed to connect");
+ mBluetoothGatt.close();
+ mBluetoothGatt = null;
+ }
+ }
+
+ @Override
+ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
+ if (DEBUG){
+ Log.d(TAG, "onServiceDiscovered");
+ }
+ if ((status == BluetoothGatt.GATT_SUCCESS) && (mBluetoothGatt.getService(SERVICE_UUID) != null)) {
+ showMessage("Service discovered");
+ Intent intent = new Intent(ACTION_CONNECTION_SERVICES_DISCOVERED);
+ sendBroadcast(intent);
+ }
+ }
+
+ @Override
+ public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
+ String value = characteristic.getStringValue(0);
+ UUID uid = characteristic.getUuid();
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicWrite: characteristic.val=" + value + " status=" + status + " uid=" + uid);
+ }
+ }
+ };
+
+ private final ScanCallback mScanCallback = new ScanCallback() {
+ @Override
+ public void onScanResult(int callbackType, ScanResult result) {
+ if (mBluetoothGatt == null) {
+ stopScan();
+ mBluetoothGatt = BleClientService.connectGatt(result.getDevice(), mContext, false, mSecure, mGattCallbacks);
+ }
+ }
+ };
+
+ private void startScan() {
+ if (DEBUG) {
+ Log.d(TAG, "startScan");
+ }
+ if (!mBluetoothAdapter.isEnabled()) {
+ notifyBluetoothDisabled();
+ } else {
+ List<ScanFilter> filter = Arrays.asList(new ScanFilter.Builder().setServiceUuid(
+ new ParcelUuid(BleConnectionPriorityServerService.ADV_SERVICE_UUID)).build());
+ ScanSettings setting = new ScanSettings.Builder()
+ .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
+ mScanner.startScan(filter, setting, mScanCallback);
+ }
+ }
+
+ private void stopScan() {
+ if (DEBUG) {
+ Log.d(TAG, "stopScan");
+ }
+ if (mScanner != null) {
+ mScanner.stopScan(mScanCallback);
+ }
+ }
+
+ private void notifyMismatchSecure() {
+ Intent intent = new Intent(ACTION_BLUETOOTH_MISMATCH_SECURE);
+ sendBroadcast(intent);
+ }
+
+ private void notifyMismatchInsecure() {
+ Intent intent = new Intent(ACTION_BLUETOOTH_MISMATCH_INSECURE);
+ sendBroadcast(intent);
+ }
+
+ private void notifyDisconnect() {
+ Intent intent = new Intent(ACTION_FINISH_DISCONNECT);
+ sendBroadcast(intent);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityServerBaseActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityServerBaseActivity.java
new file mode 100644
index 0000000..c0a2f09
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityServerBaseActivity.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleConnectionPriorityServerBaseActivity extends PassFailButtons.Activity {
+
+ public static final int CONNECTION_PRIORITY_HIGH = 0;
+ public static final int CONNECTION_PRIORITY_BALANCED = 1;
+ public static final int CONNECTION_PRIORITY_LOW_POWER = 2;
+
+ private long mAverageBalanced = -1;
+ private long mAverageHigh = -1;
+ private long mAverageLow = -1;
+
+ private TestAdapter mTestAdapter;
+
+ private Dialog mDialog;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.ble_connection_priority_server_test);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_connection_priority_server_name,
+ R.string.ble_connection_priority_server_info, -1);
+
+ getPassButton().setEnabled(false);
+
+ mTestAdapter = new TestAdapter(this, setupTestList());
+ ListView listView = (ListView) findViewById(R.id.ble_server_connection_tests);
+ listView.setAdapter(mTestAdapter);
+
+ startService(new Intent(this, BleConnectionPriorityServerService.class));
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BleConnectionPriorityServerService.ACTION_BLUETOOTH_DISABLED);
+ filter.addAction(BleConnectionPriorityServerService.ACTION_CONNECTION_WRITE_REQUEST);
+ filter.addAction(BleConnectionPriorityServerService.ACTION_FINICH_CONNECTION_PRIORITY_HIGHT);
+ filter.addAction(BleConnectionPriorityServerService.ACTION_FINICH_CONNECTION_PRIORITY_BALANCED);
+ filter.addAction(BleConnectionPriorityServerService.ACTION_FINICH_CONNECTION_PRIORITY_LOW);
+ filter.addAction(BleServerService.BLE_ADVERTISE_UNSUPPORTED);
+ filter.addAction(BleServerService.BLE_OPEN_FAIL);
+ filter.addAction(BleConnectionPriorityServerService.ACTION_START_CONNECTION_PRIORITY_TEST);
+ registerReceiver(mBroadcast, filter);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ unregisterReceiver(mBroadcast);
+ closeDialog();
+ }
+
+ private List<Integer> setupTestList() {
+ ArrayList<Integer> testList = new ArrayList<Integer>();
+ testList.add(R.string.ble_connection_priority_client_high);
+ testList.add(R.string.ble_connection_priority_client_balanced);
+ testList.add(R.string.ble_connection_priority_client_low);
+ return testList;
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(new Intent(this, BleConnectionPriorityServerService.class));
+ }
+
+ private void closeDialog() {
+ if (mDialog != null) {
+ mDialog.dismiss();
+ mDialog = null;
+ }
+ }
+
+ private void showErrorDialog(int titleId, int messageId, boolean finish) {
+ closeDialog();
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(this)
+ .setTitle(titleId)
+ .setMessage(messageId);
+ if (finish) {
+ builder.setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ });
+ }
+ mDialog = builder.create();
+ mDialog.show();
+ }
+
+ private BroadcastReceiver mBroadcast = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ long average = intent.getLongExtra(BleConnectionPriorityServerService.EXTRA_AVERAGE, -1);
+ switch (action) {
+ case BleConnectionPriorityServerService.ACTION_BLUETOOTH_DISABLED:
+ new AlertDialog.Builder(context)
+ .setTitle(R.string.ble_bluetooth_disable_title)
+ .setMessage(R.string.ble_bluetooth_disable_message)
+ .setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ })
+ .create().show();
+ break;
+ case BleConnectionPriorityServerService.ACTION_START_CONNECTION_PRIORITY_TEST:
+ showProgressDialog();
+ break;
+ case BleConnectionPriorityServerService.ACTION_FINICH_CONNECTION_PRIORITY_HIGHT:
+ mAverageHigh = average;
+ mAverageBalanced = -1;
+ mAverageLow = -1;
+ break;
+ case BleConnectionPriorityServerService.ACTION_FINICH_CONNECTION_PRIORITY_BALANCED:
+ mAverageBalanced = average;
+ break;
+ case BleConnectionPriorityServerService.ACTION_FINICH_CONNECTION_PRIORITY_LOW:
+ mAverageLow = average;
+ break;
+ case BleServerService.BLE_OPEN_FAIL:
+ setTestResultAndFinish(false);
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Toast.makeText(BleConnectionPriorityServerBaseActivity.this, R.string.bt_open_failed_message, Toast.LENGTH_SHORT).show();
+ }
+ });
+ break;
+ case BleServerService.BLE_ADVERTISE_UNSUPPORTED:
+ showErrorDialog(R.string.bt_advertise_unsupported_title, R.string.bt_advertise_unsupported_message, true);
+ break;
+ }
+
+ boolean passedHigh = (mAverageHigh >= 0);
+ boolean passedAll = false;
+
+ if (passedHigh) {
+ mTestAdapter.setTestPass(CONNECTION_PRIORITY_HIGH);
+ }
+
+ if (passedHigh && (mAverageLow >= 0) && (mAverageBalanced >= 0)) {
+ boolean passedBalanced = (mAverageHigh <= mAverageBalanced);
+ boolean passedLow = (mAverageBalanced <= mAverageLow);
+
+ if (passedBalanced) {
+ mTestAdapter.setTestPass(CONNECTION_PRIORITY_BALANCED);
+ }
+ if (passedLow) {
+ mTestAdapter.setTestPass(CONNECTION_PRIORITY_LOW_POWER);
+ }
+
+ String resultMsg;
+ if (passedBalanced && passedLow) {
+ resultMsg = getString(R.string.ble_server_connection_priority_result_passed);
+ passedAll = true;
+ } else {
+ String detailsMsg = String.format(getString(R.string.ble_server_connection_priority_result_intervals),
+ mAverageHigh,
+ mAverageBalanced,
+ mAverageLow);
+ resultMsg = getString(R.string.ble_server_connection_priority_result_failed)
+ + "\n\n"
+ + detailsMsg;
+ }
+
+ closeDialog();
+ mDialog = new AlertDialog.Builder(BleConnectionPriorityServerBaseActivity.this)
+ .setMessage(resultMsg)
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ closeDialog();
+ }
+ })
+ .setOnCancelListener(new DialogInterface.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ closeDialog();
+ }
+ })
+ .create();
+ mDialog.show();
+ }
+
+ getPassButton().setEnabled(passedAll);
+ mTestAdapter.notifyDataSetChanged();
+ }
+ };
+
+ private synchronized void showProgressDialog() {
+ closeDialog();
+
+ ProgressDialog dialog = new ProgressDialog(this);
+ dialog.setTitle(R.string.ble_test_running);
+ dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+ dialog.setMessage(getString(R.string.ble_test_running_message));
+ dialog.setCanceledOnTouchOutside(false);
+ mDialog = dialog;
+ mDialog.show();
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityServerService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityServerService.java
new file mode 100644
index 0000000..e1e4eed
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleConnectionPriorityServerService.java
@@ -0,0 +1,418 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.app.Service;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGatt;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattDescriptor;
+import android.bluetooth.BluetoothGattServer;
+import android.bluetooth.BluetoothGattServerCallback;
+import android.bluetooth.BluetoothGattService;
+import android.bluetooth.BluetoothManager;
+import android.bluetooth.BluetoothProfile;
+import android.bluetooth.le.AdvertiseCallback;
+import android.bluetooth.le.AdvertiseData;
+import android.bluetooth.le.AdvertiseSettings;
+import android.bluetooth.le.BluetoothLeAdvertiser;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.ParcelUuid;
+import android.util.Log;
+import android.widget.Toast;
+
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.UUID;
+
+public class BleConnectionPriorityServerService extends Service {
+ public static final boolean DEBUG = true;
+ public static final String TAG = "BlePriorityServer";
+ private static final String RESET_COUNT_VALUE = "RESET";
+ private static final String START_VALUE = "START";
+ private static final String STOP_VALUE = "STOP";
+ public static final String CONNECTION_PRIORITY_HIGH = "PR_H";
+ public static final String CONNECTION_PRIORITY_BALANCED = "PR_B";
+ public static final String CONNECTION_PRIORITY_LOW_POWER = "PR_L";
+
+ public static final String ACTION_BLUETOOTH_DISABLED =
+ "com.android.cts.verifier.bluetooth.action.BLUETOOTH_DISABLED";
+
+ public static final String ACTION_CONNECTION_WRITE_REQUEST =
+ "com.android.cts.verifier.bluetooth.action.CONNECTION_WRITE_REQUEST";
+ public static final String EXTRA_REQUEST_COUNT =
+ "com.android.cts.verifier.bluetooth.intent.EXTRA_REQUEST_COUNT";
+ public static final String ACTION_FINICH_CONNECTION_PRIORITY_HIGHT =
+ "com.android.cts.verifier.bluetooth.action.ACTION_FINICH_CONNECTION_PRIORITY_HIGHT";
+ public static final String ACTION_FINICH_CONNECTION_PRIORITY_BALANCED =
+ "com.android.cts.verifier.bluetooth.action.ACTION_FINICH_CONNECTION_PRIORITY_BALANCED";
+ public static final String ACTION_FINICH_CONNECTION_PRIORITY_LOW =
+ "com.android.cts.verifier.bluetooth.action.ACTION_FINICH_CONNECTION_PRIORITY_LOW";
+
+ public static final String ACTION_START_CONNECTION_PRIORITY_TEST =
+ "com.android.cts.verifier.bluetooth.action.ACTION_START_CONNECTION_PRIORITY_TEST";
+
+ public static final String EXTRA_AVERAGE =
+ "com.android.cts.verifier.bluetooth.intent.EXTRA_AVERAGE";
+
+ private static final UUID SERVICE_UUID =
+ UUID.fromString("00009999-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_UUID =
+ UUID.fromString("00009998-0000-1000-8000-00805f9b34fb");
+ private static final UUID START_CHARACTERISTIC_UUID =
+ UUID.fromString("00009997-0000-1000-8000-00805f9b34fb");
+ private static final UUID STOP_CHARACTERISTIC_UUID =
+ UUID.fromString("00009995-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_UUID =
+ UUID.fromString("00009996-0000-1000-8000-00805f9b34fb");
+ public static final UUID ADV_SERVICE_UUID=
+ UUID.fromString("00002222-0000-1000-8000-00805f9b34fb");
+
+ private BluetoothManager mBluetoothManager;
+ private BluetoothGattServer mGattServer;
+ private BluetoothGattService mService;
+ private BluetoothDevice mDevice;
+ private Handler mHandler;
+ private BluetoothLeAdvertiser mAdvertiser;
+ private long mReceiveWriteCount;
+ private Timer mTimeoutTimer;
+ private TimerTask mTimeoutTimerTask;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+ mAdvertiser = mBluetoothManager.getAdapter().getBluetoothLeAdvertiser();
+ mGattServer = mBluetoothManager.openGattServer(this, mCallbacks);
+ mService = createService();
+ if ((mGattServer != null) && (mAdvertiser != null)) {
+ mGattServer.addService(mService);
+ }
+ mDevice = null;
+ mHandler = new Handler();
+
+ if (!mBluetoothManager.getAdapter().isEnabled()) {
+ notifyBluetoothDisabled();
+ } else if (mGattServer == null) {
+ notifyOpenFail();
+ } else if (mAdvertiser == null) {
+ notifyAdvertiseUnsupported();
+ } else {
+ startAdvertise();
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+
+ cancelTimeoutTimer(false);
+
+ if (mTimeoutTimer != null) {
+ mTimeoutTimer.cancel();
+ mTimeoutTimer = null;
+ }
+ mTimeoutTimerTask = null;
+
+ stopAdvertise();
+ if (mGattServer == null) {
+ return;
+ }
+ if (mDevice != null) {
+ mGattServer.cancelConnection(mDevice);
+ }
+ mGattServer.clearServices();
+ mGattServer.close();
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ return START_NOT_STICKY;
+ }
+
+ private void notifyBluetoothDisabled() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyBluetoothDisabled");
+ }
+ Intent intent = new Intent(ACTION_BLUETOOTH_DISABLED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyTestStart() {
+ Intent intent = new Intent(BleConnectionPriorityServerService.ACTION_START_CONNECTION_PRIORITY_TEST);
+ sendBroadcast(intent);
+ }
+
+ private void notifyOpenFail() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyOpenFail");
+ }
+ Intent intent = new Intent(BleServerService.BLE_OPEN_FAIL);
+ sendBroadcast(intent);
+ }
+
+ private void notifyAdvertiseUnsupported() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyAdvertiseUnsupported");
+ }
+ Intent intent = new Intent(BleServerService.BLE_ADVERTISE_UNSUPPORTED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyConnected() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyConnected");
+ }
+ }
+
+ private void notifyDisconnected() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyDisconnected");
+ }
+ }
+
+ private void notifyServiceAdded() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyServiceAdded");
+ }
+ }
+
+ private void notifyCharacteristicWriteRequest() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicWriteRequest");
+ }
+ Intent intent = new Intent(ACTION_CONNECTION_WRITE_REQUEST);
+ intent.putExtra(EXTRA_REQUEST_COUNT, String.valueOf(mReceiveWriteCount));
+ sendBroadcast(intent);
+ }
+
+ private void showMessage(final String msg) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
+ }
+ });
+ }
+
+ private synchronized void cancelTimeoutTimer(boolean runTimeout) {
+ if (mTimeoutTimerTask != null) {
+ mTimeoutTimer.cancel();
+ if (runTimeout) {
+ mTimeoutTimerTask.run();
+ }
+ mTimeoutTimerTask = null;
+ mTimeoutTimer = null;
+ }
+ }
+
+ private BluetoothGattService createService() {
+ BluetoothGattService service =
+ new BluetoothGattService(SERVICE_UUID, BluetoothGattService.SERVICE_TYPE_PRIMARY);
+ // add characteristic to service
+ // property: 0x0A (read, write)
+ // permission: 0x11 (read, write)
+ BluetoothGattCharacteristic characteristic =
+ new BluetoothGattCharacteristic(CHARACTERISTIC_UUID, 0x0A, 0x11);
+ BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor(DESCRIPTOR_UUID, 0x11);
+ characteristic.addDescriptor(descriptor);
+ service.addCharacteristic(characteristic);
+ characteristic = new BluetoothGattCharacteristic(START_CHARACTERISTIC_UUID, 0x0A, 0x11);
+ characteristic.addDescriptor(descriptor);
+ service.addCharacteristic(characteristic);
+ characteristic = new BluetoothGattCharacteristic(STOP_CHARACTERISTIC_UUID, 0x0A, 0x11);
+ characteristic.addDescriptor(descriptor);
+ service.addCharacteristic(characteristic);
+
+ return service;
+ }
+
+ private final BluetoothGattServerCallback mCallbacks = new BluetoothGattServerCallback() {
+ @Override
+ public void onConnectionStateChange(BluetoothDevice device, int status, int newState) {
+ if (DEBUG) {
+ Log.d(TAG, "onConnectionStateChange: newState=" + newState);
+ }
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ if (newState == BluetoothProfile.STATE_CONNECTED) {
+ mDevice = device;
+ notifyConnected();
+ } else if (status == BluetoothProfile.STATE_DISCONNECTED) {
+ cancelTimeoutTimer(true);
+ notifyDisconnected();
+ mDevice = null;
+ }
+ }
+ }
+
+ @Override
+ public void onServiceAdded(int status, BluetoothGattService service) {
+ if (DEBUG) {
+ Log.d(TAG, "onServiceAdded()");
+ }
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ notifyServiceAdded();
+ }
+ }
+
+ String mPriority = null;
+
+ @Override
+ public void onCharacteristicWriteRequest(BluetoothDevice device, int requestId,
+ BluetoothGattCharacteristic characteristic,
+ boolean preparedWrite, boolean responseNeeded,
+ int offset, byte[] value) {
+ if (mGattServer == null) {
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
+ return;
+ }
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicWriteRequest: preparedWrite=" + preparedWrite);
+ }
+
+ if (characteristic.getUuid().equals(START_CHARACTERISTIC_UUID)) {
+ // time out if previous measurement is running
+ cancelTimeoutTimer(true);
+
+ mPriority = new String(value);
+ Log.d(TAG, "Start Count Up. Priority is " + mPriority);
+ if (BleConnectionPriorityServerService.CONNECTION_PRIORITY_HIGH.equals(mPriority)) {
+ notifyTestStart();
+ }
+
+ // start timeout timer
+ mTimeoutTimer = new Timer(getClass().getName() + "_TimeoutTimer");
+ mTimeoutTimerTask = new TimerTask() {
+ @Override
+ public void run() {
+ // measurement timed out
+ mTimeoutTimerTask = null;
+ mTimeoutTimer = null;
+ mReceiveWriteCount = 0;
+ notifyMeasurementFinished(mPriority, Long.MAX_VALUE);
+ }
+ };
+ mTimeoutTimer.schedule(mTimeoutTimerTask, (BleConnectionPriorityClientService.DEFAULT_PERIOD * 2));
+
+ mReceiveWriteCount = 0;
+ } else if (characteristic.getUuid().equals(STOP_CHARACTERISTIC_UUID)) {
+ boolean isRunning = (mTimeoutTimerTask != null);
+ cancelTimeoutTimer(false);
+
+ String valeStr = new String(value);
+ String priority = null;
+ int writeCount = -1;
+ int sep = valeStr.indexOf(",");
+ if (sep > 0) {
+ priority = valeStr.substring(0, sep);
+ writeCount = Integer.valueOf(valeStr.substring(sep + 1));
+ }
+
+ if ((mPriority != null) && isRunning) {
+ if (mPriority.equals(priority)) {
+ long averageTime = BleConnectionPriorityClientService.DEFAULT_PERIOD / mReceiveWriteCount;
+ notifyMeasurementFinished(mPriority, averageTime);
+ Log.d(TAG, "Received " + mReceiveWriteCount + " of " + writeCount + " messages");
+ } else {
+ Log.d(TAG, "Connection priority does not match");
+ showMessage("Connection priority does not match");
+ }
+ } else {
+ Log.d(TAG, "Not Start Count UP.");
+ }
+ mReceiveWriteCount = 0;
+ } else {
+ if (mTimeoutTimerTask != null) {
+ ++mReceiveWriteCount;
+ }
+ if (!preparedWrite) {
+ characteristic.setValue(value);
+ }
+ }
+
+ if (responseNeeded) {
+ mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, 0, null);
+ }
+ }
+ };
+
+ private void notifyMeasurementFinished(String priority, long averageTime) {
+ Intent intent = new Intent();
+ intent.putExtra(EXTRA_AVERAGE, averageTime);
+ switch (priority) {
+ case CONNECTION_PRIORITY_HIGH:
+ intent.setAction(ACTION_FINICH_CONNECTION_PRIORITY_HIGHT);
+ break;
+ case CONNECTION_PRIORITY_BALANCED:
+ intent.setAction(ACTION_FINICH_CONNECTION_PRIORITY_BALANCED);
+ break;
+ case CONNECTION_PRIORITY_LOW_POWER:
+ intent.setAction(ACTION_FINICH_CONNECTION_PRIORITY_LOW);
+ break;
+ }
+ sendBroadcast(intent);
+ }
+
+ private final AdvertiseCallback mAdvertiseCallback = new AdvertiseCallback() {
+ @Override
+ public void onStartFailure(int errorCode) {
+ super.onStartFailure(errorCode);
+ if (errorCode == ADVERTISE_FAILED_FEATURE_UNSUPPORTED) {
+ notifyAdvertiseUnsupported();
+ } else {
+ notifyOpenFail();
+ }
+ }
+ };
+
+ private void startAdvertise() {
+ if (DEBUG) {
+ Log.d(TAG, "startAdvertise");
+ }
+ AdvertiseData data = new AdvertiseData.Builder()
+ .addServiceData(new ParcelUuid(ADV_SERVICE_UUID), new byte[]{1, 2, 3})
+ .addServiceUuid(new ParcelUuid(ADV_SERVICE_UUID))
+ .build();
+ AdvertiseSettings setting = new AdvertiseSettings.Builder()
+ .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY)
+ .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM)
+ .setConnectable(true)
+ .build();
+ mAdvertiser.startAdvertising(setting, data, mAdvertiseCallback);
+ }
+
+ private void stopAdvertise() {
+ if (DEBUG) {
+ Log.d(TAG, "stopAdvertise");
+ }
+ if (mAdvertiser != null) {
+ mAdvertiser.stopAdvertising(mAdvertiseCallback);
+ }
+ }
+
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedClientBaseActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedClientBaseActivity.java
new file mode 100644
index 0000000..3d2b840
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedClientBaseActivity.java
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothManager;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ListView;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleEncryptedClientBaseActivity extends PassFailButtons.Activity {
+
+ private TestAdapter mTestAdapter;
+ private int mAllPassed;
+ private Dialog mDialog;
+ private Handler mHandler;
+
+ private final int BLE_READ_ENCRIPTED_CHARACTERISTIC = 0;
+ private final int BLE_WRITE_ENCRIPTED_CHARACTERISTIC = 1;
+ private final int BLE_READ_ENCRIPTED_DESCRIPTOR = 2;
+ private final int BLE_WRITE_ENCRIPTED_DESCRIPTOR = 3;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.ble_encrypted_client_test);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_encrypted_client_name,
+ R.string.ble_encrypted_client_info, -1);
+ getPassButton().setEnabled(false);
+
+ mHandler = new Handler();
+
+ mTestAdapter = new TestAdapter(this, setupTestList());
+ ListView listView = (ListView) findViewById(R.id.ble_client_enctypted_tests);
+ listView.setAdapter(mTestAdapter);
+ listView.setOnItemClickListener(new ListView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
+ Intent intent = new Intent(BleEncryptedClientBaseActivity.this, BleEncryptedClientService.class);
+ Log.v(getLocalClassName(), "onItemClick()");
+ switch (position) {
+ case BLE_WRITE_ENCRIPTED_CHARACTERISTIC:
+ intent.setAction(BleEncryptedClientService.ACTION_WRITE_ENCRYPTED_CHARACTERISTIC);
+ break;
+ case BLE_READ_ENCRIPTED_CHARACTERISTIC:
+ intent.setAction(BleEncryptedClientService.ACTION_READ_ENCRYPTED_CHARACTERISTIC);
+ break;
+ case BLE_WRITE_ENCRIPTED_DESCRIPTOR:
+ intent.setAction(BleEncryptedClientService.ACTION_WRITE_ENCRYPTED_DESCRIPTOR);
+ break;
+ case BLE_READ_ENCRIPTED_DESCRIPTOR:
+ intent.setAction(BleEncryptedClientService.ACTION_READ_ENCRYPTED_DESCRIPTOR);
+ break;
+ default:
+ return;
+ }
+ startService(intent);
+ showProgressDialog();
+ }
+ });
+
+ mAllPassed = 0;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_BLUETOOTH_DISABLED);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_WRITE_ENCRYPTED_CHARACTERISTIC);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_READ_ENCRYPTED_CHARACTERISTIC);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_WRITE_ENCRYPTED_DESCRIPTOR);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_READ_ENCRYPTED_DESCRIPTOR);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_WRITE_NOT_ENCRYPTED_CHARACTERISTIC);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_READ_NOT_ENCRYPTED_CHARACTERISTIC);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_WRITE_NOT_ENCRYPTED_DESCRIPTOR);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_READ_NOT_ENCRYPTED_DESCRIPTOR);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_WRITE_FAIL_ENCRYPTED_CHARACTERISTIC);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_READ_FAIL_ENCRYPTED_CHARACTERISTIC);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_WRITE_FAIL_ENCRYPTED_DESCRIPTOR);
+ filter.addAction(BleEncryptedClientService.INTENT_BLE_READ_FAIL_ENCRYPTED_DESCRIPTOR);
+ filter.addAction(BleEncryptedClientService.ACTION_DISCONNECTED);
+ registerReceiver(mBroadcast, filter);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ unregisterReceiver(mBroadcast);
+ closeDialog();
+ }
+
+ private List<Integer> setupTestList() {
+ ArrayList<Integer> testList = new ArrayList<Integer>();
+ testList.add(R.string.ble_read_authenticated_characteristic_name);
+ testList.add(R.string.ble_write_authenticated_characteristic_name);
+ testList.add(R.string.ble_read_authenticated_descriptor_name);
+ testList.add(R.string.ble_write_authenticated_descriptor_name);
+ return testList;
+ }
+
+ private void showErrorDialog(String title, String message, boolean finish) {
+ closeDialog();
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(this)
+ .setTitle(title)
+ .setMessage(message);
+ if (finish) {
+ builder.setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ });
+ }
+ builder.create().show();
+ }
+
+ private synchronized void closeDialog() {
+ if (mDialog != null) {
+ mDialog.dismiss();
+ mDialog = null;
+ }
+ }
+
+ private synchronized void showProgressDialog() {
+ closeDialog();
+
+ ProgressDialog dialog = new ProgressDialog(this);
+ dialog.setTitle(R.string.ble_test_running);
+ dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+ dialog.setMessage(getString(R.string.ble_test_running_message));
+ dialog.setCanceledOnTouchOutside(false);
+ mDialog = dialog;
+ mDialog.show();
+ }
+
+ public boolean shouldRebootBluetoothAfterTest() {
+ return false;
+ }
+
+ public boolean isSecure() { return false; }
+
+ private BroadcastReceiver mBroadcast = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ switch (action) {
+ case BleEncryptedClientService.INTENT_BLE_BLUETOOTH_DISABLED:
+ showErrorDialog(getString(R.string.ble_bluetooth_disable_title), getString(R.string.ble_bluetooth_disable_message), true);
+ break;
+ case BleEncryptedClientService.INTENT_BLE_WRITE_ENCRYPTED_CHARACTERISTIC:
+ mTestAdapter.setTestPass(BLE_WRITE_ENCRIPTED_CHARACTERISTIC);
+ mAllPassed |= 0x01;
+ if (!isSecure()) {
+ closeDialog();
+ }
+ break;
+ case BleEncryptedClientService.INTENT_BLE_READ_ENCRYPTED_CHARACTERISTIC:
+ mTestAdapter.setTestPass(BLE_READ_ENCRIPTED_CHARACTERISTIC);
+ mAllPassed |= 0x02;
+ if (!isSecure()) {
+ closeDialog();
+ }
+ break;
+ case BleEncryptedClientService.INTENT_BLE_WRITE_ENCRYPTED_DESCRIPTOR:
+ mTestAdapter.setTestPass(BLE_WRITE_ENCRIPTED_DESCRIPTOR);
+ mAllPassed |= 0x04;
+ if (!isSecure()) {
+ closeDialog();
+ }
+ break;
+ case BleEncryptedClientService.INTENT_BLE_READ_ENCRYPTED_DESCRIPTOR:
+ mTestAdapter.setTestPass(BLE_READ_ENCRIPTED_DESCRIPTOR);
+ mAllPassed |= 0x08;
+ if (!isSecure()) {
+ closeDialog();
+ }
+ break;
+ case BleEncryptedClientService.INTENT_BLE_WRITE_NOT_ENCRYPTED_CHARACTERISTIC:
+ showErrorDialog(getString(R.string.ble_encrypted_client_name), getString(R.string.ble_encrypted_client_no_encrypted_characteristic), false);
+ break;
+ case BleEncryptedClientService.INTENT_BLE_READ_NOT_ENCRYPTED_CHARACTERISTIC:
+ showErrorDialog(getString(R.string.ble_encrypted_client_name), getString(R.string.ble_encrypted_client_no_encrypted_characteristic), false);
+ break;
+ case BleEncryptedClientService.INTENT_BLE_WRITE_NOT_ENCRYPTED_DESCRIPTOR:
+ showErrorDialog(getString(R.string.ble_encrypted_client_name), getString(R.string.ble_encrypted_client_no_encrypted_descriptor), false);
+ break;
+ case BleEncryptedClientService.INTENT_BLE_READ_NOT_ENCRYPTED_DESCRIPTOR:
+ showErrorDialog(getString(R.string.ble_encrypted_client_name), getString(R.string.ble_encrypted_client_no_encrypted_descriptor), false);
+ break;
+
+ case BleEncryptedClientService.INTENT_BLE_WRITE_FAIL_ENCRYPTED_CHARACTERISTIC:
+ showErrorDialog(getString(R.string.ble_encrypted_client_name), getString(R.string.ble_encrypted_client_fail_write_encrypted_characteristic), false);
+ break;
+ case BleEncryptedClientService.INTENT_BLE_READ_FAIL_ENCRYPTED_CHARACTERISTIC:
+ showErrorDialog(getString(R.string.ble_encrypted_client_name), getString(R.string.ble_encrypted_client_fail_read_encrypted_characteristic), false);
+ break;
+ case BleEncryptedClientService.INTENT_BLE_WRITE_FAIL_ENCRYPTED_DESCRIPTOR:
+ showErrorDialog(getString(R.string.ble_encrypted_client_name), getString(R.string.ble_encrypted_client_fail_write_encrypted_descriptor), false);
+ break;
+ case BleEncryptedClientService.INTENT_BLE_READ_FAIL_ENCRYPTED_DESCRIPTOR:
+ showErrorDialog(getString(R.string.ble_encrypted_client_name), getString(R.string.ble_encrypted_client_fail_read_encrypted_descriptor), false);
+ break;
+
+ case BleEncryptedClientService.ACTION_DISCONNECTED:
+ if (shouldRebootBluetoothAfterTest()) {
+ mBtPowerSwitcher.executeSwitching();
+ } else {
+ closeDialog();
+ }
+ break;
+ }
+
+ mTestAdapter.notifyDataSetChanged();
+ if (mAllPassed == 0x0F) {
+ getPassButton().setEnabled(true);
+ }
+ }
+ };
+
+ private static final long BT_ON_DELAY = 10000;
+ private final BluetoothPowerSwitcher mBtPowerSwitcher = new BluetoothPowerSwitcher();
+ private class BluetoothPowerSwitcher extends BroadcastReceiver {
+
+ private boolean mIsSwitching = false;
+ private BluetoothAdapter mAdapter;
+
+ public void executeSwitching() {
+ if (mAdapter == null) {
+ BluetoothManager btMgr = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+ mAdapter = btMgr.getAdapter();
+ }
+
+ if (!mIsSwitching) {
+ IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
+ registerReceiver(this, filter);
+ mIsSwitching = true;
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mAdapter.disable();
+ }
+ }, 1000);
+ }
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+ int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
+ if (state == BluetoothAdapter.STATE_OFF) {
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mAdapter.enable();
+ }
+ }, BT_ON_DELAY);
+ } else if (state == BluetoothAdapter.STATE_ON) {
+ mIsSwitching = false;
+ unregisterReceiver(this);
+ getPassButton().setEnabled(true);
+ closeDialog();
+ }
+ }
+ }
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedClientService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedClientService.java
new file mode 100644
index 0000000..68797f5
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedClientService.java
@@ -0,0 +1,582 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.app.Service;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGatt;
+import android.bluetooth.BluetoothGattCallback;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattDescriptor;
+import android.bluetooth.BluetoothGattService;
+import android.bluetooth.BluetoothManager;
+import android.bluetooth.BluetoothProfile;
+import android.bluetooth.le.BluetoothLeScanner;
+import android.bluetooth.le.ScanCallback;
+import android.bluetooth.le.ScanFilter;
+import android.bluetooth.le.ScanResult;
+import android.bluetooth.le.ScanSettings;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.ParcelUuid;
+import android.util.Log;
+import android.widget.Toast;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+public class BleEncryptedClientService extends Service {
+ public static final boolean DEBUG = true;
+ public static final String TAG = "BleEncryptedClient";
+
+ public static final String ACTION_CONNECT_WITH_SECURE =
+ "com.android.cts.verifier.bluetooth.encripted.action.ACTION_CONNECT_WITH_SECURE";
+ public static final String ACTION_CONNECT_WITHOUT_SECURE =
+ "com.android.cts.verifier.bluetooth.encripted.action.ACTION_CONNECT_WITHOUT_SECURE";
+
+ public static final String INTENT_BLE_BLUETOOTH_DISABLED =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLE_BLUETOOTH_DISABLED";
+ public static final String INTENT_BLE_WRITE_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLE_WRITE_ENCRYPTED_CHARACTERISTIC";
+ public static final String INTENT_BLE_WRITE_NOT_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLE_WRITE_NOT_ENCRYPTED_CHARACTERISTIC";
+ public static final String INTENT_BLE_READ_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLE_READ_ENCRYPTED_CHARACTERISTIC";
+ public static final String INTENT_BLE_READ_NOT_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLE_READ_NOT_ENCRYPTED_CHARACTERISTIC";
+ public static final String INTENT_BLE_WRITE_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLE_WRITE_ENCRYPTED_DESCRIPTOR";
+ public static final String INTENT_BLE_WRITE_NOT_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLE_WRITE_NOT_ENCRYPTED_DESCRIPTOR";
+ public static final String INTENT_BLE_READ_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLE_READ_ENCRYPTED_DESCRIPTOR";
+ public static final String INTENT_BLE_READ_NOT_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLE_READ_NOT_ENCRYPTED_DESCRIPTOR";
+ public static final String INTENT_BLE_WRITE_FAIL_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.intent.INTENT_BLE_WRITE_FAIL_ENCRYPTED_CHARACTERISTIC";
+ public static final String INTENT_BLE_READ_FAIL_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.intent.INTENT_BLE_READ_FAIL_ENCRYPTED_CHARACTERISTIC";
+ public static final String INTENT_BLE_WRITE_FAIL_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.intent.INTENT_BLE_WRITE_FAIL_ENCRYPTED_DESCRIPTOR";
+ public static final String INTENT_BLE_READ_FAIL_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.intent.INTENT_BLE_READ_FAIL_ENCRYPTED_DESCRIPTOR";
+
+ public static final String ACTION_WRITE_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.action.WRITE_ENCRYPTED_CHARACTERISTIC";
+ public static final String ACTION_READ_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.action.READ_ENCRYPTED_CHARACTERISTIC";
+ public static final String ACTION_WRITE_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.action.WRITE_ENCRYPTED_DESCRIPTOR";
+ public static final String ACTION_READ_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.action.READ_ENCRYPTED_DESCRIPTOR";
+
+ public static final String ACTION_DISCONNECTED =
+ "com.android.cts.verifier.bluetooth.encripted.action.DISCONNECTED";
+
+ public static final String WRITE_VALUE = "ENC_CLIENT_TEST";
+
+ private static final UUID SERVICE_UUID =
+ UUID.fromString("00009999-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_UUID =
+ UUID.fromString("00009998-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_UUID =
+ UUID.fromString("00009997-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_ENCRYPTED_WRITE_UUID =
+ UUID.fromString("00009996-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_ENCRYPTED_READ_UUID =
+ UUID.fromString("00009995-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_ENCRYPTED_WRITE_UUID =
+ UUID.fromString("00009994-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_ENCRYPTED_READ_UUID =
+ UUID.fromString("00009993-0000-1000-8000-00805f9b34fb");
+
+ private BluetoothManager mBluetoothManager;
+ private BluetoothAdapter mBluetoothAdapter;
+ private BluetoothGatt mBluetoothGatt;
+ private BluetoothLeScanner mScanner;
+ private BluetoothDevice mDevice;
+ private Handler mHandler;
+ private Context mContext;
+ private String mAction;
+ private boolean mSecure;
+ private String mTarget;
+
+ private String mLastScanError;
+ private TestTaskQueue mTaskQueue;
+
+ public BleEncryptedClientService() {
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ mTaskQueue = new TestTaskQueue(getClass().getName() + "_enc_cli_taskHandlerThread");
+
+ mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+ mBluetoothAdapter = mBluetoothManager.getAdapter();
+
+ mScanner = mBluetoothAdapter.getBluetoothLeScanner();
+ mHandler = new Handler();
+ mContext = this;
+ mSecure = false;
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+
+ mTaskQueue.quit();
+
+ if (mBluetoothGatt != null) {
+ mBluetoothGatt.disconnect();
+ mBluetoothGatt.close();
+ mBluetoothGatt = null;
+ mDevice = null;
+ }
+ stopScan();
+ }
+
+ private void notifyBluetoothDisabled() {
+ Intent intent = new Intent(INTENT_BLE_BLUETOOTH_DISABLED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyDisconnected() {
+ Intent intent = new Intent(ACTION_DISCONNECTED);
+ sendBroadcast(intent);
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ if (!mBluetoothAdapter.isEnabled()) {
+ notifyBluetoothDisabled();
+ } else {
+ if (intent != null) {
+ mAction = intent.getAction();
+ if (mAction == null) {
+ mSecure = intent.getBooleanExtra(BleEncryptedServerService.EXTRA_SECURE, false);
+ } else {
+ switch (mAction) {
+ case ACTION_CONNECT_WITH_SECURE:
+ mSecure = true;
+ break;
+ case ACTION_CONNECT_WITHOUT_SECURE:
+ mSecure = false;
+ break;
+ case ACTION_WRITE_ENCRYPTED_CHARACTERISTIC:
+ mTarget = BleEncryptedServerService.WRITE_CHARACTERISTIC;
+ startScan();
+ break;
+ case ACTION_READ_ENCRYPTED_CHARACTERISTIC:
+ mTarget = BleEncryptedServerService.READ_CHARACTERISTIC;
+ startScan();
+ break;
+ case ACTION_WRITE_ENCRYPTED_DESCRIPTOR:
+ mTarget = BleEncryptedServerService.WRITE_DESCRIPTOR;
+ startScan();
+ break;
+ case ACTION_READ_ENCRYPTED_DESCRIPTOR:
+ mTarget = BleEncryptedServerService.READ_DESCRIPTOR;
+ startScan();
+ break;
+ default:
+ return START_NOT_STICKY;
+ }
+ }
+ }
+ }
+ return START_NOT_STICKY;
+ }
+
+ private BluetoothGattService getService() {
+ BluetoothGattService service = null;
+
+ if (mBluetoothGatt != null) {
+ service = mBluetoothGatt.getService(SERVICE_UUID);
+ if (service == null) {
+ showMessage("Service not found");
+ }
+ }
+ return service;
+ }
+
+ private BluetoothGattCharacteristic getCharacteristic(UUID uuid) {
+ BluetoothGattCharacteristic characteristic = null;
+
+ BluetoothGattService service = getService();
+ if (service != null) {
+ characteristic = service.getCharacteristic(uuid);
+ if (characteristic == null) {
+ showMessage("Characteristic not found");
+ }
+ }
+ return characteristic;
+ }
+
+ private BluetoothGattDescriptor getDescriptor(UUID uid) {
+ BluetoothGattDescriptor descriptor = null;
+
+ BluetoothGattCharacteristic characteristic = getCharacteristic(CHARACTERISTIC_UUID);
+ if (characteristic != null) {
+ descriptor = characteristic.getDescriptor(uid);
+ if (descriptor == null) {
+ showMessage("Descriptor not found");
+ }
+ }
+ return descriptor;
+ }
+
+ private void sleep(int millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "Error in thread sleep", e);
+ }
+ }
+
+ private void startEncryptedAction() {
+ BluetoothGattCharacteristic characteristic;
+ BluetoothGattCharacteristic caseCharacteristic;
+ BluetoothGattDescriptor descriptor;
+ switch (mTarget) {
+ case BleEncryptedServerService.WRITE_CHARACTERISTIC:
+ Log.v(TAG, "WRITE_CHARACTERISTIC");
+ characteristic = getCharacteristic(CHARACTERISTIC_ENCRYPTED_WRITE_UUID);
+ characteristic.setValue(WRITE_VALUE);
+ mBluetoothGatt.writeCharacteristic(characteristic);
+ break;
+ case BleEncryptedServerService.READ_CHARACTERISTIC:
+ Log.v(TAG, "READ_CHARACTERISTIC");
+ characteristic = getCharacteristic(CHARACTERISTIC_ENCRYPTED_READ_UUID);
+ mBluetoothGatt.readCharacteristic(characteristic);
+ break;
+ case BleEncryptedServerService.WRITE_DESCRIPTOR:
+ Log.v(TAG, "WRITE_DESCRIPTOR");
+ descriptor = getDescriptor(DESCRIPTOR_ENCRYPTED_WRITE_UUID);
+ descriptor.setValue(WRITE_VALUE.getBytes());
+ mBluetoothGatt.writeDescriptor(descriptor);
+ break;
+ case BleEncryptedServerService.READ_DESCRIPTOR:
+ Log.v(TAG, "READ_DESCRIPTOR");
+ descriptor = getDescriptor(DESCRIPTOR_ENCRYPTED_READ_UUID);
+ mBluetoothGatt.readDescriptor(descriptor);
+ break;
+ }
+ }
+
+ private void showMessage(final String msg) {
+ mHandler.post(new Runnable() {
+ public void run() {
+ Toast.makeText(BleEncryptedClientService.this, msg, Toast.LENGTH_SHORT).show();
+ }
+ });
+ }
+
+ private final BluetoothGattCallback mGattCallbacks = new BluetoothGattCallback() {
+ @Override
+ public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
+ if (DEBUG) Log.d(TAG, "onConnectionStateChange: status = " + status + ", newState = " + newState);
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ if (newState == BluetoothProfile.STATE_CONNECTED) {
+ showMessage("Bluetooth LE connected");
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ mBluetoothGatt.discoverServices();
+ }
+ }, 1000);
+ } else if (status == BluetoothProfile.STATE_DISCONNECTED) {
+ showMessage("Bluetooth LE disconnected");
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ if (mBluetoothGatt != null) {
+ mBluetoothGatt.close();
+ mBluetoothGatt = null;
+ mTarget = null;
+ mDevice = null;
+ notifyDisconnected();
+ }
+ }
+ }, 1000);
+ }
+ } else {
+ showMessage("Connection Not Success.");
+ if (mTarget != null) {
+ Intent intent;
+ switch (mTarget) {
+ case BleEncryptedServerService.READ_CHARACTERISTIC:
+ intent = new Intent(INTENT_BLE_READ_FAIL_ENCRYPTED_CHARACTERISTIC);
+ break;
+ case BleEncryptedServerService.WRITE_CHARACTERISTIC:
+ if (mSecure) {
+ intent = new Intent(INTENT_BLE_WRITE_FAIL_ENCRYPTED_CHARACTERISTIC);
+ } else {
+ intent = new Intent(INTENT_BLE_WRITE_ENCRYPTED_CHARACTERISTIC);
+ }
+ break;
+ case BleEncryptedServerService.READ_DESCRIPTOR:
+ intent = new Intent(INTENT_BLE_READ_FAIL_ENCRYPTED_DESCRIPTOR);
+ break;
+ case BleEncryptedServerService.WRITE_DESCRIPTOR:
+ if (mSecure) {
+ intent = new Intent(INTENT_BLE_WRITE_FAIL_ENCRYPTED_DESCRIPTOR);
+ } else {
+ intent = new Intent(INTENT_BLE_WRITE_ENCRYPTED_DESCRIPTOR);
+ }
+ break;
+ default:
+ return;
+ }
+ if (mBluetoothGatt != null) {
+ mBluetoothGatt.close();
+ mBluetoothGatt = null;
+ mDevice = null;
+ mTarget = null;
+ }
+ sendBroadcast(intent);
+ }
+ }
+ }
+
+ @Override
+ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
+ if (DEBUG){
+ Log.d(TAG, "onServiceDiscovered");
+ }
+ if ((status == BluetoothGatt.GATT_SUCCESS) && (mBluetoothGatt.getService(SERVICE_UUID) != null)) {
+ showMessage("Service discovered");
+ startEncryptedAction();
+ }
+ }
+
+ @Override
+ public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, final int status) {
+ final String value = characteristic.getStringValue(0);
+ UUID uid = characteristic.getUuid();
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicWrite: characteristic.val=" + value + " status=" + status + " uid=" + uid);
+ }
+
+ if (uid.equals(CHARACTERISTIC_ENCRYPTED_WRITE_UUID)) {
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ if (mSecure) {
+ mBluetoothGatt.disconnect();
+ if (WRITE_VALUE.equals(value)) {
+ Intent intent = new Intent(INTENT_BLE_WRITE_ENCRYPTED_CHARACTERISTIC);
+ sendBroadcast(intent);
+ } else {
+ showMessage("Written data is not correct");
+ }
+ }
+ } else {
+ if (!mSecure) {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_WRITE_NOT_ENCRYPTED_CHARACTERISTIC);
+ sendBroadcast(intent);
+ } else {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_WRITE_FAIL_ENCRYPTED_CHARACTERISTIC);
+ sendBroadcast(intent);
+ }
+ }
+ }
+ }, 1000);
+ }
+ }
+
+ @Override
+ public void onCharacteristicRead(BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic, final int status) {
+ UUID uid = characteristic.getUuid();
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicRead: status=" + status);
+ }
+ if (uid.equals(CHARACTERISTIC_ENCRYPTED_READ_UUID)) {
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ if (mSecure) {
+ mBluetoothGatt.disconnect();
+ if (Arrays.equals(BleEncryptedServerService.WRITE_VALUE.getBytes(), characteristic.getValue())) {
+ Intent intent = new Intent(INTENT_BLE_READ_ENCRYPTED_CHARACTERISTIC);
+ sendBroadcast(intent);
+ } else {
+ showMessage("Read data is not correct");
+ }
+ } else {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_READ_NOT_ENCRYPTED_CHARACTERISTIC);
+ sendBroadcast(intent);
+ }
+ } else {
+ if (!mSecure) {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_READ_ENCRYPTED_CHARACTERISTIC);
+ sendBroadcast(intent);
+ } else {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_READ_FAIL_ENCRYPTED_CHARACTERISTIC);
+ sendBroadcast(intent);
+ }
+ }
+ }
+ }, 1000);
+ }
+ }
+
+ @Override
+ public void onDescriptorRead(BluetoothGatt gatt, final BluetoothGattDescriptor descriptor, final int status) {
+ if (DEBUG) {
+ Log.d(TAG, "onDescriptorRead: status=" + status);
+ }
+
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ UUID uid = descriptor.getUuid();
+ if ((status == BluetoothGatt.GATT_SUCCESS)) {
+ if (uid.equals(DESCRIPTOR_ENCRYPTED_READ_UUID)) {
+ if (mSecure) {
+ mBluetoothGatt.disconnect();
+ if (Arrays.equals(BleEncryptedServerService.WRITE_VALUE.getBytes(), descriptor.getValue())) {
+ Intent intent = new Intent(INTENT_BLE_READ_ENCRYPTED_DESCRIPTOR);
+ sendBroadcast(intent);
+ } else {
+ showMessage("Read data is not correct");
+ }
+ } else {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_READ_NOT_ENCRYPTED_DESCRIPTOR);
+ sendBroadcast(intent);
+ }
+ }
+ } else {
+ if (!mSecure) {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_READ_ENCRYPTED_DESCRIPTOR);
+ sendBroadcast(intent);
+ } else {
+ if (uid.equals(DESCRIPTOR_ENCRYPTED_READ_UUID)) {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_READ_FAIL_ENCRYPTED_DESCRIPTOR);
+ sendBroadcast(intent);
+ }
+ }
+ }
+ }
+ }, 1000);
+ }
+
+ @Override
+ public void onDescriptorWrite(BluetoothGatt gatt, final BluetoothGattDescriptor descriptor, final int status) {
+ if (DEBUG) {
+ Log.d(TAG, "onDescriptorWrite: status=" + status);
+ }
+
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ UUID uid = descriptor.getUuid();
+ if (uid.equals(DESCRIPTOR_ENCRYPTED_WRITE_UUID)) {
+ if ((status == BluetoothGatt.GATT_SUCCESS)) {
+ if (mSecure) {
+ mBluetoothGatt.disconnect();
+ if (Arrays.equals(WRITE_VALUE.getBytes(), descriptor.getValue())) {
+ Intent intent = new Intent(INTENT_BLE_WRITE_ENCRYPTED_DESCRIPTOR);
+ sendBroadcast(intent);
+ } else {
+ showMessage("Written data is not correct");
+ }
+ }
+ } else {
+ if (!mSecure) {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_WRITE_NOT_ENCRYPTED_DESCRIPTOR);
+ sendBroadcast(intent);
+ } else {
+ mBluetoothGatt.disconnect();
+ Intent intent = new Intent(INTENT_BLE_WRITE_FAIL_ENCRYPTED_DESCRIPTOR);
+ sendBroadcast(intent);
+ }
+ }
+ }
+ }
+ }, 1000);
+ }
+ };
+
+ private final ScanCallback mScanCallback = new ScanCallback() {
+ @Override
+ public void onScanResult(int callbackType, final ScanResult result) {
+ if (mBluetoothGatt== null) {
+ mDevice = result.getDevice();
+ int bond_state = mDevice.getBondState();
+ if (mSecure && bond_state != BluetoothDevice.BOND_BONDED) {
+ mLastScanError = "This test is a test of Secure.\n Before running the test, please do the pairing.";
+ return;
+ } else if (!mSecure && bond_state != BluetoothDevice.BOND_NONE) {
+ mLastScanError = "This test is a test of Insecure\n Before running the test, please release the pairing.";
+ return;
+ }
+ mLastScanError = null;
+ stopScan();
+ mBluetoothGatt = BleClientService.connectGatt(mDevice, mContext, false, mSecure, mGattCallbacks);
+ }
+ }
+ };
+
+ private void startScan() {
+ if (DEBUG) Log.d(TAG, "startScan");
+ List<ScanFilter> filter = Arrays.asList(new ScanFilter.Builder().setServiceUuid(
+ new ParcelUuid(BleEncryptedServerService.ADV_SERVICE_UUID)).build());
+ ScanSettings setting = new ScanSettings.Builder()
+ .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
+ mScanner.startScan(filter, setting, mScanCallback);
+
+ mTaskQueue.addTask(new Runnable() {
+ @Override
+ public void run() {
+ if (mLastScanError != null) {
+ stopScan();
+ Toast.makeText(BleEncryptedClientService.this, mLastScanError, Toast.LENGTH_LONG).show();
+ mLastScanError = null;
+ }
+ }
+ }, 10000);
+ }
+
+ private void stopScan() {
+ if (DEBUG) Log.d(TAG, "stopScan");
+ if (mScanner != null) {
+ mScanner.stopScan(mScanCallback);
+ }
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedServerBaseActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedServerBaseActivity.java
new file mode 100644
index 0000000..5639b50
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedServerBaseActivity.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleEncryptedServerBaseActivity extends PassFailButtons.Activity {
+
+ private TestAdapter mTestAdapter;
+ private int mAllPassed;
+
+ private final int WAIT_WRITE_ENCRIPTED_CHARACTERISTIC = 0;
+ private final int WAIT_READ_ENCRIPTED_CHARACTERISTIC = 1;
+ private final int WAIT_WRITE_ENCRIPTED_DESCRIPTOR = 2;
+ private final int WAIT_READ_ENCRIPTED_DESCRIPTOR = 3;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.ble_encrypted_server_test);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_encrypted_server_name,
+ R.string.ble_encrypted_server_info, -1);
+
+ getPassButton().setEnabled(false);
+
+ mTestAdapter = new TestAdapter(this, setupTestList());
+ ListView listView = (ListView) findViewById(R.id.ble_server_enctypted_tests);
+ listView.setAdapter(mTestAdapter);
+
+ startService(new Intent(this, BleEncryptedServerService.class));
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BleEncryptedServerService.INTENT_BLUETOOTH_DISABLED);
+ filter.addAction(BleEncryptedServerService.INTENT_WAIT_WRITE_ENCRYPTED_CHARACTERISTIC);
+ filter.addAction(BleEncryptedServerService.INTENT_WAIT_READ_ENCRYPTED_CHARACTERISTIC);
+ filter.addAction(BleEncryptedServerService.INTENT_WAIT_WRITE_ENCRYPTED_DESCRIPTOR);
+ filter.addAction(BleEncryptedServerService.INTENT_WAIT_READ_ENCRYPTED_DESCRIPTOR);
+ filter.addAction(BleServerService.BLE_ADVERTISE_UNSUPPORTED);
+ filter.addAction(BleServerService.BLE_OPEN_FAIL);
+ registerReceiver(mBroadcast, filter);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ unregisterReceiver(mBroadcast);
+ }
+
+ private List<Integer> setupTestList() {
+ ArrayList<Integer> testList = new ArrayList<Integer>();
+ testList.add(R.string.ble_server_write_characteristic_need_encrypted);
+ testList.add(R.string.ble_server_read_characteristic_need_encrypted);
+ testList.add(R.string.ble_server_write_descriptor_need_encrypted);
+ testList.add(R.string.ble_server_read_descriptor_need_encrypted);
+ return testList;
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(new Intent(this, BleConnectionPriorityServerService.class));
+ }
+
+ private BroadcastReceiver mBroadcast = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ switch (action) {
+ case BleEncryptedServerService.INTENT_BLUETOOTH_DISABLED:
+ new AlertDialog.Builder(context)
+ .setTitle(R.string.ble_bluetooth_disable_title)
+ .setMessage(R.string.ble_bluetooth_disable_message)
+ .setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ })
+ .create().show();
+ break;
+ case BleEncryptedServerService.INTENT_WAIT_WRITE_ENCRYPTED_CHARACTERISTIC:
+ mTestAdapter.setTestPass(WAIT_WRITE_ENCRIPTED_CHARACTERISTIC);
+ mAllPassed |= 0x01;
+ break;
+ case BleEncryptedServerService.INTENT_WAIT_READ_ENCRYPTED_CHARACTERISTIC:
+ mTestAdapter.setTestPass(WAIT_READ_ENCRIPTED_CHARACTERISTIC);
+ mAllPassed |= 0x02;
+ break;
+ case BleEncryptedServerService.INTENT_WAIT_WRITE_ENCRYPTED_DESCRIPTOR:
+ mTestAdapter.setTestPass(WAIT_WRITE_ENCRIPTED_DESCRIPTOR);
+ mAllPassed |= 0x04;
+ break;
+ case BleEncryptedServerService.INTENT_WAIT_READ_ENCRYPTED_DESCRIPTOR:
+ mTestAdapter.setTestPass(WAIT_READ_ENCRIPTED_DESCRIPTOR);
+ mAllPassed |= 0x08;
+ break;
+ case BleServerService.BLE_ADVERTISE_UNSUPPORTED:
+ showErrorDialog(R.string.bt_advertise_unsupported_title, R.string.bt_advertise_unsupported_message, true);
+ break;
+ case BleServerService.BLE_OPEN_FAIL:
+ setTestResultAndFinish(false);
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Toast.makeText(BleEncryptedServerBaseActivity.this, R.string.bt_open_failed_message, Toast.LENGTH_SHORT).show();
+ }
+ });
+ break;
+ }
+ mTestAdapter.notifyDataSetChanged();
+ if (mAllPassed == 0x0F) {
+ getPassButton().setEnabled(true);
+ }
+ }
+ };
+
+ private void showErrorDialog(int titleId, int messageId, boolean finish) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this)
+ .setTitle(titleId)
+ .setMessage(messageId);
+ if (finish) {
+ builder.setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ });
+ }
+ builder.create().show();
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedServerService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedServerService.java
new file mode 100644
index 0000000..6fb09a1
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleEncryptedServerService.java
@@ -0,0 +1,480 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.app.Service;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGatt;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattDescriptor;
+import android.bluetooth.BluetoothGattServer;
+import android.bluetooth.BluetoothGattServerCallback;
+import android.bluetooth.BluetoothGattService;
+import android.bluetooth.BluetoothManager;
+import android.bluetooth.BluetoothProfile;
+import android.bluetooth.le.AdvertiseCallback;
+import android.bluetooth.le.AdvertiseData;
+import android.bluetooth.le.AdvertiseSettings;
+import android.bluetooth.le.BluetoothLeAdvertiser;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.ParcelUuid;
+import android.util.Log;
+
+import java.util.Arrays;
+import java.util.UUID;
+
+public class BleEncryptedServerService extends Service {
+ public BleEncryptedServerService() {
+ }
+ public static final boolean DEBUG = true;
+ public static final String TAG = "BleEncryptedServer";
+
+ public static final String INTENT_BLUETOOTH_DISABLED =
+ "com.android.cts.verifier.bluetooth.encripted.intent.BLUETOOTH_DISABLED";
+
+ public static final String ACTION_CONNECT_WITH_SECURE =
+ "com.android.cts.verifier.bluetooth.encripted.action.ACTION_CONNECT_WITH_SECURE";
+ public static final String ACTION_CONNECT_WITHOUT_SECURE =
+ "com.android.cts.verifier.bluetooth.encripted.action.ACTION_CONNECT_WITHOUT_SECURE";
+
+ public static final String INTENT_WAIT_WRITE_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.intent.WAIT_WRITE_ENCRYPTED_CHARACTERISTIC";
+ public static final String INTENT_WAIT_READ_ENCRYPTED_CHARACTERISTIC =
+ "com.android.cts.verifier.bluetooth.encripted.intent.WAIT_READ_ENCRYPTED_CHARACTERISTIC";
+ public static final String INTENT_WAIT_WRITE_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.intent.WAIT_WRITE_ENCRYPTED_DESCRIPTOR";
+ public static final String INTENT_WAIT_READ_ENCRYPTED_DESCRIPTOR =
+ "com.android.cts.verifier.bluetooth.encripted.intent.WAIT_READ_ENCRYPTED_DESCRIPTOR";
+
+ private static final UUID SERVICE_UUID =
+ UUID.fromString("00009999-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_UUID =
+ UUID.fromString("00009998-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_UUID =
+ UUID.fromString("00009997-0000-1000-8000-00805f9b34fb");
+
+ private static final UUID CHARACTERISTIC_ENCRYPTED_WRITE_UUID =
+ UUID.fromString("00009996-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_ENCRYPTED_READ_UUID =
+ UUID.fromString("00009995-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_ENCRYPTED_WRITE_UUID =
+ UUID.fromString("00009994-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_ENCRYPTED_READ_UUID =
+ UUID.fromString("00009993-0000-1000-8000-00805f9b34fb");
+
+ public static final UUID ADV_SERVICE_UUID=
+ UUID.fromString("00002222-0000-1000-8000-00805f9b34fb");
+
+ private static final int CONN_INTERVAL = 150; // connection interval 150ms
+
+ public static final String EXTRA_SECURE = "SECURE";
+ public static final String WRITE_CHARACTERISTIC = "WRITE_CHAR";
+ public static final String READ_CHARACTERISTIC = "READ_CHAR";
+ public static final String WRITE_DESCRIPTOR = "WRITE_DESC";
+ public static final String READ_DESCRIPTOR = "READ_DESC";
+
+ public static final String WRITE_VALUE = "ENC_SERVER_TEST";
+
+ private BluetoothManager mBluetoothManager;
+ private BluetoothGattServer mGattServer;
+ private BluetoothGattService mService;
+ private BluetoothDevice mDevice;
+ private BluetoothLeAdvertiser mAdvertiser;
+ private boolean mSecure;
+ private String mTarget;
+ private Handler mHandler;
+ private Runnable mResetValuesTask;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ mHandler = new Handler();
+ mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+ mAdvertiser = mBluetoothManager.getAdapter().getBluetoothLeAdvertiser();
+ mGattServer = mBluetoothManager.openGattServer(this, mCallbacks);
+ mService = createService();
+ if ((mGattServer != null) && (mAdvertiser != null)) {
+ mGattServer.addService(mService);
+ }
+ mDevice = null;
+ mSecure = false;
+ if (!mBluetoothManager.getAdapter().isEnabled()) {
+ notifyBluetoothDisabled();
+ } else if (mGattServer == null) {
+ notifyOpenFail();
+ } else if (mAdvertiser == null) {
+ notifyAdvertiseUnsupported();
+ } else {
+ startAdvertise();
+ }
+
+ resetValues();
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopAdvertise();
+ if (mGattServer == null) {
+ return;
+ }
+ if (mDevice != null) {
+ mGattServer.cancelConnection(mDevice);
+ }
+ mGattServer.clearServices();
+ mGattServer.close();
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ String action = intent.getAction();
+ if (action != null) {
+ switch (action) {
+ case ACTION_CONNECT_WITH_SECURE:
+ mSecure = true;
+ break;
+ case ACTION_CONNECT_WITHOUT_SECURE:
+ mSecure = false;
+ break;
+ }
+ }
+ return START_NOT_STICKY;
+ }
+
+ /**
+ * Sets default value to characteristic and descriptor.
+ *
+ * Set operation will be done after connection interval.
+ * (If set values immediately, multiple read/write operations may fail.)
+ */
+ private synchronized void resetValues() {
+ // cancel pending task
+ if (mResetValuesTask != null) {
+ mHandler.removeCallbacks(mResetValuesTask);
+ mResetValuesTask = null;
+ }
+
+ // reserve task
+ mResetValuesTask = new Runnable() {
+ @Override
+ public void run() {
+ BluetoothGattCharacteristic characteristic = mService.getCharacteristic(CHARACTERISTIC_ENCRYPTED_READ_UUID);
+ characteristic.setValue(WRITE_VALUE.getBytes());
+ characteristic = mService.getCharacteristic(CHARACTERISTIC_UUID);
+ characteristic.getDescriptor(DESCRIPTOR_ENCRYPTED_READ_UUID).setValue(WRITE_VALUE.getBytes());
+ }
+ };
+ mHandler.postDelayed(mResetValuesTask, CONN_INTERVAL);
+ }
+
+ private void notifyBluetoothDisabled() {
+ Intent intent = new Intent(INTENT_BLUETOOTH_DISABLED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyOpenFail() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyOpenFail");
+ }
+ Intent intent = new Intent(BleServerService.BLE_OPEN_FAIL);
+ sendBroadcast(intent);
+ }
+
+ private void notifyAdvertiseUnsupported() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyAdvertiseUnsupported");
+ }
+ Intent intent = new Intent(BleServerService.BLE_ADVERTISE_UNSUPPORTED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyConnected() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyConnected");
+ }
+ resetValues();
+ }
+
+ private void notifyDisconnected() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyDisconnected");
+ }
+ }
+
+ private void notifyServiceAdded() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyServiceAdded");
+ }
+ }
+
+ private void notifyCharacteristicWriteRequest() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicWriteRequest");
+ }
+ Intent intent = new Intent(INTENT_WAIT_WRITE_ENCRYPTED_CHARACTERISTIC);
+ sendBroadcast(intent);
+ resetValues();
+ }
+
+ private void notifyCharacteristicReadRequest() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicReadRequest");
+ }
+ Intent intent = new Intent(INTENT_WAIT_READ_ENCRYPTED_CHARACTERISTIC);
+ sendBroadcast(intent);
+ resetValues();
+ }
+
+ private void notifyDescriptorWriteRequest() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyDescriptorWriteRequest");
+ }
+ Intent intent = new Intent(INTENT_WAIT_WRITE_ENCRYPTED_DESCRIPTOR);
+ sendBroadcast(intent);
+ resetValues();
+ }
+
+ private void notifyDescriptorReadRequest() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyDescriptorReadRequest");
+ }
+ Intent intent = new Intent(INTENT_WAIT_READ_ENCRYPTED_DESCRIPTOR);
+ sendBroadcast(intent);
+ resetValues();
+ }
+
+ private BluetoothGattService createService() {
+ BluetoothGattService service =
+ new BluetoothGattService(SERVICE_UUID, BluetoothGattService.SERVICE_TYPE_PRIMARY);
+ // add characteristic to service
+ // property: 0x0A (read, write)
+ // permission: 0x11 (read, write)
+ BluetoothGattCharacteristic characteristic =
+ new BluetoothGattCharacteristic(CHARACTERISTIC_UUID, 0x0A, 0x11);
+
+ BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor(DESCRIPTOR_UUID, 0x11);
+ characteristic.addDescriptor(descriptor);
+
+ // Encrypted Descriptor
+ descriptor = new BluetoothGattDescriptor(DESCRIPTOR_ENCRYPTED_READ_UUID, 0x02);
+ characteristic.addDescriptor(descriptor);
+ descriptor = new BluetoothGattDescriptor(DESCRIPTOR_ENCRYPTED_WRITE_UUID, 0x20);
+ characteristic.addDescriptor(descriptor);
+ service.addCharacteristic(characteristic);
+
+ // Encrypted Characteristic
+ characteristic = new BluetoothGattCharacteristic(CHARACTERISTIC_ENCRYPTED_READ_UUID, 0x0A, 0x02);
+ descriptor = new BluetoothGattDescriptor(DESCRIPTOR_UUID, 0x11);
+ characteristic.addDescriptor(descriptor);
+ service.addCharacteristic(characteristic);
+ characteristic = new BluetoothGattCharacteristic(CHARACTERISTIC_ENCRYPTED_WRITE_UUID, 0x0A, 0x20);
+ descriptor = new BluetoothGattDescriptor(DESCRIPTOR_UUID, 0x11);
+ characteristic.addDescriptor(descriptor);
+ service.addCharacteristic(characteristic);
+
+ return service;
+ }
+
+ private final BluetoothGattServerCallback mCallbacks = new BluetoothGattServerCallback() {
+ @Override
+ public void onConnectionStateChange(BluetoothDevice device, int status, int newState) {
+ if (DEBUG) {
+ Log.d(TAG, "onConnectionStateChange: newState=" + newState);
+ }
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ if (newState == BluetoothProfile.STATE_CONNECTED) {
+ mDevice = device;
+ notifyConnected();
+ } else if (status == BluetoothProfile.STATE_DISCONNECTED) {
+ notifyDisconnected();
+ mDevice = null;
+ mTarget = null;
+ }
+ }
+ }
+
+ @Override
+ public void onServiceAdded(int status, BluetoothGattService service) {
+ if (DEBUG) {
+ Log.d(TAG, "onServiceAdded()");
+ }
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ notifyServiceAdded();
+ }
+ }
+
+ String mPriority = null;
+
+ @Override
+ public void onCharacteristicWriteRequest(BluetoothDevice device, int requestId,
+ BluetoothGattCharacteristic characteristic,
+ boolean preparedWrite, boolean responseNeeded,
+ int offset, byte[] value) {
+ int status = BluetoothGatt.GATT_SUCCESS;
+ if (mGattServer == null) {
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
+ return;
+ }
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicWriteRequest: preparedWrite=" + preparedWrite);
+ }
+ if (characteristic.getUuid().equals(CHARACTERISTIC_ENCRYPTED_WRITE_UUID)) {
+ if (mSecure) {
+ characteristic.setValue(value);
+ if (Arrays.equals(BleEncryptedClientService.WRITE_VALUE.getBytes(), characteristic.getValue())) {
+ notifyCharacteristicWriteRequest();
+ } else {
+ status = BluetoothGatt.GATT_FAILURE;
+ }
+ } else {
+ // will not occur
+ status = BluetoothGatt.GATT_FAILURE;
+ }
+ } else if (characteristic.getUuid().equals(CHARACTERISTIC_UUID)) {
+ mTarget = new String(value);
+ characteristic.setValue(value);
+ }
+
+ if (responseNeeded) {
+ mGattServer.sendResponse(device, requestId, status, offset, value);
+ }
+ }
+
+ @Override
+ public void onCharacteristicReadRequest(BluetoothDevice device, int requestId, int offset, BluetoothGattCharacteristic characteristic) {
+ int status = BluetoothGatt.GATT_SUCCESS;
+ if (mGattServer == null) {
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
+ return;
+ }
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicReadRequest()");
+ }
+ if (characteristic.getUuid().equals(CHARACTERISTIC_ENCRYPTED_READ_UUID)) {
+ if (mSecure) {
+ notifyCharacteristicReadRequest();
+ }
+ }
+ mGattServer.sendResponse(device, requestId, status, offset, characteristic.getValue());
+ }
+
+ @Override
+ public void onDescriptorReadRequest(BluetoothDevice device, int requestId, int offset, BluetoothGattDescriptor descriptor) {
+ int status = BluetoothGatt.GATT_SUCCESS;
+ if (mGattServer == null) {
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
+ return;
+ }
+ if (DEBUG) {
+ Log.d(TAG, "onDescriptorReadRequest():");
+ }
+
+ if (descriptor.getUuid().equals(DESCRIPTOR_ENCRYPTED_READ_UUID)) {
+ if (mSecure) {
+ notifyDescriptorReadRequest();
+ }
+ }
+ Log.d(TAG, " status = " + status);
+ mGattServer.sendResponse(device, requestId, status, offset, descriptor.getValue());
+ }
+
+ @Override
+ public void onDescriptorWriteRequest(BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor, boolean preparedWrite, boolean responseNeeded, int offset, byte[] value) {
+ int status = BluetoothGatt.GATT_SUCCESS;
+ if (mGattServer == null) {
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
+ return;
+ }
+
+ if (DEBUG) {
+ Log.d(TAG, "onDescriptorWriteRequest: preparedWrite=" + preparedWrite + ", responseNeeded= " + responseNeeded);
+ }
+
+ if (descriptor.getUuid().equals(DESCRIPTOR_ENCRYPTED_WRITE_UUID)) {
+ if (mSecure) {
+ descriptor.setValue(value);
+ if (Arrays.equals(BleEncryptedClientService.WRITE_VALUE.getBytes(), descriptor.getValue())) {
+ notifyDescriptorWriteRequest();
+ } else {
+ status = BluetoothGatt.GATT_FAILURE;
+ }
+ } else {
+ // will not occur
+ status = BluetoothGatt.GATT_FAILURE;
+ }
+ }
+
+ if (responseNeeded) {
+ mGattServer.sendResponse(device, requestId, status, offset, value);
+ }
+ }
+ };
+
+ private final AdvertiseCallback mAdvertiseCallback = new AdvertiseCallback() {
+ @Override
+ public void onStartFailure(int errorCode) {
+ super.onStartFailure(errorCode);
+ if (errorCode == ADVERTISE_FAILED_FEATURE_UNSUPPORTED) {
+ notifyAdvertiseUnsupported();
+ } else {
+ notifyOpenFail();
+ }
+ }
+ };
+
+ private void startAdvertise() {
+ if (DEBUG) {
+ Log.d(TAG, "startAdvertise");
+ }
+ AdvertiseData data = new AdvertiseData.Builder()
+ .addServiceData(new ParcelUuid(ADV_SERVICE_UUID), new byte[]{1, 2, 3})
+ .addServiceUuid(new ParcelUuid(ADV_SERVICE_UUID))
+ .build();
+ AdvertiseSettings setting = new AdvertiseSettings.Builder()
+ .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY)
+ .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM)
+ .setConnectable(true)
+ .build();
+ mAdvertiser.startAdvertising(setting, data, mAdvertiseCallback);
+ }
+
+ private void stopAdvertise() {
+ if (DEBUG) {
+ Log.d(TAG, "stopAdvertise");
+ }
+ if (mAdvertiser != null) {
+ mAdvertiser.stopAdvertising(mAdvertiseCallback);
+ }
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureClientStartActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureClientStartActivity.java
new file mode 100644
index 0000000..03256fb
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureClientStartActivity.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+public class BleInsecureClientStartActivity extends BleClientTestBaseActivity {
+ private Intent mIntent;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mIntent = new Intent(this, BleClientService.class);
+ mIntent.setAction(BleClientService.BLE_CLIENT_ACTION_CLIENT_CONNECT);
+
+ startService(mIntent);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(mIntent);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureClientTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureClientTestListActivity.java
new file mode 100644
index 0000000..f058602
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureClientTestListActivity.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.bluetooth.BluetoothAdapter;
+import android.os.Bundle;
+
+import com.android.cts.verifier.ManifestTestListAdapter;
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleInsecureClientTestListActivity extends PassFailButtons.TestListActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.pass_fail_list);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_insecure_client_test_list_name,
+ R.string.ble_insecure_client_test_list_info,
+ -1);
+
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ List<String> disabledTest = new ArrayList<String>();
+ if (adapter == null || !adapter.isOffloadedFilteringSupported()) {
+ disabledTest.add(
+ "com.android.cts.verifier.bluetooth.BleAdvertiserHardwareScanFilterActivity.");
+ }
+
+ setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(),
+ disabledTest.toArray(new String[disabledTest.size()])));
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureConnectionPriorityClientTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureConnectionPriorityClientTestActivity.java
new file mode 100644
index 0000000..cbb9af5
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureConnectionPriorityClientTestActivity.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+public class BleInsecureConnectionPriorityClientTestActivity extends BleConnectionPriorityClientBaseActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Intent intent = new Intent(BleInsecureConnectionPriorityClientTestActivity.this,
+ BleConnectionPriorityClientService.class);
+ startService(intent);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(new Intent(this, BleConnectionPriorityClientService.class));
+ }
+}
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureConnectionPriorityServerTestActivity.java
similarity index 60%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureConnectionPriorityServerTestActivity.java
index 1293572..e95fda5 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureConnectionPriorityServerTestActivity.java
@@ -1,19 +1,27 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <linux/filter.h>
-
-struct sock_fprog GetTestSeccompFilterProgram();
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleInsecureConnectionPriorityServerTestActivity extends BleConnectionPriorityServerBaseActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureEncryptedClientTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureEncryptedClientTestActivity.java
new file mode 100644
index 0000000..f6f467d
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureEncryptedClientTestActivity.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+public class BleInsecureEncryptedClientTestActivity extends BleEncryptedClientBaseActivity {
+ private Intent mIntent;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mIntent = new Intent(this, BleEncryptedClientService.class);
+ mIntent.setAction(BleEncryptedClientService.ACTION_CONNECT_WITHOUT_SECURE);
+ startService(mIntent);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(mIntent);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureEncryptedServerTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureEncryptedServerTestActivity.java
new file mode 100644
index 0000000..64bb71c
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureEncryptedServerTestActivity.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.widget.Toast;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+public class BleInsecureEncryptedServerTestActivity extends PassFailButtons.Activity {
+ private Intent mIntent;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.ble_insecure_encrypted_server_test);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_encrypted_server_name,
+ R.string.ble_encrypted_server_info, -1);
+
+ getPassButton().setEnabled(true);
+
+ mIntent = new Intent(this, BleEncryptedServerService.class);
+ mIntent.setAction(BleEncryptedServerService.ACTION_CONNECT_WITHOUT_SECURE);
+
+ startService(mIntent);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BleEncryptedServerService.INTENT_BLUETOOTH_DISABLED);
+ filter.addAction(BleServerService.BLE_OPEN_FAIL);
+ filter.addAction(BleServerService.BLE_ADVERTISE_UNSUPPORTED);
+ registerReceiver(mBroadcast, filter);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ unregisterReceiver(mBroadcast);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(mIntent);
+ }
+
+ private void showErrorDialog(int titleId, int messageId, boolean finish) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this)
+ .setTitle(titleId)
+ .setMessage(messageId);
+ if (finish) {
+ builder.setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ });
+ }
+ builder.create().show();
+ }
+
+ private BroadcastReceiver mBroadcast = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ switch (action) {
+ case BleEncryptedServerService.INTENT_BLUETOOTH_DISABLED:
+ // show message to turn on Bluetooth
+ new AlertDialog.Builder(context)
+ .setTitle(R.string.ble_bluetooth_disable_title)
+ .setMessage(R.string.ble_bluetooth_disable_message)
+ .setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ })
+ .create().show();
+ break;
+ case BleServerService.BLE_ADVERTISE_UNSUPPORTED:
+ showErrorDialog(R.string.bt_advertise_unsupported_title,
+ R.string.bt_advertise_unsupported_message,
+ true);
+ break;
+ case BleServerService.BLE_OPEN_FAIL:
+ setTestResultAndFinish(false);
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Toast.makeText(BleInsecureEncryptedServerTestActivity.this,
+ R.string.bt_open_failed_message,
+ Toast.LENGTH_SHORT).show();
+ }
+ });
+ break;
+ }
+ }
+ };
+}
\ No newline at end of file
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerAdvertiserPowerLevelActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerAdvertiserPowerLevelActivity.java
new file mode 100644
index 0000000..1191bba
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerAdvertiserPowerLevelActivity.java
@@ -0,0 +1,11 @@
+package com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleInsecureServerAdvertiserPowerLevelActivity extends BleAdvertiserPowerLevelActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerAdvertiserTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerAdvertiserTestActivity.java
new file mode 100644
index 0000000..2005ef2
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerAdvertiserTestActivity.java
@@ -0,0 +1,11 @@
+package com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleInsecureServerAdvertiserTestActivity extends BleAdvertiserTestActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerScannerPowerLevelActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerScannerPowerLevelActivity.java
new file mode 100644
index 0000000..e3f3f86
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerScannerPowerLevelActivity.java
@@ -0,0 +1,11 @@
+package com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleInsecureServerScannerPowerLevelActivity extends BleScannerPowerLevelActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerScannerTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerScannerTestActivity.java
new file mode 100644
index 0000000..e1376f4
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerScannerTestActivity.java
@@ -0,0 +1,11 @@
+package com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleInsecureServerScannerTestActivity extends BleScannerTestActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerStartActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerStartActivity.java
new file mode 100644
index 0000000..63d1bb5
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerStartActivity.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+public class BleInsecureServerStartActivity extends BleServerTestBaseActivity {
+ private Intent mIntent;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mIntent = new Intent(this, BleServerService.class);
+ mIntent.setAction(BleServerService.BLE_ACTION_SERVER_NON_SECURE);
+ startService(mIntent);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(mIntent);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerTestListActivity.java
new file mode 100644
index 0000000..533e756
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleInsecureServerTestListActivity.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.bluetooth.BluetoothAdapter;
+import android.os.Bundle;
+
+import com.android.cts.verifier.ManifestTestListAdapter;
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleInsecureServerTestListActivity extends PassFailButtons.TestListActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.pass_fail_list);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_insecure_server_test_list_name, R.string.ble_insecure_server_test_list_info, -1);
+
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ List<String> disabledTest = new ArrayList<String>();
+ if (adapter == null || !adapter.isOffloadedFilteringSupported()) {
+ disabledTest.add(
+ "com.android.cts.verifier.bluetooth.BleAdvertiserHardwareScanFilterActivity.");
+ }
+
+ setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(),
+ disabledTest.toArray(new String[disabledTest.size()])));
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerPowerLevelActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerPowerLevelActivity.java
index bf3484e..b2c6c60 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerPowerLevelActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerPowerLevelActivity.java
@@ -29,6 +29,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Log;
@@ -72,7 +73,7 @@
@Override
public void onFinish() {
- mTimerText.setTextColor(getResources().getColor(R.color.red));
+ mTimerText.setTextColor(Color.RED);
mTimerText.setText("Time is up!");
}
};
@@ -188,7 +189,7 @@
case BleScannerService.BLE_PRIVACY_NEW_MAC_RECEIVE:
Toast.makeText(context, "New MAC address detected", Toast.LENGTH_SHORT)
.show();
- mTimerText.setTextColor(getResources().getColor(R.color.green));
+ mTimerText.setTextColor(Color.GREEN);
mTimerText.append(" Get new MAC address.");
mTimer.cancel();
getPassButton().setEnabled(true);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerService.java
index eb71164..2bcd86a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerService.java
@@ -23,9 +23,9 @@
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanFilter;
-import android.bluetooth.le.ScanSettings;
import android.bluetooth.le.ScanRecord;
import android.bluetooth.le.ScanResult;
+import android.bluetooth.le.ScanSettings;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
@@ -34,11 +34,9 @@
import android.util.Log;
import android.widget.Toast;
-import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
public class BleScannerService extends Service {
@@ -144,7 +142,9 @@
@Override
public void onDestroy() {
super.onDestroy();
- mScanner.stopScan(mCallback);
+ if (mScanner != null) {
+ mScanner.stopScan(mCallback);
+ }
}
private void showMessage(final String msg) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerTestActivity.java
index 52933e0..20cea88 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerTestActivity.java
@@ -16,13 +16,16 @@
package com.android.cts.verifier.bluetooth;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.bluetooth.BluetoothAdapter;
+import android.content.DialogInterface;
+import android.os.Bundle;
+
import com.android.cts.verifier.ManifestTestListAdapter;
import com.android.cts.verifier.PassFailButtons;
import com.android.cts.verifier.R;
-import android.bluetooth.BluetoothAdapter;
-import android.os.Bundle;
-
import java.util.ArrayList;
import java.util.List;
@@ -44,5 +47,18 @@
setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(),
disabledTest.toArray(new String[disabledTest.size()])));
+
+ if (!adapter.isEnabled()) {
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.ble_bluetooth_disable_title)
+ .setMessage(R.string.ble_bluetooth_disable_message)
+ .setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ })
+ .create().show();
+ }
}
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureClientStartActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureClientStartActivity.java
new file mode 100644
index 0000000..72d6e56
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureClientStartActivity.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+
+import com.android.cts.verifier.R;
+
+public class BleSecureClientStartActivity extends BleClientTestBaseActivity {
+ private Intent mIntent;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setInfoResources(R.string.ble_client_test_name,
+ R.string.ble_secure_client_test_info, -1);
+
+ mIntent = new Intent(this, BleClientService.class);
+ mIntent.setAction(BleClientService.BLE_CLIENT_ACTION_CLIENT_CONNECT_SECURE);
+
+ startService(mIntent);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(mIntent);
+ }
+
+ @Override
+ public boolean shouldRebootBluetoothAfterTest() {
+ return (Build.VERSION.SDK_INT > Build.VERSION_CODES.M);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureClientTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureClientTestListActivity.java
new file mode 100644
index 0000000..54f8ad1
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureClientTestListActivity.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.bluetooth.BluetoothAdapter;
+import android.os.Bundle;
+
+import com.android.cts.verifier.ManifestTestListAdapter;
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleSecureClientTestListActivity extends PassFailButtons.TestListActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.pass_fail_list);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_secure_client_test_list_name, R.string.ble_secure_client_test_list_info, -1);
+
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ List<String> disabledTest = new ArrayList<String>();
+ if (adapter == null || !adapter.isOffloadedFilteringSupported()) {
+ disabledTest.add(
+ "com.android.cts.verifier.bluetooth.BleAdvertiserHardwareScanFilterActivity.");
+ }
+
+ setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(),
+ disabledTest.toArray(new String[disabledTest.size()])));
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureConnectionPriorityClientTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureConnectionPriorityClientTestActivity.java
new file mode 100644
index 0000000..00eef49
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureConnectionPriorityClientTestActivity.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+
+public class BleSecureConnectionPriorityClientTestActivity extends BleConnectionPriorityClientBaseActivity {
+ private Intent mIntent;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mIntent = new Intent(BleSecureConnectionPriorityClientTestActivity.this, BleConnectionPriorityClientService.class);
+ mIntent.setAction(BleConnectionPriorityClientService.ACTION_CLIENT_CONNECT_SECURE);
+ startService(mIntent);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(mIntent);
+ }
+
+ @Override
+ public boolean shouldRebootBluetoothAfterTest() {
+ return (Build.VERSION.SDK_INT > Build.VERSION_CODES.M);
+ }
+}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestTimeoutException.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureConnectionPriorityServerTestActivity.java
similarity index 61%
rename from tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestTimeoutException.java
rename to apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureConnectionPriorityServerTestActivity.java
index c436658..e64d6f6 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestTimeoutException.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureConnectionPriorityServerTestActivity.java
@@ -1,26 +1,27 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-/**
- * An exception that indicates a test has timed out.
- * TODO: consider moving this to tradefed proper
- */
-public class TestTimeoutException extends Exception {
-
- private static final long serialVersionUID = 941691916057121118L;
-
-}
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleSecureConnectionPriorityServerTestActivity extends BleConnectionPriorityServerBaseActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureEncryptedClientTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureEncryptedClientTestActivity.java
new file mode 100644
index 0000000..83a747c
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureEncryptedClientTestActivity.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+
+public class BleSecureEncryptedClientTestActivity extends BleEncryptedClientBaseActivity {
+ private Intent mIntent;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mIntent = new Intent(this, BleEncryptedClientService.class);
+ mIntent.setAction(BleEncryptedClientService.ACTION_CONNECT_WITH_SECURE);
+ startService(mIntent);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(mIntent);
+ }
+
+ @Override
+ public boolean shouldRebootBluetoothAfterTest() {
+ return (Build.VERSION.SDK_INT > Build.VERSION_CODES.M);
+ }
+
+ @Override
+ public boolean isSecure() {
+ return true;
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureEncryptedServerTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureEncryptedServerTestActivity.java
new file mode 100644
index 0000000..58fbc18
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureEncryptedServerTestActivity.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+public class BleSecureEncryptedServerTestActivity extends BleEncryptedServerBaseActivity {
+ private Intent mIntent;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mIntent = new Intent(this, BleEncryptedServerService.class);
+ mIntent.setAction(BleEncryptedServerService.ACTION_CONNECT_WITH_SECURE);
+ startService(mIntent);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(mIntent);
+ }
+}
\ No newline at end of file
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerAdvertiserPowerLevelActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerAdvertiserPowerLevelActivity.java
new file mode 100644
index 0000000..f131932
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerAdvertiserPowerLevelActivity.java
@@ -0,0 +1,11 @@
+package com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleSecureServerAdvertiserPowerLevelActivity extends BleAdvertiserPowerLevelActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerAdvertiserTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerAdvertiserTestActivity.java
new file mode 100644
index 0000000..5fff2e1
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerAdvertiserTestActivity.java
@@ -0,0 +1,11 @@
+package com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleSecureServerAdvertiserTestActivity extends BleAdvertiserTestActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerScannerPowerLevelActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerScannerPowerLevelActivity.java
new file mode 100644
index 0000000..a4f29fc
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerScannerPowerLevelActivity.java
@@ -0,0 +1,11 @@
+package com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleSecureServerScannerPowerLevelActivity extends BleScannerPowerLevelActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerScannerTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerScannerTestActivity.java
new file mode 100644
index 0000000..4f38a27
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerScannerTestActivity.java
@@ -0,0 +1,11 @@
+package com.android.cts.verifier.bluetooth;
+
+import android.os.Bundle;
+
+public class BleSecureServerScannerTestActivity extends BleScannerTestActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerStartActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerStartActivity.java
new file mode 100644
index 0000000..620ade3
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerStartActivity.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+public class BleSecureServerStartActivity extends BleServerTestBaseActivity {
+ private Intent mIntent;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mIntent = new Intent(this, BleServerService.class);
+ mIntent.setAction(BleServerService.BLE_ACTION_SERVER_SECURE);
+ startService(mIntent);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ stopService(mIntent);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerTestListActivity.java
new file mode 100644
index 0000000..06d6dab
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleSecureServerTestListActivity.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.bluetooth.BluetoothAdapter;
+import android.os.Bundle;
+
+import com.android.cts.verifier.ManifestTestListAdapter;
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleSecureServerTestListActivity extends PassFailButtons.TestListActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.pass_fail_list);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_secure_server_test_list_name, R.string.ble_secure_server_test_list_info, -1);
+
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ List<String> disabledTest = new ArrayList<String>();
+ if (adapter == null || !adapter.isOffloadedFilteringSupported()) {
+ disabledTest.add(
+ "com.android.cts.verifier.bluetooth.BleAdvertiserHardwareScanFilterActivity.");
+ }
+
+ setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(),
+ disabledTest.toArray(new String[disabledTest.size()])));
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerService.java
index 8718f57..464761f 100755
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerService.java
@@ -16,14 +16,7 @@
package com.android.cts.verifier.bluetooth;
-import java.util.Date;
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.UUID;
-
import android.app.Service;
-import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
@@ -39,12 +32,24 @@
import android.bluetooth.le.BluetoothLeAdvertiser;
import android.content.Context;
import android.content.Intent;
+import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.ParcelUuid;
import android.util.Log;
import android.widget.Toast;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.Timer;
+import java.util.UUID;
+
public class BleServerService extends Service {
public static final boolean DEBUG = true;
@@ -54,29 +59,73 @@
public static final int COMMAND_WRITE_CHARACTERISTIC = 1;
public static final int COMMAND_WRITE_DESCRIPTOR = 2;
+ public static final String BLE_BLUETOOTH_MISMATCH_SECURE =
+ "com.android.cts.verifier.bluetooth.BLE_BLUETOOTH_MISMATCH_SECURE";
+ public static final String BLE_BLUETOOTH_MISMATCH_INSECURE =
+ "com.android.cts.verifier.bluetooth.BLE_BLUETOOTH_MISMATCH_INSECURE";
+ public static final String BLE_BLUETOOTH_DISABLED =
+ "com.android.cts.verifier.bluetooth.BLE_BLUETOOTH_DISABLED";
+ public static final String BLE_ACTION_SERVER_SECURE =
+ "com.android.cts.verifier.bluetooth.BLE_ACTION_SERVER_SECURE";
+ public static final String BLE_ACTION_SERVER_NON_SECURE =
+ "com.android.cts.verifier.bluetooth.BLE_ACTION_SERVER_NON_SECURE";
+
+
public static final String BLE_SERVER_CONNECTED =
"com.android.cts.verifier.bluetooth.BLE_SERVER_CONNECTED";
public static final String BLE_SERVER_DISCONNECTED =
"com.android.cts.verifier.bluetooth.BLE_SERVER_DISCONNECTED";
public static final String BLE_SERVICE_ADDED =
"com.android.cts.verifier.bluetooth.BLE_SERVICE_ADDED";
+ public static final String BLE_MTU_REQUEST_23BYTES =
+ "com.android.cts.verifier.bluetooth.BLE_MTU_REQUEST_23BYTES";
+ public static final String BLE_MTU_REQUEST_512BYTES =
+ "com.android.cts.verifier.bluetooth.BLE_MTU_REQUEST_512BYTES";
public static final String BLE_CHARACTERISTIC_READ_REQUEST =
"com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_READ_REQUEST";
public static final String BLE_CHARACTERISTIC_WRITE_REQUEST =
"com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_WRITE_REQUEST";
+ public static final String BLE_CHARACTERISTIC_READ_REQUEST_WITHOUT_PERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_READ_REQUEST_WITHOUT_PERMISSION";
+ public static final String BLE_CHARACTERISTIC_WRITE_REQUEST_WITHOUT_PERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_WRITE_REQUEST_WITHOUT_PERMISSION";
+ public static final String BLE_CHARACTERISTIC_READ_REQUEST_NEED_ENCRYPTED =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_READ_REQUEST_NEED_ENCRYPTED";
+ public static final String BLE_CHARACTERISTIC_WRITE_REQUEST_NEED_ENCRYPTED =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_WRITE_REQUEST_NEED_ENCRYPTED";
+ public static final String BLE_CHARACTERISTIC_NOTIFICATION_REQUEST =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_NOTIFICATION_REQUEST";
+ public static final String BLE_CHARACTERISTIC_INDICATE_REQUEST =
+ "com.android.cts.verifier.bluetooth.BLE_CHARACTERISTIC_INDICATE_REQUEST";
public static final String BLE_DESCRIPTOR_READ_REQUEST =
"com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_READ_REQUEST";
public static final String BLE_DESCRIPTOR_WRITE_REQUEST =
"com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_WRITE_REQUEST";
+ public static final String BLE_DESCRIPTOR_READ_REQUEST_WITHOUT_PERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_READ_REQUEST_WITHOUT_PERMISSION";
+ public static final String BLE_DESCRIPTOR_WRITE_REQUEST_WITHOUT_PERMISSION =
+ "com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_WRITE_REQUEST_WITHOUT_PERMISSION";
+ public static final String BLE_DESCRIPTOR_READ_REQUEST_NEED_ENCRYPTED =
+ "com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_READ_REQUEST_NEED_ENCRYPTED";
+ public static final String BLE_DESCRIPTOR_WRITE_REQUEST_NEED_ENCRYPTED =
+ "com.android.cts.verifier.bluetooth.BLE_DESCRIPTOR_WRITE_REQUEST_NEED_ENCRYPTED";
public static final String BLE_EXECUTE_WRITE =
"com.android.cts.verifier.bluetooth.BLE_EXECUTE_WRITE";
public static final String BLE_OPEN_FAIL =
"com.android.cts.verifier.bluetooth.BLE_OPEN_FAIL";
+ public static final String BLE_RELIABLE_WRITE_BAD_RESP =
+ "com.android.cts.verifier.bluetooth.BLE_RELIABLE_WRITE_BAD_RESP";
+ public static final String BLE_ADVERTISE_UNSUPPORTED =
+ "com.android.cts.verifier.bluetooth.BLE_ADVERTISE_UNSUPPORTED";
+ public static final String BLE_ADD_SERVICE_FAIL =
+ "com.android.cts.verifier.bluetooth.BLE_ADD_SERVICE_FAIL";
private static final UUID SERVICE_UUID =
UUID.fromString("00009999-0000-1000-8000-00805f9b34fb");
private static final UUID CHARACTERISTIC_UUID =
UUID.fromString("00009998-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_RESULT_UUID =
+ UUID.fromString("00009974-0000-1000-8000-00805f9b34fb");
private static final UUID UPDATE_CHARACTERISTIC_UUID =
UUID.fromString("00009997-0000-1000-8000-00805f9b34fb");
private static final UUID DESCRIPTOR_UUID =
@@ -84,6 +133,82 @@
public static final UUID ADV_SERVICE_UUID=
UUID.fromString("00003333-0000-1000-8000-00805f9b34fb");
+ private static final UUID SERVICE_UUID_ADDITIONAL =
+ UUID.fromString("00009995-0000-1000-8000-00805f9b34fb");
+ private static final UUID SERVICE_UUID_INCLUDED =
+ UUID.fromString("00009994-0000-1000-8000-00805f9b34fb");
+
+ // Variable for registration permission of Characteristic
+ private static final UUID CHARACTERISTIC_NO_READ_UUID =
+ UUID.fromString("00009984-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_NO_WRITE_UUID =
+ UUID.fromString("00009983-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_NEED_ENCRYPTED_READ_UUID =
+ UUID.fromString("00009982-0000-1000-8000-00805f9b34fb");
+ private static final UUID CHARACTERISTIC_NEED_ENCRYPTED_WRITE_UUID =
+ UUID.fromString("00009981-0000-1000-8000-00805f9b34fb");
+
+ // Variable for registration permission of Descriptor
+ private static final UUID DESCRIPTOR_NO_READ_UUID =
+ UUID.fromString("00009973-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_NO_WRITE_UUID =
+ UUID.fromString("00009972-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_NEED_ENCRYPTED_READ_UUID =
+ UUID.fromString("00009969-0000-1000-8000-00805f9b34fb");
+ private static final UUID DESCRIPTOR_NEED_ENCRYPTED_WRITE_UUID =
+ UUID.fromString("00009968-0000-1000-8000-00805f9b34fb");
+
+ // Variable for registration upper limit confirmation of Characteristic
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_1 =
+ UUID.fromString("00009989-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_2 =
+ UUID.fromString("00009988-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_3 =
+ UUID.fromString("00009987-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_4 =
+ UUID.fromString("00009986-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_5 =
+ UUID.fromString("00009985-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_6 =
+ UUID.fromString("00009979-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_7 =
+ UUID.fromString("00009978-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_8 =
+ UUID.fromString("00009977-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_9 =
+ UUID.fromString("00009976-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_10 =
+ UUID.fromString("00009975-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_11 =
+ UUID.fromString("00009959-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_12 =
+ UUID.fromString("00009958-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_13 =
+ UUID.fromString("00009957-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_14 =
+ UUID.fromString("00009956-0000-1000-8000-00805f9b34fb");
+ private static final UUID UPDATE_CHARACTERISTIC_UUID_15 =
+ UUID.fromString("00009955-0000-1000-8000-00805f9b34fb");
+
+ private static final UUID UPDATE_DESCRIPTOR_UUID =
+ UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
+
+ private static final UUID INDICATE_CHARACTERISTIC_UUID =
+ UUID.fromString("00009971-0000-1000-8000-00805f9b34fb");
+
+ private static final int CONN_INTERVAL = 150; // connection interval 150ms
+
+ // Delay of notification when secure test failed to start.
+ private static final long NOTIFICATION_DELAY_OF_SECURE_TEST_FAILURE = 5 * 1000;
+
+ public static final String WRITE_VALUE = "SERVER_TEST";
+ private static final String NOTIFY_VALUE = "NOTIFY_TEST";
+ private static final String INDICATE_VALUE = "INDICATE_TEST";
+ public static final String READ_NO_PERMISSION = "READ_NO_CHAR";
+ public static final String WRITE_NO_PERMISSION = "WRITE_NO_CHAR";
+ public static final String DESCRIPTOR_READ_NO_PERMISSION = "READ_NO_DESC";
+ public static final String DESCRIPTOR_WRITE_NO_PERMISSION = "WRITE_NO_DESC";
+
private BluetoothManager mBluetoothManager;
private BluetoothGattServer mGattServer;
private BluetoothGattService mService;
@@ -92,6 +217,25 @@
private Handler mHandler;
private String mReliableWriteValue;
private BluetoothLeAdvertiser mAdvertiser;
+ private boolean mIndicated;
+ private int mNotifyCount;
+ private boolean mSecure;
+ private int mCountMtuChange;
+ private int mMtuSize = -1;
+ private String mMtuTestReceivedData;
+ private Runnable mResetValuesTask;
+ private BluetoothGattService mAdditionalNotificationService;
+
+ // Task to notify failure of starting secure test.
+ // Secure test calls BluetoothDevice#createBond() when devices were not paired.
+ // createBond() causes onConnectionStateChange() twice, and it works as strange sequence.
+ // At the first onConnectionStateChange(), target device is not paired(bond state is
+ // BluetoothDevice.BOND_NONE).
+ // At the second onConnectionStateChange(), target devices is paired(bond state is
+ // BluetoothDevice.BOND_BONDED).
+ // CTS Verifier will perform lazy check of bond state.Verifier checks bond state
+ // after NOTIFICATION_DELAY_OF_SECURE_TEST_FAILURE from the first onConnectionStateChange().
+ private Runnable mNotificationTaskOfSecureTestStartFailure;
@Override
public void onCreate() {
@@ -100,22 +244,73 @@
mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
mAdvertiser = mBluetoothManager.getAdapter().getBluetoothLeAdvertiser();
mGattServer = mBluetoothManager.openGattServer(this, mCallbacks);
+
mService = createService();
- if (mGattServer != null) {
- mGattServer.addService(mService);
- }
+ mAdditionalNotificationService = createAdditionalNotificationService();
+
mDevice = null;
- mReliableWriteValue = null;
+ mReliableWriteValue = "";
mHandler = new Handler();
- if (mGattServer == null) {
+ if (!mBluetoothManager.getAdapter().isEnabled()) {
+ notifyBluetoothDisabled();
+ } else if (mGattServer == null) {
notifyOpenFail();
+ } else if (mAdvertiser == null) {
+ notifyAdvertiseUnsupported();
+ } else {
+ // start adding services
+ mNotifyCount = 11;
+ mSecure = false;
+ mCountMtuChange = 0;
+ if (!mGattServer.addService(mService)) {
+ notifyAddServiceFail();
+ }
}
}
+ private void notifyBluetoothDisabled() {
+ Intent intent = new Intent(BLE_BLUETOOTH_DISABLED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyMismatchSecure() {
+ Intent intent = new Intent(BLE_BLUETOOTH_MISMATCH_SECURE);
+ sendBroadcast(intent);
+ }
+
+ private void notifyMismatchInsecure() {
+ /*
+ Intent intent = new Intent(BLE_BLUETOOTH_MISMATCH_INSECURE);
+ sendBroadcast(intent);
+ */
+ }
+
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
- startAdvertise();
+ String action = intent.getAction();
+ if (action != null) {
+ switch (action) {
+ case BLE_ACTION_SERVER_SECURE:
+ mSecure = true;
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
+ showMessage("Skip MTU test.");
+ mCountMtuChange = 1;
+ notifyMtuRequest();
+ mCountMtuChange = 2;
+ notifyMtuRequest();
+ mCountMtuChange = 0;
+ }
+ break;
+ case BLE_ACTION_SERVER_NON_SECURE:
+ mSecure = false;
+ break;
+ }
+ }
+
+ if (mBluetoothManager.getAdapter().isEnabled() && (mAdvertiser != null)) {
+ startAdvertise();
+ }
return START_NOT_STICKY;
}
@@ -127,145 +322,498 @@
@Override
public void onDestroy() {
super.onDestroy();
+ cancelNotificationTaskOfSecureTestStartFailure();
stopAdvertise();
if (mGattServer == null) {
return;
}
- if (mDevice != null) mGattServer.cancelConnection(mDevice);
+ if (mDevice != null) {
+ mGattServer.cancelConnection(mDevice);
+ }
+ mGattServer.clearServices();
mGattServer.close();
}
- private void writeCharacteristic(String writeValue) {
- BluetoothGattCharacteristic characteristic = getCharacteristic(CHARACTERISTIC_UUID);
- if (characteristic != null) return;
- characteristic.setValue(writeValue);
- }
+ /**
+ * Sets default value to characteristic and descriptor.
+ *
+ * Set operation will be done after connection interval.
+ * (If set values immediately, multiple read/write operations may fail.)
+ */
+ private synchronized void resetValues() {
+ // cancel pending task
+ if (mResetValuesTask != null) {
+ mHandler.removeCallbacks(mResetValuesTask);
+ mResetValuesTask = null;
+ }
- private void writeDescriptor(String writeValue) {
- BluetoothGattDescriptor descriptor = getDescriptor();
- if (descriptor == null) return;
- descriptor.setValue(writeValue.getBytes());
+ // reserve task
+ mResetValuesTask = new Runnable() {
+ @Override
+ public void run() {
+ getCharacteristic(CHARACTERISTIC_UUID).setValue(WRITE_VALUE.getBytes());
+ getDescriptor().setValue(WRITE_VALUE.getBytes());
+ }
+ };
+ mHandler.postDelayed(mResetValuesTask, CONN_INTERVAL);
}
private void notifyOpenFail() {
- if (DEBUG) Log.d(TAG, "notifyOpenFail");
+ if (DEBUG) {
+ Log.d(TAG, "notifyOpenFail");
+ }
Intent intent = new Intent(BLE_OPEN_FAIL);
sendBroadcast(intent);
}
- private void notifyConnected() {
- if (DEBUG) Log.d(TAG, "notifyConnected");
- Intent intent = new Intent(BLE_SERVER_CONNECTED);
+ private void notifyAddServiceFail() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyAddServiceFail");
+ }
+ Intent intent = new Intent(BLE_ADD_SERVICE_FAIL);
sendBroadcast(intent);
}
+ private void notifyAdvertiseUnsupported() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyAdvertiseUnsupported");
+ }
+ Intent intent = new Intent(BLE_ADVERTISE_UNSUPPORTED);
+ sendBroadcast(intent);
+ }
+
+ private void notifyConnected() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyConnected");
+ }
+ Intent intent = new Intent(BLE_SERVER_CONNECTED);
+ sendBroadcast(intent);
+
+ resetValues();
+ }
+
private void notifyDisconnected() {
- if (DEBUG) Log.d(TAG, "notifyDisconnected");
+ if (DEBUG) {
+ Log.d(TAG, "notifyDisconnected");
+ }
Intent intent = new Intent(BLE_SERVER_DISCONNECTED);
sendBroadcast(intent);
}
private void notifyServiceAdded() {
- if (DEBUG) Log.d(TAG, "notifyServiceAdded");
+ if (DEBUG) {
+ Log.d(TAG, "notifyServiceAdded");
+ }
Intent intent = new Intent(BLE_SERVICE_ADDED);
sendBroadcast(intent);
}
- private void notifyCharacteristicReadRequest() {
- if (DEBUG) Log.d(TAG, "notifyCharacteristicReadRequest");
+ private void notifyMtuRequest() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyMtuRequest");
+ }
+ Intent intent;
+ if (mCountMtuChange == 1) {
+ intent = new Intent(BLE_MTU_REQUEST_23BYTES);
+ } else if (mCountMtuChange == 2) {
+ intent = new Intent(BLE_MTU_REQUEST_512BYTES);
+ } else {
+ return; // never occurs
+ }
+ sendBroadcast(intent);
+ }
+
+ private void notifyCharacteristicReadRequest(boolean resetValues) {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicReadRequest");
+ }
Intent intent = new Intent(BLE_CHARACTERISTIC_READ_REQUEST);
sendBroadcast(intent);
+
+ if (resetValues) {
+ resetValues();
+ }
}
private void notifyCharacteristicWriteRequest() {
- if (DEBUG) Log.d(TAG, "notifyCharacteristicWriteRequest");
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicWriteRequest");
+ }
Intent intent = new Intent(BLE_CHARACTERISTIC_WRITE_REQUEST);
sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyCharacteristicReadRequestWithoutPermission() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicReadRequestWithoutPermission");
+ }
+ Intent intent = new Intent(BLE_CHARACTERISTIC_READ_REQUEST_WITHOUT_PERMISSION);
+ sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyCharacteristicWriteRequestWithoutPermission() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicWriteRequestWithoutPermission");
+ }
+ Intent intent = new Intent(BLE_CHARACTERISTIC_WRITE_REQUEST_WITHOUT_PERMISSION);
+ sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyCharacteristicReadRequestNeedEncrypted() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicReadRequestNeedEncrypted");
+ }
+ Intent intent = new Intent(BLE_CHARACTERISTIC_READ_REQUEST_NEED_ENCRYPTED);
+ sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyCharacteristicWriteRequestNeedEncrypted() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicWriteRequestNeedEncrypted");
+ }
+ Intent intent = new Intent(BLE_CHARACTERISTIC_WRITE_REQUEST_NEED_ENCRYPTED);
+ sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyCharacteristicNotificationRequest() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicNotificationRequest");
+ }
+ mNotifyCount = 11;
+ Intent intent = new Intent(BLE_CHARACTERISTIC_NOTIFICATION_REQUEST);
+ sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyCharacteristicIndicationRequest() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyCharacteristicIndicationRequest");
+ }
+ Intent intent = new Intent(BLE_CHARACTERISTIC_INDICATE_REQUEST);
+ sendBroadcast(intent);
+
+ resetValues();
}
private void notifyDescriptorReadRequest() {
- if (DEBUG) Log.d(TAG, "notifyDescriptorReadRequest");
+ if (DEBUG) {
+ Log.d(TAG, "notifyDescriptorReadRequest");
+ }
Intent intent = new Intent(BLE_DESCRIPTOR_READ_REQUEST);
sendBroadcast(intent);
+
+ resetValues();
}
private void notifyDescriptorWriteRequest() {
- if (DEBUG) Log.d(TAG, "notifyDescriptorWriteRequest");
+ if (DEBUG) {
+ Log.d(TAG, "notifyDescriptorWriteRequest");
+ }
Intent intent = new Intent(BLE_DESCRIPTOR_WRITE_REQUEST);
sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyDescriptorReadRequestWithoutPermission() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyDescriptorReadRequestWithoutPermission");
+ }
+ Intent intent = new Intent(BLE_DESCRIPTOR_READ_REQUEST_WITHOUT_PERMISSION);
+ sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyDescriptorWriteRequestWithoutPermission() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyDescriptorWriteRequestWithoutPermission");
+ }
+ Intent intent = new Intent(BLE_DESCRIPTOR_WRITE_REQUEST_WITHOUT_PERMISSION);
+ sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyDescriptorReadRequestNeedEncrypted() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyDescriptorReadRequestNeedEncrypted");
+ }
+ Intent intent = new Intent(BLE_DESCRIPTOR_READ_REQUEST_NEED_ENCRYPTED);
+ sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyDescriptorWriteRequestNeedEncrypted() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyDescriptorWriteRequestNeedEncrypted");
+ }
+ Intent intent = new Intent(BLE_DESCRIPTOR_WRITE_REQUEST_NEED_ENCRYPTED);
+ sendBroadcast(intent);
+
+ resetValues();
}
private void notifyExecuteWrite() {
- if (DEBUG) Log.d(TAG, "notifyExecuteWrite");
+ if (DEBUG) {
+ Log.d(TAG, "notifyExecuteWrite");
+ }
Intent intent = new Intent(BLE_EXECUTE_WRITE);
sendBroadcast(intent);
+
+ resetValues();
+ }
+
+ private void notifyReliableWriteBadResp() {
+ if (DEBUG) {
+ Log.d(TAG, "notifyReliableWriteBadResp");
+ }
+ Intent intent = new Intent(BLE_RELIABLE_WRITE_BAD_RESP);
+ sendBroadcast(intent);
+
+ resetValues();
}
private BluetoothGattCharacteristic getCharacteristic(UUID uuid) {
- BluetoothGattCharacteristic characteristic =
- mService.getCharacteristic(uuid);
+ BluetoothGattCharacteristic characteristic = mService.getCharacteristic(uuid);
if (characteristic == null) {
showMessage("Characteristic not found");
- return null;
}
return characteristic;
}
private BluetoothGattDescriptor getDescriptor() {
- BluetoothGattCharacteristic characteristic = getCharacteristic(CHARACTERISTIC_UUID);
- if (characteristic == null) return null;
+ BluetoothGattDescriptor descriptor = null;
- BluetoothGattDescriptor descriptor = characteristic.getDescriptor(DESCRIPTOR_UUID);
- if (descriptor == null) {
- showMessage("Descriptor not found");
- return null;
+ BluetoothGattCharacteristic characteristic = getCharacteristic(CHARACTERISTIC_UUID);
+ if (characteristic != null) {
+ descriptor = characteristic.getDescriptor(DESCRIPTOR_UUID);
+ if (descriptor == null) {
+ showMessage("Descriptor not found");
+ }
}
return descriptor;
}
+ /**
+ * Create service for notification test
+ * @return
+ */
+ private BluetoothGattService createAdditionalNotificationService() {
+ BluetoothGattService service =
+ new BluetoothGattService(SERVICE_UUID_ADDITIONAL, BluetoothGattService.SERVICE_TYPE_PRIMARY);
+
+ BluetoothGattCharacteristic notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_1, 0x12, 0x1);
+ BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_2, 0x14, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_3, 0x16, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_4, 0x18, 0x10);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_5, 0x1C, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_11, 0x3A, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_12, 0x3C, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_13, 0x3E, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_14, 0x10, 0x0);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_15, 0x30, 0x0);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ return service;
+ }
+
private BluetoothGattService createService() {
BluetoothGattService service =
new BluetoothGattService(SERVICE_UUID, BluetoothGattService.SERVICE_TYPE_PRIMARY);
BluetoothGattCharacteristic characteristic =
new BluetoothGattCharacteristic(CHARACTERISTIC_UUID, 0x0A, 0x11);
+ characteristic.setValue(WRITE_VALUE.getBytes());
+
BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor(DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(WRITE_VALUE.getBytes());
+ characteristic.addDescriptor(descriptor);
+
+ BluetoothGattDescriptor descriptor_permission = new BluetoothGattDescriptor(DESCRIPTOR_NO_READ_UUID, 0x10);
+ characteristic.addDescriptor(descriptor_permission);
+
+ descriptor_permission = new BluetoothGattDescriptor(DESCRIPTOR_NO_WRITE_UUID, 0x01);
+ characteristic.addDescriptor(descriptor_permission);
+
+ service.addCharacteristic(characteristic);
+
+ characteristic =
+ new BluetoothGattCharacteristic(CHARACTERISTIC_RESULT_UUID, 0x0A, 0x11);
+ characteristic.addDescriptor(descriptor);
+
+ BluetoothGattDescriptor descriptor_encrypted = new BluetoothGattDescriptor(DESCRIPTOR_NEED_ENCRYPTED_READ_UUID, 0x02);
+ characteristic.addDescriptor(descriptor_encrypted);
+
+ descriptor_encrypted = new BluetoothGattDescriptor(DESCRIPTOR_NEED_ENCRYPTED_WRITE_UUID, 0x20);
+ characteristic.addDescriptor(descriptor_encrypted);
+
+ service.addCharacteristic(characteristic);
+
+ // Add new Characteristics
+ // Registered the characteristic of read permission for operation confirmation.
+ characteristic =
+ new BluetoothGattCharacteristic(CHARACTERISTIC_NO_READ_UUID, 0x0A, 0x10);
characteristic.addDescriptor(descriptor);
service.addCharacteristic(characteristic);
+ // Registered the characteristic of write permission for operation confirmation.
+ characteristic =
+ new BluetoothGattCharacteristic(CHARACTERISTIC_NO_WRITE_UUID, 0x0A, 0x01);
+ characteristic.addDescriptor(descriptor);
+ service.addCharacteristic(characteristic);
+
+ // Registered the characteristic of authenticate (Encrypted) for operation confirmation.
+ characteristic =
+ new BluetoothGattCharacteristic(CHARACTERISTIC_NEED_ENCRYPTED_READ_UUID, 0x0A, 0x02);
+ characteristic.addDescriptor(descriptor);
+ service.addCharacteristic(characteristic);
+
+ characteristic =
+ new BluetoothGattCharacteristic(CHARACTERISTIC_NEED_ENCRYPTED_WRITE_UUID, 0x0A, 0x20);
+ characteristic.addDescriptor(descriptor);
+ service.addCharacteristic(characteristic);
+
+ // Add new Characteristics(Indicate)
+ BluetoothGattCharacteristic indicateCharacteristic =
+ new BluetoothGattCharacteristic(INDICATE_CHARACTERISTIC_UUID, 0x2A, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ indicateCharacteristic.addDescriptor(descriptor);
+ indicateCharacteristic.setValue(INDICATE_VALUE);
+ service.addCharacteristic(indicateCharacteristic);
+
+ // Add new Characteristics(Notify)
BluetoothGattCharacteristic notiCharacteristic =
- new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID, 0x10, 0x00);
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID, 0x1A, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_6, 0x1E, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_7, 0x32, 0x1);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_8, 0x34, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_9, 0x36, 0x11);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
+ service.addCharacteristic(notiCharacteristic);
+
+ notiCharacteristic =
+ new BluetoothGattCharacteristic(UPDATE_CHARACTERISTIC_UUID_10, 0x38, 0x10);
+ descriptor = new BluetoothGattDescriptor(UPDATE_DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
+ notiCharacteristic.addDescriptor(descriptor);
+ notiCharacteristic.setValue(NOTIFY_VALUE);
service.addCharacteristic(notiCharacteristic);
return service;
}
- private void beginNotification() {
- TimerTask task = new TimerTask() {
- @Override
- public void run() {
- if (mGattServer == null) {
- if (DEBUG) Log.d(TAG, "GattServer is null, return");
- return;
- }
- BluetoothGattCharacteristic characteristic =
- mService.getCharacteristic(UPDATE_CHARACTERISTIC_UUID);
- if (characteristic == null) return;
-
- String date = (new Date()).toString();
- characteristic.setValue(date);
- mGattServer.notifyCharacteristicChanged(mDevice, characteristic, false);
- }
- };
- mNotificationTimer = new Timer();
- mNotificationTimer.schedule(task, 0, 1000);
- }
-
- private void stopNotification() {
- if (mNotificationTimer == null) return;
- mNotificationTimer.cancel();
- mNotificationTimer = null;
- }
-
private void showMessage(final String msg) {
mHandler.post(new Runnable() {
public void run() {
@@ -274,17 +822,83 @@
});
}
+ private void onMtuTestDataReceive() {
+
+ Log.d(TAG, "onMtuTestDataReceive(" + mCountMtuChange + "):" + mMtuTestReceivedData);
+
+ // verify
+ if (mMtuTestReceivedData.equals(BleClientService.WRITE_VALUE_512BYTES_FOR_MTU)) {
+
+ // write back data
+ // MTU test verifies whether the write/read operations go well.
+ BluetoothGattCharacteristic characteristic = getCharacteristic(CHARACTERISTIC_UUID);
+ characteristic.setValue(mMtuTestReceivedData.getBytes());
+
+ notifyMtuRequest();
+ } else {
+ showMessage(getString(R.string.ble_mtu_fail_message));
+ }
+ mMtuTestReceivedData = "";
+ if (mCountMtuChange >= 2) {
+ // All MTU change tests completed
+ mCountMtuChange = 0;
+ }
+ }
+
+ private synchronized void cancelNotificationTaskOfSecureTestStartFailure() {
+ if (mNotificationTaskOfSecureTestStartFailure != null) {
+ mHandler.removeCallbacks(mNotificationTaskOfSecureTestStartFailure);
+ mNotificationTaskOfSecureTestStartFailure = null;
+ }
+ }
+
private final BluetoothGattServerCallback mCallbacks = new BluetoothGattServerCallback() {
@Override
public void onConnectionStateChange(BluetoothDevice device, int status, int newState) {
- if (DEBUG) Log.d(TAG, "onConnectionStateChange: newState=" + newState);
+ if (DEBUG) {
+ Log.d(TAG, "onConnectionStateChange: newState=" + newState);
+ }
+
if (status == BluetoothGatt.GATT_SUCCESS) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
mDevice = device;
- notifyConnected();
- beginNotification();
+ boolean bonded = false;
+ Set<BluetoothDevice> pairedDevices = mBluetoothManager.getAdapter().getBondedDevices();
+ if (pairedDevices.size() > 0) {
+ for (BluetoothDevice target : pairedDevices) {
+ if (target.getAddress().equals(device.getAddress())) {
+ bonded = true;
+ break;
+ }
+ }
+ }
+
+ if (mSecure && ((device.getBondState() == BluetoothDevice.BOND_NONE) || !bonded)) {
+ // not pairing and execute Secure Test
+ cancelNotificationTaskOfSecureTestStartFailure();
+ /*
+ mNotificationTaskOfSecureTestStartFailure = new Runnable() {
+ @Override
+ public void run() {
+ mNotificationTaskOfSecureTestStartFailure = null;
+ if (mSecure && (mDevice.getBondState() != BluetoothDevice.BOND_BONDED)) {
+ notifyMismatchSecure();
+ }
+ }
+ };
+ mHandler.postDelayed(mNotificationTaskOfSecureTestStartFailure,
+ NOTIFICATION_DELAY_OF_SECURE_TEST_FAILURE);
+ */
+ } else if (!mSecure && ((device.getBondState() != BluetoothDevice.BOND_NONE) || bonded)) {
+ // already pairing nad execute Insecure Test
+ /*
+ notifyMismatchInsecure();
+ */
+ } else {
+ cancelNotificationTaskOfSecureTestStartFailure();
+ notifyConnected();
+ }
} else if (status == BluetoothProfile.STATE_DISCONNECTED) {
- stopNotification();
notifyDisconnected();
mDevice = null;
}
@@ -293,22 +907,78 @@
@Override
public void onServiceAdded(int status, BluetoothGattService service) {
- if (DEBUG) Log.d(TAG, "onServiceAdded()");
- if (status == BluetoothGatt.GATT_SUCCESS) notifyServiceAdded();
+ if (DEBUG) {
+ Log.d(TAG, "onServiceAdded(): " + service.getUuid());
+ dumpService(service, 0);
+ }
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ UUID uuid = service.getUuid();
+
+ if (uuid.equals(mService.getUuid())) {
+ // create and add nested service
+ BluetoothGattService includedService =
+ new BluetoothGattService(SERVICE_UUID_INCLUDED, BluetoothGattService.SERVICE_TYPE_SECONDARY);
+ BluetoothGattCharacteristic characteristic =
+ new BluetoothGattCharacteristic(CHARACTERISTIC_UUID, 0x0A, 0x11);
+ characteristic.setValue(WRITE_VALUE.getBytes());
+ BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor(DESCRIPTOR_UUID, 0x11);
+ descriptor.setValue(WRITE_VALUE.getBytes());
+ characteristic.addDescriptor(descriptor);
+ includedService.addCharacteristic(characteristic);
+ mGattServer.addService(includedService);
+ } else if (uuid.equals(SERVICE_UUID_INCLUDED)) {
+ mService.addService(service);
+ mGattServer.addService(mAdditionalNotificationService);
+ } else if (uuid.equals(mAdditionalNotificationService.getUuid())) {
+ // all services added
+ notifyServiceAdded();
+ } else {
+ notifyAddServiceFail();
+ }
+ } else {
+ notifyAddServiceFail();
+ }
}
@Override
- public void onCharacteristicReadRequest(BluetoothDevice device, int requestId,
- int offset, BluetoothGattCharacteristic characteristic) {
+ public void onCharacteristicReadRequest(BluetoothDevice device, int requestId, int offset, BluetoothGattCharacteristic characteristic) {
if (mGattServer == null) {
- if (DEBUG) Log.d(TAG, "GattServer is null, return");
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
return;
}
- if (DEBUG) Log.d(TAG, "onCharacteristicReadRequest()");
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicReadRequest()");
+ }
- notifyCharacteristicReadRequest();
- mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, 0,
- characteristic.getValue());
+ boolean finished = false;
+ byte[] value = null;
+ if (mMtuSize > 0) {
+ byte[] buf = characteristic.getValue();
+ if (buf != null) {
+ int len = Math.min((buf.length - offset), mMtuSize);
+ if (len > 0) {
+ value = Arrays.copyOfRange(buf, offset, (offset + len));
+ }
+ finished = ((offset + len) >= buf.length);
+ if (finished) {
+ Log.d(TAG, "sent whole data: " + (new String(characteristic.getValue())));
+ }
+ }
+ } else {
+ value = characteristic.getValue();
+ finished = true;
+ }
+
+ mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, value);
+
+ UUID uid = characteristic.getUuid();
+ if (uid.equals(CHARACTERISTIC_NEED_ENCRYPTED_READ_UUID)) {
+ notifyCharacteristicReadRequestNeedEncrypted();
+ } else {
+ notifyCharacteristicReadRequest(finished);
+ }
}
@Override
@@ -317,32 +987,113 @@
boolean preparedWrite, boolean responseNeeded,
int offset, byte[] value) {
if (mGattServer == null) {
- if (DEBUG) Log.d(TAG, "GattServer is null, return");
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
return;
}
- if (DEBUG) Log.d(TAG, "onCharacteristicWriteRequest: preparedWrite=" + preparedWrite);
+ if (DEBUG) {
+ Log.d(TAG, "onCharacteristicWriteRequest: preparedWrite=" + preparedWrite + ", responseNeeded= " + responseNeeded);
+ }
- notifyCharacteristicWriteRequest();
- if (preparedWrite) mReliableWriteValue = new String(value);
- else characteristic.setValue(value);
+ if (characteristic.getUuid().equals(CHARACTERISTIC_RESULT_UUID)) {
+ String resValue = new String(value);
+ Log.d(TAG, "CHARACTERISTIC_RESULT_UUID: resValue=" + resValue);
+ switch (resValue) {
+ case WRITE_NO_PERMISSION:
+ notifyCharacteristicWriteRequestWithoutPermission();
+ break;
+ case READ_NO_PERMISSION:
+ notifyCharacteristicReadRequestWithoutPermission();
+ break;
+ case DESCRIPTOR_WRITE_NO_PERMISSION:
+ notifyDescriptorWriteRequestWithoutPermission();
+ break;
+ case DESCRIPTOR_READ_NO_PERMISSION:
+ notifyDescriptorReadRequestWithoutPermission();
+ break;
+ }
+ if (responseNeeded) {
+ mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, value);
+ }
+ return;
+ }
- if (responseNeeded)
+ // MTU test flow
+ if (mCountMtuChange > 0) {
+ if (preparedWrite) {
+ mMtuTestReceivedData += new String(value);
+ } else {
+ String strValue = new String(value);
+ if (mCountMtuChange > 0) {
+ mMtuTestReceivedData = strValue;
+ onMtuTestDataReceive();
+ }
+ }
+ if (responseNeeded) {
+ mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, value);
+ }
+
+ return;
+ }
+
+ // Reliable write with bad response test flow
+ String valueStr = new String(value);
+ if (BleClientService.WRITE_VALUE_BAD_RESP.equals(valueStr)) {
mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, 0, null);
+ notifyReliableWriteBadResp();
+ return;
+ }
+
+ if (preparedWrite) {
+ mReliableWriteValue += (new String(value));
+ } else {
+ characteristic.setValue(value);
+ // verify
+ if (Arrays.equals(BleClientService.WRITE_VALUE.getBytes(), characteristic.getValue())) {
+ UUID uid = characteristic.getUuid();
+ if (uid.equals(CHARACTERISTIC_NEED_ENCRYPTED_WRITE_UUID)) {
+ notifyCharacteristicWriteRequestNeedEncrypted();
+ } else {
+ notifyCharacteristicWriteRequest();
+ }
+ } else {
+ showMessage("Written data is not correct");
+ }
+ }
+
+ if (responseNeeded) {
+ mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, value);
+ }
}
@Override
public void onDescriptorReadRequest(BluetoothDevice device, int requestId,
int offset, BluetoothGattDescriptor descriptor) {
if (mGattServer == null) {
- if (DEBUG) Log.d(TAG, "GattServer is null, return");
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
return;
}
- if (DEBUG) Log.d(TAG, "onDescriptorReadRequest(): (descriptor == getDescriptor())="
- + (descriptor == getDescriptor()));
+ if (DEBUG) {
+ Log.d(TAG, "onDescriptorReadRequest(): (descriptor == getDescriptor())="
+ + (descriptor == getDescriptor()));
+ }
- notifyDescriptorReadRequest();
- mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, 0,
- descriptor.getValue());
+ UUID uid = descriptor.getUuid();
+ if (uid.equals(DESCRIPTOR_NEED_ENCRYPTED_READ_UUID)){
+ notifyDescriptorReadRequestNeedEncrypted();
+ } else {
+ notifyDescriptorReadRequest();
+ }
+
+ byte[] value = descriptor.getValue();
+ if (value == null) {
+ throw new RuntimeException("descriptor data read is null");
+ }
+
+ mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, value);
}
@Override
@@ -351,35 +1102,139 @@
boolean preparedWrite, boolean responseNeeded,
int offset, byte[] value) {
if (mGattServer == null) {
- if (DEBUG) Log.d(TAG, "GattServer is null, return");
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
return;
}
- if (DEBUG) Log.d(TAG, "onDescriptorWriteRequest(): (descriptor == getDescriptor())="
- + (descriptor == getDescriptor()));
+ BluetoothGattCharacteristic characteristic = descriptor.getCharacteristic();
+ UUID uid = characteristic.getUuid();
+ if (DEBUG) {
+ Log.d(TAG, "onDescriptorWriteRequest: preparedWrite=" + preparedWrite + ", responseNeeded= " + responseNeeded);
+ Log.d(TAG, " characteristic uuid = " + uid);
+ }
- notifyDescriptorWriteRequest();
descriptor.setValue(value);
- if (responseNeeded)
- mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, 0, null);
+ UUID duid = descriptor.getUuid();
+ // If there is a written request to the CCCD for Notify.
+ if (duid.equals(UPDATE_DESCRIPTOR_UUID)) {
+ if (Arrays.equals(value, BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE)) {
+ mGattServer.notifyCharacteristicChanged(mDevice, descriptor.getCharacteristic(), false);
+ mIndicated = false;
+ } else if (Arrays.equals(value, BluetoothGattDescriptor.ENABLE_INDICATION_VALUE)) {
+ mGattServer.notifyCharacteristicChanged(mDevice, descriptor.getCharacteristic(), true);
+ mIndicated = true;
+ }
+ } else if (duid.equals(DESCRIPTOR_NEED_ENCRYPTED_WRITE_UUID)) {
+ // verify
+ if (Arrays.equals(BleClientService.WRITE_VALUE.getBytes(), descriptor.getValue())) {
+ notifyDescriptorWriteRequestNeedEncrypted();
+ } else {
+ showMessage("Written data is not correct");
+ }
+ } else {
+ // verify
+ if (Arrays.equals(BleClientService.WRITE_VALUE.getBytes(), descriptor.getValue())) {
+ notifyDescriptorWriteRequest();
+ } else {
+ showMessage("Written data is not correct");
+ }
+ }
+ if (responseNeeded) {
+ mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, value);
+ }
}
@Override
public void onExecuteWrite(BluetoothDevice device, int requestId, boolean execute) {
if (mGattServer == null) {
- if (DEBUG) Log.d(TAG, "GattServer is null, return");
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
return;
}
- if (DEBUG) Log.d(TAG, "onExecuteWrite");
- if (execute) {
- notifyExecuteWrite();
- getCharacteristic(CHARACTERISTIC_UUID).setValue(mReliableWriteValue);
- mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, 0, null);
+ if (DEBUG) {
+ Log.d(TAG, "onExecuteWrite");
}
+
+ if (execute) {
+ if (mCountMtuChange > 0) {
+ onMtuTestDataReceive();
+ } else {
+ // verify
+ String str = BleClientService.WRITE_VALUE_507BYTES_FOR_RELIABLE_WRITE
+ + BleClientService.WRITE_VALUE_507BYTES_FOR_RELIABLE_WRITE;
+ if (str.equals(mReliableWriteValue)) {
+ notifyExecuteWrite();
+ } else {
+ showMessage("Failed to receive data");
+ Log.d(TAG, "Failed to receive data:" + mReliableWriteValue);
+ }
+ }
+ mReliableWriteValue = "";
+ }
+ mGattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, 0, null);
+ }
+
+ @Override
+ public void onNotificationSent(BluetoothDevice device, int status) {
+ if (mGattServer == null) {
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
+ return;
+ }
+ if (DEBUG) {
+ Log.d(TAG, "onNotificationSent");
+ }
+
+ if (status == BluetoothGatt.GATT_SUCCESS) {
+ if (mIndicated) {
+ notifyCharacteristicIndicationRequest();
+ } else {
+ mNotifyCount--;
+ if (mNotifyCount == 0) {
+ notifyCharacteristicNotificationRequest();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onMtuChanged(BluetoothDevice device, int mtu) {
+ if (mGattServer == null) {
+ if (DEBUG) {
+ Log.d(TAG, "GattServer is null, return");
+ }
+ return;
+ }
+ if (DEBUG) {
+ Log.d(TAG, "onMtuChanged");
+ }
+
+ mMtuSize = mtu;
+ if (mCountMtuChange == 0) {
+ if (mtu != 23) {
+ String msg = String.format(getString(R.string.ble_mtu_mismatch_message),
+ 23, mtu);
+ showMessage(msg);
+ }
+ } else if (mCountMtuChange == 1) {
+ if (mtu != 512) {
+ String msg = String.format(getString(R.string.ble_mtu_mismatch_message),
+ 512, mtu);
+ showMessage(msg);
+ }
+ }
+ mMtuTestReceivedData = "";
+ ++mCountMtuChange;
}
};
private void startAdvertise() {
- if (DEBUG) Log.d(TAG, "startAdvertise");
+ if (DEBUG) {
+ Log.d(TAG, "startAdvertise");
+ }
AdvertiseData data = new AdvertiseData.Builder()
.addServiceData(new ParcelUuid(ADV_SERVICE_UUID), new byte[]{1,2,3})
.addServiceUuid(new ParcelUuid(ADV_SERVICE_UUID))
@@ -393,10 +1248,67 @@
}
private void stopAdvertise() {
- if (DEBUG) Log.d(TAG, "stopAdvertise");
- mAdvertiser.stopAdvertising(mAdvertiseCallback);
+ if (DEBUG) {
+ Log.d(TAG, "stopAdvertise");
+ }
+ if (mAdvertiser != null) {
+ mAdvertiser.stopAdvertising(mAdvertiseCallback);
+ }
}
- private final AdvertiseCallback mAdvertiseCallback = new AdvertiseCallback(){};
+ private final AdvertiseCallback mAdvertiseCallback = new AdvertiseCallback(){
+ @Override
+ public void onStartFailure(int errorCode) {
+ // Implementation for API Test.
+ super.onStartFailure(errorCode);
+ if (DEBUG) {
+ Log.d(TAG, "onStartFailure");
+ }
+
+ if (errorCode == ADVERTISE_FAILED_FEATURE_UNSUPPORTED) {
+ notifyAdvertiseUnsupported();
+ } else {
+ notifyOpenFail();
+ }
+ }
+
+ @Override
+ public void onStartSuccess(AdvertiseSettings settingsInEffect) {
+ // Implementation for API Test.
+ super.onStartSuccess(settingsInEffect);
+ if (DEBUG) {
+ Log.d(TAG, "onStartSuccess");
+ }
+ }
+ };
+
+ /*protected*/ static void dumpService(BluetoothGattService service, int level) {
+ String indent = "";
+ for (int i = 0; i < level; ++i) {
+ indent += " ";
+ }
+
+ Log.d(TAG, indent + "[service]");
+ Log.d(TAG, indent + "UUID: " + service.getUuid());
+ Log.d(TAG, indent + " [characteristics]");
+ for (BluetoothGattCharacteristic ch : service.getCharacteristics()) {
+ Log.d(TAG, indent + " UUID: " + ch.getUuid());
+ Log.d(TAG, indent + " properties: " + String.format("0x%02X", ch.getProperties()));
+ Log.d(TAG, indent + " permissions: " + String.format("0x%02X", ch.getPermissions()));
+ Log.d(TAG, indent + " [descriptors]");
+ for (BluetoothGattDescriptor d : ch.getDescriptors()) {
+ Log.d(TAG, indent + " UUID: " + d.getUuid());
+ Log.d(TAG, indent + " permissions: " + String.format("0x%02X", d.getPermissions()));
+ }
+ }
+
+ if (service.getIncludedServices() != null) {
+ Log.d(TAG, indent + " [included services]");
+ for (BluetoothGattService s : service.getIncludedServices()) {
+ dumpService(s, level+1);
+ }
+ }
+ }
+
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerStartActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerStartActivity.java
deleted file mode 100644
index e8e35d5..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerStartActivity.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2013 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 com.android.cts.verifier.bluetooth;
-
-import com.android.cts.verifier.PassFailButtons;
-import com.android.cts.verifier.R;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class BleServerStartActivity extends PassFailButtons.Activity {
-
- private TestAdapter mTestAdapter;
- private int mAllPassed;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.ble_server_start);
- setPassFailButtonClickListeners();
- setInfoResources(R.string.ble_server_start_name,
- R.string.ble_server_start_info, -1);
- getPassButton().setEnabled(false);
-
- mTestAdapter = new TestAdapter(this, setupTestList());
- ListView listView = (ListView) findViewById(R.id.ble_server_tests);
- listView.setAdapter(mTestAdapter);
-
- mAllPassed = 0;
- startService(new Intent(this, BleServerService.class));
- }
-
- @Override
- public void onResume() {
- super.onResume();
-
- IntentFilter filter = new IntentFilter();
- filter.addAction(BleServerService.BLE_SERVICE_ADDED);
- filter.addAction(BleServerService.BLE_SERVER_CONNECTED);
- filter.addAction(BleServerService.BLE_CHARACTERISTIC_READ_REQUEST);
- filter.addAction(BleServerService.BLE_CHARACTERISTIC_WRITE_REQUEST);
- filter.addAction(BleServerService.BLE_DESCRIPTOR_READ_REQUEST);
- filter.addAction(BleServerService.BLE_DESCRIPTOR_WRITE_REQUEST);
- filter.addAction(BleServerService.BLE_EXECUTE_WRITE);
- filter.addAction(BleServerService.BLE_SERVER_DISCONNECTED);
- filter.addAction(BleServerService.BLE_OPEN_FAIL);
- registerReceiver(onBroadcast, filter);
- }
-
- @Override
- public void onPause() {
- super.onPause();
- unregisterReceiver(onBroadcast);
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- stopService(new Intent(this, BleServerService.class));
- }
-
- private List<Integer> setupTestList() {
- ArrayList<Integer> testList = new ArrayList<Integer>();
- testList.add(R.string.ble_server_add_service);
- testList.add(R.string.ble_server_receiving_connect);
- testList.add(R.string.ble_server_read_characteristic);
- testList.add(R.string.ble_server_write_characteristic);
- testList.add(R.string.ble_server_read_descriptor);
- testList.add(R.string.ble_server_write_descriptor);
- testList.add(R.string.ble_server_reliable_write);
- testList.add(R.string.ble_server_receiving_disconnect);
- return testList;
- }
-
- private BroadcastReceiver onBroadcast = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (action == BleServerService.BLE_SERVICE_ADDED) {
- mTestAdapter.setTestPass(0);
- mAllPassed |= 0x01;
- } else if (action == BleServerService.BLE_SERVER_CONNECTED) {
- mTestAdapter.setTestPass(1);
- mAllPassed |= 0x02;
- } else if (action == BleServerService.BLE_CHARACTERISTIC_READ_REQUEST) {
- mTestAdapter.setTestPass(2);
- mAllPassed |= 0x04;
- } else if (action == BleServerService.BLE_CHARACTERISTIC_WRITE_REQUEST) {
- mTestAdapter.setTestPass(3);
- mAllPassed |= 0x08;
- } else if (action == BleServerService.BLE_DESCRIPTOR_READ_REQUEST) {
- mTestAdapter.setTestPass(4);
- mAllPassed |= 0x10;
- } else if (action == BleServerService.BLE_DESCRIPTOR_WRITE_REQUEST) {
- mTestAdapter.setTestPass(5);
- mAllPassed |= 0x20;
- } else if (action == BleServerService.BLE_EXECUTE_WRITE) {
- mTestAdapter.setTestPass(6);
- mAllPassed |= 0x40;
- } else if (action == BleServerService.BLE_SERVER_DISCONNECTED) {
- mTestAdapter.setTestPass(7);
- mAllPassed |= 0x80;
- } else if (action == BleServerService.BLE_OPEN_FAIL) {
- setTestResultAndFinish(false);
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(BleServerStartActivity.this, "Cannot open GattService",
- Toast.LENGTH_SHORT).show();
- }
- });
- }
- mTestAdapter.notifyDataSetChanged();
- if (mAllPassed == 0xFF) getPassButton().setEnabled(true);
- }
- };
-}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerTestBaseActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerTestBaseActivity.java
new file mode 100644
index 0000000..c58ee46
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerTestBaseActivity.java
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2013 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 com.android.cts.verifier.bluetooth;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BleServerTestBaseActivity extends PassFailButtons.Activity {
+
+ private static final int PASS_FLAG_ADD_SERVICE = 0x1;
+ private static final int PASS_FLAG_CONNECT = 0x2;
+ private static final int PASS_FLAG_READ_CHARACTERISTIC = 0x4;
+ private static final int PASS_FLAG_WRITE_CHARACTERISTIC = 0x8;
+ private static final int PASS_FLAG_READ_DESCRIPTOR = 0x10;
+ private static final int PASS_FLAG_WRITE_DESCRIPTOR = 0x20;
+ private static final int PASS_FLAG_WRITE = 0x40;
+ private static final int PASS_FLAG_DISCONNECT = 0x80;
+ private static final int PASS_FLAG_NOTIFY_CHARACTERISTIC = 0x100;
+ private static final int PASS_FLAG_READ_CHARACTERISTIC_NO_PERMISSION = 0x200;
+ private static final int PASS_FLAG_WRITE_CHARACTERISTIC_NO_PERMISSION = 0x400;
+ private static final int PASS_FLAG_READ_DESCRIPTOR_NO_PERMISSION = 0x800;
+ private static final int PASS_FLAG_WRITE_DESCRIPTOR_NO_PERMISSION = 0x1000;
+ private static final int PASS_FLAG_INDICATE_CHARACTERISTIC = 0x2000;
+ private static final int PASS_FLAG_MTU_CHANGE_23BYTES = 0x4000;
+ private static final int PASS_FLAG_MTU_CHANGE_512BYTES = 0x8000;
+ private static final int PASS_FLAG_RELIABLE_WRITE_BAD_RESP = 0x10000;
+ private static final int PASS_FLAG_ALL = 0x1FFFF;
+
+ private final int BLE_SERVICE_ADDED = 0;
+ private final int BLE_SERVER_CONNECTED = 1;
+ private final int BLE_CHARACTERISTIC_READ_REQUEST = 2;
+ private final int BLE_CHARACTERISTIC_WRITE_REQUEST = 3;
+ private final int BLE_SERVER_MTU_23BYTES = 4;
+ private final int BLE_SERVER_MTU_512BYTES = 5;
+ private final int BLE_CHARACTERISTIC_READ_REQUEST_WITHOUT_PERMISSION = 6;
+ private final int BLE_CHARACTERISTIC_WRITE_REQUEST_WITHOUT_PERMISSION = 7;
+ private final int BLE_EXECUTE_WRITE = 8;
+ private final int BLE_EXECUTE_WRITE_BAD_RESP = 9;
+ private final int BLE_CHARACTERISTIC_NOTIFICATION_REQUEST = 9; //10;
+ private final int BLE_CHARACTERISTIC_INDICATE_REQUEST = 10; //11;
+ private final int BLE_DESCRIPTOR_READ_REQUEST = 11; //12;
+ private final int BLE_DESCRIPTOR_WRITE_REQUEST = 12; //13;
+ private final int BLE_DESCRIPTOR_READ_REQUEST_WITHOUT_PERMISSION = 13; //14;
+ private final int BLE_DESCRIPTOR_WRITE_REQUEST_WITHOUT_PERMISSION = 14; //15;
+ private final int BLE_SERVER_DISCONNECTED = 15; //16;
+ private final int BLE_OPEN_FAIL = 16; //17;
+
+ private TestAdapter mTestAdapter;
+ private long mAllPassed;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.ble_server_start);
+ setPassFailButtonClickListeners();
+ setInfoResources(R.string.ble_server_start_name,
+ R.string.ble_server_start_info, -1);
+ getPassButton().setEnabled(false);
+
+ mTestAdapter = new TestAdapter(this, setupTestList());
+ ListView listView = (ListView) findViewById(R.id.ble_server_tests);
+ listView.setAdapter(mTestAdapter);
+
+// mAllPassed = 0;
+ // skip Reliable write (bad response) test
+ mAllPassed = PASS_FLAG_RELIABLE_WRITE_BAD_RESP;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BleServerService.BLE_BLUETOOTH_DISABLED);
+ filter.addAction(BleServerService.BLE_SERVICE_ADDED);
+ filter.addAction(BleServerService.BLE_SERVER_CONNECTED);
+ filter.addAction(BleServerService.BLE_MTU_REQUEST_23BYTES);
+ filter.addAction(BleServerService.BLE_MTU_REQUEST_512BYTES);
+ filter.addAction(BleServerService.BLE_CHARACTERISTIC_READ_REQUEST);
+ filter.addAction(BleServerService.BLE_CHARACTERISTIC_WRITE_REQUEST);
+ filter.addAction(BleServerService.BLE_CHARACTERISTIC_READ_REQUEST_WITHOUT_PERMISSION);
+ filter.addAction(BleServerService.BLE_CHARACTERISTIC_WRITE_REQUEST_WITHOUT_PERMISSION);
+ filter.addAction(BleServerService.BLE_CHARACTERISTIC_NOTIFICATION_REQUEST);
+ filter.addAction(BleServerService.BLE_CHARACTERISTIC_INDICATE_REQUEST);
+ filter.addAction(BleServerService.BLE_DESCRIPTOR_READ_REQUEST);
+ filter.addAction(BleServerService.BLE_DESCRIPTOR_WRITE_REQUEST);
+ filter.addAction(BleServerService.BLE_DESCRIPTOR_READ_REQUEST_WITHOUT_PERMISSION);
+ filter.addAction(BleServerService.BLE_DESCRIPTOR_WRITE_REQUEST_WITHOUT_PERMISSION);
+ filter.addAction(BleServerService.BLE_EXECUTE_WRITE);
+ filter.addAction(BleServerService.BLE_RELIABLE_WRITE_BAD_RESP);
+ filter.addAction(BleServerService.BLE_SERVER_DISCONNECTED);
+ filter.addAction(BleServerService.BLE_OPEN_FAIL);
+ filter.addAction(BleServerService.BLE_BLUETOOTH_MISMATCH_SECURE);
+ filter.addAction(BleServerService.BLE_BLUETOOTH_MISMATCH_INSECURE);
+ filter.addAction(BleServerService.BLE_ADVERTISE_UNSUPPORTED);
+ filter.addAction(BleServerService.BLE_ADD_SERVICE_FAIL);
+
+ registerReceiver(mBroadcast, filter);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ unregisterReceiver(mBroadcast);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ }
+
+ private List<Integer> setupTestList() {
+ ArrayList<Integer> testList = new ArrayList<Integer>();
+ testList.add(R.string.ble_server_add_service);
+ testList.add(R.string.ble_server_receiving_connect);
+ testList.add(R.string.ble_server_read_characteristic);
+ testList.add(R.string.ble_server_write_characteristic);
+ testList.add(R.string.ble_server_mtu_23bytes);
+ testList.add(R.string.ble_server_mtu_512bytes);
+ testList.add(R.string.ble_server_read_characteristic_without_permission);
+ testList.add(R.string.ble_server_write_characteristic_without_permission);
+ testList.add(R.string.ble_server_reliable_write);
+// testList.add(R.string.ble_server_reliable_write_bad_resp);
+ testList.add(R.string.ble_server_notify_characteristic);
+ testList.add(R.string.ble_server_indicate_characteristic);
+ testList.add(R.string.ble_server_read_descriptor);
+ testList.add(R.string.ble_server_write_descriptor);
+ testList.add(R.string.ble_server_read_descriptor_without_permission);
+ testList.add(R.string.ble_server_write_descriptor_without_permission);
+ testList.add(R.string.ble_server_receiving_disconnect);
+ return testList;
+ }
+
+ private void showErrorDialog(int titleId, int messageId, boolean finish) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this)
+ .setTitle(titleId)
+ .setMessage(messageId);
+ if (finish) {
+ builder.setOnCancelListener(new Dialog.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ finish();
+ }
+ });
+ }
+ builder.create().show();
+ }
+
+ private BroadcastReceiver mBroadcast = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ switch (action) {
+ case BleServerService.BLE_BLUETOOTH_DISABLED:
+ showErrorDialog(R.string.ble_bluetooth_disable_title, R.string.ble_bluetooth_disable_message, true);
+ break;
+ case BleServerService.BLE_SERVICE_ADDED:
+ mTestAdapter.setTestPass(BLE_SERVICE_ADDED);
+ mAllPassed |= PASS_FLAG_ADD_SERVICE;
+ break;
+ case BleServerService.BLE_SERVER_CONNECTED:
+ mTestAdapter.setTestPass(BLE_SERVER_CONNECTED);
+ mAllPassed |= PASS_FLAG_CONNECT;
+ break;
+ case BleServerService.BLE_CHARACTERISTIC_READ_REQUEST:
+ // Sometimes server returns incorrect pairing status.
+ // And it causes the mismatch of pairing status and connection status.
+ // So consider the connection went well if reading characteristic went well.
+ mTestAdapter.setTestPass(BLE_SERVER_CONNECTED);
+ mAllPassed |= PASS_FLAG_CONNECT;
+
+ mTestAdapter.setTestPass(BLE_CHARACTERISTIC_READ_REQUEST);
+ mAllPassed |= PASS_FLAG_READ_CHARACTERISTIC;
+ break;
+ case BleServerService.BLE_CHARACTERISTIC_WRITE_REQUEST:
+ mTestAdapter.setTestPass(BLE_CHARACTERISTIC_WRITE_REQUEST);
+ mAllPassed |= PASS_FLAG_WRITE_CHARACTERISTIC;
+ break;
+ case BleServerService.BLE_DESCRIPTOR_READ_REQUEST:
+ mTestAdapter.setTestPass(BLE_DESCRIPTOR_READ_REQUEST);
+ mAllPassed |= PASS_FLAG_READ_DESCRIPTOR;
+ break;
+ case BleServerService.BLE_DESCRIPTOR_WRITE_REQUEST:
+ mTestAdapter.setTestPass(BLE_DESCRIPTOR_WRITE_REQUEST);
+ mAllPassed |= PASS_FLAG_WRITE_DESCRIPTOR;
+ break;
+ case BleServerService.BLE_EXECUTE_WRITE:
+ mTestAdapter.setTestPass(BLE_EXECUTE_WRITE);
+ mAllPassed |= PASS_FLAG_WRITE;
+ break;
+ case BleServerService.BLE_RELIABLE_WRITE_BAD_RESP:
+ mTestAdapter.setTestPass(BLE_EXECUTE_WRITE_BAD_RESP);
+ mAllPassed |= PASS_FLAG_RELIABLE_WRITE_BAD_RESP;
+ break;
+ case BleServerService.BLE_SERVER_DISCONNECTED:
+ mTestAdapter.setTestPass(BLE_SERVER_DISCONNECTED);
+ mAllPassed |= PASS_FLAG_DISCONNECT;
+ break;
+ case BleServerService.BLE_CHARACTERISTIC_NOTIFICATION_REQUEST:
+ mTestAdapter.setTestPass(BLE_CHARACTERISTIC_NOTIFICATION_REQUEST);
+ mAllPassed |= PASS_FLAG_NOTIFY_CHARACTERISTIC;
+ break;
+ case BleServerService.BLE_CHARACTERISTIC_READ_REQUEST_WITHOUT_PERMISSION:
+ mTestAdapter.setTestPass(BLE_CHARACTERISTIC_READ_REQUEST_WITHOUT_PERMISSION);
+ mAllPassed |= PASS_FLAG_READ_CHARACTERISTIC_NO_PERMISSION;
+ break;
+ case BleServerService.BLE_CHARACTERISTIC_WRITE_REQUEST_WITHOUT_PERMISSION:
+ mTestAdapter.setTestPass(BLE_CHARACTERISTIC_WRITE_REQUEST_WITHOUT_PERMISSION);
+ mAllPassed |= PASS_FLAG_WRITE_CHARACTERISTIC_NO_PERMISSION;
+ break;
+ case BleServerService.BLE_DESCRIPTOR_READ_REQUEST_WITHOUT_PERMISSION:
+ mTestAdapter.setTestPass(BLE_DESCRIPTOR_READ_REQUEST_WITHOUT_PERMISSION);
+ mAllPassed |= PASS_FLAG_READ_DESCRIPTOR_NO_PERMISSION;
+ break;
+ case BleServerService.BLE_DESCRIPTOR_WRITE_REQUEST_WITHOUT_PERMISSION:
+ mTestAdapter.setTestPass(BLE_DESCRIPTOR_WRITE_REQUEST_WITHOUT_PERMISSION);
+ mAllPassed |= PASS_FLAG_WRITE_DESCRIPTOR_NO_PERMISSION;
+ break;
+ case BleServerService.BLE_CHARACTERISTIC_INDICATE_REQUEST:
+ mTestAdapter.setTestPass(BLE_CHARACTERISTIC_INDICATE_REQUEST);
+ mAllPassed |= PASS_FLAG_INDICATE_CHARACTERISTIC;
+ break;
+ case BleServerService.BLE_MTU_REQUEST_23BYTES:
+ mTestAdapter.setTestPass(BLE_SERVER_MTU_23BYTES);
+ mAllPassed |= PASS_FLAG_MTU_CHANGE_23BYTES;
+ break;
+ case BleServerService.BLE_MTU_REQUEST_512BYTES:
+ mTestAdapter.setTestPass(BLE_SERVER_MTU_512BYTES);
+ mAllPassed |= PASS_FLAG_MTU_CHANGE_512BYTES;
+ break;
+ case BleServerService.BLE_BLUETOOTH_MISMATCH_SECURE:
+ showErrorDialog(R.string.ble_bluetooth_mismatch_title, R.string.ble_bluetooth_mismatch_secure_message, true);
+ break;
+ case BleServerService.BLE_BLUETOOTH_MISMATCH_INSECURE:
+ showErrorDialog(R.string.ble_bluetooth_mismatch_title, R.string.ble_bluetooth_mismatch_insecure_message, true);
+ break;
+ case BleServerService.BLE_ADVERTISE_UNSUPPORTED:
+ showErrorDialog(R.string.bt_advertise_unsupported_title, R.string.bt_advertise_unsupported_message, true);
+ break;
+ case BleServerService.BLE_OPEN_FAIL:
+ setTestResultAndFinish(false);
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Toast.makeText(BleServerTestBaseActivity.this, R.string.bt_open_failed_message, Toast.LENGTH_SHORT).show();
+ }
+ });
+ break;
+ case BleServerService.BLE_ADD_SERVICE_FAIL:
+ showErrorDialog(R.string.bt_add_service_failed_title, R.string.bt_add_service_failed_message, true);
+ break;
+ }
+
+ mTestAdapter.notifyDataSetChanged();
+ if (mAllPassed == PASS_FLAG_ALL) getPassButton().setEnabled(true);
+ }
+ };
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java
index df70984..3477870 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java
@@ -16,14 +16,14 @@
package com.android.cts.verifier.bluetooth;
-import com.android.cts.verifier.ManifestTestListAdapter;
-import com.android.cts.verifier.PassFailButtons;
-import com.android.cts.verifier.R;
-
import android.bluetooth.BluetoothAdapter;
import android.os.Bundle;
import android.widget.Toast;
+import com.android.cts.verifier.ManifestTestListAdapter;
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
import java.util.ArrayList;
import java.util.List;
@@ -54,14 +54,20 @@
disabledTestArray.add(
"com.android.cts.verifier.bluetooth.BleClientTestActivity");
disabledTestArray.add(
- "com.android.cts.verifier.bluetooth.BleServerStartActivity");
+ "com.android.cts.verifier.bluetooth.BleServerTestBaseActivity");
+ disabledTestArray.add(
+ "com.android.cts.verifier.bluetooth.BleConnectionPriorityServerBaseActivity");
+ disabledTestArray.add(
+ "com.android.cts.verifier.bluetooth.BleConnectionPriorityClientBaseActivity");
} else if (!bluetoothAdapter.isMultipleAdvertisementSupported()) {
disabledTestArray.add(
"com.android.cts.verifier.bluetooth.BleAdvertiserTestActivity");
disabledTestArray.add(
- "com.android.cts.verifier.bluetooth.BleServerStartActivity");
+ "com.android.cts.verifier.bluetooth.BleServerTestBaseActivity");
disabledTestArray.add(
"com.android.cts.verifier.bluetooth.BleScannerTestActivity");
+ disabledTestArray.add(
+ "com.android.cts.verifier.bluetooth.BleConnectionPriorityServerBaseActivity");
}
setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(),
disabledTestArray.toArray(new String[disabledTestArray.size()])));
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/TestTaskQueue.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/TestTaskQueue.java
new file mode 100644
index 0000000..5ceee0c
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/TestTaskQueue.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.bluetooth;
+
+import android.os.Handler;
+import android.os.HandlerThread;
+
+import java.util.ArrayList;
+
+/**
+ * TestTaskQueue runs asynchronous operations on background thread.
+ *
+ * TestTaskQueue holds Handler which runs on background thread.
+ * Asynchronous operations will be run by adding operation by addTask().
+ * Each operations will be managed by Handler.
+ */
+public class TestTaskQueue {
+
+ private Handler mHandler;
+ private ArrayList<Runnable> mTasks = new ArrayList<>();
+
+ public TestTaskQueue(String threadName) {
+ HandlerThread th = new HandlerThread(threadName);
+ th.start();
+ mHandler = new Handler(th.getLooper());
+ }
+
+ /**
+ * Cancels all pending operations.
+ */
+ public synchronized void quit() {
+ // cancel all pending operations.
+ for (Runnable task : mTasks) {
+ mHandler.removeCallbacks(task);
+ }
+ mTasks.clear();
+
+ // terminate Handler
+ mHandler.getLooper().quit();
+ mHandler = null;
+ }
+
+ /**
+ * Reserves new asynchronous operation.
+ * Operations will be run sequentially.
+ *
+ * @param r new operation
+ */
+ public synchronized void addTask(Runnable r) {
+ addTask(r, 0);
+ }
+
+ /**
+ * Reserves new asynchronous operation.
+ * Operations will be run sequentially.
+ *
+ * @param r new operation
+ * @param delay delay for execution
+ */
+ public synchronized void addTask(final Runnable r, long delay) {
+ if ((mHandler != null) && (r != null)) {
+ Runnable task = new Runnable() {
+ @Override
+ public void run() {
+ mTasks.remove(this);
+ r.run();
+ }
+ };
+ mTasks.add(task);
+ mHandler.postDelayed(task, delay);
+ }
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/ConditionProviderVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/ConditionProviderVerifierActivity.java
index 496414f..0b0be81 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/ConditionProviderVerifierActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/ConditionProviderVerifierActivity.java
@@ -399,6 +399,11 @@
// Now that it's subscribed, remove the rule and verify that it
// unsubscribes.
mNm.removeAutomaticZenRule(id);
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ logFail("unexpected InterruptedException");
+ }
MockConditionProvider.probeSubscribe(mContext,
new MockConditionProvider.ParcelableListResultCatcher() {
@Override
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java
new file mode 100644
index 0000000..8250594
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.voicemail;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.telecom.TelecomManager;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+import com.android.cts.verifier.voicemail.VoicemailBroadcastReceiver.ReceivedListener;
+
+/**
+ * This test ask the tester to set the CTS verifier as the default dialer and leave a voicemail. The
+ * test will pass if the verifier is able to receive a broadcast for the incoming voicemail. This
+ * depends on telephony to send the broadcast to the default dialer when receiving a Message Waiting
+ * Indicator SMS.
+ */
+public class VoicemailBroadcastActivity extends PassFailButtons.Activity {
+
+ private String mDefaultDialer;
+
+ private ImageView mSetDefaultDialerImage;
+ private ImageView mLeaveVoicemailImage;
+ private TextView mLeaveVoicemailText;
+ private ImageView mRestoreDefaultDialerImage;
+ private TextView mRestoreDefaultDialerText;
+
+ private Button mSetDefaultDialerButton;
+ private Button mRestoreDefaultDialerButton;
+
+ private BroadcastReceiver mDefaultDialerChangedReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String packageName =
+ intent.getStringExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME);
+ if (!getPassButton().isEnabled()) {
+ updateSetDefaultDialerState(packageName);
+ } else {
+ if (packageName.equals(getPackageName())) {
+ mRestoreDefaultDialerImage
+ .setImageDrawable(getDrawable(R.drawable.fs_indeterminate));
+ } else {
+ mRestoreDefaultDialerImage.setImageDrawable(getDrawable(R.drawable.fs_good));
+ }
+ }
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ View view = getLayoutInflater().inflate(R.layout.voicemail_broadcast, null);
+ setContentView(view);
+ setInfoResources(R.string.voicemail_broadcast_test,
+ R.string.voicemail_broadcast_instructions, -1);
+ setPassFailButtonClickListeners();
+ getPassButton().setEnabled(false);
+
+ mSetDefaultDialerImage = (ImageView) findViewById(R.id.set_default_dialer_image);
+ mLeaveVoicemailImage = (ImageView) findViewById(R.id.leave_voicemail_image);
+ mLeaveVoicemailText = (TextView) findViewById(R.id.leave_voicemail_text);
+ mRestoreDefaultDialerImage = (ImageView) findViewById(R.id.restore_default_dialer_image);
+ mRestoreDefaultDialerText = (TextView) findViewById(R.id.restore_default_dialer_text);
+
+ mSetDefaultDialerButton = (Button) view.findViewById(R.id.set_default_dialer);
+ mRestoreDefaultDialerButton = (Button) view.findViewById(R.id.restore_default_dialer);
+
+ final TelecomManager telecomManager = getSystemService(TelecomManager.class);
+ mDefaultDialer = telecomManager.getDefaultDialerPackage();
+ updateSetDefaultDialerState(mDefaultDialer);
+ if (mDefaultDialer.equals(getPackageName())) {
+ // The CTS verifier is already the default dialer (probably due to the tester exiting
+ // mid test. We don't know what the default dialer should be so just prompt the tester
+ // to restore it through settings, and remove the button.
+ mRestoreDefaultDialerText
+ .setText(R.string.voicemail_restore_default_dialer_no_default_description);
+ mRestoreDefaultDialerButton.setVisibility(View.GONE);
+ }
+
+ mSetDefaultDialerButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (telecomManager.getDefaultDialerPackage().equals(getPackageName())) {
+ Toast.makeText(VoicemailBroadcastActivity.this,
+ R.string.voicemail_default_dialer_already_set, Toast.LENGTH_SHORT)
+ .show();
+ return;
+ }
+
+ final Intent intent = new Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER);
+ intent.putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME,
+ getPackageName());
+ startActivityForResult(intent, 0);
+ }
+ });
+
+ mRestoreDefaultDialerButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (telecomManager.getDefaultDialerPackage().equals(mDefaultDialer)) {
+ Toast.makeText(VoicemailBroadcastActivity.this,
+ R.string.voicemail_default_dialer_already_restored, Toast.LENGTH_SHORT)
+ .show();
+ return;
+ }
+
+ final Intent intent = new Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER);
+ intent.putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME,
+ mDefaultDialer);
+ startActivityForResult(intent, 0);
+ }
+ });
+
+ VoicemailBroadcastReceiver.setListener(new ReceivedListener() {
+ @Override
+ public void onReceived() {
+
+ Toast.makeText(VoicemailBroadcastActivity.this,
+ R.string.voicemail_broadcast_received, Toast.LENGTH_SHORT).show();
+ mLeaveVoicemailImage.setImageDrawable(getDrawable(R.drawable.fs_good));
+ mLeaveVoicemailText.setText(R.string.voicemail_broadcast_received);
+ getPassButton().setEnabled(true);
+ }
+ });
+
+ registerReceiver(mDefaultDialerChangedReceiver,
+ new IntentFilter(TelecomManager.ACTION_DEFAULT_DIALER_CHANGED));
+ }
+
+ @Override
+ protected void onDestroy() {
+ VoicemailBroadcastReceiver.setListener(null);
+ unregisterReceiver(mDefaultDialerChangedReceiver);
+ super.onDestroy();
+ }
+
+ private void updateSetDefaultDialerState(String packageName) {
+ if (packageName.equals(getPackageName())) {
+ mSetDefaultDialerImage.setImageDrawable(getDrawable(R.drawable.fs_good));
+ } else {
+ mSetDefaultDialerImage.setImageDrawable(getDrawable(R.drawable.fs_indeterminate));
+ }
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastReceiver.java b/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastReceiver.java
new file mode 100644
index 0000000..1785576
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastReceiver.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.verifier.voicemail;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+/**
+ * Receiver used by {@link VoicemailBroadcastActivity} to receive {@link
+ * android.telephony.TelephonyManager.ACTION_SHOW_VOICEMAIL_NOTIFICATION}, which must be a manifest
+ * receiver.
+ */
+public class VoicemailBroadcastReceiver extends BroadcastReceiver {
+
+ public interface ReceivedListener {
+
+ void onReceived();
+ }
+
+ private static ReceivedListener sListener;
+
+ public static void setListener(ReceivedListener listener) {
+ sListener = listener;
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (sListener != null) {
+ sListener.onReceived();
+ }
+ }
+}
diff --git a/apps/cts-usb-accessory/Android.mk b/apps/cts-usb-accessory/Android.mk
index f3a7ebd..7699b1a 100644
--- a/apps/cts-usb-accessory/Android.mk
+++ b/apps/cts-usb-accessory/Android.mk
@@ -28,6 +28,7 @@
LOCAL_C_INCLUDES += \
bionic/libc/kernel/uapi \
+ bionic/libc/kernel/android/uapi \
bionic/libc/kernel/uapi/asm-x86 \
LOCAL_STATIC_LIBRARIES := libusbhost libcutils
diff --git a/build/config.mk b/build/config.mk
index 3b9723b..2c3d87b 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -14,8 +14,6 @@
# Test XMLs, native executables, and packages will be placed in this
# directory before creating the final CTS distribution.
-CTS_TESTCASES_OUT := $(HOST_OUT)/old-cts/old-android-cts/repository/testcases
-
COMPATIBILITY_TESTCASES_OUT_cts := $(HOST_OUT)/cts/android-cts/testcases
# Scanners of source files for tests which are then inputed into
@@ -36,18 +34,12 @@
# Holds the target architecture to build for.
CTS_TARGET_ARCH := $(TARGET_ARCH)
-# default module config filename
-CTS_MODULE_TEST_CONFIG := AndroidTest.xml
-
# CTS build rules
BUILD_COMPATIBILITY_SUITE := cts/build/compatibility_test_suite.mk
BUILD_CTS_EXECUTABLE := cts/build/test_executable.mk
BUILD_CTS_PACKAGE := cts/build/test_package.mk
-BUILD_CTS_GTEST_PACKAGE := cts/build/test_gtest_package.mk
-BUILD_CTS_HOST_JAVA_LIBRARY := cts/build/test_host_java_library.mk
+BUILD_CTS_HOST_JAVA_LIBRARY := $(BUILD_HOST_JAVA_LIBRARY)
BUILD_CTS_TARGET_JAVA_LIBRARY := cts/build/test_target_java_library.mk
-BUILD_CTS_DEQP_PACKAGE := cts/build/test_deqp_package.mk
BUILD_CTS_SUPPORT_PACKAGE := cts/build/support_package.mk
-BUILD_CTS_MODULE_TEST_CONFIG := cts/build/module_test_config.mk
BUILD_CTS_DEVICE_INFO_PACKAGE := cts/build/device_info_package.mk
BUILD_CTS_TARGET_TESTNG_PACKAGE := cts/build/test_target_testng_package.mk
diff --git a/build/module_test_config.mk b/build/module_test_config.mk
deleted file mode 100644
index fec4893..0000000
--- a/build/module_test_config.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2015 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.
-
-ifneq ($(LOCAL_CTS_MODULE_CONFIG),)
-cts_module_test_config := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).config
-$(cts_module_test_config): $(LOCAL_CTS_MODULE_CONFIG) | $(ACP)
- $(call copy-file-to-target)
-endif
-# clear var
-LOCAL_CTS_MODULE_CONFIG :=
diff --git a/build/support_package.mk b/build/support_package.mk
index 16a254e..f6f13d1 100644
--- a/build/support_package.mk
+++ b/build/support_package.mk
@@ -23,14 +23,3 @@
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE)
-
-cts_support_apks :=
-$(foreach fp, $(ALL_MODULES.$(LOCAL_PACKAGE_NAME).BUILT_INSTALLED),\
- $(eval pair := $(subst :,$(space),$(fp)))\
- $(eval built := $(word 1,$(pair)))\
- $(eval installed := $(CTS_TESTCASES_OUT)/$(notdir $(word 2,$(pair))))\
- $(eval $(call copy-one-file, $(built), $(installed)))\
- $(eval cts_support_apks += $(installed)))
-
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_support_apks)
diff --git a/build/test_deqp_package.mk b/build/test_deqp_package.mk
deleted file mode 100644
index f98f342..0000000
--- a/build/test_deqp_package.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2012 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.
-
-#
-# Builds dEQP test description XMLs needed by CTS.
-#
-
-CTS_DEQP_CONFIG_PATH := $(call my-dir)
-
-cts_library_xml := $(CTS_TESTCASES_OUT)/com.drawelements.deqp.$(DEQP_API).xml
-$(cts_library_xml): MUSTPASS_XML_FILE := external/deqp/android/cts/master/com.drawelements.deqp.$(DEQP_API).xml
-$(cts_library_xml): PRIVATE_TEST_NAME := $(DEQP_TEST_NAME)
-$(cts_library_xml): PRIVATE_TEST_PACKAGE := com.drawelements.deqp.$(DEQP_API)
-$(cts_library_xml): PRIVATE_DUMMY_CASELIST := $(CTS_DEQP_CONFIG_PATH)/deqp_dummy_test_list
-$(cts_library_xml): external/deqp/android/cts/master/com.drawelements.deqp.$(DEQP_API).xml external/deqp/android/cts/mnc/$(DEQP_API)-master.txt $(CTS_EXPECTATIONS) $(CTS_UNSUPPORTED_ABIS) $(CTS_XML_GENERATOR)
- $(hide) echo Generating test description for $(PRIVATE_TEST_NAME)
- $(hide) mkdir -p $(CTS_TESTCASES_OUT)
-
-# Query build ABIs by routing a dummy test list through xml generator and parse result. Use sed to insert the ABI string into the XML files.
- $(hide) SUPPORTED_ABI_ATTR=`$(CTS_XML_GENERATOR) -t dummyTest \
- -n dummyName \
- -p invalid.dummy \
- -e $(CTS_EXPECTATIONS) \
- -b $(CTS_UNSUPPORTED_ABIS) \
- -a $(CTS_TARGET_ARCH) \
- < $(PRIVATE_DUMMY_CASELIST) \
- | grep --only-matching -e " abis=\"[^\"]*\""` && \
- $(SED_EXTENDED) -e "s:^(\s*)<Test ((.[^/]|[^/])*)(/?)>$$:\1<Test \2 $${SUPPORTED_ABI_ATTR}\4>:" \
- < $(MUSTPASS_XML_FILE) \
- > $@
diff --git a/build/test_executable.mk b/build/test_executable.mk
index 979f59e..062ddc4 100644
--- a/build/test_executable.mk
+++ b/build/test_executable.mk
@@ -13,45 +13,11 @@
# limitations under the License.
#
-# Builds an executable and defines a rule to generate the associated test
-# package XML needed by CTS.
+# Builds an executable:
#
-# 1. Replace "include $(BUILD_EXECUTABLE)"
-# with "include $(BUILD_CTS_EXECUTABLE)"
-#
-# 2. Define LOCAL_CTS_TEST_PACKAGE to group the tests under a package
-# as needed by CTS.
+# * Replace "include $(BUILD_EXECUTABLE)"
+# with "include $(BUILD_CTS_EXECUTABLE)"
#
LOCAL_CXX_STL := libc++
include $(BUILD_EXECUTABLE)
-include $(BUILD_CTS_MODULE_TEST_CONFIG)
-
-cts_executable_bin :=
-$(foreach fp, $(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(ALL_MODULES.$(LOCAL_MODULE)$(TARGET_2ND_ARCH_MODULE_SUFFIX).BUILT),\
- $(eval installed := $(CTS_TESTCASES_OUT)/$(notdir $(fp)))\
- $(eval $(call copy-one-file, $(fp), $(installed)))\
- $(eval cts_executable_bin += $(installed)))
-
-cts_executable_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).xml
-$(cts_executable_xml): PRIVATE_TEST_PACKAGE := $(LOCAL_CTS_TEST_PACKAGE)
-$(cts_executable_xml): PRIVATE_EXECUTABLE := $(LOCAL_MODULE)
-$(cts_executable_xml): PRIVATE_LIST_EXECUTABLE := $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)_list
-$(cts_executable_xml): $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)_list
-$(cts_executable_xml): $(cts_executable_bin)
-$(cts_executable_xml): $(cts_module_test_config)
-$(cts_executable_xml): $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) $(CTS_EXPECTATIONS) $(CTS_UNSUPPORTED_ABIS) $(CTS_NATIVE_TEST_SCANNER) $(CTS_XML_GENERATOR)
- $(hide) echo Generating test description for native package $(PRIVATE_TEST_PACKAGE)
- $(hide) mkdir -p $(CTS_TESTCASES_OUT)
- $(hide) $(PRIVATE_LIST_EXECUTABLE) --gtest_list_tests | \
- $(CTS_NATIVE_TEST_SCANNER) -t $(PRIVATE_TEST_PACKAGE) | \
- $(CTS_XML_GENERATOR) -t native \
- -n $(PRIVATE_EXECUTABLE) \
- -p $(PRIVATE_TEST_PACKAGE) \
- -e $(CTS_EXPECTATIONS) \
- -b $(CTS_UNSUPPORTED_ABIS) \
- -a $(CTS_TARGET_ARCH) \
- -o $@
-
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_executable_bin) $(cts_executable_xml) $(cts_module_test_config)
diff --git a/build/test_gtest_package.mk b/build/test_gtest_package.mk
deleted file mode 100644
index 6f71830..0000000
--- a/build/test_gtest_package.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2012 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.
-
-#
-# Builds a package and defines a rule to generate the associated test
-# package XML needed by CTS.
-#
-# Replace "include $(BUILD_PACKAGE)" with "include $(BUILD_CTS_GTEST_PACKAGE)"
-#
-
-# Disable by default so "m cts" will work in emulator builds
-LOCAL_DEX_PREOPT := false
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-include $(BUILD_CTS_MODULE_TEST_CONFIG)
-
-cts_package_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_PACKAGE_NAME).xml
-$(cts_package_xml): PRIVATE_PATH := $(LOCAL_PATH)
-$(cts_package_xml): PRIVATE_TEST_PACKAGE := android.$(notdir $(LOCAL_PATH))
-$(cts_package_xml): PRIVATE_EXECUTABLE := $(LOCAL_MODULE)
-$(cts_package_xml): PRIVATE_MANIFEST := $(LOCAL_PATH)/AndroidManifest.xml
-$(cts_package_xml): PRIVATE_TEST_LIST := $(LOCAL_PATH)/$(LOCAL_MODULE)_list.txt
-$(cts_package_xml): $(LOCAL_PATH)/$(LOCAL_MODULE)_list.txt
-$(cts_package_xml): $(cts_support_apks)
-$(cts_package_xml): $(cts_module_test_config)
-$(cts_package_xml): $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) $(CTS_NATIVE_TEST_SCANNER) $(CTS_XML_GENERATOR)
- $(hide) echo Generating test description for wrapped native package $(PRIVATE_EXECUTABLE)
- $(hide) mkdir -p $(CTS_TESTCASES_OUT)
- $(hide) cat $(PRIVATE_TEST_LIST) | \
- $(CTS_NATIVE_TEST_SCANNER) -t $(PRIVATE_TEST_PACKAGE) | \
- $(CTS_XML_GENERATOR) -t wrappednative \
- -m $(PRIVATE_MANIFEST) \
- -n $(PRIVATE_EXECUTABLE) \
- -p $(PRIVATE_TEST_PACKAGE) \
- -e $(CTS_EXPECTATIONS) \
- -b $(CTS_UNSUPPORTED_ABIS) \
- -a $(CTS_TARGET_ARCH) \
- -o $@
-
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_package_xml) $(cts_module_test_config)
diff --git a/build/test_host_java_library.mk b/build/test_host_java_library.mk
deleted file mode 100644
index 7fdefb5..0000000
--- a/build/test_host_java_library.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright (C) 2011 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.
-
-#
-# Builds a host library and defines a rule to generate the associated test
-# package XML needed by CTS.
-#
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-include $(BUILD_CTS_MODULE_TEST_CONFIG)
-
-cts_library_jar := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).jar
-$(cts_library_jar): $(LOCAL_BUILT_MODULE)
- $(copy-file-to-target)
-
-cts_src_dirs := $(LOCAL_PATH)/src
-cts_src_dirs += $(sort $(dir $(LOCAL_GENERATED_SOURCES)))
-cts_src_dirs := $(addprefix -s , $(cts_src_dirs))
-
-cts_library_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).xml
-$(cts_library_xml): PRIVATE_SRC_DIRS := $(cts_src_dirs)
-$(cts_library_xml): PRIVATE_TEST_PACKAGE := $(LOCAL_CTS_TEST_PACKAGE)
-$(cts_library_xml): PRIVATE_LIBRARY := $(LOCAL_MODULE)
-$(cts_library_xml): PRIVATE_JAR_PATH := $(LOCAL_MODULE).jar
-$(cts_library_xml): $(cts_library_jar)
-$(cts_library_xml): $(cts_module_test_config)
-$(cts_library_xml): $(CTS_EXPECTATIONS) $(CTS_UNSUPPORTED_ABIS) $(CTS_JAVA_TEST_SCANNER_DOCLET) $(CTS_JAVA_TEST_SCANNER) $(CTS_XML_GENERATOR)
- $(hide) echo Generating test description for host library $(PRIVATE_LIBRARY)
- $(hide) mkdir -p $(CTS_TESTCASES_OUT)
- $(hide) $(CTS_JAVA_TEST_SCANNER) $(PRIVATE_SRC_DIRS) \
- -d $(CTS_JAVA_TEST_SCANNER_DOCLET) | \
- $(CTS_XML_GENERATOR) -t hostSideOnly \
- -j $(PRIVATE_JAR_PATH) \
- -n $(PRIVATE_LIBRARY) \
- -p $(PRIVATE_TEST_PACKAGE) \
- -e $(CTS_EXPECTATIONS) \
- -b $(CTS_UNSUPPORTED_ABIS) \
- -a $(CTS_TARGET_ARCH) \
- -o $@
-
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_library_jar) $(cts_library_xml) $(cts_module_test_config)
diff --git a/build/test_package.mk b/build/test_package.mk
index 690e2e9..92e5ee5 100644
--- a/build/test_package.mk
+++ b/build/test_package.mk
@@ -25,41 +25,3 @@
LOCAL_STATIC_JAVA_LIBRARIES += platform-test-annotations
include $(BUILD_CTS_SUPPORT_PACKAGE)
-include $(BUILD_CTS_MODULE_TEST_CONFIG)
-
-cts_src_dirs := $(LOCAL_PATH)
-cts_src_dirs += $(sort $(dir $(LOCAL_GENERATED_SOURCES)))
-cts_src_dirs := $(addprefix -s , $(cts_src_dirs))
-
-cts_package_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_PACKAGE_NAME).xml
-$(cts_package_xml): PRIVATE_SRC_DIRS := $(cts_src_dirs)
-$(cts_package_xml): PRIVATE_INSTRUMENTATION := $(LOCAL_INSTRUMENTATION_FOR)
-$(cts_package_xml): PRIVATE_PACKAGE := $(LOCAL_PACKAGE_NAME)
-ifneq ($(filter cts/suite/cts/%, $(LOCAL_PATH)),)
-PRIVATE_CTS_TEST_PACKAGE_NAME_ := com.android.cts.$(notdir $(LOCAL_PATH))
-else
-PRIVATE_CTS_TEST_PACKAGE_NAME_ := android.$(notdir $(LOCAL_PATH))
-endif
-$(cts_package_xml): PRIVATE_TEST_PACKAGE := $(PRIVATE_CTS_TEST_PACKAGE_NAME_)
-$(cts_package_xml): PRIVATE_MANIFEST := $(LOCAL_PATH)/AndroidManifest.xml
-$(cts_package_xml): PRIVATE_TEST_TYPE := $(if $(LOCAL_CTS_TEST_RUNNER),$(LOCAL_CTS_TEST_RUNNER),'')
-$(cts_package_xml): $(cts_support_apks)
-$(cts_package_xml): $(cts_module_test_config)
-$(cts_package_xml): $(CTS_EXPECTATIONS) $(CTS_UNSUPPORTED_ABIS) $(CTS_JAVA_TEST_SCANNER_DOCLET) $(CTS_JAVA_TEST_SCANNER) $(CTS_XML_GENERATOR)
- $(hide) echo Generating test description for java package $(PRIVATE_PACKAGE)
- $(hide) mkdir -p $(CTS_TESTCASES_OUT)
- $(hide) $(CTS_JAVA_TEST_SCANNER) \
- $(PRIVATE_SRC_DIRS) \
- -d $(CTS_JAVA_TEST_SCANNER_DOCLET) | \
- $(CTS_XML_GENERATOR) \
- -t $(PRIVATE_TEST_TYPE) \
- -m $(PRIVATE_MANIFEST) \
- -i "$(PRIVATE_INSTRUMENTATION)" \
- -n $(PRIVATE_PACKAGE) \
- -p $(PRIVATE_TEST_PACKAGE) \
- -e $(CTS_EXPECTATIONS) \
- -b $(CTS_UNSUPPORTED_ABIS) \
- -a $(CTS_TARGET_ARCH) \
- -o $@
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_package_xml) $(cts_module_test_config)
diff --git a/build/test_target_java_library.mk b/build/test_target_java_library.mk
index c2a93d4..354af6c 100644
--- a/build/test_target_java_library.mk
+++ b/build/test_target_java_library.mk
@@ -20,35 +20,3 @@
LOCAL_DEX_PREOPT := false
LOCAL_STATIC_JAVA_LIBRARIES += platform-test-annotations
include $(BUILD_JAVA_LIBRARY)
-include $(BUILD_CTS_MODULE_TEST_CONFIG)
-
-cts_library_jar := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).jar
-$(cts_library_jar): $(LOCAL_BUILT_MODULE)
- $(copy-file-to-target)
-
-cts_library_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).xml
-$(cts_library_xml): $(cts_library_jar)
-$(cts_library_xml): PRIVATE_PATH := $(LOCAL_PATH)/src
-$(cts_library_xml): PRIVATE_TEST_PACKAGE := $(LOCAL_CTS_TEST_PACKAGE)
-$(cts_library_xml): PRIVATE_LIBRARY := $(LOCAL_MODULE)
-$(cts_library_xml): PRIVATE_JAR_PATH := $(LOCAL_MODULE).jar
-$(cts_library_xml): PRIVATE_RUNTIME_ARGS := $(LOCAL_CTS_TARGET_RUNTIME_ARGS)
-$(cts_library_xml): $(cts_library_jar)
-$(cts_library_xml): $(cts_module_test_config)
-$(cts_library_xml): $(CTS_EXPECTATIONS) $(CTS_UNSUPPORTED_ABIS) $(CTS_JAVA_TEST_SCANNER_DOCLET) $(CTS_JAVA_TEST_SCANNER) $(CTS_XML_GENERATOR)
- $(hide) echo Generating test description for target library $(PRIVATE_LIBRARY)
- $(hide) mkdir -p $(CTS_TESTCASES_OUT)
- $(hide) $(CTS_JAVA_TEST_SCANNER) -s $(PRIVATE_PATH) \
- -d $(CTS_JAVA_TEST_SCANNER_DOCLET) | \
- $(CTS_XML_GENERATOR) -t jUnitDeviceTest \
- -j $(PRIVATE_JAR_PATH) \
- -n $(PRIVATE_LIBRARY) \
- -p $(PRIVATE_TEST_PACKAGE) \
- -e $(CTS_EXPECTATIONS) \
- -b $(CTS_UNSUPPORTED_ABIS) \
- -a $(CTS_TARGET_ARCH) \
- -x "runtimeArgs->$(PRIVATE_RUNTIME_ARGS)" \
- -o $@
-
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_library_jar) $(cts_library_xml) $(cts_module_test_config)
diff --git a/build/test_target_testng_package.mk b/build/test_target_testng_package.mk
index d038917..8a0e596 100644
--- a/build/test_target_testng_package.mk
+++ b/build/test_target_testng_package.mk
@@ -21,34 +21,3 @@
LOCAL_STATIC_JAVA_LIBRARIES += platform-test-annotations
include $(BUILD_JAVA_LIBRARY)
include $(BUILD_CTS_MODULE_TEST_CONFIG)
-
-cts_library_jar := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).jar
-$(cts_library_jar): $(LOCAL_BUILT_MODULE)
- $(copy-file-to-target)
-
-CTS_DEQP_CONFIG_PATH := $(call my-dir)
-
-cts_library_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).xml
-$(cts_library_xml): MUSTPASS_XML_FILE := $(LOCAL_CTS_TESTCASE_XML_INPUT)
-$(cts_library_xml): PRIVATE_DUMMY_CASELIST := $(CTS_DEQP_CONFIG_PATH)/deqp_dummy_test_list
-$(cts_library_xml): $(cts_library_jar)
-$(cts_library_xml): $(cts_module_test_config)
-$(cts_library_xml): $(CTS_EXPECTATIONS) $(CTS_UNSUPPORTED_ABIS) $(CTS_XML_GENERATOR) $(CTS_TESTCASE_XML_INPUT)
- $(hide) echo Generating test description for target testng package $(PRIVATE_LIBRARY)
- $(hide) mkdir -p $(CTS_TESTCASES_OUT)
-
-# Query build ABIs by routing a dummy test list through xml generator and parse result. Use sed to insert the ABI string into the XML files.
- $(hide) SUPPORTED_ABI_ATTR=`$(CTS_XML_GENERATOR) -t dummyTest \
- -n dummyName \
- -p invalid.dummy \
- -e $(CTS_EXPECTATIONS) \
- -b $(CTS_UNSUPPORTED_ABIS) \
- -a $(CTS_TARGET_ARCH) \
- < $(PRIVATE_DUMMY_CASELIST) \
- | grep --only-matching -e " abis=\"[^\"]*\""` && \
- $(SED_EXTENDED) -e "s:^(\s*)<Test ((.[^/]|[^/])*)(/?)>$$:\1<Test \2 $${SUPPORTED_ABI_ATTR}\4>:" \
- < $(MUSTPASS_XML_FILE) \
- > $@
-
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_library_jar) $(cts_library_xml) $(cts_module_test_config)
diff --git a/common/host-side/manifest-generator/tests/Android.mk b/common/host-side/manifest-generator/tests/Android.mk
index 2eb5d2f..1601fc8 100644
--- a/common/host-side/manifest-generator/tests/Android.mk
+++ b/common/host-side/manifest-generator/tests/Android.mk
@@ -18,7 +18,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := compatibility-manifest-generator junit
+LOCAL_JAVA_LIBRARIES := compatibility-manifest-generator junit-host
LOCAL_MODULE := compatibility-manifest-generator-tests
diff --git a/common/host-side/tradefed/res/report/compatibility_result.xsl b/common/host-side/tradefed/res/report/compatibility_result.xsl
index b86107d..156f3c6 100644
--- a/common/host-side/tradefed/res/report/compatibility_result.xsl
+++ b/common/host-side/tradefed/res/report/compatibility_result.xsl
@@ -161,7 +161,7 @@
</div>
<xsl:call-template name="filteredResultTestReport">
- <xsl:with-param name="header" select="'Failured Tests'" />
+ <xsl:with-param name="header" select="'Failed Tests'" />
<xsl:with-param name="resultFilter" select="'fail'" />
</xsl:call-template>
@@ -185,12 +185,14 @@
<h2 align="center"><xsl:value-of select="$header" /> (<xsl:value-of select="$numMatching"/>)</h2>
<xsl:call-template name="detailedTestReport">
<xsl:with-param name="resultFilter" select="$resultFilter"/>
+ <xsl:with-param name="fullStackTrace" select="true()"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="detailedTestReport">
<xsl:param name="resultFilter" />
+ <xsl:param name="fullStackTrace" />
<div>
<xsl:for-each select="Result/Module">
<xsl:if test="$resultFilter=''
@@ -236,7 +238,14 @@
</td>
<td class="failuredetails">
<div class="details">
- <xsl:value-of select="Failure/@message"/>
+ <xsl:choose>
+ <xsl:when test="$fullStackTrace=true()">
+ <xsl:value-of select="Failure/StackTrace" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="Failure/@message"/>
+ </xsl:otherwise>
+ </xsl:choose>
</div>
</td>
</xsl:if>
diff --git a/common/util/Android.mk b/common/util/Android.mk
index c95508b..faf4596 100644
--- a/common/util/Android.mk
+++ b/common/util/Android.mk
@@ -42,7 +42,7 @@
LOCAL_MODULE := compatibility-common-util-hostsidelib
-LOCAL_STATIC_JAVA_LIBRARIES := junit kxml2-2.3.0 platform-test-annotations-host
+LOCAL_STATIC_JAVA_LIBRARIES := junit-host kxml2-2.3.0 platform-test-annotations-host
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/common/util/tests/Android.mk b/common/util/tests/Android.mk
index 0e0af50..aa39ef5 100644
--- a/common/util/tests/Android.mk
+++ b/common/util/tests/Android.mk
@@ -18,7 +18,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := junit kxml2-2.3.0 tradefed-prebuilt compatibility-common-util-hostsidelib
+LOCAL_JAVA_LIBRARIES := junit-host kxml2-2.3.0 tradefed-prebuilt compatibility-common-util-hostsidelib
LOCAL_MODULE := compatibility-common-util-tests
diff --git a/development/ide/eclipse/.classpath b/development/ide/eclipse/.classpath
index 98939ba..8e44571 100644
--- a/development/ide/eclipse/.classpath
+++ b/development/ide/eclipse/.classpath
@@ -93,8 +93,6 @@
<classpathentry kind="src" path="cts/tools/dex-tools/src"/>
<classpathentry kind="src" path="cts/tools/signature-tools/src"/>
<classpathentry kind="src" path="cts/tools/signature-tools/test"/>
- <classpathentry kind="src" path="cts/tools/tradefed-host/src"/>
- <classpathentry kind="src" path="cts/tools/tradefed-host/tests/src"/>
<classpathentry kind="src" path="cts/tools/utils"/>
<classpathentry kind="src" path="cts/tools/vm-tests-tf/src"/>
<classpathentry kind="src" path="external/easymock/src"/>
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.1-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.1-1024.apk
new file mode 100644
index 0000000..02ce027
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.1-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.1-2048.apk
new file mode 100644
index 0000000..62f8e69
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.1-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.1-3072.apk
new file mode 100644
index 0000000..e8f1633
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.3-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.3-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.3-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.3-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.3-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha1-1.2.840.10040.4.3-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1.2.840.10040.4.1-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1.2.840.10040.4.1-1024.apk
new file mode 100644
index 0000000..11d3942
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1.2.840.10040.4.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1.2.840.10040.4.1-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1.2.840.10040.4.1-2048.apk
new file mode 100644
index 0000000..be8fd4b
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1.2.840.10040.4.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1.2.840.10040.4.1-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1.2.840.10040.4.1-3072.apk
new file mode 100644
index 0000000..2f4db65
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1.2.840.10040.4.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-2.16.840.1.101.3.4.3.1-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-2.16.840.1.101.3.4.3.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-2.16.840.1.101.3.4.3.1-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-2.16.840.1.101.3.4.3.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-2.16.840.1.101.3.4.3.1-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha224-2.16.840.1.101.3.4.3.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1.2.840.10040.4.1-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1.2.840.10040.4.1-1024.apk
new file mode 100644
index 0000000..5a7e4d3
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1.2.840.10040.4.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1.2.840.10040.4.1-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1.2.840.10040.4.1-2048.apk
new file mode 100644
index 0000000..edeb27d
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1.2.840.10040.4.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1.2.840.10040.4.1-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1.2.840.10040.4.1-3072.apk
new file mode 100644
index 0000000..ea5deea
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1.2.840.10040.4.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-2.16.840.1.101.3.4.3.2-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-2.16.840.1.101.3.4.3.2-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-2.16.840.1.101.3.4.3.2-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-2.16.840.1.101.3.4.3.2-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-2.16.840.1.101.3.4.3.2-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha256-2.16.840.1.101.3.4.3.2-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-2.16.840.1.101.3.4.3.3-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-2.16.840.1.101.3.4.3.3-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-2.16.840.1.101.3.4.3.3-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-2.16.840.1.101.3.4.3.3-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-2.16.840.1.101.3.4.3.3-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha384-2.16.840.1.101.3.4.3.3-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-2.16.840.1.101.3.4.3.4-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-2.16.840.1.101.3.4.3.4-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-2.16.840.1.101.3.4.3.4-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-2.16.840.1.101.3.4.3.4-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-2.16.840.1.101.3.4.3.4-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-dsa-sha512-2.16.840.1.101.3.4.3.4-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-p256.apk
new file mode 100644
index 0000000..bfa657a
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-p384.apk
new file mode 100644
index 0000000..42ee240
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-p521.apk
new file mode 100644
index 0000000..fe3efbf
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.4.1-p256.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-p256.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.4.1-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.4.1-p384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-p384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.4.1-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.4.1-p521.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-p521.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha1-1.2.840.10045.4.1-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-p256.apk
new file mode 100644
index 0000000..fff1789
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-p384.apk
new file mode 100644
index 0000000..0d83e41
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-p521.apk
new file mode 100644
index 0000000..92f8548
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.4.3.1-p256.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-p256.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.4.3.1-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.4.3.1-p384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-p384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.4.3.1-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.4.3.1-p521.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-p521.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha224-1.2.840.10045.4.3.1-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-p256.apk
new file mode 100644
index 0000000..c289f6f
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-p384.apk
new file mode 100644
index 0000000..b979702
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-p521.apk
new file mode 100644
index 0000000..9ab8bd4
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.4.3.2-p256.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-p256.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.4.3.2-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.4.3.2-p384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-p384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.4.3.2-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.4.3.2-p521.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-p521.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha256-1.2.840.10045.4.3.2-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-p256.apk
new file mode 100644
index 0000000..c24be65
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-p384.apk
new file mode 100644
index 0000000..dc06637
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-p521.apk
new file mode 100644
index 0000000..8194a87
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.4.3.3-p256.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-p256.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.4.3.3-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.4.3.3-p384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-p384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.4.3.3-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.4.3.3-p521.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-p521.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha384-1.2.840.10045.4.3.3-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-p256.apk
new file mode 100644
index 0000000..ecd9287
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-p384.apk
new file mode 100644
index 0000000..c2afc5a
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-p521.apk
new file mode 100644
index 0000000..62b86b2
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-p256.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.4.3.4-p256.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-p256.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.4.3.4-p256.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-p384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.4.3.4-p384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-p384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.4.3.4-p384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-p521.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.4.3.4-p521.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-p521.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-ecdsa-sha512-1.2.840.10045.4.3.4-p521.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-16384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-16384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-4096.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-4096.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-8192.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-8192.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-1024.apk
new file mode 100644
index 0000000..4f248bd
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-16384.apk
new file mode 100644
index 0000000..ee14de4
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-2048.apk
new file mode 100644
index 0000000..d7c292f
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-3072.apk
new file mode 100644
index 0000000..5d0d11a
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-4096.apk
new file mode 100644
index 0000000..32e28a9
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-8192.apk
new file mode 100644
index 0000000..10163b6
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-16384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-16384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-4096.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-4096.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-8192.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-8192.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-1024.apk
new file mode 100644
index 0000000..091cf6f
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-16384.apk
new file mode 100644
index 0000000..4da371d
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-2048.apk
new file mode 100644
index 0000000..43bb698
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-3072.apk
new file mode 100644
index 0000000..a4c2b15
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-4096.apk
new file mode 100644
index 0000000..806e0ea
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-8192.apk
new file mode 100644
index 0000000..efb124b
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-16384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-16384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-4096.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-4096.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-8192.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-8192.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-1024.apk
new file mode 100644
index 0000000..37192c3
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-16384.apk
new file mode 100644
index 0000000..357999a
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-2048.apk
new file mode 100644
index 0000000..a8a6b15
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-3072.apk
new file mode 100644
index 0000000..5c7c901
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-4096.apk
new file mode 100644
index 0000000..2774259
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-8192.apk
new file mode 100644
index 0000000..1df393a
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-16384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-16384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-4096.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-4096.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-8192.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-8192.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-1024.apk
new file mode 100644
index 0000000..2aea3bd
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-16384.apk
new file mode 100644
index 0000000..9fafe2c
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-2048.apk
new file mode 100644
index 0000000..348afda
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-3072.apk
new file mode 100644
index 0000000..db73a9b
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-4096.apk
new file mode 100644
index 0000000..34be32d
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-8192.apk
new file mode 100644
index 0000000..9af7d99
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-16384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-16384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-4096.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-4096.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-8192.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-8192.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-1024.apk
new file mode 100644
index 0000000..8e72556
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-16384.apk
new file mode 100644
index 0000000..d4fc6fb
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-2048.apk
new file mode 100644
index 0000000..1e3be03
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-3072.apk
new file mode 100644
index 0000000..ac9e972
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-4096.apk
new file mode 100644
index 0000000..d220048
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-8192.apk
new file mode 100644
index 0000000..c70bce1
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-1024.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1024.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-16384.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-16384.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-2048.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-2048.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-3072.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-3072.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-4096.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-4096.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-8192.apk
similarity index 100%
rename from hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-8192.apk
rename to hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-1024.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-1024.apk
new file mode 100644
index 0000000..480fcc5
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-1024.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-16384.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-16384.apk
new file mode 100644
index 0000000..a6089e6
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-16384.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-2048.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-2048.apk
new file mode 100644
index 0000000..9de481f
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-2048.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-3072.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-3072.apk
new file mode 100644
index 0000000..895e2c5
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-3072.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-4096.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-4096.apk
new file mode 100644
index 0000000..70b7592
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-4096.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-8192.apk b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-8192.apk
new file mode 100644
index 0000000..475a4e6
--- /dev/null
+++ b/hostsidetests/appsecurity/res/pkgsigverify/v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-8192.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
index c49340e..ae619fe 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
@@ -230,6 +230,51 @@
}
}
+ /**
+ * Test that apps with read permissions see the appropriate permissions
+ * when apps with r/w permission levels move around their files.
+ */
+ public void testMultiViewMoveConsistency() throws Exception {
+ final int[] users = createUsersForTest();
+ try {
+ wipePrimaryExternalStorage();
+
+ getDevice().uninstallPackage(NONE_PKG);
+ getDevice().uninstallPackage(READ_PKG);
+ getDevice().uninstallPackage(WRITE_PKG);
+ final String[] options = {AbiUtils.createAbiFlag(mAbi.getName())};
+
+ assertNull(getDevice().installPackage(getTestAppFile(WRITE_APK), false, options));
+ assertNull(getDevice().installPackage(getTestAppFile(READ_APK), false, options));
+
+ for (int user : users) {
+ runDeviceTests(READ_PKG, ".ReadMultiViewTest", "testFolderSetup", user);
+ }
+ for (int user : users) {
+ runDeviceTests(READ_PKG, ".ReadMultiViewTest", "testRWAccess", user);
+ }
+
+ for (int user : users) {
+ runDeviceTests(WRITE_PKG, ".WriteMultiViewTest", "testMoveAway", user);
+ }
+ for (int user : users) {
+ runDeviceTests(READ_PKG, ".ReadMultiViewTest", "testROAccess", user);
+ }
+
+ for (int user : users) {
+ runDeviceTests(WRITE_PKG, ".WriteMultiViewTest", "testMoveBack", user);
+ }
+ for (int user : users) {
+ runDeviceTests(READ_PKG, ".ReadMultiViewTest", "testRWAccess", user);
+ }
+ } finally {
+ getDevice().uninstallPackage(NONE_PKG);
+ getDevice().uninstallPackage(READ_PKG);
+ getDevice().uninstallPackage(WRITE_PKG);
+ removeUsersForTest(users);
+ }
+ }
+
private void wipePrimaryExternalStorage() throws DeviceNotAvailableException {
getDevice().executeShellCommand("rm -rf /sdcard/Android");
getDevice().executeShellCommand("rm -rf /sdcard/DCIM");
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/PkgInstallSignatureVerificationTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/PkgInstallSignatureVerificationTest.java
index c0c7dc0..4ae7cc3 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/PkgInstallSignatureVerificationTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/PkgInstallSignatureVerificationTest.java
@@ -81,83 +81,127 @@
public void testInstallV1OneSignerMD5withRSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-rsa-pkcs1-md5-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.1-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-md5-1.2.840.113549.1.1.4-%s.apk", RSA_KEY_NAMES);
}
public void testInstallV1OneSignerSHA1withRSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-rsa-pkcs1-sha1-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.5-%s.apk", RSA_KEY_NAMES);
}
public void testInstallV1OneSignerSHA224withRSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-rsa-pkcs1-sha224-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.1-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha224-1.2.840.113549.1.1.14-%s.apk", RSA_KEY_NAMES);
}
public void testInstallV1OneSignerSHA256withRSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-rsa-pkcs1-sha256-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.1-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha256-1.2.840.113549.1.1.11-%s.apk", RSA_KEY_NAMES);
}
public void testInstallV1OneSignerSHA384withRSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-rsa-pkcs1-sha384-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.1-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha384-1.2.840.113549.1.1.12-%s.apk", RSA_KEY_NAMES);
}
public void testInstallV1OneSignerSHA512withRSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-rsa-pkcs1-sha512-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.1-%s.apk", RSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-rsa-pkcs1-sha512-1.2.840.113549.1.1.13-%s.apk", RSA_KEY_NAMES);
}
public void testInstallV1OneSignerSHA1withECDSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-ecdsa-sha1-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha1-1.2.840.10045.2.1-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha1-1.2.840.10045.4.1-%s.apk", EC_KEY_NAMES);
}
public void testInstallV1OneSignerSHA224withECDSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-ecdsa-sha224-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha224-1.2.840.10045.2.1-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha224-1.2.840.10045.4.3.1-%s.apk", EC_KEY_NAMES);
}
public void testInstallV1OneSignerSHA256withECDSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-ecdsa-sha256-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha256-1.2.840.10045.2.1-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha256-1.2.840.10045.4.3.2-%s.apk", EC_KEY_NAMES);
}
public void testInstallV1OneSignerSHA384withECDSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-ecdsa-sha384-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha384-1.2.840.10045.2.1-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha384-1.2.840.10045.4.3.3-%s.apk", EC_KEY_NAMES);
}
public void testInstallV1OneSignerSHA512withECDSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-ecdsa-sha512-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha512-1.2.840.10045.2.1-%s.apk", EC_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-ecdsa-sha512-1.2.840.10045.4.3.4-%s.apk", EC_KEY_NAMES);
}
public void testInstallV1OneSignerSHA1withDSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-dsa-sha1-%s.apk", DSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-dsa-sha1-1.2.840.10040.4.1-%s.apk", DSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-dsa-sha1-1.2.840.10040.4.3-%s.apk", DSA_KEY_NAMES);
}
public void testInstallV1OneSignerSHA224withDSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-dsa-sha224-%s.apk", DSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-dsa-sha224-1.2.840.10040.4.1-%s.apk", DSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-dsa-sha224-2.16.840.1.101.3.4.3.1-%s.apk", DSA_KEY_NAMES);
}
public void testInstallV1OneSignerSHA256withDSA() throws Exception {
// APK signed with v1 scheme only, one signer.
- assertInstallSucceedsForEach("v1-only-with-dsa-sha256-%s.apk", DSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-dsa-sha256-1.2.840.10040.4.1-%s.apk", DSA_KEY_NAMES);
+ assertInstallSucceedsForEach(
+ "v1-only-with-dsa-sha256-2.16.840.1.101.3.4.3.2-%s.apk", DSA_KEY_NAMES);
}
// Android platform doesn't support DSA with SHA-384 and SHA-512.
// public void testInstallV1OneSignerSHA384withDSA() throws Exception {
// // APK signed with v1 scheme only, one signer.
-// assertInstallSucceedsForEach("v1-only-with-dsa-sha384-%s.apk", DSA_KEY_NAMES);
+// assertInstallSucceedsForEach(
+// "v1-only-with-dsa-sha384-2.16.840.1.101.3.4.3.3-%s.apk", DSA_KEY_NAMES);
// }
//
// public void testInstallV1OneSignerSHA512withDSA() throws Exception {
// // APK signed with v1 scheme only, one signer.
-// assertInstallSucceedsForEach("v1-only-with-dsa-sha512-%s.apk", DSA_KEY_NAMES);
+// assertInstallSucceedsForEach(
+// "v1-only-with-dsa-sha512-2.16.840.1.101.3.4.3.3-%s.apk", DSA_KEY_NAMES);
// }
public void testInstallV2StrippedFails() throws Exception {
@@ -342,17 +386,18 @@
public void testCorrectCertUsedFromPkcs7SignedDataCertsSet() throws Exception {
// Obtained by prepending the rsa-1024 certificate to the PKCS#7 SignedData certificates set
- // of v1-only-with-rsa-pkcs1-sha1-2048.apk META-INF/CERT.RSA. The certs (in the order of
- // appearance in the file) are thus: rsa-1024, rsa-2048. The package's signing cert is
- // rsa-2048.
+ // of v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-2048.apk META-INF/CERT.RSA. The certs
+ // (in the order of appearance in the file) are thus: rsa-1024, rsa-2048. The package's
+ // signing cert is rsa-2048.
assertInstallSucceeds("v1-only-pkcs7-cert-bag-first-cert-not-used.apk");
// Check that rsa-1024 was not used as the previously installed package's signing cert.
assertInstallFailsWithError(
- "v1-only-with-rsa-pkcs1-sha1-1024.apk", "signatures do not match");
+ "v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-1024.apk",
+ "signatures do not match");
// Check that rsa-2048 was used as the previously installed package's signing cert.
- assertInstallSucceeds("v1-only-with-rsa-pkcs1-sha1-2048.apk");
+ assertInstallSucceeds("v1-only-with-rsa-pkcs1-sha1-1.2.840.113549.1.1.1-2048.apk");
}
public void testV1SchemeSignatureCertNotReencoded() throws Exception {
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
index c2c6d0f..1ea4eba 100644
--- a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
@@ -52,20 +52,6 @@
include $(BUILD_PREBUILT)
-# Add package to the set of APKs available to CTS
-# Unceremoneously ripped from cts/build/support_package.mk
-cts_support_apks :=
-$(foreach fp, $(ALL_MODULES.$(LOCAL_MODULE).BUILT_INSTALLED),\
- $(eval pair := $(subst :,$(space),$(fp)))\
- $(eval built := $(word 1,$(pair)))\
- $(eval installed := $(CTS_TESTCASES_OUT)/$(notdir $(word 2,$(pair))))\
- $(eval $(call copy-one-file, $(built), $(installed)))\
- $(eval cts_support_apks += $(installed)))
-
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_support_apks)
-
-
###########################################################
# Variant: Privileged app upgrade (wrong SHA)
@@ -82,16 +68,3 @@
LOCAL_SRC_FILES := CtsShimPrivUpgradeWrongSHA.apk
include $(BUILD_PREBUILT)
-
-# Add package to the set of APKs available to CTS
-# Unceremoneously ripped from cts/build/support_package.mk
-cts_support_apks :=
-$(foreach fp, $(ALL_MODULES.$(LOCAL_MODULE).BUILT_INSTALLED),\
- $(eval pair := $(subst :,$(space),$(fp)))\
- $(eval built := $(word 1,$(pair)))\
- $(eval installed := $(CTS_TESTCASES_OUT)/$(notdir $(word 2,$(pair))))\
- $(eval $(call copy-one-file, $(built), $(installed)))\
- $(eval cts_support_apks += $(installed)))
-
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_support_apks)
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/src/com/android/cts/readexternalstorageapp/ReadMultiViewTest.java b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/src/com/android/cts/readexternalstorageapp/ReadMultiViewTest.java
new file mode 100644
index 0000000..6061117
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/src/com/android/cts/readexternalstorageapp/ReadMultiViewTest.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2015 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 com.android.cts.readexternalstorageapp;
+
+import static android.test.MoreAsserts.assertNotEqual;
+
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.PACKAGE_WRITE;
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.assertFileReadOnlyAccess;
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.assertFileReadWriteAccess;
+
+import android.system.Os;
+
+import android.test.AndroidTestCase;
+
+import java.io.File;
+import java.util.List;
+
+public class ReadMultiViewTest extends AndroidTestCase {
+ /**
+ * Create a file in PACKAGE_READ's cache.
+ */
+ public void testFolderSetup() throws Exception {
+ final File ourCache = getContext().getExternalCacheDir();
+ final File ourTestDir = new File(ourCache, "testDir");
+ final File ourFile = new File(ourTestDir, "test.probe");
+
+ ourFile.getParentFile().mkdirs();
+ assertTrue(ourFile.createNewFile());
+ }
+
+ /**
+ * Verify that we have R/W access to test.probe in our cache.
+ */
+ public void testRWAccess() throws Exception {
+ final File ourCache = getContext().getExternalCacheDir();
+ final File ourTestDir = new File(ourCache, "testDir");
+ final File testFile = new File(ourTestDir, "test.probe");
+
+ assertFileReadWriteAccess(testFile);
+ assertEquals(Os.getuid(), Os.stat(ourCache.getAbsolutePath()).st_uid);
+ assertEquals(Os.getuid(), Os.stat(ourTestDir.getAbsolutePath()).st_uid);
+ assertEquals(Os.getuid(), Os.stat(testFile.getAbsolutePath()).st_uid);
+ }
+
+ /**
+ * Verify that we have RO access to test.probe in PACKAGE_WRITE's cache.
+ */
+ public void testROAccess() throws Exception {
+ final File ourCache = getContext().getExternalCacheDir();
+ final File otherCache = new File(ourCache.getAbsolutePath()
+ .replace(getContext().getPackageName(), PACKAGE_WRITE));
+ final File otherTestDir = new File(otherCache, "testDir");
+ final File testFile = new File(otherTestDir, "test.probe");
+
+ assertFileReadOnlyAccess(testFile);
+ assertNotEqual(Os.getuid(), Os.stat(testFile.getAbsolutePath()).st_uid);
+ assertNotEqual(Os.getuid(), Os.stat(otherCache.getAbsolutePath()).st_uid);
+ assertNotEqual(Os.getuid(), Os.stat(otherTestDir.getAbsolutePath()).st_uid);
+ }
+}
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteMultiViewTest.java b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteMultiViewTest.java
new file mode 100644
index 0000000..db1c721
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteMultiViewTest.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2015 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 com.android.cts.writeexternalstorageapp;
+
+import static android.test.MoreAsserts.assertNotEqual;
+
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.PACKAGE_READ;
+import static com.android.cts.externalstorageapp.CommonExternalStorageTest.assertFileReadWriteAccess;
+
+import android.system.Os;
+
+import android.test.AndroidTestCase;
+
+
+import android.util.Log;
+
+import java.io.File;
+import java.util.List;
+
+public class WriteMultiViewTest extends AndroidTestCase {
+ /**
+ * Move PACKAGE_READ's cache to our cache
+ */
+ public void testMoveAway() throws Exception {
+ final File ourCache = getContext().getExternalCacheDir();
+ final File otherCache = new File(ourCache.getAbsolutePath()
+ .replace(getContext().getPackageName(), PACKAGE_READ));
+ final File ourTestDir = new File(ourCache, "testDir");
+ final File otherTestDir = new File(otherCache, "testDir");
+ final File beforeFile = new File(otherTestDir, "test.probe");
+ final File afterFile = new File(ourTestDir, "test.probe");
+
+ Os.rename(otherTestDir.getAbsolutePath(), ourTestDir.getAbsolutePath());
+
+ assertEquals(Os.getuid(), Os.stat(ourCache.getAbsolutePath()).st_uid);
+ assertEquals(Os.getuid(), Os.stat(ourTestDir.getAbsolutePath()).st_uid);
+ assertEquals(Os.getuid(), Os.stat(afterFile.getAbsolutePath()).st_uid);
+ }
+
+ /**
+ * Move our cache to PACKAGE_READ's cache
+ */
+ public void testMoveBack() throws Exception {
+ final File ourCache = getContext().getExternalCacheDir();
+ final File otherCache = new File(ourCache.getAbsolutePath()
+ .replace(getContext().getPackageName(), PACKAGE_READ));
+ final File ourTestDir = new File(ourCache, "testDir");
+ final File otherTestDir = new File(otherCache, "testDir");
+ final File beforeFile = new File(ourTestDir, "test.probe");
+ final File afterFile = new File(otherTestDir, "test.probe");
+
+ Os.rename(ourTestDir.getAbsolutePath(), otherTestDir.getAbsolutePath());
+
+ assertNotEqual(Os.getuid(), Os.stat(otherCache.getAbsolutePath()).st_uid);
+ assertNotEqual(Os.getuid(), Os.stat(otherTestDir.getAbsolutePath()).st_uid);
+ assertNotEqual(Os.getuid(), Os.stat(afterFile.getAbsolutePath()).st_uid);
+ }
+}
diff --git a/hostsidetests/compilation/assets/primary.prof b/hostsidetests/compilation/assets/primary.prof
index dbd70c7..18792ba 100644
--- a/hostsidetests/compilation/assets/primary.prof
+++ b/hostsidetests/compilation/assets/primary.prof
Binary files differ
diff --git a/hostsidetests/cpptools/Android.mk b/hostsidetests/cpptools/Android.mk
index 824dd97..2c1f697 100644
--- a/hostsidetests/cpptools/Android.mk
+++ b/hostsidetests/cpptools/Android.mk
@@ -23,7 +23,7 @@
# Must match the package name in CtsTestCaseList.mk
LOCAL_MODULE := CtsCppToolsTestCases
-LOCAL_JAVA_LIBRARIES := old-cts-tradefed ddmlib-prebuilt tradefed-prebuilt
+LOCAL_JAVA_LIBRARIES := ddmlib-prebuilt tradefed-prebuilt
LOCAL_CTS_TEST_PACKAGE := android.tests.cpptools
diff --git a/hostsidetests/jdwpsecurity/app/Android.mk b/hostsidetests/jdwpsecurity/app/Android.mk
index 6c7845c..22f236a 100644
--- a/hostsidetests/jdwpsecurity/app/Android.mk
+++ b/hostsidetests/jdwpsecurity/app/Android.mk
@@ -21,12 +21,3 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
include $(BUILD_JAVA_LIBRARY)
-
-# Copy the built module to the cts dir
-cts_library_jar := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).jar
-$(cts_library_jar): $(LOCAL_BUILT_MODULE)
- $(copy-file-to-target)
-
-# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
-$(my_register_name) : $(cts_library_jar)
-
diff --git a/hostsidetests/net/aidl/Android.mk b/hostsidetests/net/aidl/Android.mk
index a7ec6ef..4aa55b6 100644
--- a/hostsidetests/net/aidl/Android.mk
+++ b/hostsidetests/net/aidl/Android.mk
@@ -19,4 +19,4 @@
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := com/android/cts/net/hostside/IRemoteSocketFactory.aidl
LOCAL_MODULE := CtsHostsideNetworkTestsAidl
-include $(BUILD_JAVA_LIBRARY)
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java
index 12fe625..a8ad2b8 100755
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java
@@ -84,6 +84,11 @@
* https://android-review.googlesource.com/#/c/99225/
* https://android-review.googlesource.com/#/c/100557/
*
+ * To ensure that the kernel has the required commits, run the kernel unit
+ * tests described at:
+ *
+ * https://source.android.com/devices/tech/config/kernel_network_tests.html
+ *
*/
public class VpnTest extends InstrumentationTestCase {
diff --git a/hostsidetests/os/Android.mk b/hostsidetests/os/Android.mk
index 8e334fe..bb5154f 100644
--- a/hostsidetests/os/Android.mk
+++ b/hostsidetests/os/Android.mk
@@ -27,8 +27,6 @@
LOCAL_CTS_TEST_PACKAGE := android.host.os
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
diff --git a/hostsidetests/os/OldAndroidTest.xml b/hostsidetests/os/OldAndroidTest.xml
deleted file mode 100644
index 6694c30..0000000
--- a/hostsidetests/os/OldAndroidTest.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="CTS package preparer for install/uninstall of the apk used as a test operation target">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsDeviceOsTestApp.apk" />
-</configuration>
diff --git a/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk b/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
index 76aa570..7ab0433 100644
--- a/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
+++ b/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
@@ -21,8 +21,6 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
LOCAL_PACKAGE_NAME := CtsHostLinkVerificationApp
# Tag this module as a cts test artifact
diff --git a/hostsidetests/security/Android.mk b/hostsidetests/security/Android.mk
index cc04431..85492de 100644
--- a/hostsidetests/security/Android.mk
+++ b/hostsidetests/security/Android.mk
@@ -59,14 +59,7 @@
selinux_neverallow_gen_data := cts/tools/selinux/SELinuxNeverallowTestFrame.py
-old_cts_sepolicy-analyze := $(CTS_TESTCASES_OUT)/sepolicy-analyze
-
-LOCAL_ADDITIONAL_DEPENDENCIES := $(COMPATIBILITY_TESTCASES_OUT_cts)/sepolicy-analyze \
- $(old_cts_sepolicy-analyze)
-
-$(old_cts_sepolicy-analyze) : $(HOST_OUT_EXECUTABLES)/sepolicy-analyze
- mkdir -p $(dir $@)
- $(copy-file-to-target)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(COMPATIBILITY_TESTCASES_OUT_cts)/sepolicy-analyze
LOCAL_GENERATED_SOURCES := $(call local-generated-sources-dir)/android/cts/security/SELinuxNeverallowRulesTest.java
diff --git a/hostsidetests/security/src/android/cts/security/FileSystemPermissionTest.java b/hostsidetests/security/src/android/cts/security/FileSystemPermissionTest.java
new file mode 100644
index 0000000..f4ce1bd
--- /dev/null
+++ b/hostsidetests/security/src/android/cts/security/FileSystemPermissionTest.java
@@ -0,0 +1,138 @@
+package android.cts.security;
+
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.testtype.DeviceTestCase;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class FileSystemPermissionTest extends DeviceTestCase {
+
+ /**
+ * A reference to the device under test.
+ */
+ private ITestDevice mDevice;
+
+ /**
+ * Used to build the find command for finding insecure file system components
+ */
+ private static final String INSECURE_DEVICE_ADB_COMMAND = "find %s -type %s -perm /o=rwx 2>/dev/null";
+
+ /**
+ * Whitelist exceptions of allowed world accessbale char files under /dev
+ */
+ private static final Set<String> CHAR_DEV_EXCEPTIONS = new HashSet<String>(
+ Arrays.asList(
+ // All exceptions should be alphabetical and associated with a bug number.
+ "/dev/adsprpc-smd", // b/11710243
+ "/dev/alarm", // b/9035217
+ "/dev/ashmem",
+ "/dev/binder",
+ "/dev/card0", // b/13159510
+ "/dev/renderD128",
+ "/dev/renderD129", // b/23798677
+ "/dev/dri/card0", // b/13159510
+ "/dev/dri/renderD128",
+ "/dev/dri/renderD129", // b/23798677
+ "/dev/felica", // b/11142586
+ "/dev/felica_ant", // b/11142586
+ "/dev/felica_cen", // b/11142586
+ "/dev/felica_pon", // b/11142586
+ "/dev/felica_rfs", // b/11142586
+ "/dev/felica_rws", // b/11142586
+ "/dev/felica_uicc", // b/11142586
+ "/dev/full",
+ "/dev/galcore",
+ "/dev/genlock", // b/9035217
+ "/dev/graphics/galcore",
+ "/dev/ion",
+ "/dev/kgsl-2d0", // b/11271533
+ "/dev/kgsl-2d1", // b/11271533
+ "/dev/kgsl-3d0", // b/9035217
+ "/dev/log/events", // b/9035217
+ "/dev/log/main", // b/9035217
+ "/dev/log/radio", // b/9035217
+ "/dev/log/system", // b/9035217
+ "/dev/mali0", // b/9106968
+ "/dev/mali", // b/11142586
+ "/dev/mm_interlock", // b/12955573
+ "/dev/mm_isp", // b/12955573
+ "/dev/mm_v3d", // b/12955573
+ "/dev/msm_rotator", // b/9035217
+ "/dev/null",
+ "/dev/nvhost-as-gpu",
+ "/dev/nvhost-ctrl", // b/9088251
+ "/dev/nvhost-ctrl-gpu",
+ "/dev/nvhost-dbg-gpu",
+ "/dev/nvhost-gpu",
+ "/dev/nvhost-gr2d", // b/9088251
+ "/dev/nvhost-gr3d", // b/9088251
+ "/dev/nvhost-tsec",
+ "/dev/nvhost-prof-gpu",
+ "/dev/nvhost-vic",
+ "/dev/nvmap", // b/9088251
+ "/dev/pmsg0", // b/31857082
+ "/dev/ptmx", // b/9088251
+ "/dev/pvrsrvkm", // b/9108170
+ "/dev/pvr_sync",
+ "/dev/quadd",
+ "/dev/random",
+ "/dev/snfc_cen", // b/11142586
+ "/dev/snfc_hsel", // b/11142586
+ "/dev/snfc_intu_poll", // b/11142586
+ "/dev/snfc_rfs", // b/11142586
+ "/dev/tegra-throughput",
+ "/dev/tiler", // b/9108170
+ "/dev/tty",
+ "/dev/urandom",
+ "/dev/ump", // b/11142586
+ "/dev/xt_qtaguid", // b/9088251
+ "/dev/zero",
+ "/dev/fimg2d", // b/10428016
+ "/dev/mobicore-user" // b/10428016
+ ));
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mDevice = getDevice();
+ }
+
+ public void testAllCharacterDevicesAreSecure() throws DeviceNotAvailableException {
+ Set <String> insecure = getAllInsecureDevicesInDirAndSubdir("/dev", "c");
+ Set <String> insecurePts = getAllInsecureDevicesInDirAndSubdir("/dev/pts", "c");
+ insecure.removeAll(CHAR_DEV_EXCEPTIONS);
+ insecure.removeAll(insecurePts);
+ assertTrue("Found insecure character devices: " + insecure.toString(),
+ insecure.isEmpty());
+ }
+
+ public void testAllBlockDevicesAreSecure() throws Exception {
+ Set<String> insecure = getAllInsecureDevicesInDirAndSubdir("/dev", "b");
+ assertTrue("Found insecure block devices: " + insecure.toString(),
+ insecure.isEmpty());
+ }
+
+ /**
+ * Searches for all world accessable files, note this may need sepolicy to search the desired
+ * location and stat files.
+ * @path The path to search, must be a directory.
+ * @type The type of file to search for, must be a valid find command argument to the type
+ * option.
+ * @returns The set of insecure fs objects found.
+ */
+ private Set<String> getAllInsecureDevicesInDirAndSubdir(String path, String type) throws DeviceNotAvailableException {
+
+ String cmd = getInsecureDeviceAdbCommand(path, type);
+ String output = mDevice.executeShellCommand(cmd);
+ // Splitting an empty string results in an array of an empty string.
+ String [] found = output.length() > 0 ? output.split("\\s") : new String[0];
+ return new HashSet<String>(Arrays.asList(found));
+ }
+
+ private static String getInsecureDeviceAdbCommand(String path, String type) {
+ return String.format(INSECURE_DEVICE_ADB_COMMAND, path, type);
+ }
+}
diff --git a/hostsidetests/services/activitymanager/Android.mk b/hostsidetests/services/activitymanager/Android.mk
index 0cf1f2b..51a6ed4 100644
--- a/hostsidetests/services/activitymanager/Android.mk
+++ b/hostsidetests/services/activitymanager/Android.mk
@@ -27,8 +27,6 @@
LOCAL_CTS_TEST_PACKAGE := android.server
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
diff --git a/hostsidetests/services/activitymanager/OldAndroidTest.xml b/hostsidetests/services/activitymanager/OldAndroidTest.xml
deleted file mode 100644
index 37393763..0000000
--- a/hostsidetests/services/activitymanager/OldAndroidTest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="CTS package preparer for install/uninstall of the apk used as a test operation target">
- <include name="common-config" />
- <!-- This will tell tradefed to install the test apk. -->
- <option name="cts-apk-installer:test-file-name" value="CtsDeviceServicesTestApp.apk" />
-</configuration>
diff --git a/hostsidetests/services/windowmanager/Android.mk b/hostsidetests/services/windowmanager/Android.mk
index eeac27b..4448d9a 100644
--- a/hostsidetests/services/windowmanager/Android.mk
+++ b/hostsidetests/services/windowmanager/Android.mk
@@ -18,7 +18,6 @@
LOCAL_MODULE_TAGS := tests
-# Must match the package name in OldCtsTestCaseList.mk
LOCAL_MODULE := CtsDragAndDropHostTestCases
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -27,8 +26,6 @@
LOCAL_CTS_TEST_PACKAGE := android.wm.cts
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
diff --git a/hostsidetests/services/windowmanager/OldAndroidTest.xml b/hostsidetests/services/windowmanager/OldAndroidTest.xml
deleted file mode 100644
index ddf1f41..0000000
--- a/hostsidetests/services/windowmanager/OldAndroidTest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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="CTS package preparer for install/uninstall of the apk used as a test operation target">
- <include name="common-config" />
- <!-- This will tell tradefed to install the test apk. -->
- <option name="cts-apk-installer:test-file-name" value="CtsDragAndDropSourceApp.apk" />
- <option name="cts-apk-installer:test-file-name" value="CtsDragAndDropTargetApp.apk" />
- <option name="cts-apk-installer:test-file-name" value="CtsDragAndDropTargetAppSdk23.apk" />
-</configuration>
diff --git a/hostsidetests/systemui/Android.mk b/hostsidetests/systemui/Android.mk
index 41f05ef..1c0dd06 100644
--- a/hostsidetests/systemui/Android.mk
+++ b/hostsidetests/systemui/Android.mk
@@ -28,8 +28,6 @@
LOCAL_CTS_TEST_PACKAGE := android.host.systemui
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
diff --git a/hostsidetests/systemui/OldAndroidTest.xml b/hostsidetests/systemui/OldAndroidTest.xml
deleted file mode 100644
index 2efcb94..0000000
--- a/hostsidetests/systemui/OldAndroidTest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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 CTS System UI host test cases">
-
- <include name="common-config" />
- <!-- This will tell tradefed to install the test apk. -->
- <option name="cts-apk-installer:test-file-name" value="CtsSystemUiDeviceApp.apk" />
-</configuration>
diff --git a/libs/deviceutil/Android.mk b/libs/deviceutil/Android.mk
index bb039ca..287148b 100644
--- a/libs/deviceutil/Android.mk
+++ b/libs/deviceutil/Android.mk
@@ -17,8 +17,7 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
- $(call all-java-files-under, src) \
- $(call all-java-files-under, ../commonutil/src)
+ $(call all-java-files-under, src)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
diff --git a/suite/audio_quality/Android.mk b/suite/audio_quality/Android.mk
index 491596e..c3404d2 100644
--- a/suite/audio_quality/Android.mk
+++ b/suite/audio_quality/Android.mk
@@ -19,16 +19,19 @@
CTS_AUDIO_TOP:= $(call my-dir)
+include $(call all-makefiles-under,$(CTS_AUDIO_TOP))
+
CTS_AUDIO_INSTALL_DIR := $(HOST_OUT)/cts-audio-quality/android-cts-audio-quality
CTS_AUDIO_QUALITY_ZIP := $(HOST_OUT)/cts-audio-quality/android-cts-audio-quality.zip
cts_audio_quality_client_apk := $(TARGET_OUT_DATA_APPS)/CtsAudioClient/CtsAudioClient.apk
-cts_audio_quality_host_bins := $(HOST_OUT)/bin/cts_audio_quality_test $(HOST_OUT)/bin/cts_audio_quality
+cts_audio_quality_host_bins := $(ALL_MODULES.cts_audio_quality_test.INSTALLED) $(ALL_MODULES.cts_audio_quality.INSTALLED)
$(CTS_AUDIO_QUALITY_ZIP): PRIVATE_CLIENT_APK := $(cts_audio_quality_client_apk)
$(CTS_AUDIO_QUALITY_ZIP): PRIVATE_HOST_BINS := $(cts_audio_quality_host_bins)
$(CTS_AUDIO_QUALITY_ZIP): PRIVATE_TEST_DESC := $(CTS_AUDIO_TOP)/test_description
$(CTS_AUDIO_QUALITY_ZIP): $(cts_audio_quality_client_apk) $(cts_audio_quality_host_bins) \
$(CTS_AUDIO_TOP)/test_description | $(ACP)
+ $(hide) rm -rf $@ $(CTS_AUDIO_INSTALL_DIR)
$(hide) mkdir -p $(CTS_AUDIO_INSTALL_DIR)/client
$(hide) $(ACP) -fp $(PRIVATE_CLIENT_APK) \
$(CTS_AUDIO_INSTALL_DIR)/client
@@ -51,6 +54,4 @@
$(call dist-for-goals, cts, $(CTS_AUDIO_QUALITY_ZIP))
endif # cts
-include $(call all-subdir-makefiles)
-
endif # linux
diff --git a/suite/audio_quality/executable/Android.mk b/suite/audio_quality/executable/Android.mk
index 8049596..b22d542 100644
--- a/suite/audio_quality/executable/Android.mk
+++ b/suite/audio_quality/executable/Android.mk
@@ -17,12 +17,12 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-subdir-cpp-files)
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/../lib/include external/tinyalsa/include/ libcore/include \
- $(LOCAL_PATH)/../lib/src
-LOCAL_STATIC_LIBRARIES += libutils liblog libcutils libtinyalsa libtinyxml
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../lib/include $(LOCAL_PATH)/../lib/src
+LOCAL_STATIC_LIBRARIES += libutils liblog libcutils libtinyalsa libtinyxml2
LOCAL_WHOLE_STATIC_LIBRARIES := libcts_audio_quality
LOCAL_CFLAGS:= -g -fno-exceptions
-LOCAL_LDFLAGS:= -g -lrt -ldl -lstdc++ -lm -fno-exceptions -lpthread
+LOCAL_LDFLAGS:= -g -lrt -ldl -lm -fno-exceptions -lpthread
+LOCAL_CXX_STL := libc++_static
LOCAL_MODULE_HOST_OS := linux
LOCAL_MODULE:= cts_audio_quality
include $(BUILD_HOST_EXECUTABLE)
diff --git a/suite/audio_quality/executable/src/main.cpp b/suite/audio_quality/executable/src/main.cpp
index 66d90cc..0e969d1 100644
--- a/suite/audio_quality/executable/src/main.cpp
+++ b/suite/audio_quality/executable/src/main.cpp
@@ -18,7 +18,7 @@
#include <utils/String8.h>
-#include <UniquePtr.h>
+#include <memory>
#include "GenericFactory.h"
#include "Log.h"
@@ -90,7 +90,7 @@
return 1;
}
- UniquePtr<CleanupStatics> staticStuffs(new CleanupStatics());
+ std::unique_ptr<CleanupStatics> staticStuffs(new CleanupStatics());
if (Settings::Instance() == NULL) {
fprintf(stderr, "caanot create Settings");
return 1;
@@ -130,7 +130,7 @@
Settings::Instance()->addSetting(Settings::EDEVICE_INFO, deviceInfo);
ModelBuilder modelBuilder;
- UniquePtr<TaskGeneric> topTask(modelBuilder.parseTestDescriptionXml(xmlFile));
+ std::unique_ptr<TaskGeneric> topTask(modelBuilder.parseTestDescriptionXml(xmlFile));
if (topTask.get() == NULL) {
LOGE("Parsing of %x failed", xmlFile.string());
return 1;
diff --git a/suite/audio_quality/lib/Android.mk b/suite/audio_quality/lib/Android.mk
index d4aaf84..cd19e85 100644
--- a/suite/audio_quality/lib/Android.mk
+++ b/suite/audio_quality/lib/Android.mk
@@ -17,9 +17,8 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-subdir-cpp-files)
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/src /usr/include/ \
- external/tinyalsa/include/ external/tinyxml/ libcore/include
-LOCAL_STATIC_LIBRARIES += libutils liblog libtinyalsa libcutils libtinyxml
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/src
+LOCAL_STATIC_LIBRARIES += libutils liblog libtinyalsa libcutils libtinyxml2
LOCAL_CFLAGS:= -g -fno-exceptions
LOCAL_LDFLAGS:= -g -lrt -ldl -lm -fno-exceptions
LOCAL_MODULE_HOST_OS := linux
diff --git a/suite/audio_quality/lib/include/GenericFactory.h b/suite/audio_quality/lib/include/GenericFactory.h
index 9f74b7f..9dc9c02 100644
--- a/suite/audio_quality/lib/include/GenericFactory.h
+++ b/suite/audio_quality/lib/include/GenericFactory.h
@@ -26,7 +26,7 @@
*/
class GenericFactory {
public:
-
+ virtual ~GenericFactory();
virtual ClientInterface* createClientInterface();
virtual TaskGeneric* createTask(TaskGeneric::TaskType type);
};
diff --git a/suite/audio_quality/lib/include/Semaphore.h b/suite/audio_quality/lib/include/Semaphore.h
index 3fdcc75..c4c3e88 100644
--- a/suite/audio_quality/lib/include/Semaphore.h
+++ b/suite/audio_quality/lib/include/Semaphore.h
@@ -27,7 +27,7 @@
*/
class Semaphore {
public:
- Semaphore(int count = 0);
+ explicit Semaphore(int count = 0);
~Semaphore();
diff --git a/suite/audio_quality/lib/include/Settings.h b/suite/audio_quality/lib/include/Settings.h
index a8cfea5..6404769 100644
--- a/suite/audio_quality/lib/include/Settings.h
+++ b/suite/audio_quality/lib/include/Settings.h
@@ -32,7 +32,7 @@
ETEST_XML = 4, // name of test description xml
EMAX_SETTINGS = 4 // not real setting
};
- void addSetting(SettingType type, const android::String8 setting);
+ void addSetting(SettingType type, const android::String8& setting);
const android::String8& getSetting(SettingType type);
private:
static Settings* mInstance;
diff --git a/suite/audio_quality/lib/include/audio/AudioPlaybackLocal.h b/suite/audio_quality/lib/include/audio/AudioPlaybackLocal.h
index 94422af..fcfb270 100644
--- a/suite/audio_quality/lib/include/audio/AudioPlaybackLocal.h
+++ b/suite/audio_quality/lib/include/audio/AudioPlaybackLocal.h
@@ -27,7 +27,7 @@
class AudioPlaybackLocal: public AudioLocal {
public:
- AudioPlaybackLocal(int hwId);
+ explicit AudioPlaybackLocal(int hwId);
virtual ~AudioPlaybackLocal();
protected:
bool doPrepare(AudioHardware::SamplingRate, int samplesInOneGo);
diff --git a/suite/audio_quality/lib/include/audio/AudioProtocol.h b/suite/audio_quality/lib/include/audio/AudioProtocol.h
index 01e8507..eaf93a8 100644
--- a/suite/audio_quality/lib/include/audio/AudioProtocol.h
+++ b/suite/audio_quality/lib/include/audio/AudioProtocol.h
@@ -102,7 +102,7 @@
class CmdDownload: public AudioProtocol {
public:
- CmdDownload(ClientSocket& socket)
+ explicit CmdDownload(ClientSocket& socket)
: AudioProtocol(socket, ECmdDownload) {};
virtual ~CmdDownload() {};
virtual bool sendCommand(AudioParam& param);
@@ -111,7 +111,7 @@
class CmdStartPlayback: public AudioProtocol {
public:
- CmdStartPlayback(ClientSocket& socket)
+ explicit CmdStartPlayback(ClientSocket& socket)
: AudioProtocol(socket, ECmdStartPlayback) {};
virtual ~CmdStartPlayback() {};
virtual bool sendCommand(AudioParam& param);
@@ -119,14 +119,14 @@
class CmdStopPlayback: public AudioProtocol {
public:
- CmdStopPlayback(ClientSocket& socket)
+ explicit CmdStopPlayback(ClientSocket& socket)
: AudioProtocol(socket, ECmdStopPlayback) {};
virtual ~CmdStopPlayback() {};
};
class CmdStartRecording: public AudioProtocol {
public:
- CmdStartRecording(ClientSocket& socket)
+ explicit CmdStartRecording(ClientSocket& socket)
: AudioProtocol(socket, ECmdStartRecording) {};
virtual ~CmdStartRecording() {};
@@ -137,14 +137,14 @@
class CmdStopRecording: public AudioProtocol {
public:
- CmdStopRecording(ClientSocket& socket)
+ explicit CmdStopRecording(ClientSocket& socket)
: AudioProtocol(socket, ECmdStopRecording) {};
virtual ~CmdStopRecording() {};
};
class CmdGetDeviceInfo: public AudioProtocol {
public:
- CmdGetDeviceInfo(ClientSocket& socket)
+ explicit CmdGetDeviceInfo(ClientSocket& socket)
: AudioProtocol(socket, ECmdGetDeviceInfo) {};
virtual ~CmdGetDeviceInfo() {};
diff --git a/suite/audio_quality/lib/include/audio/AudioRecordingLocal.h b/suite/audio_quality/lib/include/audio/AudioRecordingLocal.h
index 614ed6d..e192812 100644
--- a/suite/audio_quality/lib/include/audio/AudioRecordingLocal.h
+++ b/suite/audio_quality/lib/include/audio/AudioRecordingLocal.h
@@ -27,7 +27,7 @@
class AudioRecordingLocal: public AudioLocal {
public:
- AudioRecordingLocal(int hwId);
+ explicit AudioRecordingLocal(int hwId);
virtual ~AudioRecordingLocal();
protected:
bool doPrepare(AudioHardware::SamplingRate, int samplesInOneGo);
diff --git a/suite/audio_quality/lib/include/audio/AudioRemote.h b/suite/audio_quality/lib/include/audio/AudioRemote.h
index 1268ee0..f5e6c2e 100644
--- a/suite/audio_quality/lib/include/audio/AudioRemote.h
+++ b/suite/audio_quality/lib/include/audio/AudioRemote.h
@@ -30,7 +30,7 @@
int mode = AudioHardware::EModeVoice);
protected:
- AudioRemote(android::sp<RemoteAudio>& remote);
+ explicit AudioRemote(android::sp<RemoteAudio>& remote);
virtual ~AudioRemote() {};
protected:
@@ -42,7 +42,7 @@
class AudioRemotePlayback: public AudioRemote {
public:
- AudioRemotePlayback(android::sp<RemoteAudio>& remote);
+ explicit AudioRemotePlayback(android::sp<RemoteAudio>& remote);
virtual ~AudioRemotePlayback() {};
virtual bool startPlaybackOrRecord(android::sp<Buffer>& buffer, int numberRepetition = 1);
virtual bool waitForCompletion();
@@ -52,7 +52,7 @@
class AudioRemoteRecording: public AudioRemote {
public:
- AudioRemoteRecording(android::sp<RemoteAudio>& remote);
+ explicit AudioRemoteRecording(android::sp<RemoteAudio>& remote);
virtual ~AudioRemoteRecording() {};
virtual bool startPlaybackOrRecord(android::sp<Buffer>& buffer, int numberRepetition = 1);
virtual bool waitForCompletion();
diff --git a/suite/audio_quality/lib/include/audio/Buffer.h b/suite/audio_quality/lib/include/audio/Buffer.h
index 343c502..17c5679 100644
--- a/suite/audio_quality/lib/include/audio/Buffer.h
+++ b/suite/audio_quality/lib/include/audio/Buffer.h
@@ -32,7 +32,7 @@
*/
class Buffer: public virtual android::RefBase {
public:
- Buffer(size_t capacity, size_t size = 0, bool stereo = true);
+ explicit Buffer(size_t capacity, size_t size = 0, bool stereo = true);
virtual ~Buffer();
diff --git a/suite/audio_quality/lib/include/audio/RemoteAudio.h b/suite/audio_quality/lib/include/audio/RemoteAudio.h
index 26647c4..be977b2 100644
--- a/suite/audio_quality/lib/include/audio/RemoteAudio.h
+++ b/suite/audio_quality/lib/include/audio/RemoteAudio.h
@@ -40,12 +40,12 @@
class RemoteAudio: public android::Thread {
public:
- RemoteAudio(ClientSocket& socket);
+ explicit RemoteAudio(ClientSocket& socket);
virtual ~RemoteAudio();
/** launch a thread, and connect to host */
bool init(int port);
- bool downloadData(const android::String8 name, android::sp<Buffer>& buffer, int& id);
+ bool downloadData(const android::String8& name, android::sp<Buffer>& buffer, int& id);
// <0 : not found
int getDataId(const android::String8& name);
bool startPlayback(bool stereo, int samplingF, int mode, int volume,
diff --git a/suite/audio_quality/lib/include/task/ModelBuilder.h b/suite/audio_quality/lib/include/task/ModelBuilder.h
index c6102d7..c997000 100644
--- a/suite/audio_quality/lib/include/task/ModelBuilder.h
+++ b/suite/audio_quality/lib/include/task/ModelBuilder.h
@@ -21,8 +21,9 @@
#include <utils/String8.h>
#include "TaskAll.h"
-class TiXmlElement;
-
+namespace tinyxml2 {
+class XMLElement;
+};
class GenericFactory;
@@ -33,7 +34,7 @@
class ModelBuilder {
public:
ModelBuilder();
- ModelBuilder(GenericFactory* factory);
+ explicit ModelBuilder(GenericFactory* factory);
virtual ~ModelBuilder();
/**
@@ -48,11 +49,11 @@
};
private:
- virtual bool parseAttributes(const TiXmlElement& elem, TaskGeneric& task);
- virtual TaskGeneric* parseGeneric(const TiXmlElement& elem, int tableIndex);
- virtual TaskCase* parseCase(const TiXmlElement& root);
- virtual TaskBatch* parseBatch(const TiXmlElement& root, const android::String8& xmlFileName);
- virtual TaskCase* parseInclude(const TiXmlElement& elem, const android::String8& path);
+ virtual bool parseAttributes(const tinyxml2::XMLElement& elem, TaskGeneric& task);
+ virtual TaskGeneric* parseGeneric(const tinyxml2::XMLElement& elem, int tableIndex);
+ virtual TaskCase* parseCase(const tinyxml2::XMLElement& root);
+ virtual TaskBatch* parseBatch(const tinyxml2::XMLElement& root, const android::String8& xmlFileName);
+ virtual TaskCase* parseInclude(const tinyxml2::XMLElement& elem, const android::String8& path);
struct ParsingInfo {
const char* name; // XML element name
diff --git a/suite/audio_quality/lib/include/task/TaskAsync.h b/suite/audio_quality/lib/include/task/TaskAsync.h
index 4a8ed32..9651c90 100644
--- a/suite/audio_quality/lib/include/task/TaskAsync.h
+++ b/suite/audio_quality/lib/include/task/TaskAsync.h
@@ -27,7 +27,7 @@
*/
class TaskAsync: public TaskGeneric {
public:
- TaskAsync(TaskType type);
+ explicit TaskAsync(TaskType type);
virtual ~TaskAsync();
virtual TaskGeneric::ExecutionResult run();
virtual bool parseAttribute(const android::String8& name, const android::String8& value);
diff --git a/suite/audio_quality/lib/include/task/TaskCase.h b/suite/audio_quality/lib/include/task/TaskCase.h
index 4e20829..22d94e9 100644
--- a/suite/audio_quality/lib/include/task/TaskCase.h
+++ b/suite/audio_quality/lib/include/task/TaskCase.h
@@ -58,11 +58,11 @@
ETypeI64
};
inline Value(): mType(ETypeDouble) {};
- inline Value(Type type): mType(type) {};
- inline Value(double val): mType(ETypeDouble) {
+ inline explicit Value(Type type): mType(type) {};
+ inline explicit Value(double val): mType(ETypeDouble) {
setDouble(val);
};
- inline Value(int64_t val): mType(ETypeI64) {
+ inline explicit Value(int64_t val): mType(ETypeI64) {
setInt64(val);
};
inline Type getType() {
@@ -123,7 +123,7 @@
*/
bool translateVarName(const android::String8& orig, android::String8& translated);
- void setDetails(android::String8 details);
+ void setDetails(const android::String8& details);
const android::String8& getDetails() const;
private:
void releaseRemoteAudio();
diff --git a/suite/audio_quality/lib/include/task/TaskGeneric.h b/suite/audio_quality/lib/include/task/TaskGeneric.h
index 6f60bcf..af0a500 100644
--- a/suite/audio_quality/lib/include/task/TaskGeneric.h
+++ b/suite/audio_quality/lib/include/task/TaskGeneric.h
@@ -48,7 +48,7 @@
//no ETaskInclude include does not involve any action.
};
- TaskGeneric(TaskType type);
+ explicit TaskGeneric(TaskType type);
virtual ~TaskGeneric();
diff --git a/suite/audio_quality/lib/include/task/TaskProcess.h b/suite/audio_quality/lib/include/task/TaskProcess.h
index d043d98..724ebd7 100644
--- a/suite/audio_quality/lib/include/task/TaskProcess.h
+++ b/suite/audio_quality/lib/include/task/TaskProcess.h
@@ -18,9 +18,9 @@
#ifndef CTSAUDIO_TASKPROCESS_H
#define CTSAUDIO_TASKPROCESS_H
+#include <memory>
#include <vector>
-#include <UniquePtr.h>
#include <utils/StrongPointer.h>
#include "audio/Buffer.h"
@@ -42,15 +42,15 @@
bool parseParams(std::vector<Param>& list, const char* str, bool isInput);
//typedef necessary to prevent compiler's confusion
typedef void* void_ptr;
- typedef UniquePtr<TaskCase::Value> UniqueValue;
- typedef UniquePtr<android::sp<Buffer> > UniqueBuffer;
+ typedef std::unique_ptr<TaskCase::Value> UniqueValue;
+ typedef std::unique_ptr<android::sp<Buffer> > UniqueBuffer;
/// construct Buffers and Values for calling builtin functions.
- /// all constructed stuffs automatically deleted by the passed UniquePtrs
+ /// all constructed stuffs automatically deleted by the passed std::unique_ptrs.
bool prepareParams(std::vector<TaskProcess::Param>& list,
const bool* inputTypes,
- UniquePtr<void_ptr, DefaultDelete<void_ptr[]> > & ptrs,
- UniquePtr<UniqueValue, DefaultDelete<UniqueValue[]> > & values,
- UniquePtr<UniqueBuffer, DefaultDelete<UniqueBuffer[]> > & buffers,
+ std::unique_ptr<void_ptr[]>& ptrs,
+ std::unique_ptr<UniqueValue[]>& values,
+ std::unique_ptr<UniqueBuffer[]>& buffers,
bool isInput);
private:
@@ -69,7 +69,7 @@
class Param {
public:
Param(ParamType type, android::String8& string);
- Param(TaskCase::Value& val);
+ explicit Param(TaskCase::Value& val);
ParamType getType();
android::String8& getParamString();
TaskCase::Value& getValue();
@@ -86,7 +86,7 @@
std::vector<Param> mInput;
std::vector<Param> mOutput;
BuiltinProcessing mBuiltin;
- UniquePtr<SignalProcessingInterface> mSp;
+ std::unique_ptr<SignalProcessingInterface> mSp;
};
diff --git a/suite/audio_quality/lib/src/Adb.h b/suite/audio_quality/lib/src/Adb.h
index 59d4b9b..c85b9f7 100644
--- a/suite/audio_quality/lib/src/Adb.h
+++ b/suite/audio_quality/lib/src/Adb.h
@@ -24,7 +24,7 @@
public:
/// device: device number typically passed in adb's -s argument.
/// if device string is empty, adb command will be called without -s option.
- Adb(const android::String8& device);
+ explicit Adb(const android::String8& device);
~Adb();
bool setPortForwarding(int hostPort, int devicePort);
/// install given clientBinary to DUT and launch given component.
diff --git a/suite/audio_quality/lib/src/GenericFactory.cpp b/suite/audio_quality/lib/src/GenericFactory.cpp
index 2402055..d70d907 100644
--- a/suite/audio_quality/lib/src/GenericFactory.cpp
+++ b/suite/audio_quality/lib/src/GenericFactory.cpp
@@ -69,3 +69,6 @@
LOGD("GenericFactory::createTask 0x%x, type %d", task, type);
return task;
}
+
+GenericFactory::~GenericFactory() {
+}
diff --git a/suite/audio_quality/lib/src/RWBuffer.h b/suite/audio_quality/lib/src/RWBuffer.h
index 8b9d2a0..8065e3e 100644
--- a/suite/audio_quality/lib/src/RWBuffer.h
+++ b/suite/audio_quality/lib/src/RWBuffer.h
@@ -25,7 +25,7 @@
/// utility for R/W buffer
class RWBuffer {
public:
- RWBuffer(int capacity)
+ explicit RWBuffer(int capacity)
: mCapacity(capacity),
mWrPoint(0),
mRdPoint(0) {
diff --git a/suite/audio_quality/lib/src/Settings.cpp b/suite/audio_quality/lib/src/Settings.cpp
index 42dd30e..7af4c08 100644
--- a/suite/audio_quality/lib/src/Settings.cpp
+++ b/suite/audio_quality/lib/src/Settings.cpp
@@ -34,7 +34,7 @@
}
-void Settings::addSetting(SettingType type, const android::String8 setting)
+void Settings::addSetting(SettingType type, const android::String8& setting)
{
mSettings[type] = setting;
}
diff --git a/suite/audio_quality/lib/src/SignalProcessingImpl.h b/suite/audio_quality/lib/src/SignalProcessingImpl.h
index 29b410e..2b8b8e0 100644
--- a/suite/audio_quality/lib/src/SignalProcessingImpl.h
+++ b/suite/audio_quality/lib/src/SignalProcessingImpl.h
@@ -17,7 +17,7 @@
#ifndef CTSAUDIO_SIGNALPROCESSINGIMPL_H
#define CTSAUDIO_SIGNALPROCESSINGIMPL_H
-#include <UniquePtr.h>
+#include <memory>
#include <utils/String8.h>
#include "SignalProcessingInterface.h"
@@ -46,7 +46,7 @@
private:
static const int SCRIPT_PORT = 15010;
- UniquePtr<ClientSocket> mSocket;
+ std::unique_ptr<ClientSocket> mSocket;
pid_t mChildPid;
bool mChildRunning;
RWBuffer mBuffer;
diff --git a/suite/audio_quality/lib/src/audio/AudioProtocol.cpp b/suite/audio_quality/lib/src/audio/AudioProtocol.cpp
index 25c1422..26ce5c5 100644
--- a/suite/audio_quality/lib/src/audio/AudioProtocol.cpp
+++ b/suite/audio_quality/lib/src/audio/AudioProtocol.cpp
@@ -18,7 +18,7 @@
#include <sys/types.h>
#include <sys/socket.h>
-#include <UniquePtr.h>
+#include <memory>
#include <utils/StrongPointer.h>
#include "audio/Buffer.h"
@@ -183,7 +183,7 @@
}
int len = ntohl(data[2]);
- UniquePtr<char, DefaultDelete<char[]> > infoString(new char[len + 1]);
+ std::unique_ptr<char[]> infoString(new char[len + 1]);
if (!readData(infoString.get(), len)) {
return false;
}
diff --git a/suite/audio_quality/lib/src/audio/RemoteAudio.cpp b/suite/audio_quality/lib/src/audio/RemoteAudio.cpp
index ead04b91..56758fb 100644
--- a/suite/audio_quality/lib/src/audio/RemoteAudio.cpp
+++ b/suite/audio_quality/lib/src/audio/RemoteAudio.cpp
@@ -193,7 +193,7 @@
}
-bool RemoteAudio::downloadData(const android::String8 name, android::sp<Buffer>& buffer, int& id)
+bool RemoteAudio::downloadData(const android::String8& name, android::sp<Buffer>& buffer, int& id)
{
CommandHandler* handler = reinterpret_cast<CommandHandler*>(mDownloadHandler.get());
id = mDownloadId;
diff --git a/suite/audio_quality/lib/src/task/ModelBuilder.cpp b/suite/audio_quality/lib/src/task/ModelBuilder.cpp
index 6f34f5c..78e5138 100644
--- a/suite/audio_quality/lib/src/task/ModelBuilder.cpp
+++ b/suite/audio_quality/lib/src/task/ModelBuilder.cpp
@@ -14,14 +14,16 @@
* the License.
*/
-#include <tinyxml.h>
+#include <tinyxml2.h>
-#include <UniquePtr.h>
+#include <memory>
#include "Log.h"
#include "GenericFactory.h"
#include "task/ModelBuilder.h"
+using namespace tinyxml2;
+
static const int MAX_NO_CHILDREN = 8;
static const ModelBuilder::ChildInfo CASE_TABLE[] = {
{ TaskGeneric::ETaskSetup, true },
@@ -83,12 +85,13 @@
TaskGeneric* ModelBuilder::parseTestDescriptionXml(const android::String8& xmlFileName,
bool caseOnly)
{
- TiXmlDocument doc(xmlFileName.string());
- if (!doc.LoadFile()) {
- LOGE("ModelBuilder::parseTestDescriptionXml cannot load file %s", xmlFileName.string());
+ XMLDocument doc;
+ int error = doc.LoadFile(xmlFileName.string());
+ if (error != XML_NO_ERROR) {
+ LOGE("ModelBuilder::parseTestDescriptionXml cannot load file %s: %d", xmlFileName.string(), error);
return NULL;
}
- const TiXmlElement* root;
+ const XMLElement* root;
if ((root = doc.FirstChildElement("case")) != NULL) {
return parseCase(*root);
} else if (!caseOnly && ((root = doc.FirstChildElement("batch")) != NULL)) {
@@ -99,11 +102,11 @@
}
}
-TaskGeneric* ModelBuilder::parseGeneric(const TiXmlElement& self, int tableIndex)
+TaskGeneric* ModelBuilder::parseGeneric(const XMLElement& self, int tableIndex)
{
TaskGeneric::TaskType typeSelf(mParsingTable[tableIndex].type);
int Nchildren = mParsingTable[tableIndex].Nchildren;
- UniquePtr<TaskGeneric> taskSelf(mFactory->createTask(typeSelf));
+ std::unique_ptr<TaskGeneric> taskSelf(mFactory->createTask(typeSelf));
if (taskSelf.get() == NULL) {
return NULL;
}
@@ -118,7 +121,7 @@
}
// handle children
- const TiXmlElement* child = self.FirstChildElement();
+ const XMLElement* child = self.FirstChildElement();
while (child != NULL) {
TaskGeneric::TaskType childType(TaskGeneric::ETaskInvalid);
int i;
@@ -148,7 +151,7 @@
typeSelf);
return NULL;
}
- UniquePtr<TaskGeneric> taskChild(parseGeneric(*child, i));
+ std::unique_ptr<TaskGeneric> taskChild(parseGeneric(*child, i));
if (taskChild.get() == NULL) {
LOGE("ModelBuilder::parseGeneric failed in parsing child type %d for type %d",
childType, typeSelf);
@@ -175,16 +178,16 @@
}
-TaskCase* ModelBuilder::parseCase(const TiXmlElement& root)
+TaskCase* ModelBuilder::parseCase(const XMLElement& root)
{
// position 0 of mParsingTable should be "case"
return reinterpret_cast<TaskCase*>(parseGeneric(root, 0));
}
-TaskBatch* ModelBuilder::parseBatch(const TiXmlElement& root, const android::String8& xmlFileName)
+TaskBatch* ModelBuilder::parseBatch(const XMLElement& root, const android::String8& xmlFileName)
{
- UniquePtr<TaskBatch> batch(
+ std::unique_ptr<TaskBatch> batch(
reinterpret_cast<TaskBatch*>(mFactory->createTask(TaskGeneric::ETaskBatch)));
if (batch.get() == NULL) {
LOGE("ModelBuilder::handleBatch cannot create TaskBatch");
@@ -194,14 +197,14 @@
return NULL;
}
- const TiXmlElement* inc = root.FirstChildElement("include");
+ const XMLElement* inc = root.FirstChildElement("include");
if (inc == NULL) {
LOGE("ModelBuilder::handleBatch no include inside batch");
return NULL;
}
android::String8 path = xmlFileName.getPathDir();
- UniquePtr<TaskCase> testCase;
+ std::unique_ptr<TaskCase> testCase;
int i = 0;
while (1) {
if (inc == NULL) {
@@ -231,7 +234,7 @@
return batch.release();
}
-TaskCase* ModelBuilder::parseInclude(const TiXmlElement& elem, const android::String8& path)
+TaskCase* ModelBuilder::parseInclude(const XMLElement& elem, const android::String8& path)
{
const char* fileName = elem.Attribute("file");
if (fileName == NULL) {
@@ -245,9 +248,9 @@
return reinterpret_cast<TaskCase*>(parseTestDescriptionXml(incFile, true));
}
-bool ModelBuilder::parseAttributes(const TiXmlElement& elem, TaskGeneric& task)
+bool ModelBuilder::parseAttributes(const XMLElement& elem, TaskGeneric& task)
{
- const TiXmlAttribute* attr = elem.FirstAttribute();
+ const XMLAttribute* attr = elem.FirstAttribute();
while (1) {
if (attr == NULL) {
break;
diff --git a/suite/audio_quality/lib/src/task/TaskCase.cpp b/suite/audio_quality/lib/src/task/TaskCase.cpp
index 5f9de97..861802d 100644
--- a/suite/audio_quality/lib/src/task/TaskCase.cpp
+++ b/suite/audio_quality/lib/src/task/TaskCase.cpp
@@ -292,7 +292,7 @@
mClient = NULL;
}
-void TaskCase::setDetails(android::String8 details)
+void TaskCase::setDetails(const android::String8& details)
{
mDetails = details;
}
diff --git a/suite/audio_quality/lib/src/task/TaskDownload.cpp b/suite/audio_quality/lib/src/task/TaskDownload.cpp
index dacefc5..2973f17 100644
--- a/suite/audio_quality/lib/src/task/TaskDownload.cpp
+++ b/suite/audio_quality/lib/src/task/TaskDownload.cpp
@@ -14,7 +14,6 @@
* the License.
*/
-#include <UniquePtr.h>
#include "Log.h"
#include "audio/AudioSignalFactory.h"
#include "audio/RemoteAudio.h"
diff --git a/suite/audio_quality/lib/src/task/TaskProcess.cpp b/suite/audio_quality/lib/src/task/TaskProcess.cpp
index 061dda5..816e920 100644
--- a/suite/audio_quality/lib/src/task/TaskProcess.cpp
+++ b/suite/audio_quality/lib/src/task/TaskProcess.cpp
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
+#include <memory>
#include <vector>
#include "Log.h"
@@ -52,9 +53,9 @@
// Allocate Buffers and Values to pass to builtin functions
bool TaskProcess::prepareParams(std::vector<TaskProcess::Param>& list,
const bool* paramTypes,
- UniquePtr<void_ptr, DefaultDelete<void_ptr[]> > & ptrs,
- UniquePtr<UniqueValue, DefaultDelete<UniqueValue[]> > & values,
- UniquePtr<UniqueBuffer, DefaultDelete<UniqueBuffer[]> > & buffers,
+ std::unique_ptr<void_ptr[]>& ptrs,
+ std::unique_ptr<UniqueValue[]>& values,
+ std::unique_ptr<UniqueBuffer[]>& buffers,
bool isInput)
{
size_t N = list.size();
@@ -92,7 +93,7 @@
}
switch(list[i].getType()) {
case EId: {
- UniquePtr<android::sp<Buffer> > buffer(new android::sp<Buffer>());
+ std::unique_ptr<android::sp<Buffer> > buffer(new android::sp<Buffer>());
if (buffer.get() == NULL) {
LOGE("alloc failed");
return false;
@@ -166,17 +167,17 @@
}
}
// This is for passing to builtin fns. Just void pts will be cleared in exit
- UniquePtr<void_ptr, DefaultDelete<void_ptr[]> > inputs;
+ std::unique_ptr<void_ptr[]> inputs;
// This is for holding Value instances. Will be destroyed in exit
- UniquePtr<UniqueValue, DefaultDelete<UniqueValue[]> > inputValues;
+ std::unique_ptr<UniqueValue[]> inputValues;
// This is for holding android::sp<Buffer>. Buffer itself is from the global map.
- UniquePtr<UniqueBuffer, DefaultDelete<UniqueBuffer[]> > inputBuffers;
+ std::unique_ptr<UniqueBuffer[]> inputBuffers;
- UniquePtr<void_ptr, DefaultDelete<void_ptr[]> > outputs;
+ std::unique_ptr<void_ptr[]> outputs;
// Value is created here. Builtin function just need to set it.
- UniquePtr<UniqueValue, DefaultDelete<UniqueValue[]> > outputValues;
+ std::unique_ptr<UniqueValue[]> outputValues;
// Buffer itself should be allocated by the builtin function itself.
- UniquePtr<UniqueBuffer, DefaultDelete<UniqueBuffer[]> > outputBuffers;
+ std::unique_ptr<UniqueBuffer[]> outputBuffers;
if (!prepareParams(mInput, builtIn ? info->mInputTypes : NULL, inputs, inputValues,
inputBuffers, true)) {
@@ -192,11 +193,11 @@
if (builtIn) {
result = (mBuiltin.*(info->mFunction))(inputs.get(), outputs.get());
} else {
- UniquePtr<bool, DefaultDelete<bool[]> > inputTypes(new bool[mInput.size()]);
+ std::unique_ptr<bool[]> inputTypes(new bool[mInput.size()]);
for (size_t i = 0; i < mInput.size(); i++) {
(inputTypes.get())[i] = mInput[i].isIdType();
}
- UniquePtr<bool, DefaultDelete<bool[]> > outputTypes(new bool[mOutput.size()]);
+ std::unique_ptr<bool[]> outputTypes(new bool[mOutput.size()]);
for (size_t i = 0; i < mOutput.size(); i++) {
(outputTypes.get())[i] = mOutput[i].isIdType();
}
@@ -245,14 +246,15 @@
{
LOGV("TaskProcess::parseParams will parse %s", str);
android::String8 paramStr(str);
- UniquePtr<std::vector<android::String8> > paramTokens(StringUtil::split(paramStr, ','));
+ std::unique_ptr<std::vector<android::String8>> paramTokens(StringUtil::split(paramStr, ','));
if (paramTokens.get() == NULL) {
LOGE("split failed");
return false;
}
std::vector<android::String8>& tokens = *(paramTokens.get());
for (size_t i = 0; i < tokens.size(); i++) {
- UniquePtr<std::vector<android::String8> > itemTokens(StringUtil::split(tokens[i], ':'));
+ std::unique_ptr<std::vector<android::String8>> itemTokens(StringUtil::split(tokens[i],
+ ':'));
if (itemTokens.get() == NULL) {
LOGE("split failed");
return false;
@@ -294,7 +296,7 @@
bool TaskProcess::parseAttribute(const android::String8& name, const android::String8& value)
{
if (StringUtil::compare(name, "method") == 0) {
- UniquePtr<std::vector<android::String8> > tokenPtr(StringUtil::split(value, ':'));
+ std::unique_ptr<std::vector<android::String8> > tokenPtr(StringUtil::split(value, ':'));
std::vector<android::String8>* tokens = tokenPtr.get();
if (tokens == NULL) {
LOGE("split failed");
diff --git a/suite/audio_quality/lib/src/task/TaskSave.cpp b/suite/audio_quality/lib/src/task/TaskSave.cpp
index 156e554..18dfb5e 100644
--- a/suite/audio_quality/lib/src/task/TaskSave.cpp
+++ b/suite/audio_quality/lib/src/task/TaskSave.cpp
@@ -18,7 +18,7 @@
#include <sys/types.h>
#include <errno.h>
-#include <UniquePtr.h>
+#include <memory>
#include "Log.h"
#include "FileUtil.h"
@@ -51,7 +51,7 @@
return true; // true as there is no need to save
}
- UniquePtr<std::vector<android::String8> > list(StringUtil::split(fileValue, ','));
+ std::unique_ptr<std::vector<android::String8> > list(StringUtil::split(fileValue, ','));
std::vector<android::String8>* listp = list.get();
if (listp == NULL) {
LOGE("alloc failed");
@@ -75,7 +75,7 @@
}
for (size_t i = 0; i < listp->size(); i++) {
- UniquePtr<std::list<TaskCase::BufferPair> > buffers(
+ std::unique_ptr<std::list<TaskCase::BufferPair> > buffers(
getTestCase()->findAllBuffers((*listp)[i]));
std::list<TaskCase::BufferPair>* buffersp = buffers.get();
if (buffersp == NULL) {
@@ -104,7 +104,7 @@
return true; // true as there is no need to save
}
- UniquePtr<std::vector<android::String8> > list(StringUtil::split(reportValue, ','));
+ std::unique_ptr<std::vector<android::String8> > list(StringUtil::split(reportValue, ','));
std::vector<android::String8>* listp = list.get();
if (listp == NULL) {
LOGE("alloc failed");
@@ -113,7 +113,7 @@
MSG("=== Values stored ===");
android::String8 details;
for (size_t i = 0; i < listp->size(); i++) {
- UniquePtr<std::list<TaskCase::ValuePair> > values(
+ std::unique_ptr<std::list<TaskCase::ValuePair> > values(
getTestCase()->findAllValues((*listp)[i]));
std::list<TaskCase::ValuePair>* valuesp = values.get();
if (valuesp == NULL) {
diff --git a/suite/audio_quality/lib/src/task/TaskSound.cpp b/suite/audio_quality/lib/src/task/TaskSound.cpp
index 8dd9b4a..58b0364 100644
--- a/suite/audio_quality/lib/src/task/TaskSound.cpp
+++ b/suite/audio_quality/lib/src/task/TaskSound.cpp
@@ -14,7 +14,7 @@
* the License.
*/
-#include <UniquePtr.h>
+#include <memory>
#include "Log.h"
#include "audio/AudioSignalFactory.h"
#include "audio/RemoteAudio.h"
@@ -61,7 +61,7 @@
LOGE("TaskSound::run %s string not found", STR_TYPE.string());
return TaskGeneric::EResultError;
}
- UniquePtr<std::vector<android::String8> > tokens(StringUtil::split(type, ':'));
+ std::unique_ptr<std::vector<android::String8> > tokens(StringUtil::split(type, ':'));
if (tokens.get() == NULL) {
LOGE("alloc failed");
return TaskGeneric::EResultError;
diff --git a/suite/audio_quality/test/Android.mk b/suite/audio_quality/test/Android.mk
index 21b0250..7a84802 100644
--- a/suite/audio_quality/test/Android.mk
+++ b/suite/audio_quality/test/Android.mk
@@ -19,15 +19,24 @@
LOCAL_SRC_FILES := $(call all-subdir-cpp-files)
#$(info $(LOCAL_SRC_FILES))
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/../lib/include $(LOCAL_PATH)/../lib/src external/gtest/include \
- external/tinyalsa/include/ libcore/include
-LOCAL_STATIC_LIBRARIES := libutils libgtest_host libgtest_main_host liblog libcutils libtinyalsa \
- libtinyxml
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/../lib/include \
+ $(LOCAL_PATH)/../lib/src \
+
+LOCAL_STATIC_LIBRARIES := \
+ libutils \
+ liblog \
+ libcutils \
+ libtinyalsa \
+ libtinyxml2 \
+
# need to keep everything in libcts_.. Otherwise, linker will drop some
# functions and linker error happens
LOCAL_WHOLE_STATIC_LIBRARIES := libcts_audio_quality
LOCAL_CFLAGS:= -g -fno-exceptions
LOCAL_LDFLAGS:= -g -lrt -ldl -lm -fno-exceptions -lpthread
+LOCAL_CXX_STL := libc++_static
LOCAL_MODULE_HOST_OS := linux
-LOCAL_MODULE:= cts_audio_quality_test
-include $(BUILD_HOST_EXECUTABLE)
+LOCAL_MODULE := cts_audio_quality_test
+LOCAL_MULTILIB := first
+include $(BUILD_HOST_NATIVE_TEST)
diff --git a/suite/audio_quality/test/BufferTest.cpp b/suite/audio_quality/test/BufferTest.cpp
index 2c7b20e..5e315977 100644
--- a/suite/audio_quality/test/BufferTest.cpp
+++ b/suite/audio_quality/test/BufferTest.cpp
@@ -17,7 +17,7 @@
#include <stdint.h>
#include <gtest/gtest.h>
-#include <UniquePtr.h>
+#include <memory>
#include "audio/Buffer.h"
@@ -38,7 +38,7 @@
TEST_F(BufferTest, saveLoadStereoTest) {
const int BUFFER_SIZE = 32;
- UniquePtr<Buffer> buffer(new Buffer(BUFFER_SIZE, BUFFER_SIZE, true));
+ std::unique_ptr<Buffer> buffer(new Buffer(BUFFER_SIZE, BUFFER_SIZE, true));
ASSERT_TRUE(buffer.get() != NULL);
int16_t* data = (int16_t*)buffer->getData();
ASSERT_TRUE(data != NULL);
@@ -49,7 +49,7 @@
android::String8 file("/tmp/cts_audio_temp");
ASSERT_TRUE(buffer->saveToFile(file));
file.append(".r2s");
- UniquePtr<Buffer> bufferRead(Buffer::loadFromFile(file));
+ std::unique_ptr<Buffer> bufferRead(Buffer::loadFromFile(file));
ASSERT_TRUE(bufferRead.get() != NULL);
ASSERT_TRUE(bufferRead->getSize() == (size_t)BUFFER_SIZE);
ASSERT_TRUE(bufferRead->isStereo());
@@ -63,14 +63,14 @@
TEST_F(BufferTest, monoLTest) {
const int BUFFER_SIZE = 8;
- UniquePtr<Buffer> buffer(new Buffer(BUFFER_SIZE, BUFFER_SIZE, true));
+ std::unique_ptr<Buffer> buffer(new Buffer(BUFFER_SIZE, BUFFER_SIZE, true));
ASSERT_TRUE(buffer.get() != NULL);
int16_t* data = (int16_t*)buffer->getData();
ASSERT_TRUE(data != NULL);
for (int i = 0; i < BUFFER_SIZE/2; i++) {
data[i] = i;
}
- UniquePtr<Buffer> bufferl(new Buffer(BUFFER_SIZE/2, BUFFER_SIZE/2, false));
+ std::unique_ptr<Buffer> bufferl(new Buffer(BUFFER_SIZE/2, BUFFER_SIZE/2, false));
ASSERT_TRUE(bufferl.get() != NULL);
data = (int16_t*)bufferl->getData();
ASSERT_TRUE(data != NULL);
diff --git a/suite/audio_quality/test/FileUtilTest.cpp b/suite/audio_quality/test/FileUtilTest.cpp
index d79b2aa..990d7b9 100644
--- a/suite/audio_quality/test/FileUtilTest.cpp
+++ b/suite/audio_quality/test/FileUtilTest.cpp
@@ -17,8 +17,6 @@
#include <stdint.h>
#include <gtest/gtest.h>
-#include <UniquePtr.h>
-
#include "Log.h"
#include "FileUtil.h"
diff --git a/suite/audio_quality/test/LogTest.cpp b/suite/audio_quality/test/LogTest.cpp
index 421b904..4412338 100644
--- a/suite/audio_quality/test/LogTest.cpp
+++ b/suite/audio_quality/test/LogTest.cpp
@@ -17,8 +17,6 @@
#include <stdint.h>
#include <gtest/gtest.h>
-#include <UniquePtr.h>
-
#include "Log.h"
diff --git a/suite/audio_quality/test/MixerTest.cpp b/suite/audio_quality/test/MixerTest.cpp
index 96c23ed..413c3ce 100644
--- a/suite/audio_quality/test/MixerTest.cpp
+++ b/suite/audio_quality/test/MixerTest.cpp
@@ -16,7 +16,6 @@
#include <stdint.h>
#include <gtest/gtest.h>
-#include <UniquePtr.h>
#include <tinyalsa/asoundlib.h>
#include <Log.h>
#include <audio/AudioHardware.h>
diff --git a/suite/audio_quality/test/TaskTest.cpp b/suite/audio_quality/test/TaskTest.cpp
index b003d99..3636f82 100644
--- a/suite/audio_quality/test/TaskTest.cpp
+++ b/suite/audio_quality/test/TaskTest.cpp
@@ -37,7 +37,7 @@
static int mRunCounter;
static int mLiveInstanceCounter;
- TestTaskDummy(TaskGeneric::TaskType type)
+ explicit TestTaskDummy(TaskGeneric::TaskType type)
: TaskGeneric(type) {
mLiveInstanceCounter++;
diff --git a/tests/admin/Android.mk b/tests/admin/Android.mk
index 60b7aeb..74bfc70 100644
--- a/tests/admin/Android.mk
+++ b/tests/admin/Android.mk
@@ -32,8 +32,6 @@
LOCAL_INSTRUMENTATION_FOR := CtsAdminApp
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/admin/OldAndroidTest.xml b/tests/admin/OldAndroidTest.xml
deleted file mode 100644
index 0cfada8..0000000
--- a/tests/admin/OldAndroidTest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="CTS device admin test config">
- <include name="common-config" />
- <option name="run-command:run-command" value="dpm set-active-admin --user cur android.admin.app/.CtsDeviceAdminReceiver" />
- <option name="run-command:run-command" value="dpm set-active-admin --user cur android.admin.app/.CtsDeviceAdminReceiver2" />
-</configuration>
diff --git a/tests/app/Android.mk b/tests/app/Android.mk
index 775e679..d62ee46 100644
--- a/tests/app/Android.mk
+++ b/tests/app/Android.mk
@@ -34,8 +34,6 @@
LOCAL_INSTRUMENTATION_FOR := CtsAppTestStubs
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_SDK_VERSION := test_current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/app/OldAndroidTest.xml b/tests/app/OldAndroidTest.xml
deleted file mode 100644
index 01ebbcb..0000000
--- a/tests/app/OldAndroidTest.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="Base config for CTS package preparer">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsSimpleApp.apk" />
-</configuration>
diff --git a/tests/aslr/Android.mk b/tests/aslr/Android.mk
index ebee2a8..6ad636b 100644
--- a/tests/aslr/Android.mk
+++ b/tests/aslr/Android.mk
@@ -14,20 +14,13 @@
LOCAL_PATH:= $(call my-dir)
-test_executable := CtsAslrMallocTestCases
-list_executable := $(test_executable)_list
-
include $(CLEAR_VARS)
-LOCAL_MODULE:= $(test_executable)
-LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE:= CtsAslrMallocTestCases
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
LOCAL_MULTILIB := both
LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-LOCAL_C_INCLUDES := \
- external/gtest/include
-
LOCAL_SRC_FILES := \
src/AslrMallocTest.cpp
@@ -43,20 +36,3 @@
LOCAL_COMPATIBILITY_SUITE := cts
include $(BUILD_CTS_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE := $(list_executable)
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
- src/AslrMallocTest.cpp
-
-LOCAL_CFLAGS := \
- -DBUILD_ONLY \
-
-LOCAL_SHARED_LIBRARIES := \
- liblog
-
-include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tests/aslr/src/AslrMallocTest.cpp b/tests/aslr/src/AslrMallocTest.cpp
index 6e773cb..9259841 100644
--- a/tests/aslr/src/AslrMallocTest.cpp
+++ b/tests/aslr/src/AslrMallocTest.cpp
@@ -17,7 +17,6 @@
#define LOG_NDEBUG 0
#define LOG_TAG "AslrMallocTest"
-#if !defined(BUILD_ONLY)
#include <android-base/file.h>
#include <android-base/parseint.h>
#include <android-base/stringprintf.h>
@@ -30,7 +29,6 @@
#include <sys/wait.h>
#include <unistd.h>
#include <unordered_set>
-#endif
#include <gtest/gtest.h>
#include <string>
@@ -50,7 +48,6 @@
* performs malloc(size) and prints out the address */
static const std::string argPrint = "--print-malloc-address";
-#if !defined(BUILD_ONLY)
class AslrMallocTest : public ::testing::Test
{
protected:
@@ -135,13 +132,6 @@
}
}
};
-#else /* defined(BUILD_ONLY) */
-class AslrMallocTest : public ::testing::Test
-{
-protected:
- void TestRandomization() {}
-};
-#endif
TEST_F(AslrMallocTest, testMallocRandomization) {
TestRandomization();
@@ -149,7 +139,6 @@
int main(int argc, char **argv)
{
-#if !defined(BUILD_ONLY)
if (argc == 3 && argPrint == argv[1]) {
size_t size;
@@ -160,7 +149,6 @@
printf("%p", malloc(size));
return EXIT_SUCCESS;
}
-#endif
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/tests/backup/Android.mk b/tests/backup/Android.mk
index 2a7485a..a2de68b 100644
--- a/tests/backup/Android.mk
+++ b/tests/backup/Android.mk
@@ -34,8 +34,6 @@
LOCAL_SDK_VERSION := test_current
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
include $(BUILD_CTS_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/backup/OldAndroidTest.xml b/tests/backup/OldAndroidTest.xml
deleted file mode 100644
index fd0881f..0000000
--- a/tests/backup/OldAndroidTest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2016 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 CTS Backup test cases">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsBackupApp.apk" />
-</configuration>
diff --git a/tests/camera/Android.mk b/tests/camera/Android.mk
index 4065bfb..48550f6 100644
--- a/tests/camera/Android.mk
+++ b/tests/camera/Android.mk
@@ -32,6 +32,8 @@
libctscamera2_jni \
libnativehelper_compat_libc++
+LOCAL_NDK_STL_VARIANT := c++_shared
+
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
# Tag this module as a cts test artifact
diff --git a/tests/camera/libctscamera2jni/Android.mk b/tests/camera/libctscamera2jni/Android.mk
index eac42f5..4b80553 100644
--- a/tests/camera/libctscamera2jni/Android.mk
+++ b/tests/camera/libctscamera2jni/Android.mk
@@ -36,18 +36,16 @@
# Flags to avoid warnings from DNG SDK
LOCAL_CFLAGS += -Wno-unused-parameter
-LOCAL_STATIC_LIBRARIES := libdng_sdk_validate libjpeg_static libz
+LOCAL_STATIC_LIBRARIES := libdng_sdk_validate libjpeg_static_ndk
LOCAL_SHARED_LIBRARIES := libandroid \
libnativehelper_compat_libc++ \
liblog \
libcamera2ndk \
- libmediandk
+ libmediandk \
+ libz \
# NDK build, shared C++ runtime
-#LOCAL_SDK_VERSION := current
-#LOCAL_NDK_STL_VARIANT := c++_shared
-
-# Temporary workaround until camera2 NDK is active. See b/27102995.
-LOCAL_CXX_STL := libc++_static
+LOCAL_SDK_VERSION := 24
+LOCAL_NDK_STL_VARIANT := c++_shared
include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/core/libcore/com/Android.mk b/tests/core/libcore/com/Android.mk
index c1df39a..db08dbd 100644
--- a/tests/core/libcore/com/Android.mk
+++ b/tests/core/libcore/com/Android.mk
@@ -17,5 +17,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.com
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/conscrypt/Android.mk b/tests/core/libcore/conscrypt/Android.mk
index cd8559c..7428bf0 100644
--- a/tests/core/libcore/conscrypt/Android.mk
+++ b/tests/core/libcore/conscrypt/Android.mk
@@ -20,6 +20,5 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.conscrypt
-LOCAL_STATIC_JAVA_LIBRARIES := core-tests conscrypt-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+LOCAL_STATIC_JAVA_LIBRARIES := conscrypt-tests mockito-target-minus-junit4
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/dalvik/Android.mk b/tests/core/libcore/dalvik/Android.mk
index 501c674..42d14f3 100644
--- a/tests/core/libcore/dalvik/Android.mk
+++ b/tests/core/libcore/dalvik/Android.mk
@@ -17,5 +17,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.dalvik
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_annotation/Android.mk b/tests/core/libcore/harmony_annotation/Android.mk
index 6746cf3..e9f716e 100644
--- a/tests/core/libcore/harmony_annotation/Android.mk
+++ b/tests/core/libcore/harmony_annotation/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_annotation
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_io/Android.mk b/tests/core/libcore/harmony_java_io/Android.mk
index 3108f30..a8d4fa0 100644
--- a/tests/core/libcore/harmony_java_io/Android.mk
+++ b/tests/core/libcore/harmony_java_io/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_io
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_lang/Android.mk b/tests/core/libcore/harmony_java_lang/Android.mk
index e333708..8b1bdff 100644
--- a/tests/core/libcore/harmony_java_lang/Android.mk
+++ b/tests/core/libcore/harmony_java_lang/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_lang
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_math/Android.mk b/tests/core/libcore/harmony_java_math/Android.mk
index 5889f85..8310743 100644
--- a/tests/core/libcore/harmony_java_math/Android.mk
+++ b/tests/core/libcore/harmony_java_math/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_math
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_net/Android.mk b/tests/core/libcore/harmony_java_net/Android.mk
index 95218c4..7917bcc 100644
--- a/tests/core/libcore/harmony_java_net/Android.mk
+++ b/tests/core/libcore/harmony_java_net/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_net
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_nio/Android.mk b/tests/core/libcore/harmony_java_nio/Android.mk
index 5bdfd17..2c6f673 100644
--- a/tests/core/libcore/harmony_java_nio/Android.mk
+++ b/tests/core/libcore/harmony_java_nio/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_nio
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_text/Android.mk b/tests/core/libcore/harmony_java_text/Android.mk
index 21113e5..ecd1574 100644
--- a/tests/core/libcore/harmony_java_text/Android.mk
+++ b/tests/core/libcore/harmony_java_text/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_text
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_util/Android.mk b/tests/core/libcore/harmony_java_util/Android.mk
index f34295e..6d7bded 100644
--- a/tests/core/libcore/harmony_java_util/Android.mk
+++ b/tests/core/libcore/harmony_java_util/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_util
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_javax_security/Android.mk b/tests/core/libcore/harmony_javax_security/Android.mk
index fce594b..011940d 100644
--- a/tests/core/libcore/harmony_javax_security/Android.mk
+++ b/tests/core/libcore/harmony_javax_security/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_javax_security
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_logging/Android.mk b/tests/core/libcore/harmony_logging/Android.mk
index 69a8e3a..2ec10f1 100644
--- a/tests/core/libcore/harmony_logging/Android.mk
+++ b/tests/core/libcore/harmony_logging/Android.mk
@@ -21,5 +21,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_logging
LOCAL_STATIC_JAVA_LIBRARIES := apache-harmony-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/libcore/Android.mk b/tests/core/libcore/libcore/Android.mk
index c9aea5e..baee5f6 100644
--- a/tests/core/libcore/libcore/Android.mk
+++ b/tests/core/libcore/libcore/Android.mk
@@ -20,5 +20,4 @@
# android.test.runner (which might pull in a different version from the
# one that would be pulled in here).
LOCAL_STATIC_JAVA_LIBRARIES := core-tests mockito-target-minus-junit4
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/org/Android.mk b/tests/core/libcore/org/Android.mk
index d174f98..0f3f0ca 100644
--- a/tests/core/libcore/org/Android.mk
+++ b/tests/core/libcore/org/Android.mk
@@ -17,5 +17,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.org
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/sun/Android.mk b/tests/core/libcore/sun/Android.mk
index 2fa1520..ed6d2c7 100644
--- a/tests/core/libcore/sun/Android.mk
+++ b/tests/core/libcore/sun/Android.mk
@@ -17,5 +17,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.sun
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/tests/Android.mk b/tests/core/libcore/tests/Android.mk
index 6429558..1d00b06 100644
--- a/tests/core/libcore/tests/Android.mk
+++ b/tests/core/libcore/tests/Android.mk
@@ -17,5 +17,4 @@
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.tests
LOCAL_STATIC_JAVA_LIBRARIES := core-tests mockito-target-minus-junit4
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/runner/Android.mk b/tests/core/runner/Android.mk
index f2b83ed..b627b2a 100644
--- a/tests/core/runner/Android.mk
+++ b/tests/core/runner/Android.mk
@@ -27,8 +27,6 @@
LOCAL_STATIC_JAVA_LIBRARIES := cts-test-runner
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
-
include $(BUILD_CTSCORE_PACKAGE)
#==========================================================
@@ -48,9 +46,7 @@
vogarexpect \
testng
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
-
-include $(BUILD_JAVA_LIBRARY)
+include $(BUILD_STATIC_JAVA_LIBRARY)
#==========================================================
# Build the run listener
@@ -64,4 +60,4 @@
LOCAL_MODULE := cts-test-runner
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
-include $(BUILD_JAVA_LIBRARY)
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/core/runner/AndroidManifest.xml b/tests/core/runner/AndroidManifest.xml
index 05d210b..001e6f2 100644
--- a/tests/core/runner/AndroidManifest.xml
+++ b/tests/core/runner/AndroidManifest.xml
@@ -18,6 +18,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.core.tests.runner">
<uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+
<application>
<uses-library android:name="android.test.runner" />
</application>
diff --git a/tests/core/runner/src/com/android/cts/core/runner/CoreTestRunner.java b/tests/core/runner/src/com/android/cts/core/runner/CoreTestRunner.java
index d995fd9..6f18194 100644
--- a/tests/core/runner/src/com/android/cts/core/runner/CoreTestRunner.java
+++ b/tests/core/runner/src/com/android/cts/core/runner/CoreTestRunner.java
@@ -33,10 +33,10 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
-import java.util.HashSet;
import javax.annotation.Nullable;
import org.junit.runner.Computer;
import org.junit.runner.JUnitCore;
@@ -82,10 +82,7 @@
/** The args for the runner. */
private Bundle args;
- /** Only count the number of tests, and not run them. */
- private boolean testCountOnly;
-
- /** Only log the number of tests, and not run them. */
+ /** Only log the number and names of tests, and not run them. */
private boolean logOnly;
/** The amount of time in millis to wait for a single test to complete. */
@@ -123,8 +120,13 @@
// unparceled.
Log.d(TAG, "In OnCreate: " + args);
- this.logOnly = "true".equalsIgnoreCase(args.getString(ARGUMENT_LOG_ONLY));
- this.testCountOnly = args.getBoolean(ARGUMENT_COUNT);
+ // Treat logOnly and count as the same. This is not quite true as count should only send
+ // the host the number of tests but logOnly should send the name and number. However,
+ // this is how this has always behaved and it does not appear to have caused any problems.
+ // Changing it seems unnecessary given that count is CTSv1 only and CTSv1 will be removed
+ // soon now that CTSv2 is ready.
+ boolean testCountOnly = args.getBoolean(ARGUMENT_COUNT);
+ this.logOnly = "true".equalsIgnoreCase(args.getString(ARGUMENT_LOG_ONLY)) || testCountOnly;
this.testTimeout = parseUnsignedLong(args.getString(ARGUMENT_TIMEOUT), ARGUMENT_TIMEOUT);
try {
@@ -237,28 +239,27 @@
@Override
public void onStart() {
- if (logOnly || testCountOnly) {
+ if (logOnly) {
Log.d(TAG, "Counting/logging tests only");
} else {
Log.d(TAG, "Running tests");
}
AndroidRunnerParams runnerParams = new AndroidRunnerParams(this, args,
- logOnly || testCountOnly, testTimeout, false /*ignoreSuiteMethods*/);
+ false, testTimeout, false /*ignoreSuiteMethods*/);
- JUnitCore core = new JUnitCore();
-
- Request request;
+ Runner runner;
try {
RunnerBuilder runnerBuilder = new ExtendedAndroidRunnerBuilder(runnerParams);
Class[] classes = testList.getClassesToRun();
for (Class cls : classes) {
Log.d(TAG, "Found class to run: " + cls.getName());
}
- Runner suite = new Computer().getSuite(runnerBuilder, classes);
+ runner = new Computer().getSuite(runnerBuilder, classes);
- if (suite instanceof Filterable) {
- Filterable filterable = (Filterable) suite;
+ if (runner instanceof Filterable) {
+ Log.d(TAG, "Applying filters");
+ Filterable filterable = (Filterable) runner;
// Filter out all the tests that are expected to fail.
Filter filter = new TestFilter(testList, expectationStore);
@@ -268,9 +269,18 @@
} catch (NoTestsRemainException e) {
// Sometimes filtering will remove all tests but we do not care about that.
}
+ Log.d(TAG, "Applied filters");
}
- request = Request.runner(suite);
+ // If the tests are only supposed to be logged and not actually run then replace the
+ // runner with a runner that will fire notifications for all the tests that would have
+ // been run. This is needed because CTSv2 does a log only run through a CTS module in
+ // order to generate a list of tests that will be run so that it can monitor them.
+ // Encapsulating that in a Runner implementation makes it easier to leverage the
+ // existing code for running tests.
+ if (logOnly) {
+ runner = new DescriptionHierarchyNotifier(runner.getDescription());
+ }
} catch (InitializationError e) {
throw new RuntimeException("Could not create a suite", e);
@@ -279,23 +289,33 @@
InstrumentationResultPrinter instrumentationResultPrinter =
new InstrumentationResultPrinter();
instrumentationResultPrinter.setInstrumentation(this);
+
+ JUnitCore core = new JUnitCore();
core.addListener(instrumentationResultPrinter);
- for (Class<? extends RunListener> listenerClass : listenerClasses) {
- try {
- RunListener runListener = listenerClass.newInstance();
- if (runListener instanceof InstrumentationRunListener) {
- ((InstrumentationRunListener) runListener).setInstrumentation(this);
+ // If not logging the list of tests then add any additional configured listeners. These
+ // must be added before firing any events.
+ if (!logOnly) {
+ // Add additional configured listeners.
+ for (Class<? extends RunListener> listenerClass : listenerClasses) {
+ try {
+ RunListener runListener = listenerClass.newInstance();
+ if (runListener instanceof InstrumentationRunListener) {
+ ((InstrumentationRunListener) runListener).setInstrumentation(this);
+ }
+ core.addListener(runListener);
+ } catch (InstantiationException | IllegalAccessException e) {
+ Log.e(TAG,
+ "Could not create instance of listener: " + listenerClass, e);
}
- core.addListener(runListener);
- } catch (InstantiationException | IllegalAccessException e) {
- Log.e(TAG, "Could not create instance of listener: " + listenerClass, e);
}
}
+ Log.d(TAG, "Finished preparations, running/listing tests");
+
Bundle results = new Bundle();
try {
- core.run(request);
+ core.run(Request.runner(runner));
} catch (RuntimeException e) {
final String msg = "Fatal exception when running tests";
Log.e(TAG, msg, e);
@@ -343,5 +363,4 @@
}
return -1;
}
-
}
diff --git a/tests/core/runner/src/com/android/cts/core/runner/DescriptionHierarchyNotifier.java b/tests/core/runner/src/com/android/cts/core/runner/DescriptionHierarchyNotifier.java
new file mode 100644
index 0000000..5c94fd7
--- /dev/null
+++ b/tests/core/runner/src/com/android/cts/core/runner/DescriptionHierarchyNotifier.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016 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 com.android.cts.core.runner;
+
+import java.util.List;
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.RunNotifier;
+
+/**
+ * A {@link Runner} that does not actually run any tests but simply fires events for all leaf
+ * {@link Description} instances in the supplied {@link Description} hierarchy.
+ */
+class DescriptionHierarchyNotifier extends Runner {
+
+ private final Description description;
+
+ DescriptionHierarchyNotifier(Description description) {
+ this.description = description;
+ }
+
+ @Override
+ public Description getDescription() {
+ return description;
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ generateListOfTests(notifier, description);
+ }
+
+ /**
+ * Generates a list of tests to run by recursing over the {@link Description} hierarchy and
+ * firing events to simulate the tests being run successfully.
+ * @param runNotifier the notifier to which the events are sent.
+ * @param description the description to traverse.
+ */
+ private void generateListOfTests(RunNotifier runNotifier, Description description) {
+ List<Description> children = description.getChildren();
+ if (children.isEmpty()) {
+ runNotifier.fireTestStarted(description);
+ runNotifier.fireTestFinished(description);
+ } else {
+ for (Description child : children) {
+ generateListOfTests(runNotifier, child);
+ }
+ }
+ }
+}
diff --git a/tests/core/runner/src/com/android/cts/core/runner/support/ExtendedAndroidLogOnlyBuilder.java b/tests/core/runner/src/com/android/cts/core/runner/support/ExtendedAndroidLogOnlyBuilder.java
deleted file mode 100644
index 956ebff..0000000
--- a/tests/core/runner/src/com/android/cts/core/runner/support/ExtendedAndroidLogOnlyBuilder.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2016 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 com.android.cts.core.runner.support;
-
-import android.support.test.internal.runner.AndroidLogOnlyBuilder;
-import android.support.test.internal.util.AndroidRunnerParams;
-import android.support.test.runner.AndroidJUnit4;
-import junit.framework.TestCase;
-import org.junit.runner.RunWith;
-import org.junit.runner.Runner;
-import org.junit.runners.Parameterized;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.JUnit4;
-import org.junit.runners.model.RunnerBuilder;
-import org.junit.runners.Suite;
-
-import static android.support.test.internal.util.AndroidRunnerBuilderUtil.isJUnit3Test;
-import static android.support.test.internal.util.AndroidRunnerBuilderUtil.isJUnit3TestSuite;
-
-/**
- * Extends {@link AndroidLogOnlyBuilder} to add support for passing the
- * {@link AndroidRunnerParams} object to the constructor of any {@link RunnerBuilder}
- * implementation that is not a {@link BlockJUnit4ClassRunner}.
- *
- * <p>If {@link AndroidRunnerParams#isSkipExecution()} is {@code true} the super class will create
- * a {@link RunnerBuilder} that will fire appropriate events as if the tests are being run but will
- * not actually run the test. Unfortunately, when it does that it appears to assume that the runner
- * extends {@link BlockJUnit4ClassRunner}, returns a skipping {@link RunnerBuilder} appropriate for
- * that and ignores the actual {@code runnerClass}. That is a problem because it will not work for
- * custom {@link RunnerBuilder} instances that do not extend {@link BlockJUnit4ClassRunner}.
- *
- * <p>Therefore, when skipping execution this does some additional checks to make sure that the
- * {@code runnerClass} does extend {@link BlockJUnit4ClassRunner} before calling the overridden
- * method.
- *
- * <p>It then attempts to construct a {@link RunnerBuilder} by calling the constructor with the
- * signature {@code <init>(Class, AndroidRunnerParams)}. If that doesn't exist it falls back to
- * the overridden behavior.
- *
- * <p>Another unfortunate behavior of the {@link AndroidLogOnlyBuilder} is that it assumes the
- * {@link Parameterized} class has a field called DEFAULT_FACTORY. That field is only present
- * in JUnit 4.12, and not JUnit 4.10 used by tests run by CoreTestRunner.
- * Therefore these tests are actually skipped by this class and executed even though
- * isSkipExecution is true.
- */
-class ExtendedAndroidLogOnlyBuilder extends AndroidLogOnlyBuilder {
-
- private final AndroidRunnerParams runnerParams;
-
- public ExtendedAndroidLogOnlyBuilder(AndroidRunnerParams runnerParams) {
- super(runnerParams);
- this.runnerParams = runnerParams;
- }
-
- @Override
- public Runner runnerForClass(Class<?> testClass) throws Throwable {
- if (!runnerParams.isSkipExecution() ||
- isJUnit3Test(testClass) || isJUnit3TestSuite(testClass)) {
- return super.runnerForClass(testClass);
- }
-
- RunWith annotation = testClass.getAnnotation(RunWith.class);
-
- if (annotation != null) {
- Class<? extends Runner> runnerClass = annotation.value();
- if (runnerClass == AndroidJUnit4.class || runnerClass == JUnit4.class
- || TestCase.class.isAssignableFrom(testClass)) {
- return super.runnerForClass(testClass);
- }
- try {
- // b/28606746 try to build an AndroidJUnit4 runner to avoid BlockJUnit4ClassRunner
- return runnerClass.getConstructor(Class.class, AndroidRunnerParams.class).newInstance(
- testClass, runnerParams);
- } catch (NoSuchMethodException e) {
- // Let the super class handle the error for us and throw an InitializationError
- // exception. Returning null means that this test will be executed.
- // b/28606746 Some parameterized tests that cannot be skipped fall through this
- return null;
- }
- }
- return super.runnerForClass(testClass);
- }
-}
diff --git a/tests/core/runner/src/com/android/cts/core/runner/support/ExtendedAndroidRunnerBuilder.java b/tests/core/runner/src/com/android/cts/core/runner/support/ExtendedAndroidRunnerBuilder.java
index 58ef951..a2f95e2 100644
--- a/tests/core/runner/src/com/android/cts/core/runner/support/ExtendedAndroidRunnerBuilder.java
+++ b/tests/core/runner/src/com/android/cts/core/runner/support/ExtendedAndroidRunnerBuilder.java
@@ -16,7 +16,6 @@
package com.android.cts.core.runner.support;
-import android.support.test.internal.runner.AndroidLogOnlyBuilder;
import android.support.test.internal.util.AndroidRunnerParams;
import android.util.Log;
import org.junit.runners.model.RunnerBuilder;
@@ -28,7 +27,6 @@
*/
public class ExtendedAndroidRunnerBuilder extends AndroidRunnerBuilder {
- private final ExtendedAndroidLogOnlyBuilder androidLogOnlyBuilder;
private static final boolean DEBUG = false;
private final TestNgRunnerBuilder mTestNgBuilder;
@@ -38,8 +36,7 @@
*/
public ExtendedAndroidRunnerBuilder(AndroidRunnerParams runnerParams) {
super(runnerParams, false /* CTSv1 filtered out Test suite() classes. */);
- androidLogOnlyBuilder = new ExtendedAndroidLogOnlyBuilder(runnerParams);
- mTestNgBuilder = new TestNgRunnerBuilder(runnerParams);
+ mTestNgBuilder = new TestNgRunnerBuilder();
}
@Override
@@ -48,26 +45,15 @@
Log.d("ExAndRunBuild", "runnerForClass: Searching runner for class " + testClass.getName());
}
- Runner runner;
// Give TestNG tests a chance to participate in the Runner search first.
// (Note that the TestNG runner handles log-only runs by itself)
- runner = mTestNgBuilder.runnerForClass(testClass);
- if (runner != null) {
- logFoundRunner(runner);
- return runner;
+ Runner runner = mTestNgBuilder.runnerForClass(testClass);
+ if (runner == null) {
+ // Use the normal Runner search mechanism (for Junit tests).
+ runner = super.runnerForClass(testClass);
}
- // Check if this is a dry-run with -e log true argument passed to the runner.
- runner = androidLogOnlyBuilder.runnerForClass(testClass);
- if (runner != null) {
- logFoundRunner(runner);
- return runner;
- }
-
- // Use the normal Runner search mechanism (for Junit tests).
- runner = super.runnerForClass(testClass);
logFoundRunner(runner);
-
return runner;
}
diff --git a/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunner.java b/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunner.java
index eff9d3c..38d0fd2 100644
--- a/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunner.java
+++ b/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunner.java
@@ -16,7 +16,6 @@
package com.android.cts.core.runner.support;
-import android.support.test.internal.util.AndroidRunnerParams;
import android.util.Log;
import org.junit.runner.Description;
@@ -42,23 +41,18 @@
private static final boolean DEBUG = false;
- private static final String TESTNG_TEST = "org.testng.annotations.Test";
-
private Description mDescription;
/** Class name for debugging. */
private String mClassName;
/** Don't include the same method names twice. */
private HashSet<String> mMethodSet = new HashSet<>();
- /** Don't actually run the test if this is true, just report passing. */
- private final boolean mSkipExecution;
/**
- * @param runnerParams {@link AndroidRunnerParams} that stores common runner parameters
+ * @param testClass the test class to run
*/
- TestNgRunner(Class<?> testClass, boolean skipExecution) {
+ TestNgRunner(Class<?> testClass) {
mDescription = generateTestNgDescription(testClass);
mClassName = testClass.getName();
- mSkipExecution = skipExecution;
}
// Runner implementation
@@ -118,21 +112,13 @@
notifier.fireTestStarted(child);
- // CTS has a phase where it "collects" all the tests first.
- // Just report that the test passes without actually running it here.
- if (mSkipExecution) {
- notifier.fireTestFinished(child);
- continue;
- }
-
// Avoid looking at all the methods by just using the string method name.
if (!SingleTestNgTestExecutor.execute(klass, methodName)) {
// TODO: get the error messages from testng somehow.
notifier.fireTestFailure(new Failure(child, new AssertionError()));
}
- else {
- notifier.fireTestFinished(child);
- }
+
+ notifier.fireTestFinished(child);
// TODO: Check @Test(enabled=false) and invoke #fireTestIgnored instead.
}
}
diff --git a/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java b/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
index 621eeb5..1465bf0 100644
--- a/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
+++ b/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
@@ -16,9 +16,6 @@
package com.android.cts.core.runner.support;
-import android.support.test.internal.util.AndroidRunnerParams;
-
-import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import org.junit.runner.Runner;
@@ -30,23 +27,12 @@
* A {@link RunnerBuilder} that can TestNG tests.
*/
class TestNgRunnerBuilder extends RunnerBuilder {
- private static final String TESTNG_TEST = "org.testng.annotations.Test";
- private final AndroidRunnerParams mRunnerParams;
-
- /**
- * @param runnerParams {@link AndroidRunnerParams} that stores common runner parameters
- */
- TestNgRunnerBuilder(AndroidRunnerParams runnerParams) {
- mRunnerParams = runnerParams;
- }
-
-
// Returns a TestNG runner for this class, only if it is a class
// annotated with testng's @Test or has any methods with @Test in it.
@Override
public Runner runnerForClass(Class<?> testClass) {
if (isTestNgTestClass(testClass)) {
- return new TestNgRunner(testClass, mRunnerParams.isSkipExecution());
+ return new TestNgRunner(testClass);
}
return null;
diff --git a/tests/dram/jni/Android.mk b/tests/dram/jni/Android.mk
index a86d4da..4469cc4 100644
--- a/tests/dram/jni/Android.mk
+++ b/tests/dram/jni/Android.mk
@@ -24,8 +24,6 @@
LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-LOCAL_SHARED_LIBRARIES := libnativehelper
-
LOCAL_SDK_VERSION := 14
include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/expectations/knownfailures.txt b/tests/expectations/knownfailures.txt
index db70868..a6d31b0 100644
--- a/tests/expectations/knownfailures.txt
+++ b/tests/expectations/knownfailures.txt
@@ -273,13 +273,6 @@
bug: 23144425
},
{
- description: "Telephony returning wrong value.",
- names: [
- "android.telephony.cts.CellInfoTest#testCellInfo"
- ],
- bug: 23979591
-},
-{
description: "Video encoding tests are timing out.",
names: [
"android.media.cts.VideoEncoderTest#testGoogH264FlexArbitraryW",
diff --git a/tests/jank/Android.mk b/tests/jank/Android.mk
index a42a68b..6d85c70 100644
--- a/tests/jank/Android.mk
+++ b/tests/jank/Android.mk
@@ -29,6 +29,4 @@
LOCAL_STATIC_JAVA_LIBRARIES := ctsdeviceutil compatibility-device-util ctstestrunner ub-uiautomator ub-janktesthelper
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/jank/OldAndroidTest.xml b/tests/jank/OldAndroidTest.xml
deleted file mode 100644
index 633f650..0000000
--- a/tests/jank/OldAndroidTest.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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 CTS Jank Test Cases">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsUiDeviceTestCases.apk" />
-</configuration>
diff --git a/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/LibcoreTest.java b/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/LibcoreTest.java
new file mode 100644
index 0000000..cc03798
--- /dev/null
+++ b/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/LibcoreTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 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 com.android.compatibility.testtype;
+
+import com.android.tradefed.config.Option;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.result.ITestInvocationListener;
+import com.android.tradefed.testtype.AndroidJUnitTest;
+import com.android.tradefed.util.ArrayUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A specialized test type for Libcore tests that provides the ability to specify a set of
+ * expectation files. Expectation files are used to indicate tests that are expected to fail,
+ * often because they come from upstream projects, and should not be run under CTS.
+ */
+public class LibcoreTest extends AndroidJUnitTest {
+
+ private static final String INSTRUMENTATION_ARG_NAME = "core-expectations";
+
+ @Option(name = "core-expectation", description = "Provides failure expectations for libcore "
+ + "tests via the specified file; the path must be absolute and will be resolved to "
+ + "matching bundled resource files; this parameter should be repeated for each "
+ + "expectation file")
+ private List<String> mCoreExpectations = new ArrayList<>();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
+ if (!mCoreExpectations.isEmpty()) {
+ addInstrumentationArg(INSTRUMENTATION_ARG_NAME, ArrayUtil.join(",", mCoreExpectations));
+ }
+ super.run(listener);
+ }
+}
diff --git a/tests/leanbackjank/Android.mk b/tests/leanbackjank/Android.mk
index 5a89666..e2c2593 100644
--- a/tests/leanbackjank/Android.mk
+++ b/tests/leanbackjank/Android.mk
@@ -37,8 +37,6 @@
android-support-v7-recyclerview \
android-support-v4
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
include $(BUILD_CTS_PACKAGE)
include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/tests/leanbackjank/OldAndroidTest.xml b/tests/leanbackjank/OldAndroidTest.xml
deleted file mode 100644
index 1ee5722..0000000
--- a/tests/leanbackjank/OldAndroidTest.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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 CTS LeanbackJank Test Cases">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsLeanbackJankApp.apk" />
-</configuration>
diff --git a/tests/libcore/jsr166/Android.mk b/tests/libcore/jsr166/Android.mk
new file mode 100644
index 0000000..e71bb57
--- /dev/null
+++ b/tests/libcore/jsr166/Android.mk
@@ -0,0 +1,45 @@
+# Copyright (C) 2016 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_PACKAGE_NAME := CtsLibcoreJsr166TestCases
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ cts-core-test-runner \
+ jsr166-tests
+
+# Don't include this package in any target
+LOCAL_MODULE_TAGS := tests
+
+# When built, explicitly put it in the data partition.
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_DEX_PREOPT := false
+LOCAL_JACK_FLAGS := --multi-dex native
+
+LOCAL_PROGUARD_ENABLED := disabled
+
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts
+
+LOCAL_JAVA_RESOURCE_FILES := \
+ libcore/expectations/brokentests.txt \
+ libcore/expectations/icebox.txt \
+ libcore/expectations/knownfailures.txt \
+ libcore/expectations/taggedtests.txt
+
+include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/jsr166/AndroidManifest.xml b/tests/libcore/jsr166/AndroidManifest.xml
new file mode 100644
index 0000000..85bef99
--- /dev/null
+++ b/tests/libcore/jsr166/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2016 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.cts.jsr166">
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="com.android.cts.core.runner.CoreTestRunner"
+ android:targetPackage="android.libcore.cts.jsr166"
+ android:label="CTS Libcore JSR166 test cases" />
+
+</manifest>
diff --git a/tests/libcore/jsr166/AndroidTest.xml b/tests/libcore/jsr166/AndroidTest.xml
new file mode 100644
index 0000000..639f365
--- /dev/null
+++ b/tests/libcore/jsr166/AndroidTest.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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 CTS Libcore JSR166 test cases">
+ <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+ <option name="run-command" value="mkdir -p /data/local/tmp/ctslibcore/java.io.tmpdir" />
+ <option name="run-command" value="mkdir -p /data/local/tmp/ctslibcore/user.home" />
+ <option name="teardown-command" value="rm -rf /data/local/tmp/ctslibcore" />
+ </target_preparer>
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <!-- this has the CoreTestRunner which needs to be in a separate APK -->
+ <option name="test-file-name" value="CtsLibcoreTestRunner.apk" />
+ <!-- this has just the instrumentation which acts as the tests we want to run -->
+ <option name="test-file-name" value="CtsLibcoreJsr166TestCases.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.testtype.LibcoreTest" >
+ <!-- override AJUR -->
+ <option name="runner" value="com.android.cts.core.runner.CoreTestRunner" />
+ <option name="package" value="android.libcore.cts.jsr166" />
+ <option name="instrumentation-arg" key="core-listener"
+ value="com.android.cts.runner.CtsTestRunListener"/>
+ <option name="core-expectation" value="/knownfailures.txt" />
+ <option name="core-expectation" value="/brokentests.txt" />
+ <option name="core-expectation" value="/icebox.txt" />
+ <option name="core-expectation" value="/taggedtests.txt" />
+ <option name="runtime-hint" value="10m"/>
+ <!-- 20x default timeout of 600sec -->
+ <option name="shell-timeout" value="12000000"/>
+ </test>
+</configuration>
diff --git a/tests/libcore/luni/Android.mk b/tests/libcore/luni/Android.mk
index 22a975d..9ba061a 100644
--- a/tests/libcore/luni/Android.mk
+++ b/tests/libcore/luni/Android.mk
@@ -23,8 +23,8 @@
conscrypt-tests \
core-tests \
cts-core-test-runner \
- jsr166-tests \
mockito-target \
+ tzdata_update2-tests \
tzdata_update-tests
# Don't include this package in any target
@@ -53,8 +53,7 @@
libcore/expectations/brokentests.txt \
libcore/expectations/icebox.txt \
libcore/expectations/knownfailures.txt \
- libcore/expectations/taggedtests.txt
-
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ libcore/expectations/taggedtests.txt \
+ libcore/expectations/virtualdeviceknownfailures.txt
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/luni/AndroidTest.xml b/tests/libcore/luni/AndroidTest.xml
index 1e47502..b589a5c 100644
--- a/tests/libcore/luni/AndroidTest.xml
+++ b/tests/libcore/luni/AndroidTest.xml
@@ -23,14 +23,17 @@
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsLibcoreTestCases.apk" />
</target_preparer>
- <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <test class="com.android.compatibility.testtype.LibcoreTest" >
<!-- override AJUR -->
<option name="runner" value="com.android.cts.core.runner.CoreTestRunner" />
<option name="package" value="android.libcore.cts" />
<option name="instrumentation-arg" key="core-listener"
value="com.android.cts.runner.CtsTestRunListener"/>
- <option name="instrumentation-arg" key="core-expectations"
- value="/knownfailures.txt,/brokentests.txt,/icebox.txt,/taggedtests.txt,/expectations/cts-runner-specific-failures.txt" />
+ <option name="core-expectation" value="/knownfailures.txt" />
+ <option name="core-expectation" value="/brokentests.txt" />
+ <option name="core-expectation" value="/icebox.txt" />
+ <option name="core-expectation" value="/taggedtests.txt" />
+ <option name="core-expectation" value="/expectations/cts-runner-specific-failures.txt" />
<option name="runtime-hint" value="45m"/>
<!-- 20x default timeout of 600sec -->
<option name="shell-timeout" value="12000000"/>
diff --git a/tests/libcore/ojluni/Android.mk b/tests/libcore/ojluni/Android.mk
index 4311b57..36ba4f2 100644
--- a/tests/libcore/ojluni/Android.mk
+++ b/tests/libcore/ojluni/Android.mk
@@ -39,14 +39,10 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_JAVA_RESOURCE_DIRS := resources
-
LOCAL_JAVA_RESOURCE_FILES := \
libcore/expectations/brokentests.txt \
libcore/expectations/icebox.txt \
libcore/expectations/knownfailures.txt \
libcore/expectations/taggedtests.txt
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
-
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/ojluni/AndroidTest.xml b/tests/libcore/ojluni/AndroidTest.xml
index 1d32530..8ab126cf 100644
--- a/tests/libcore/ojluni/AndroidTest.xml
+++ b/tests/libcore/ojluni/AndroidTest.xml
@@ -26,14 +26,17 @@
<!-- this has just the instrumentation which acts as the tests we want to run -->
<option name="test-file-name" value="CtsLibcoreOjTestCases.apk" />
</target_preparer>
- <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <test class="com.android.compatibility.testtype.LibcoreTest" >
<!-- override AJUR -->
<option name="runner" value="com.android.cts.core.runner.CoreTestRunner" />
<option name="package" value="android.libcore.cts.oj" />
<option name="instrumentation-arg" key="core-listener"
value="com.android.cts.runner.CtsTestRunListener"/>
- <option name="instrumentation-arg" key="core-expectations"
- value="/knownfailures.txt,/brokentests.txt,/icebox.txt,/taggedtests.txt,/expectations/cts-runner-specific-failures.txt" />
+ <option name="core-expectation" value="/knownfailures.txt" />
+ <option name="core-expectation" value="/brokentests.txt" />
+ <option name="core-expectation" value="/icebox.txt" />
+ <option name="core-expectation" value="/taggedtests.txt" />
+ <option name="core-expectation" value="/expectations/cts-runner-specific-failures.txt" />
<option name="runtime-hint" value="45m"/>
<!-- 20x default timeout of 600sec -->
<option name="shell-timeout" value="12000000"/>
diff --git a/tests/libcore/okhttp/Android.mk b/tests/libcore/okhttp/Android.mk
index ad78841..840f1a2 100644
--- a/tests/libcore/okhttp/Android.mk
+++ b/tests/libcore/okhttp/Android.mk
@@ -48,6 +48,4 @@
libcore/expectations/knownfailures.txt \
libcore/expectations/taggedtests.txt
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
-
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/okhttp/AndroidTest.xml b/tests/libcore/okhttp/AndroidTest.xml
index 00c390d..1969e8c 100644
--- a/tests/libcore/okhttp/AndroidTest.xml
+++ b/tests/libcore/okhttp/AndroidTest.xml
@@ -26,14 +26,16 @@
<!-- this has just the instrumentation which acts as the tests we want to run -->
<option name="test-file-name" value="CtsLibcoreOkHttpTestCases.apk" />
</target_preparer>
- <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <test class="com.android.compatibility.testtype.LibcoreTest" >
<!-- override AJUR -->
<option name="runner" value="com.android.cts.core.runner.CoreTestRunner" />
<option name="package" value="android.libcore.cts.okhttp" />
<option name="instrumentation-arg" key="core-listener"
value="com.android.cts.runner.CtsTestRunListener"/>
- <option name="instrumentation-arg" key="core-expectations"
- value="/knownfailures.txt,/brokentests.txt,/icebox.txt,/taggedtests.txt" />
+ <option name="core-expectation" value="/knownfailures.txt" />
+ <option name="core-expectation" value="/brokentests.txt" />
+ <option name="core-expectation" value="/icebox.txt" />
+ <option name="core-expectation" value="/taggedtests.txt" />
<option name="runtime-hint" value="10m"/>
<!-- 20x default timeout of 600sec -->
<option name="shell-timeout" value="12000000"/>
diff --git a/tests/libcore/runner/Android.mk b/tests/libcore/runner/Android.mk
index b338e12..d7399cd 100644
--- a/tests/libcore/runner/Android.mk
+++ b/tests/libcore/runner/Android.mk
@@ -35,6 +35,4 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
-
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/openglperf2/jni/graphics/MeshNode.h b/tests/openglperf2/jni/graphics/MeshNode.h
index a02b6bd..c0a43b3 100644
--- a/tests/openglperf2/jni/graphics/MeshNode.h
+++ b/tests/openglperf2/jni/graphics/MeshNode.h
@@ -21,7 +21,7 @@
class MeshNode: public SceneGraphNode {
public:
- MeshNode(const Mesh* mesh);
+ explicit MeshNode(const Mesh* mesh);
virtual ~MeshNode() {};
protected:
virtual void before(Program& program, Matrix& model, Matrix& view, Matrix& projection) = 0;
diff --git a/tests/openglperf2/jni/graphics/PerspectiveProgram.h b/tests/openglperf2/jni/graphics/PerspectiveProgram.h
index 7792a3d..773552f 100644
--- a/tests/openglperf2/jni/graphics/PerspectiveProgram.h
+++ b/tests/openglperf2/jni/graphics/PerspectiveProgram.h
@@ -23,7 +23,7 @@
class PerspectiveProgram: public Program {
public:
- PerspectiveProgram(GLuint programId);
+ explicit PerspectiveProgram(GLuint programId);
virtual ~PerspectiveProgram() {};
virtual void before(Matrix& model, Matrix& view, Matrix& projection);
diff --git a/tests/openglperf2/jni/graphics/Program.h b/tests/openglperf2/jni/graphics/Program.h
index 6161baf..86f1cf0 100644
--- a/tests/openglperf2/jni/graphics/Program.h
+++ b/tests/openglperf2/jni/graphics/Program.h
@@ -20,7 +20,7 @@
class Program {
public:
- Program(GLuint programId);
+ explicit Program(GLuint programId);
virtual ~Program() {};
virtual void before(Matrix& model, Matrix& view, Matrix& projection);
virtual void after(Matrix& model, Matrix& view, Matrix& projection);
diff --git a/tests/openglperf2/jni/graphics/ProgramNode.h b/tests/openglperf2/jni/graphics/ProgramNode.h
index fe69958..3f39ef2 100644
--- a/tests/openglperf2/jni/graphics/ProgramNode.h
+++ b/tests/openglperf2/jni/graphics/ProgramNode.h
@@ -20,7 +20,7 @@
class ProgramNode: public SceneGraphNode {
public:
- ProgramNode(Program& program);
+ explicit ProgramNode(Program& program);
virtual ~ProgramNode() {};
void drawProgram(Matrix& model, Matrix& view, Matrix& projection);
protected:
diff --git a/tests/openglperf2/jni/graphics/TransformationNode.h b/tests/openglperf2/jni/graphics/TransformationNode.h
index 04ba5c2..5ccb6a1 100644
--- a/tests/openglperf2/jni/graphics/TransformationNode.h
+++ b/tests/openglperf2/jni/graphics/TransformationNode.h
@@ -20,7 +20,7 @@
class TransformationNode: public SceneGraphNode {
public:
- TransformationNode(Matrix* matrix);
+ explicit TransformationNode(Matrix* matrix);
virtual ~TransformationNode();
protected:
virtual void before(Program& program, Matrix& model, Matrix& view,
diff --git a/tests/openglperf2/jni/reference/ReferenceRenderer.h b/tests/openglperf2/jni/reference/ReferenceRenderer.h
index f5c4b65..5bed530 100644
--- a/tests/openglperf2/jni/reference/ReferenceRenderer.h
+++ b/tests/openglperf2/jni/reference/ReferenceRenderer.h
@@ -21,7 +21,7 @@
class ReferenceRenderer: public Renderer {
public:
- ReferenceRenderer(ANativeWindow* window);
+ explicit ReferenceRenderer(ANativeWindow* window);
virtual ~ReferenceRenderer() {};
bool setUp(int workload);
bool tearDown();
diff --git a/tests/openglperf2/test/Android.mk b/tests/openglperf2/test/Android.mk
index e83e584..a9ec558 100644
--- a/tests/openglperf2/test/Android.mk
+++ b/tests/openglperf2/test/Android.mk
@@ -18,9 +18,9 @@
LOCAL_SRC_FILES := $(call all-subdir-cpp-files)
LOCAL_SRC_FILES += ../jni/graphics/Matrix.cpp
-LOCAL_C_INCLUDES += external/gtest/include $(LOCAL_PATH)/../jni/graphics/
-LOCAL_STATIC_LIBRARIES := libgtest_host libgtest_main_host liblog
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../jni/graphics/
+LOCAL_STATIC_LIBRARIES := liblog
LOCAL_LDFLAGS:= -g -lpthread
LOCAL_MODULE_HOST_OS := linux
LOCAL_MODULE:= cts_device_opengl_test
-include $(BUILD_HOST_EXECUTABLE)
+include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tests/signature/Android.mk b/tests/signature/Android.mk
index 2e9f7de..6a8dcf9 100644
--- a/tests/signature/Android.mk
+++ b/tests/signature/Android.mk
@@ -25,12 +25,9 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
-# For CTS v1
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
include $(BUILD_CTS_PACKAGE)
@@ -40,7 +37,7 @@
include $(CLEAR_VARS)
# These files are for device-side only, so filter-out for host library
-LOCAL_DEVICE_ONLY_SOURCES := %/SignatureTest.java
+LOCAL_DEVICE_ONLY_SOURCES := %/SignatureTest.java %/IntentTest.java %/CurrentApi.java
LOCAL_SRC_FILES := $(filter-out $(LOCAL_DEVICE_ONLY_SOURCES), $(call all-java-files-under, src))
diff --git a/tests/signature/AndroidTest.xml b/tests/signature/AndroidTest.xml
index e3561cc..930bcac 100644
--- a/tests/signature/AndroidTest.xml
+++ b/tests/signature/AndroidTest.xml
@@ -15,12 +15,21 @@
-->
<configuration description="Config for CTS Signature test cases">
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+ <option name="run-command" value="mkdir -p /data/local/tmp/signature-test-packages" />
+ <option name='run-command'
+ value='pm list packages | while read a; do dumpsys package ${a#"package:"} > /data/local/tmp/signature-test-packages/${a#"package:"}.txt; done' />
+ <option name="teardown-command" value="mkdir -p /data/local/tmp/signature-test-packages" />
+ </target_preparer>
+ <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="mkdir -p /data/local/tmp/signature-test" />
<option name="teardown-command" value="rm -rf /data/local/tmp/signature-test" />
</target_preparer>
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
<option name="push" value="current.api->/data/local/tmp/signature-test/current.api" />
</target_preparer>
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+ <option name="push" value="system-current.api->/data/local/tmp/signature-test/system-current.api" />
+ </target_preparer>
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSignatureTestCases.apk" />
diff --git a/tests/signature/OldAndroidTest.xml b/tests/signature/OldAndroidTest.xml
deleted file mode 100644
index b4338da..0000000
--- a/tests/signature/OldAndroidTest.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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 CTS Signature test cases">
- <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
- <option name="run-command" value="mkdir -p /data/local/tmp/signature-test" />
- <option name="teardown-command" value="rm -rf /data/local/tmp/signature-test" />
- </target_preparer>
- <target_preparer class="com.android.cts.tradefed.targetprep.CtsFilePusher">
- <option name="push" value="current.api->/data/local/tmp/signature-test/current.api" />
- </target_preparer>
-</configuration>
diff --git a/tests/signature/api/Android.mk b/tests/signature/api/Android.mk
index 4e30cce..d27a83b 100644
--- a/tests/signature/api/Android.mk
+++ b/tests/signature/api/Android.mk
@@ -34,9 +34,21 @@
@mkdir -p $(dir $@)
$(hide) $(APICHECK_COMMAND) -convert2xml $< $@
-# For CTS v1
-cts_api_xml_v1 := $(CTS_TESTCASES_OUT)/current.api
-$(cts_api_xml_v1): $(LOCAL_BUILT_MODULE) | $(ACP)
- $(call copy-file-to-new-target)
+include $(CLEAR_VARS)
-$(CTS_TESTCASES_OUT)/CtsSignatureTestCases.xml: $(cts_api_xml_v1)
+# current api, in XML format.
+# ============================================================
+include $(CLEAR_VARS)
+LOCAL_MODULE := cts-system-current-api
+LOCAL_MODULE_STEM := system-current.api
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_ETC)
+
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE) : frameworks/base/api/system-current.txt | $(APICHECK)
+ @echo "Convert API file $@"
+ @mkdir -p $(dir $@)
+ $(hide) $(APICHECK_COMMAND) -convert2xml $< $@
diff --git a/tests/signature/src/android/signature/cts/CurrentApi.java b/tests/signature/src/android/signature/cts/CurrentApi.java
new file mode 100644
index 0000000..4c48f9f
--- /dev/null
+++ b/tests/signature/src/android/signature/cts/CurrentApi.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2016 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 android.signature.cts;
+
+import android.signature.cts.JDiffClassDescription.JDiffConstructor;
+import android.signature.cts.JDiffClassDescription.JDiffField;
+import android.signature.cts.JDiffClassDescription.JDiffMethod;
+
+import java.lang.reflect.Modifier;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+/**
+ * Helper methods and constants used for parsing the current api file.
+ */
+class CurrentApi {
+
+ private CurrentApi() {}
+
+ static final String CURRENT_API_FILE =
+ "/data/local/tmp/signature-test/current.api";
+ static final String SYSTEM_CURRENT_API_FILE =
+ "/data/local/tmp/signature-test/system-current.api";
+
+ static final String TAG_ROOT = "api";
+ static final String TAG_PACKAGE = "package";
+ static final String TAG_CLASS = "class";
+ static final String TAG_INTERFACE = "interface";
+ static final String TAG_IMPLEMENTS = "implements";
+ static final String TAG_CONSTRUCTOR = "constructor";
+ static final String TAG_METHOD = "method";
+ static final String TAG_PARAM = "parameter";
+ static final String TAG_EXCEPTION = "exception";
+ static final String TAG_FIELD = "field";
+
+ static final String MODIFIER_ABSTRACT = "abstract";
+ static final String MODIFIER_FINAL = "final";
+ static final String MODIFIER_NATIVE = "native";
+ static final String MODIFIER_PRIVATE = "private";
+ static final String MODIFIER_PROTECTED = "protected";
+ static final String MODIFIER_PUBLIC = "public";
+ static final String MODIFIER_STATIC = "static";
+ static final String MODIFIER_SYNCHRONIZED = "synchronized";
+ static final String MODIFIER_TRANSIENT = "transient";
+ static final String MODIFIER_VOLATILE = "volatile";
+ static final String MODIFIER_VISIBILITY = "visibility";
+
+ static final String ATTRIBUTE_NAME = "name";
+ static final String ATTRIBUTE_VALUE = "value";
+ static final String ATTRIBUTE_EXTENDS = "extends";
+ static final String ATTRIBUTE_TYPE = "type";
+ static final String ATTRIBUTE_RETURN = "return";
+
+ /**
+ * Load field information from xml to memory.
+ *
+ * @param className of the class being examined which will be shown in error messages
+ * @param parser The XmlPullParser which carries the xml information.
+ * @return the new field
+ */
+ static JDiffField loadFieldInfo(String className, XmlPullParser parser) {
+ String fieldName = parser.getAttributeValue(null, ATTRIBUTE_NAME);
+ String fieldType = parser.getAttributeValue(null, ATTRIBUTE_TYPE);
+ int modifier = jdiffModifierToReflectionFormat(className, parser);
+ String value = parser.getAttributeValue(null, ATTRIBUTE_VALUE);
+ return new JDiffField(fieldName, fieldType, modifier, value);
+ }
+
+ /**
+ * Load method information from xml to memory.
+ *
+ * @param className of the class being examined which will be shown in error messages
+ * @param parser The XmlPullParser which carries the xml information.
+ * @return the newly loaded method.
+ */
+ static JDiffMethod loadMethodInfo(String className, XmlPullParser parser) {
+ String methodName = parser.getAttributeValue(null, ATTRIBUTE_NAME);
+ String returnType = parser.getAttributeValue(null, ATTRIBUTE_RETURN);
+ int modifier = jdiffModifierToReflectionFormat(className, parser);
+ return new JDiffMethod(methodName, modifier, returnType);
+ }
+
+ /**
+ * Load constructor information from xml to memory.
+ *
+ * @param parser The XmlPullParser which carries the xml information.
+ * @param currentClass the current class being loaded.
+ * @return the new constructor
+ */
+ static JDiffConstructor loadConstructorInfo(
+ XmlPullParser parser, JDiffClassDescription currentClass) {
+ String name = currentClass.getClassName();
+ int modifier = jdiffModifierToReflectionFormat(name, parser);
+ return new JDiffConstructor(name, modifier);
+ }
+
+ /**
+ * Load class or interface information to memory.
+ *
+ * @param parser The XmlPullParser which carries the xml information.
+ * @param isInterface true if the current class is an interface, otherwise is false.
+ * @param pkg the name of the java package this class can be found in.
+ * @return the new class description.
+ */
+ static JDiffClassDescription loadClassInfo(
+ XmlPullParser parser, boolean isInterface, String pkg,
+ ResultObserver resultObserver) {
+ String className = parser.getAttributeValue(null, ATTRIBUTE_NAME);
+ JDiffClassDescription currentClass;
+ if (resultObserver != null) {
+ currentClass = new JDiffClassDescription(pkg, className, resultObserver);
+ } else {
+ currentClass = new JDiffClassDescription(pkg, className);
+ }
+
+ currentClass.setModifier(jdiffModifierToReflectionFormat(className, parser));
+ currentClass.setType(isInterface ? JDiffClassDescription.JDiffType.INTERFACE :
+ JDiffClassDescription.JDiffType.CLASS);
+ currentClass.setExtendsClass(parser.getAttributeValue(null, ATTRIBUTE_EXTENDS));
+ return currentClass;
+ }
+
+ /**
+ * Convert string modifier to int modifier.
+ *
+ * @param name of the class/method/field being examined which will be shown in error messages
+ * @param key modifier name
+ * @param value modifier value
+ * @return converted modifier value
+ */
+ static int modifierDescriptionToReflectedType(String name, String key, String value) {
+ if (key.equals(MODIFIER_ABSTRACT)) {
+ return value.equals("true") ? Modifier.ABSTRACT : 0;
+ } else if (key.equals(MODIFIER_FINAL)) {
+ return value.equals("true") ? Modifier.FINAL : 0;
+ } else if (key.equals(MODIFIER_NATIVE)) {
+ return value.equals("true") ? Modifier.NATIVE : 0;
+ } else if (key.equals(MODIFIER_STATIC)) {
+ return value.equals("true") ? Modifier.STATIC : 0;
+ } else if (key.equals(MODIFIER_SYNCHRONIZED)) {
+ return value.equals("true") ? Modifier.SYNCHRONIZED : 0;
+ } else if (key.equals(MODIFIER_TRANSIENT)) {
+ return value.equals("true") ? Modifier.TRANSIENT : 0;
+ } else if (key.equals(MODIFIER_VOLATILE)) {
+ return value.equals("true") ? Modifier.VOLATILE : 0;
+ } else if (key.equals(MODIFIER_VISIBILITY)) {
+ if (value.equals(MODIFIER_PRIVATE)) {
+ throw new RuntimeException("Private visibility found in API spec: " + name);
+ } else if (value.equals(MODIFIER_PROTECTED)) {
+ return Modifier.PROTECTED;
+ } else if (value.equals(MODIFIER_PUBLIC)) {
+ return Modifier.PUBLIC;
+ } else if ("".equals(value)) {
+ // If the visibility is "", it means it has no modifier.
+ // which is package private. We should return 0 for this modifier.
+ return 0;
+ } else {
+ throw new RuntimeException("Unknown modifier found in API spec: " + value);
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Transfer string modifier to int one.
+ *
+ * @param name of the class/method/field being examined which will be shown in error messages
+ * @param parser XML resource parser
+ * @return converted modifier
+ */
+ static int jdiffModifierToReflectionFormat(String name, XmlPullParser parser){
+ int modifier = 0;
+ for (int i = 0;i < parser.getAttributeCount();i++) {
+ modifier |= modifierDescriptionToReflectedType(name, parser.getAttributeName(i),
+ parser.getAttributeValue(i));
+ }
+ return modifier;
+ }
+}
diff --git a/tests/signature/src/android/signature/cts/IntentTest.java b/tests/signature/src/android/signature/cts/IntentTest.java
new file mode 100644
index 0000000..c0d3e84
--- /dev/null
+++ b/tests/signature/src/android/signature/cts/IntentTest.java
@@ -0,0 +1,276 @@
+/*
+ * Copyright (C) 2016 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 android.signature.cts;
+
+import static android.signature.cts.CurrentApi.CURRENT_API_FILE;
+import static android.signature.cts.CurrentApi.SYSTEM_CURRENT_API_FILE;
+import static android.signature.cts.CurrentApi.TAG_ROOT;
+import static android.signature.cts.CurrentApi.TAG_PACKAGE;
+import static android.signature.cts.CurrentApi.TAG_CLASS;
+import static android.signature.cts.CurrentApi.TAG_INTERFACE;
+import static android.signature.cts.CurrentApi.TAG_IMPLEMENTS;
+import static android.signature.cts.CurrentApi.TAG_CONSTRUCTOR;
+import static android.signature.cts.CurrentApi.TAG_METHOD;
+import static android.signature.cts.CurrentApi.TAG_PARAM;
+import static android.signature.cts.CurrentApi.TAG_EXCEPTION;
+import static android.signature.cts.CurrentApi.TAG_FIELD;
+
+import static android.signature.cts.CurrentApi.MODIFIER_ABSTRACT;
+import static android.signature.cts.CurrentApi.MODIFIER_FINAL;
+import static android.signature.cts.CurrentApi.MODIFIER_NATIVE;
+import static android.signature.cts.CurrentApi.MODIFIER_PRIVATE;
+import static android.signature.cts.CurrentApi.MODIFIER_PROTECTED;
+import static android.signature.cts.CurrentApi.MODIFIER_PUBLIC;
+import static android.signature.cts.CurrentApi.MODIFIER_STATIC;
+import static android.signature.cts.CurrentApi.MODIFIER_SYNCHRONIZED;
+import static android.signature.cts.CurrentApi.MODIFIER_TRANSIENT;
+import static android.signature.cts.CurrentApi.MODIFIER_VOLATILE;
+import static android.signature.cts.CurrentApi.MODIFIER_VISIBILITY;
+
+import static android.signature.cts.CurrentApi.ATTRIBUTE_NAME;
+import static android.signature.cts.CurrentApi.ATTRIBUTE_EXTENDS;
+import static android.signature.cts.CurrentApi.ATTRIBUTE_TYPE;
+import static android.signature.cts.CurrentApi.ATTRIBUTE_RETURN;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.signature.cts.JDiffClassDescription.JDiffConstructor;
+import android.signature.cts.JDiffClassDescription.JDiffField;
+import android.signature.cts.JDiffClassDescription.JDiffMethod;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+import android.util.Log;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.runner.RunWith;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+/**
+ * Validate that the android intents used by APKs on this device are part of the
+ * platform.
+ */
+@RunWith(AndroidJUnit4.class)
+public class IntentTest {
+ private static final String TAG = IntentTest.class.getSimpleName();
+
+ private static final File SIGNATURE_TEST_PACKGES =
+ new File("/data/local/tmp/signature-test-packages");
+ private static final String ANDROID_INTENT_PREFIX = "android.intent.action";
+ private static final String ACTION_LINE_PREFIX = " Action: ";
+ private static final Set<String> INTENT_WHITELIST = getIntentWhitelist();
+
+ private PackageManager mPackageManager;
+
+ @Before
+ public void setupPackageManager() {
+ mPackageManager = InstrumentationRegistry.getContext().getPackageManager();
+ }
+
+ @Test
+ public void shouldNotFindUnexpectedIntents() throws Exception {
+ Set<String> platformIntents = lookupPlatformIntents();
+ platformIntents.addAll(INTENT_WHITELIST);
+
+ Set<String> allInvalidIntents = new HashSet<>();
+
+ Set<String> errors = new HashSet<>();
+ List<ApplicationInfo> packages =
+ mPackageManager.getInstalledApplications(PackageManager.GET_META_DATA);
+ for (ApplicationInfo appInfo : packages) {
+ if (!isSystemApp(appInfo) && !isUpdatedSystemApp(appInfo)) {
+ // Only examine system apps
+ continue;
+ }
+ Set<String> invalidIntents = new HashSet<>();
+ Set<String> activeIntents = lookupActiveIntents(appInfo.packageName);
+
+ for (String activeIntent : activeIntents) {
+ String intent = activeIntent.trim();
+ if (!platformIntents.contains(intent) &&
+ intent.startsWith(ANDROID_INTENT_PREFIX)) {
+ invalidIntents.add(activeIntent);
+ allInvalidIntents.add(activeIntent);
+ }
+ }
+
+ String error = String.format("Package: %s Invalid Intent: %s",
+ appInfo.packageName, invalidIntents);
+ if (!invalidIntents.isEmpty()) {
+ errors.add(error);
+ }
+ }
+
+ // Log the whitelist line to make it easy to update.
+ for (String intent : allInvalidIntents) {
+ Log.d(TAG, String.format("whitelist.add(\"%s\");", intent));
+ }
+
+ Assert.assertTrue(errors.toString(), errors.isEmpty());
+ }
+
+ private Set<String> lookupPlatformIntents() {
+ try {
+ XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
+
+ Set<String> intents = new HashSet<>();
+ XmlPullParser parser = factory.newPullParser();
+ parser.setInput(new FileInputStream(new File(CURRENT_API_FILE)), null);
+ intents.addAll(parse(parser));
+
+ parser = factory.newPullParser();
+ parser.setInput(new FileInputStream(new File(SYSTEM_CURRENT_API_FILE)), null);
+ intents.addAll(parse(parser));
+ return intents;
+ } catch (XmlPullParserException | IOException e) {
+ throw new RuntimeException("failed to parse", e);
+ }
+ }
+
+ private static Set<String> parse(XmlPullParser parser)
+ throws XmlPullParserException, IOException {
+ JDiffClassDescription currentClass = null;
+ String currentPackage = "";
+ JDiffMethod currentMethod = null;
+
+ Set<String> androidIntents = new HashSet<>();
+ Set<String> keyTagSet = new HashSet<String>();
+ keyTagSet.addAll(Arrays.asList(new String[] {
+ TAG_PACKAGE, TAG_CLASS, TAG_INTERFACE, TAG_IMPLEMENTS, TAG_CONSTRUCTOR,
+ TAG_METHOD, TAG_PARAM, TAG_EXCEPTION, TAG_FIELD }));
+
+ int type;
+ while ((type=parser.next()) != XmlPullParser.START_TAG
+ && type != XmlPullParser.END_DOCUMENT) { }
+
+ if (type != XmlPullParser.START_TAG) {
+ throw new XmlPullParserException("No start tag found");
+ }
+
+ if (!parser.getName().equals(TAG_ROOT)) {
+ throw new XmlPullParserException(
+ "Unexpected start tag: found " + parser.getName() + ", expected " + TAG_ROOT);
+ }
+
+ while (true) {
+ type = XmlPullParser.START_DOCUMENT;
+ while ((type=parser.next()) != XmlPullParser.START_TAG
+ && type != XmlPullParser.END_DOCUMENT
+ && type != XmlPullParser.END_TAG) {
+ }
+
+ if (type == XmlPullParser.END_TAG) {
+ if (TAG_PACKAGE.equals(parser.getName())) {
+ currentPackage = "";
+ }
+ continue;
+ }
+
+ if (type == XmlPullParser.END_DOCUMENT) {
+ break;
+ }
+
+ String tagname = parser.getName();
+ if (!keyTagSet.contains(tagname)) {
+ continue;
+ }
+
+ if (type == XmlPullParser.START_TAG && tagname.equals(TAG_PACKAGE)) {
+ currentPackage = parser.getAttributeValue(null, ATTRIBUTE_NAME);
+ } else if (tagname.equals(TAG_CLASS)) {
+ currentClass = CurrentApi.loadClassInfo(
+ parser, false, currentPackage, null /*resultObserver*/);
+ } else if (tagname.equals(TAG_INTERFACE)) {
+ currentClass = CurrentApi.loadClassInfo(
+ parser, true, currentPackage, null /*resultObserver*/);
+ } else if (tagname.equals(TAG_FIELD)) {
+ JDiffField field =
+ CurrentApi.loadFieldInfo(currentClass.getClassName(), parser);
+ currentClass.addField(field);
+ }
+
+ if (currentClass != null) {
+ for (JDiffField diffField : currentClass.getFieldList()) {
+ String fieldValue = diffField.getValueString();
+ if (fieldValue != null) {
+ fieldValue = fieldValue.replace("\"", "");
+ if (fieldValue.startsWith(ANDROID_INTENT_PREFIX)) {
+ androidIntents.add(fieldValue);
+ }
+ }
+ }
+ }
+ }
+
+ return androidIntents;
+ }
+
+ private static boolean isSystemApp(ApplicationInfo applicationInfo) {
+ return (applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
+ }
+
+ private static boolean isUpdatedSystemApp(ApplicationInfo applicationInfo) {
+ return (applicationInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
+ }
+
+ private static Set<String> lookupActiveIntents(String packageName) {
+ HashSet<String> activeIntents = new HashSet<>();
+ File dumpsysPackage = new File(SIGNATURE_TEST_PACKGES, packageName + ".txt");
+ if (!dumpsysPackage.exists() || dumpsysPackage.length() == 0) {
+ throw new RuntimeException("Missing package info: " + dumpsysPackage.getAbsolutePath());
+ }
+ try (
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(new FileInputStream(dumpsysPackage)))) {
+ String line;
+ while ((line = in.readLine()) != null) {
+ if (line.startsWith(ACTION_LINE_PREFIX)) {
+ String intent = line.substring(
+ ACTION_LINE_PREFIX.length(), line.length() - 1);
+ activeIntents.add(intent.replace("\"", ""));
+ }
+ }
+ return activeIntents;
+ } catch (Exception e) {
+ throw new RuntimeException("While retrieving dumpsys", e);
+ }
+ }
+
+ private static Set<String> getIntentWhitelist() {
+ Set<String> whitelist = new HashSet<>();
+
+ return whitelist;
+ }
+}
diff --git a/tests/signature/src/android/signature/cts/JDiffClassDescription.java b/tests/signature/src/android/signature/cts/JDiffClassDescription.java
index 92f56bd..0cba3b4 100644
--- a/tests/signature/src/android/signature/cts/JDiffClassDescription.java
+++ b/tests/signature/src/android/signature/cts/JDiffClassDescription.java
@@ -26,6 +26,7 @@
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -243,11 +244,20 @@
*/
public static final class JDiffField extends JDiffElement {
private String mFieldType;
+ private String mFieldValue;
- public JDiffField(String name, String fieldType, int modifier) {
+ public JDiffField(String name, String fieldType, int modifier, String value) {
super(name, modifier);
mFieldType = fieldType;
+ mFieldValue = value;
+ }
+
+ /**
+ * A string representation of the value within the field.
+ */
+ public String getValueString() {
+ return mFieldValue;
}
/**
@@ -787,6 +797,15 @@
}
/**
+ * Gets the list of fields found within this class.
+ *
+ * @return the list of fields.
+ */
+ public Collection<JDiffField> getFieldList() {
+ return jDiffFields;
+ }
+
+ /**
* Checks if the class under test has compliant modifiers compared to the API.
*
* @return true if modifiers are compliant.
@@ -1090,6 +1109,15 @@
}
/**
+ * Gets the package name + short class name
+ *
+ * @return The package + short class name
+ */
+ public String getAbsoluteClassName() {
+ return mAbsoluteClassName;
+ }
+
+ /**
* Sets the modifier for the class under test.
*
* @param modifier the modifier
diff --git a/tests/signature/src/android/signature/cts/SignatureTest.java b/tests/signature/src/android/signature/cts/SignatureTest.java
index 139fb30..af82a46 100644
--- a/tests/signature/src/android/signature/cts/SignatureTest.java
+++ b/tests/signature/src/android/signature/cts/SignatureTest.java
@@ -16,6 +16,36 @@
package android.signature.cts;
+import static android.signature.cts.CurrentApi.CURRENT_API_FILE;
+import static android.signature.cts.CurrentApi.SYSTEM_CURRENT_API_FILE;
+import static android.signature.cts.CurrentApi.TAG_ROOT;
+import static android.signature.cts.CurrentApi.TAG_PACKAGE;
+import static android.signature.cts.CurrentApi.TAG_CLASS;
+import static android.signature.cts.CurrentApi.TAG_INTERFACE;
+import static android.signature.cts.CurrentApi.TAG_IMPLEMENTS;
+import static android.signature.cts.CurrentApi.TAG_CONSTRUCTOR;
+import static android.signature.cts.CurrentApi.TAG_METHOD;
+import static android.signature.cts.CurrentApi.TAG_PARAM;
+import static android.signature.cts.CurrentApi.TAG_EXCEPTION;
+import static android.signature.cts.CurrentApi.TAG_FIELD;
+
+import static android.signature.cts.CurrentApi.MODIFIER_ABSTRACT;
+import static android.signature.cts.CurrentApi.MODIFIER_FINAL;
+import static android.signature.cts.CurrentApi.MODIFIER_NATIVE;
+import static android.signature.cts.CurrentApi.MODIFIER_PRIVATE;
+import static android.signature.cts.CurrentApi.MODIFIER_PROTECTED;
+import static android.signature.cts.CurrentApi.MODIFIER_PUBLIC;
+import static android.signature.cts.CurrentApi.MODIFIER_STATIC;
+import static android.signature.cts.CurrentApi.MODIFIER_SYNCHRONIZED;
+import static android.signature.cts.CurrentApi.MODIFIER_TRANSIENT;
+import static android.signature.cts.CurrentApi.MODIFIER_VOLATILE;
+import static android.signature.cts.CurrentApi.MODIFIER_VISIBILITY;
+
+import static android.signature.cts.CurrentApi.ATTRIBUTE_NAME;
+import static android.signature.cts.CurrentApi.ATTRIBUTE_EXTENDS;
+import static android.signature.cts.CurrentApi.ATTRIBUTE_TYPE;
+import static android.signature.cts.CurrentApi.ATTRIBUTE_RETURN;
+
import android.content.res.Resources;
import android.signature.cts.JDiffClassDescription.JDiffConstructor;
import android.signature.cts.JDiffClassDescription.JDiffField;
@@ -43,35 +73,6 @@
public class SignatureTest extends AndroidTestCase {
private static final String TAG = SignatureTest.class.getSimpleName();
- private static final String CURRENT_API_FILE = "/data/local/tmp/signature-test/current.api";
-
- private static final String TAG_ROOT = "api";
- private static final String TAG_PACKAGE = "package";
- private static final String TAG_CLASS = "class";
- private static final String TAG_INTERFACE = "interface";
- private static final String TAG_IMPLEMENTS = "implements";
- private static final String TAG_CONSTRUCTOR = "constructor";
- private static final String TAG_METHOD = "method";
- private static final String TAG_PARAM = "parameter";
- private static final String TAG_EXCEPTION = "exception";
- private static final String TAG_FIELD = "field";
-
- private static final String MODIFIER_ABSTRACT = "abstract";
- private static final String MODIFIER_FINAL = "final";
- private static final String MODIFIER_NATIVE = "native";
- private static final String MODIFIER_PRIVATE = "private";
- private static final String MODIFIER_PROTECTED = "protected";
- private static final String MODIFIER_PUBLIC = "public";
- private static final String MODIFIER_STATIC = "static";
- private static final String MODIFIER_SYNCHRONIZED = "synchronized";
- private static final String MODIFIER_TRANSIENT = "transient";
- private static final String MODIFIER_VOLATILE = "volatile";
- private static final String MODIFIER_VISIBILITY = "visibility";
-
- private static final String ATTRIBUTE_NAME = "name";
- private static final String ATTRIBUTE_EXTENDS = "extends";
- private static final String ATTRIBUTE_TYPE = "type";
- private static final String ATTRIBUTE_RETURN = "return";
private HashSet<String> mKeyTagSet;
private TestResultObserver mResultObserver;
@@ -184,24 +185,27 @@
if (type == XmlPullParser.START_TAG && tagname.equals(TAG_PACKAGE)) {
currentPackage = parser.getAttributeValue(null, ATTRIBUTE_NAME);
} else if (tagname.equals(TAG_CLASS)) {
- currentClass = loadClassInfo(parser, false, currentPackage);
+ currentClass = CurrentApi.loadClassInfo(
+ parser, false, currentPackage, mResultObserver);
} else if (tagname.equals(TAG_INTERFACE)) {
- currentClass = loadClassInfo(parser, true, currentPackage);
+ currentClass = CurrentApi.loadClassInfo(
+ parser, true, currentPackage, mResultObserver);
} else if (tagname.equals(TAG_IMPLEMENTS)) {
currentClass.addImplInterface(parser.getAttributeValue(null, ATTRIBUTE_NAME));
} else if (tagname.equals(TAG_CONSTRUCTOR)) {
- JDiffConstructor constructor = loadConstructorInfo(parser, currentClass);
+ JDiffConstructor constructor =
+ CurrentApi.loadConstructorInfo(parser, currentClass);
currentClass.addConstructor(constructor);
currentMethod = constructor;
} else if (tagname.equals(TAG_METHOD)) {
- currentMethod = loadMethodInfo(currentClass.getClassName(), parser);
+ currentMethod = CurrentApi.loadMethodInfo(currentClass.getClassName(), parser);
currentClass.addMethod(currentMethod);
} else if (tagname.equals(TAG_PARAM)) {
currentMethod.addParam(parser.getAttributeValue(null, ATTRIBUTE_TYPE));
} else if (tagname.equals(TAG_EXCEPTION)) {
currentMethod.addException(parser.getAttributeValue(null, ATTRIBUTE_TYPE));
} else if (tagname.equals(TAG_FIELD)) {
- JDiffField field = loadFieldInfo(currentClass.getClassName(), parser);
+ JDiffField field = CurrentApi.loadFieldInfo(currentClass.getClassName(), parser);
currentClass.addField(field);
} else {
throw new RuntimeException(
@@ -219,127 +223,6 @@
}
}
- /**
- * Load field information from xml to memory.
- *
- * @param className of the class being examined which will be shown in error messages
- * @param parser The XmlPullParser which carries the xml information.
- * @return the new field
- */
- private JDiffField loadFieldInfo(String className, XmlPullParser parser) {
- String fieldName = parser.getAttributeValue(null, ATTRIBUTE_NAME);
- String fieldType = parser.getAttributeValue(null, ATTRIBUTE_TYPE);
- int modifier = jdiffModifierToReflectionFormat(className, parser);
- return new JDiffField(fieldName, fieldType, modifier);
- }
-
- /**
- * Load method information from xml to memory.
- *
- * @param className of the class being examined which will be shown in error messages
- * @param parser The XmlPullParser which carries the xml information.
- * @return the newly loaded method.
- */
- private JDiffMethod loadMethodInfo(String className, XmlPullParser parser) {
- String methodName = parser.getAttributeValue(null, ATTRIBUTE_NAME);
- String returnType = parser.getAttributeValue(null, ATTRIBUTE_RETURN);
- int modifier = jdiffModifierToReflectionFormat(className, parser);
- return new JDiffMethod(methodName, modifier, returnType);
- }
-
- /**
- * Load constructor information from xml to memory.
- *
- * @param parser The XmlPullParser which carries the xml information.
- * @param currentClass the current class being loaded.
- * @return the new constructor
- */
- private JDiffConstructor loadConstructorInfo(XmlPullParser parser,
- JDiffClassDescription currentClass) {
- String name = currentClass.getClassName();
- int modifier = jdiffModifierToReflectionFormat(name, parser);
- return new JDiffConstructor(name, modifier);
- }
-
- /**
- * Load class or interface information to memory.
- *
- * @param parser The XmlPullParser which carries the xml information.
- * @param isInterface true if the current class is an interface, otherwise is false.
- * @param pkg the name of the java package this class can be found in.
- * @return the new class description.
- */
- private JDiffClassDescription loadClassInfo(XmlPullParser parser,
- boolean isInterface,
- String pkg) {
- String className = parser.getAttributeValue(null, ATTRIBUTE_NAME);
- JDiffClassDescription currentClass = new JDiffClassDescription(pkg,
- className,
- mResultObserver);
- currentClass.setModifier(jdiffModifierToReflectionFormat(className, parser));
- currentClass.setType(isInterface ? JDiffClassDescription.JDiffType.INTERFACE :
- JDiffClassDescription.JDiffType.CLASS);
- currentClass.setExtendsClass(parser.getAttributeValue(null, ATTRIBUTE_EXTENDS));
- return currentClass;
- }
-
- /**
- * Convert string modifier to int modifier.
- *
- * @param name of the class/method/field being examined which will be shown in error messages
- * @param key modifier name
- * @param value modifier value
- * @return converted modifier value
- */
- private static int modifierDescriptionToReflectedType(String name, String key, String value) {
- if (key.equals(MODIFIER_ABSTRACT)) {
- return value.equals("true") ? Modifier.ABSTRACT : 0;
- } else if (key.equals(MODIFIER_FINAL)) {
- return value.equals("true") ? Modifier.FINAL : 0;
- } else if (key.equals(MODIFIER_NATIVE)) {
- return value.equals("true") ? Modifier.NATIVE : 0;
- } else if (key.equals(MODIFIER_STATIC)) {
- return value.equals("true") ? Modifier.STATIC : 0;
- } else if (key.equals(MODIFIER_SYNCHRONIZED)) {
- return value.equals("true") ? Modifier.SYNCHRONIZED : 0;
- } else if (key.equals(MODIFIER_TRANSIENT)) {
- return value.equals("true") ? Modifier.TRANSIENT : 0;
- } else if (key.equals(MODIFIER_VOLATILE)) {
- return value.equals("true") ? Modifier.VOLATILE : 0;
- } else if (key.equals(MODIFIER_VISIBILITY)) {
- if (value.equals(MODIFIER_PRIVATE)) {
- throw new RuntimeException("Private visibility found in API spec: " + name);
- } else if (value.equals(MODIFIER_PROTECTED)) {
- return Modifier.PROTECTED;
- } else if (value.equals(MODIFIER_PUBLIC)) {
- return Modifier.PUBLIC;
- } else if ("".equals(value)) {
- // If the visibility is "", it means it has no modifier.
- // which is package private. We should return 0 for this modifier.
- return 0;
- } else {
- throw new RuntimeException("Unknown modifier found in API spec: " + value);
- }
- }
- return 0;
- }
-
- /**
- * Transfer string modifier to int one.
- *
- * @param name of the class/method/field being examined which will be shown in error messages
- * @param parser XML resource parser
- * @return converted modifier
- */
- private static int jdiffModifierToReflectionFormat(String name, XmlPullParser parser){
- int modifier = 0;
- for (int i = 0;i < parser.getAttributeCount();i++) {
- modifier |= modifierDescriptionToReflectedType(name, parser.getAttributeName(i),
- parser.getAttributeValue(i));
- }
- return modifier;
- }
-
public static void loge(String msg, Exception e) {
Log.e(TAG, msg, e);
}
diff --git a/tests/signature/tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java b/tests/signature/tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java
index ffb81ce..9cd84c7 100644
--- a/tests/signature/tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java
+++ b/tests/signature/tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java
@@ -30,6 +30,8 @@
*/
public class JDiffClassDescriptionTest extends TestCase {
+ private static final String VALUE = "VALUE";
+
private class NoFailures implements ResultObserver {
@Override
public void notifyFailure(FailureType type, String name, String errmsg) {
@@ -215,7 +217,7 @@
public void testFinalField() {
JDiffClassDescription clz = createNormalClass();
JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
- "FINAL_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.FINAL);
+ "FINAL_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.FINAL, VALUE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "public final java.lang.String FINAL_FIELD");
@@ -224,7 +226,7 @@
public void testStaticField() {
JDiffClassDescription clz = createNormalClass();
JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
- "STATIC_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.STATIC);
+ "STATIC_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.STATIC, VALUE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "public static java.lang.String STATIC_FIELD");
@@ -233,7 +235,7 @@
public void testVolatileFiled() {
JDiffClassDescription clz = createNormalClass();
JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
- "VOLATILE_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.VOLATILE);
+ "VOLATILE_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.VOLATILE, VALUE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "public volatile java.lang.String VOLATILE_FIELD");
@@ -242,7 +244,8 @@
public void testTransientField() {
JDiffClassDescription clz = createNormalClass();
JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
- "TRANSIENT_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.TRANSIENT);
+ "TRANSIENT_FIELD", "java.lang.String",
+ Modifier.PUBLIC | Modifier.TRANSIENT, VALUE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(),
@@ -252,7 +255,7 @@
public void testPacakgeField() {
JDiffClassDescription clz = createNormalClass();
JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
- "PACAKGE_FIELD", "java.lang.String", 0);
+ "PACAKGE_FIELD", "java.lang.String", 0, VALUE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "java.lang.String PACAKGE_FIELD");
@@ -261,7 +264,7 @@
public void testPrivateField() {
JDiffClassDescription clz = createNormalClass();
JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
- "PRIVATE_FIELD", "java.lang.String", Modifier.PRIVATE);
+ "PRIVATE_FIELD", "java.lang.String", Modifier.PRIVATE, VALUE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "private java.lang.String PRIVATE_FIELD");
@@ -270,7 +273,7 @@
public void testProtectedField() {
JDiffClassDescription clz = createNormalClass();
JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
- "PROTECTED_FIELD", "java.lang.String", Modifier.PROTECTED);
+ "PROTECTED_FIELD", "java.lang.String", Modifier.PROTECTED, VALUE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "protected java.lang.String PROTECTED_FIELD");
@@ -282,7 +285,7 @@
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
- "innerClassData", "java.lang.String", Modifier.PRIVATE);
+ "innerClassData", "java.lang.String", Modifier.PRIVATE, VALUE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public class NormalClass.InnerClass");
@@ -295,7 +298,7 @@
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
- "innerInnerClassData", "java.lang.String", Modifier.PRIVATE);
+ "innerInnerClassData", "java.lang.String", Modifier.PRIVATE, VALUE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(),
diff --git a/tests/simplecpu/jni/Android.mk b/tests/simplecpu/jni/Android.mk
index 946aa37..877f1b6 100644
--- a/tests/simplecpu/jni/Android.mk
+++ b/tests/simplecpu/jni/Android.mk
@@ -24,8 +24,6 @@
LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-LOCAL_SHARED_LIBRARIES := libnativehelper
-
LOCAL_SDK_VERSION := 14
include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/accounts/Android.mk b/tests/tests/accounts/Android.mk
index 31af474..d20dc58 100644
--- a/tests/tests/accounts/Android.mk
+++ b/tests/tests/accounts/Android.mk
@@ -30,8 +30,6 @@
LOCAL_SDK_VERSION := current
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
diff --git a/tests/tests/accounts/OldAndroidTest.xml b/tests/tests/accounts/OldAndroidTest.xml
deleted file mode 100644
index 3e29c9c..0000000
--- a/tests/tests/accounts/OldAndroidTest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<!-- Copyright (C) 2015 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="Test module config for Account apis">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsUnaffiliatedAccountAuthenticators.apk" />
-</configuration>
diff --git a/tests/tests/alarmclock/Android.mk b/tests/tests/alarmclock/Android.mk
index e83accf..77cb183 100644
--- a/tests/tests/alarmclock/Android.mk
+++ b/tests/tests/alarmclock/Android.mk
@@ -29,8 +29,6 @@
LOCAL_SDK_VERSION := current
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
diff --git a/tests/tests/alarmclock/OldAndroidTest.xml b/tests/tests/alarmclock/OldAndroidTest.xml
deleted file mode 100644
index aafdb61..0000000
--- a/tests/tests/alarmclock/OldAndroidTest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<!-- Copyright (C) 2015 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="Test module config for AlarmClock">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsAlarmClockService.apk" />
- <option name="run-command:run-command"
- value="settings put secure voice_interaction_service android.alarmclock.service/.MainInteractionService" />
- <option name="cts-apk-installer:test-file-name" value="CtsAlarmClockTestCases.apk" />
-</configuration>
diff --git a/tests/tests/assist/Android.mk b/tests/tests/assist/Android.mk
index 0886340..61379c5 100644
--- a/tests/tests/assist/Android.mk
+++ b/tests/tests/assist/Android.mk
@@ -24,8 +24,6 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner ctsdeviceutil
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/assist/OldAndroidTest.xml b/tests/tests/assist/OldAndroidTest.xml
deleted file mode 100644
index 26db4cf..0000000
--- a/tests/tests/assist/OldAndroidTest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="Test module config for Assist">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsAssistService.apk" />
- <option name="cts-apk-installer:test-file-name" value="CtsAssistApp.apk" />
- <option name="run-command:run-command"
- value="settings put secure voice_interaction_service android.assist.service/.MainInteractionService" />
-</configuration>
diff --git a/tests/tests/bionic/Android.build.copy.libs.mk b/tests/tests/bionic/Android.build.copy.libs.mk
new file mode 100644
index 0000000..6c2d546
--- /dev/null
+++ b/tests/tests/bionic/Android.build.copy.libs.mk
@@ -0,0 +1,129 @@
+LOCAL_PATH := $(call my-dir)
+
+cts_bionic_tests_dir := lib32
+
+ifeq (true,$(TARGET_IS_64_BIT))
+ ifeq (,$(cts_bionic_tests_2nd_arch_prefix))
+ cts_bionic_tests_dir := lib64
+ endif
+endif
+
+# TODO(dimitry): Can this list be constructed dynamically?
+my_bionic_testlib_files := \
+ dt_runpath_a/libtest_dt_runpath_a.so \
+ dt_runpath_b_c_x/libtest_dt_runpath_b.so \
+ dt_runpath_b_c_x/libtest_dt_runpath_c.so \
+ dt_runpath_b_c_x/libtest_dt_runpath_x.so \
+ libatest_simple_zip/libatest_simple_zip.so \
+ libdlext_test_different_soname.so \
+ libdlext_test_fd/libdlext_test_fd.so \
+ libdlext_test_norelro.so \
+ libdlext_test_runpath_zip/libdlext_test_runpath_zip_zipaligned.zip \
+ libdlext_test.so \
+ libdlext_test_zip/libdlext_test_zip.so \
+ libdlext_test_zip/libdlext_test_zip_zipaligned.zip \
+ libdl_preempt_test_1.so \
+ libdl_preempt_test_2.so \
+ libdl_test_df_1_global.so \
+ libsysv-hash-table-library.so \
+ libtest_atexit.so \
+ libtest_check_order_dlsym_1_left.so \
+ libtest_check_order_dlsym_2_right.so \
+ libtest_check_order_dlsym_3_c.so \
+ libtest_check_order_dlsym_a.so \
+ libtest_check_order_dlsym_b.so \
+ libtest_check_order_dlsym_d.so \
+ libtest_check_order_dlsym.so \
+ libtest_check_order_reloc_root_1.so \
+ libtest_check_order_reloc_root_2.so \
+ libtest_check_order_reloc_root.so \
+ libtest_check_order_reloc_siblings_1.so \
+ libtest_check_order_reloc_siblings_2.so \
+ libtest_check_order_reloc_siblings_3.so \
+ libtest_check_order_reloc_siblings_a.so \
+ libtest_check_order_reloc_siblings_b.so \
+ libtest_check_order_reloc_siblings_c_1.so \
+ libtest_check_order_reloc_siblings_c_2.so \
+ libtest_check_order_reloc_siblings_c.so \
+ libtest_check_order_reloc_siblings_d.so \
+ libtest_check_order_reloc_siblings_e.so \
+ libtest_check_order_reloc_siblings_f.so \
+ libtest_check_order_reloc_siblings.so \
+ libtest_check_rtld_next_from_library.so \
+ libtest_dlopen_from_ctor_main.so \
+ libtest_dlopen_from_ctor.so \
+ libtest_dlopen_weak_undefined_func.so \
+ libtest_dlsym_df_1_global.so \
+ libtest_dlsym_from_this_child.so \
+ libtest_dlsym_from_this_grandchild.so \
+ libtest_dlsym_from_this.so \
+ libtest_dlsym_weak_func.so \
+ libtest_dt_runpath_d.so \
+ libtest_empty.so \
+ libtest_nodelete_1.so \
+ libtest_nodelete_2.so \
+ libtest_nodelete_dt_flags_1.so \
+ libtest_pthread_atfork.so \
+ libtest_relo_check_dt_needed_order_1.so \
+ libtest_relo_check_dt_needed_order_2.so \
+ libtest_relo_check_dt_needed_order.so \
+ libtest_simple.so \
+ libtest_two_parents_child.so \
+ libtest_two_parents_parent1.so \
+ libtest_two_parents_parent2.so \
+ libtest_versioned_lib.so \
+ libtest_versioned_libv1.so \
+ libtest_versioned_libv2.so \
+ libtest_versioned_otherlib_empty.so \
+ libtest_versioned_otherlib.so \
+ libtest_versioned_uselibv1.so \
+ libtest_versioned_uselibv2_other.so \
+ libtest_versioned_uselibv2.so \
+ libtest_versioned_uselibv3_other.so \
+ libtest_with_dependency_loop_a.so \
+ libtest_with_dependency_loop_b.so \
+ libtest_with_dependency_loop_b_tmp.so \
+ libtest_with_dependency_loop_c.so \
+ libtest_with_dependency_loop.so \
+ libtest_with_dependency.so \
+ prebuilt-elf-files/libtest_invalid-empty_shdr_table.so \
+ prebuilt-elf-files/libtest_invalid-rw_load_segment.so \
+ prebuilt-elf-files/libtest_invalid-unaligned_shdr_offset.so \
+ prebuilt-elf-files/libtest_invalid-zero_shdr_table_content.so \
+ prebuilt-elf-files/libtest_invalid-zero_shdr_table_offset.so \
+ prebuilt-elf-files/libtest_invalid-zero_shentsize.so \
+ prebuilt-elf-files/libtest_invalid-zero_shstrndx.so \
+ prebuilt-elf-files/libtest_invalid-textrels.so \
+ prebuilt-elf-files/libtest_invalid-textrels2.so \
+ private_namespace_libs_external/libnstest_private_external.so \
+ private_namespace_libs/libnstest_dlopened.so \
+ private_namespace_libs/libnstest_private.so \
+ private_namespace_libs/libnstest_root_not_isolated.so \
+ private_namespace_libs/libnstest_root.so \
+ public_namespace_libs/libnstest_public.so \
+
+# These libraries are not built for mips.
+my_bionic_testlib_files_non_mips := \
+ libgnu-hash-table-library.so \
+ libtest_ifunc.so \
+
+my_bionic_testlibs_src_dir := \
+ $($(cts_bionic_tests_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs
+my_bionic_testlibs_out_dir := $(cts_bionic_tests_dir)/bionic-loader-test-libs
+
+LOCAL_COMPATIBILITY_SUPPORT_FILES += \
+ $(foreach lib, $(my_bionic_testlib_files), \
+ $(my_bionic_testlibs_src_dir)/$(lib):$(my_bionic_testlibs_out_dir)/$(lib))
+
+ifneq ($(TARGET_ARCH),mips)
+LOCAL_COMPATIBILITY_SUPPORT_FILES += \
+ $(foreach lib, $(my_bionic_testlib_files_non_mips), \
+ $(my_bionic_testlibs_src_dir)/$(lib):$(my_bionic_testlibs_out_dir)/$(lib))
+endif
+
+my_bionic_testlib_files :=
+my_bionic_testlib_files_non_mips :=
+my_bionic_testlibs_src_dir :=
+my_bionic_testlibs_out_dir :=
+cts_bionic_tests_dir :=
+cts_bionic_tests_2nd_arch_prefix :=
diff --git a/tests/tests/bionic/Android.mk b/tests/tests/bionic/Android.mk
index 627841f..29c14dd 100644
--- a/tests/tests/bionic/Android.mk
+++ b/tests/tests/bionic/Android.mk
@@ -1,61 +1,45 @@
LOCAL_PATH := $(call my-dir)
-test_executable := CtsBionicTestCases
-list_executable := $(test_executable)_list
-
include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE := $(test_executable)
-LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE := CtsBionicTestCases
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
LOCAL_MULTILIB := both
LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
+LOCAL_LDFLAGS := -Wl,--rpath,\$${ORIGIN}/lib/bionic-loader-test-libs -Wl,--enable-new-dtags -Wl,--export-dynamic
+
LOCAL_SHARED_LIBRARIES += \
libdl \
+ libdl_preempt_test_1 \
+ libdl_preempt_test_2 \
+ libdl_test_df_1_global \
LOCAL_WHOLE_STATIC_LIBRARIES += \
libBionicTests \
+ libBionicLoaderTests \
libBionicCtsGtestMain \
LOCAL_STATIC_LIBRARIES += \
libbase \
+ libpagemap \
+ libziparchive \
libtinyxml2 \
liblog \
+ libz \
+ libutils \
libgtest \
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
LOCAL_CTS_TEST_PACKAGE := android.bionic
+
+cts_bionic_tests_2nd_arch_prefix :=
+include $(LOCAL_PATH)/Android.build.copy.libs.mk
+ifneq ($(TARGET_2ND_ARCH),)
+ cts_bionic_tests_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
+ include $(LOCAL_PATH)/Android.build.copy.libs.mk
+endif
+
include $(BUILD_CTS_EXECUTABLE)
-
-ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
-include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE := $(list_executable)
-LOCAL_MULTILIB := both
-# Use the 32 bit list executable since it will include some 32 bit only tests.
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-
-LOCAL_LDLIBS += \
- -lrt -ldl -lutil \
-
-LOCAL_WHOLE_STATIC_LIBRARIES += \
- libBionicTests \
- libBionicCtsGtestMain \
-
-LOCAL_STATIC_LIBRARIES += \
- libbase \
- liblog \
- libcutils \
-
-LOCAL_CXX_STL := libc++
-
-include $(BUILD_HOST_NATIVE_TEST)
-endif # ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
diff --git a/tests/tests/bionic/AndroidTest.xml b/tests/tests/bionic/AndroidTest.xml
index 97a9a0a..30717da0 100644
--- a/tests/tests/bionic/AndroidTest.xml
+++ b/tests/tests/bionic/AndroidTest.xml
@@ -19,6 +19,11 @@
<option name="push" value="CtsBionicTestCases->/data/local/tmp/CtsBionicTestCases" />
<option name="append-bitness" value="true" />
</target_preparer>
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+ <option name="cleanup" value="true" />
+ <option name="push" value="lib->/data/local/tmp/lib" />
+ <option name="append-bitness" value="true" />
+ </target_preparer>
<test class="com.android.tradefed.testtype.GTest" >
<option name="native-test-device-path" value="/data/local/tmp" />
<option name="module-name" value="CtsBionicTestCases" />
diff --git a/tests/tests/deqp/Android.mk b/tests/tests/deqp/Android.mk
deleted file mode 100644
index ce8678b..0000000
--- a/tests/tests/deqp/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2014 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.
-
-# Dummy target to make dEQP test list generation consistent with other tests.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# All APIs share the same package
-LOCAL_PACKAGE_NAME := com.drawelements.deqp
-
-include $(LOCAL_PATH)/deqp_egl.mk
-include $(LOCAL_PATH)/deqp_gles2.mk
-include $(LOCAL_PATH)/deqp_gles3.mk
-include $(LOCAL_PATH)/deqp_gles31.mk
-
-# Make the deqp app and copy it to CTS out dir.
-cts_deqp_name := com.drawelements.deqp
-cts_deqp_apk := $(CTS_TESTCASES_OUT)/$(cts_deqp_name).apk
-$(cts_deqp_apk): $(call intermediates-dir-for,APPS,$(cts_deqp_name))/package.apk
- $(call copy-file-to-target)
diff --git a/tests/tests/deqp/deqp_egl.mk b/tests/tests/deqp/deqp_egl.mk
deleted file mode 100644
index 6b4eed6..0000000
--- a/tests/tests/deqp/deqp_egl.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2015 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.
-
-# Dummy target to make dEQP EGL test list generation consistent with other
-# tests.
-
-DEQP_API := egl
-DEQP_TEST_NAME := dEQP-EGL
-
-include $(BUILD_CTS_DEQP_PACKAGE)
diff --git a/tests/tests/deqp/deqp_gles2.mk b/tests/tests/deqp/deqp_gles2.mk
deleted file mode 100644
index 3cd60da..0000000
--- a/tests/tests/deqp/deqp_gles2.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2014 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.
-
-# Dummy target to make dEQP GLES2 test list generation consistent with other
-# tests.
-
-DEQP_API := gles2
-DEQP_TEST_NAME := dEQP-GLES2
-
-include $(BUILD_CTS_DEQP_PACKAGE)
diff --git a/tests/tests/deqp/deqp_gles3.mk b/tests/tests/deqp/deqp_gles3.mk
deleted file mode 100644
index 07dfdae..0000000
--- a/tests/tests/deqp/deqp_gles3.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2014 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.
-
-# Dummy target to make dEQP GLES3 test list generation consistent with other
-# tests.
-
-DEQP_API := gles3
-DEQP_TEST_NAME := dEQP-GLES3
-
-include $(BUILD_CTS_DEQP_PACKAGE)
diff --git a/tests/tests/deqp/deqp_gles31.mk b/tests/tests/deqp/deqp_gles31.mk
deleted file mode 100644
index 7e45413..0000000
--- a/tests/tests/deqp/deqp_gles31.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2014 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.
-
-# Dummy target to make dEQP GLES31 test list generation consistent with other
-# tests.
-
-DEQP_API := gles31
-DEQP_TEST_NAME := dEQP-GLES31
-
-include $(BUILD_CTS_DEQP_PACKAGE)
diff --git a/tests/tests/display/Android.mk b/tests/tests/display/Android.mk
index 2b81ec1..4ad08a3 100644
--- a/tests/tests/display/Android.mk
+++ b/tests/tests/display/Android.mk
@@ -34,8 +34,6 @@
LOCAL_PACKAGE_NAME := CtsDisplayTestCases
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/display/OldAndroidTest.xml b/tests/tests/display/OldAndroidTest.xml
deleted file mode 100644
index dd42984..0000000
--- a/tests/tests/display/OldAndroidTest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="Base config for CTS package preparer">
- <include name="common-config" />
- <!-- Use a non-standard pattern, must match values in tests/tests/display/.../DisplayTest.java -->
- <option name="run-command:run-command" value="settings put global overlay_display_devices '181x161/214|181x161/214'" />
- <option name="run-command:teardown-command" value="settings put global overlay_display_devices """ />
-</configuration>
diff --git a/tests/tests/drm/lib/Android.mk b/tests/tests/drm/lib/Android.mk
index a061abd..73d2fe5 100644
--- a/tests/tests/drm/lib/Android.mk
+++ b/tests/tests/drm/lib/Android.mk
@@ -16,8 +16,8 @@
include $(CLEAR_VARS)
-LOCAL_CFLAGS := $(libc_common_cflags) \
- -Wno-unused-parameter \
+LOCAL_CFLAGS := -Wall -Wextra -Wunused -Werror \
+ -Wno-unused-parameter
LOCAL_MODULE := libdrmtestplugin
diff --git a/tests/tests/externalservice/Android.mk b/tests/tests/externalservice/Android.mk
index c438dd6..3208177 100644
--- a/tests/tests/externalservice/Android.mk
+++ b/tests/tests/externalservice/Android.mk
@@ -32,8 +32,6 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_PACKAGE_NAME := CtsExternalServiceTestCases
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/externalservice/OldAndroidTest.xml b/tests/tests/externalservice/OldAndroidTest.xml
deleted file mode 100644
index 838db60..0000000
--- a/tests/tests/externalservice/OldAndroidTest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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 CTS External Service test cases">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsExternalServiceService.apk" />
- <option name="cts-apk-installer:test-file-name" value="CtsExternalServiceTestCases.apk" />
-</configuration>
diff --git a/tests/tests/graphics/jni/Android.mk b/tests/tests/graphics/jni/Android.mk
index 8c225a4..dd0d7e4 100644
--- a/tests/tests/graphics/jni/Android.mk
+++ b/tests/tests/graphics/jni/Android.mk
@@ -24,11 +24,7 @@
CtsGraphicsJniOnLoad.cpp \
android_graphics_cts_VulkanFeaturesTest.cpp
-LOCAL_C_INCLUDES := \
- $(JNI_H_INCLUDE) \
- external/vulkan-validation-layers/libs/vkjson
-
-LOCAL_STATIC_LIBRARIES := libvkjson
+LOCAL_STATIC_LIBRARIES := libvkjson_ndk
LOCAL_SHARED_LIBRARIES := libvulkan liblog libdl
LOCAL_NDK_STL_VARIANT := c++_static
diff --git a/tests/tests/hardware/Android.mk b/tests/tests/hardware/Android.mk
index 9b3969c..69dbe2e 100644
--- a/tests/tests/hardware/Android.mk
+++ b/tests/tests/hardware/Android.mk
@@ -66,8 +66,6 @@
LOCAL_PACKAGE_NAME := CtsHardwareTestCases
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_SDK_VERSION := current
LOCAL_JAVA_LIBRARIES := android.test.runner
diff --git a/tests/tests/hardware/OldAndroidTest.xml b/tests/tests/hardware/OldAndroidTest.xml
deleted file mode 100644
index 4ddf28c..0000000
--- a/tests/tests/hardware/OldAndroidTest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="Base config for Sensor CTS tests. Put SensorService in restricted mode">
- <include name="common-config" />
- <!-- Put SensorService in restricted mode so that only CTS tests will be able to get access to
- sensors -->
- <option name="run-command:run-command" value="dumpsys sensorservice restrict .cts." />
- <option name="run-command:teardown-command" value="dumpsys sensorservice enable" />
-</configuration>
diff --git a/tests/tests/hardware/res/raw/gamepad_press_a.json b/tests/tests/hardware/res/raw/gamepad_press_a.json
new file mode 100644
index 0000000..ff3ca4f
--- /dev/null
+++ b/tests/tests/hardware/res/raw/gamepad_press_a.json
@@ -0,0 +1,39 @@
+{
+ "id": 1,
+ "command": "register",
+ "name": "Odie (Test)",
+ "vid": 0x18d1,
+ "pid": 0x2c40,
+ "descriptor": [0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x01, 0x05, 0x09, 0x0a, 0x01, 0x00,
+ 0x0a, 0x02, 0x00, 0x0a, 0x04, 0x00, 0x0a, 0x05, 0x00, 0x0a, 0x07, 0x00, 0x0a, 0x08, 0x00,
+ 0x0a, 0x0e, 0x00, 0x0a, 0x0f, 0x00, 0x0a, 0x0d, 0x00, 0x05, 0x0c, 0x0a, 0x24, 0x02, 0x0a,
+ 0x23, 0x02, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x0b, 0x81, 0x02, 0x75, 0x01, 0x95,
+ 0x01, 0x81, 0x03, 0x05, 0x01, 0x75, 0x04, 0x95, 0x01, 0x25, 0x07, 0x46, 0x3b, 0x01, 0x66,
+ 0x14, 0x00, 0x09, 0x39, 0x81, 0x42, 0x66, 0x00, 0x00, 0x09, 0x01, 0xa1, 0x00, 0x09, 0x30,
+ 0x09, 0x31, 0x09, 0x32, 0x09, 0x35, 0x05, 0x02, 0x09, 0xc5, 0x09, 0xc4, 0x15, 0x00, 0x26,
+ 0xff, 0x00, 0x35, 0x00, 0x46, 0xff, 0x00, 0x75, 0x08, 0x95, 0x06, 0x81, 0x02, 0xc0, 0x85,
+ 0x02, 0x05, 0x08, 0x0a, 0x01, 0x00, 0x0a, 0x02, 0x00, 0x0a, 0x03, 0x00, 0x0a, 0x04, 0x00,
+ 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x04, 0x91, 0x02, 0x75, 0x04, 0x95, 0x01, 0x91,
+ 0x03, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x05, 0x01, 0x09, 0x06, 0xa1,
+ 0x02, 0x05, 0x06, 0x09, 0x20, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x01, 0x81,
+ 0x02, 0x06, 0xbc, 0xff, 0x0a, 0xad, 0xbd, 0x75, 0x08, 0x95, 0x06, 0x81, 0x02, 0xc0, 0xc0],
+ "report": [0x01, 0x00, 0x80, 0x90, 0x80, 0x7f, 0x73, 0x00, 0x00]
+}
+
+{
+ "id": 1,
+ "command": "report",
+ "report": [0x01, 0x01, 0x80, 0x90, 0x80, 0x7f, 0x73, 0x00, 0x00]
+}
+
+{
+ "id": 1,
+ "command": "delay",
+ "duration": 10
+}
+
+{
+ "id": 1,
+ "command": "report",
+ "report": [0x01, 0x00, 0x80, 0x90, 0x80, 0x7f, 0x73, 0x00, 0x00]
+}
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tests/tests/hardware/src/android/hardware/input/cts/InputCallback.java
similarity index 66%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to tests/tests/hardware/src/android/hardware/input/cts/InputCallback.java
index 1293572..accdcaf 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tests/tests/hardware/src/android/hardware/input/cts/InputCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -14,6 +14,12 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+package android.hardware.input.cts;
-struct sock_fprog GetTestSeccompFilterProgram();
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+public interface InputCallback {
+ public void onKeyEvent(KeyEvent ev);
+ public void onMotionEvent(MotionEvent ev);
+}
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/InputCtsActivity.java b/tests/tests/hardware/src/android/hardware/input/cts/InputCtsActivity.java
new file mode 100644
index 0000000..b16cadb
--- /dev/null
+++ b/tests/tests/hardware/src/android/hardware/input/cts/InputCtsActivity.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2015 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 android.hardware.input.cts;
+
+import android.app.Activity;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class InputCtsActivity extends Activity {
+ private InputCallback mInputCallback;
+
+ @Override
+ public boolean dispatchGenericMotionEvent(MotionEvent ev) {
+ if (mInputCallback != null) {
+ mInputCallback.onMotionEvent(ev);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ if (mInputCallback != null) {
+ mInputCallback.onMotionEvent(ev);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean dispatchTrackballEvent(MotionEvent ev) {
+ if (mInputCallback != null) {
+ mInputCallback.onMotionEvent(ev);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent ev) {
+ if (mInputCallback != null) {
+ mInputCallback.onKeyEvent(ev);
+ }
+ return true;
+ }
+
+ public void setInputCallback(InputCallback callback) {
+ mInputCallback = callback;
+ }
+}
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
new file mode 100644
index 0000000..2a772ae
--- /dev/null
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2015 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 android.hardware.input.cts.tests;
+
+import android.util.Log;
+import android.view.KeyEvent;
+
+import java.io.Writer;
+import java.util.List;
+
+import android.hardware.cts.R;
+
+public class GamepadTestCase extends InputTestCase {
+ private static final String TAG = "GamepadTests";
+
+ public void testButtonA() throws Exception {
+ sendHidCommands(R.raw.gamepad_press_a);
+ assertReceivedKeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BUTTON_A);
+ assertReceivedKeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BUTTON_A);
+ assertNoMoreEvents();
+ }
+}
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
new file mode 100644
index 0000000..fba5f51
--- /dev/null
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright 2015 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 android.hardware.input.cts.tests;
+
+import android.app.UiAutomation;
+import android.hardware.input.cts.InputCtsActivity;
+import android.hardware.input.cts.InputCallback;
+import android.system.ErrnoException;
+import android.system.Os;
+import android.test.ActivityInstrumentationTestCase2;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.List;
+import java.util.UUID;
+
+public class InputTestCase extends ActivityInstrumentationTestCase2<InputCtsActivity> {
+ private static final String TAG = "InputTestCase";
+ private static final String HID_EXECUTABLE = "hid";
+ private static final int SHELL_UID = 2000;
+ private static final String[] KEY_ACTIONS = {"DOWN", "UP", "MULTIPLE"};
+
+ private File mFifo;
+ private Writer mWriter;
+
+ private BlockingQueue<KeyEvent> mKeys;
+ private BlockingQueue<MotionEvent> mMotions;
+ private InputListener mInputListener;
+
+ public InputTestCase() {
+ super(InputCtsActivity.class);
+ mKeys = new LinkedBlockingQueue<KeyEvent>();
+ mMotions = new LinkedBlockingQueue<MotionEvent>();
+ mInputListener = new InputListener();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mFifo = setupFifo();
+ clearKeys();
+ clearMotions();
+ getActivity().setInputCallback(mInputListener);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (mFifo != null) {
+ mFifo.delete();
+ mFifo = null;
+ }
+ closeQuietly(mWriter);
+ mWriter = null;
+ super.tearDown();
+ }
+
+ /**
+ * Sends the HID commands designated by the given resource id.
+ * The commands must be in the format expected by the `hid` shell command.
+ *
+ * @param id The resource id from which to load the HID commands. This must be a "raw"
+ * resource.
+ */
+ public void sendHidCommands(int id) {
+ try {
+ Writer w = getWriter();
+ w.write(getEvents(id));
+ w.flush();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Asserts that the application received a {@link android.view.KeyEvent} with the given action
+ * and keycode.
+ *
+ * If other KeyEvents are received by the application prior to the expected KeyEvent, or no
+ * KeyEvents are received within a reasonable amount of time, then this will throw an
+ * AssertionFailedError.
+ *
+ * @param action The action to expect on the next KeyEvent
+ * (e.g. {@link android.view.KeyEvent#ACTION_DOWN}).
+ * @param keyCode The expected key code of the next KeyEvent.
+ */
+ public void assertReceivedKeyEvent(int action, int keyCode) {
+ KeyEvent k = waitForKey();
+ if (k == null) {
+ fail("Timed out waiting for " + KeyEvent.keyCodeToString(keyCode)
+ + " with action " + KEY_ACTIONS[action]);
+ return;
+ }
+ assertEquals(action, k.getAction());
+ assertEquals(keyCode, k.getKeyCode());
+ }
+
+ /**
+ * Asserts that no more events have been received by the application.
+ *
+ * If any more events have been received by the application, this throws an
+ * AssertionFailedError.
+ */
+ public void assertNoMoreEvents() {
+ KeyEvent key;
+ MotionEvent motion;
+ if ((key = mKeys.poll()) != null) {
+ fail("Extraneous key events generated: " + key);
+ }
+ if ((motion = mMotions.poll()) != null) {
+ fail("Extraneous motion events generated: " + motion);
+ }
+ }
+
+ private KeyEvent waitForKey() {
+ try {
+ return mKeys.poll(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ return null;
+ }
+ }
+
+ private void clearKeys() {
+ mKeys.clear();
+ }
+
+ private void clearMotions() {
+ mMotions.clear();
+ }
+
+ private File setupFifo() throws ErrnoException {
+ File dir = getActivity().getCacheDir();
+ String filename = dir.getAbsolutePath() + File.separator + UUID.randomUUID().toString();
+ Os.mkfifo(filename, 0666);
+ File f = new File(filename);
+ return f;
+ }
+
+ private Writer getWriter() throws IOException {
+ if (mWriter == null) {
+ UiAutomation ui = getInstrumentation().getUiAutomation();
+ ui.executeShellCommand("hid " + mFifo.getAbsolutePath());
+ mWriter = new FileWriter(mFifo);
+ }
+ return mWriter;
+ }
+
+ private String getEvents(int id) throws IOException {
+ InputStream is =
+ getInstrumentation().getTargetContext().getResources().openRawResource(id);
+ return readFully(is);
+ }
+
+
+ private static void closeQuietly(AutoCloseable closeable) {
+ if (closeable != null) {
+ try {
+ closeable.close();
+ } catch (RuntimeException rethrown) {
+ throw rethrown;
+ } catch (Exception ignored) { }
+ }
+ }
+
+ private static String readFully(InputStream is) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ int read = 0;
+ byte[] buffer = new byte[1024];
+ while ((read = is.read(buffer)) >= 0) {
+ baos.write(buffer, 0, read);
+ }
+ return baos.toString();
+ }
+
+ private class InputListener implements InputCallback {
+ public void onKeyEvent(KeyEvent ev) {
+ boolean done = false;
+ do {
+ try {
+ mKeys.put(new KeyEvent(ev));
+ done = true;
+ } catch (InterruptedException ignore) { }
+ } while (!done);
+ }
+
+ public void onMotionEvent(MotionEvent ev) {
+ boolean done = false;
+ do {
+ try {
+ mMotions.put(MotionEvent.obtain(ev));
+ done = true;
+ } catch (InterruptedException ignore) { }
+ } while (!done);
+ }
+ }
+}
diff --git a/tests/tests/icu/Android.mk b/tests/tests/icu/Android.mk
index 6f183d5..096cf25 100644
--- a/tests/tests/icu/Android.mk
+++ b/tests/tests/icu/Android.mk
@@ -25,7 +25,6 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_JAVA_RESOURCE_DIRS := resources
# The aim of this package is to run tests against the implementation in use by
@@ -42,39 +41,3 @@
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-# Version 1 of the CTS framework has it's own logic for generating XML files based on scanning the
-# source for test methods and classes written using JUnit 3 (doesn't work for JUnit 4 @RunWith
-# tests). Since the ICU tests are not written using JUnit (although they are run with a custom JUnit
-# RunnerBuilder) this provides an alternative. This generates an XML representation based off a
-# list of the tests that are run by version 2 of the CTS framework (which doesn't require the list
-# in advance). The tools/update-test-list.sh script will take a host_log_[0-9]+.zip created by
-# CTSv1 and extract the list of tests run and update the test-list.txt file.
-
-CTS_ICU_TEST_LIST_PATH := $(LOCAL_PATH)/test-list.txt
-cts_package_xml := $(CTS_TESTCASES_OUT)/CtsIcuTestCases.xml
-$(cts_package_xml): $(HOST_OUT_JAVA_LIBRARIES)/cts-icu-tools.jar $(CTS_ICU_TEST_LIST_PATH) \
- $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME))/package.apk
- java -Xmx256M -classpath $(HOST_OUT_JAVA_LIBRARIES)/cts-icu-tools.jar \
- android.icu.cts.tools.GenerateTestCaseXML \
- $(CTS_ICU_TEST_LIST_PATH) \
- $(TARGET_ARCH) \
- $@
-
-# build cts-icu-tools tool
-# ============================================================
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, tools)
-LOCAL_JAVA_RESOURCE_DIRS := resources
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- descGen \
- jsr305lib
-
-LOCAL_MODULE := cts-icu-tools
-
-include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tests/tests/icu/AndroidManifest.xml b/tests/tests/icu/AndroidManifest.xml
index 1ecf5c8..c743375 100644
--- a/tests/tests/icu/AndroidManifest.xml
+++ b/tests/tests/icu/AndroidManifest.xml
@@ -25,7 +25,4 @@
<instrumentation android:name="com.android.cts.core.runner.CoreTestRunner"
android:targetPackage="android.icu.cts"
android:label="CTS Repackaged ICU4J library tests."/>
- <instrumentation android:name="android.icu.cts.IcuTestRunnerForCtsV1"
- android:targetPackage="android.icu.cts"
- android:label="CTS Repackaged ICU4J library tests."/>
</manifest>
diff --git a/tests/tests/icu/AndroidTest.xml b/tests/tests/icu/AndroidTest.xml
index 769b789..2decd12 100644
--- a/tests/tests/icu/AndroidTest.xml
+++ b/tests/tests/icu/AndroidTest.xml
@@ -17,14 +17,13 @@
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsIcuTestCases.apk" />
</target_preparer>
- <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <test class="com.android.compatibility.testtype.LibcoreTest" >
<!-- override AJUR -->
<option name="runner" value="com.android.cts.core.runner.CoreTestRunner" />
<option name="package" value="android.icu.cts" />
<option name="instrumentation-arg" key="core-root-classes"
value="android.icu.cts.coverage.TestAll,android.icu.dev.test.TestAll" />
- <option name="instrumentation-arg" key="core-expectations"
- value="/android/icu/cts/expectations/icu-known-failures.txt" />
+ <option name="core-expectation" value="/android/icu/cts/expectations/icu-known-failures.txt" />
<option name="runtime-hint" value="30m19s" />
</test>
</configuration>
diff --git a/tests/tests/icu/src/android/icu/cts/IcuTestRunnerForCtsV1.java b/tests/tests/icu/src/android/icu/cts/IcuTestRunnerForCtsV1.java
deleted file mode 100644
index 2a8d7b3..0000000
--- a/tests/tests/icu/src/android/icu/cts/IcuTestRunnerForCtsV1.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2015 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 android.icu.cts;
-
-import android.os.Bundle;
-import com.android.cts.core.runner.CoreTestRunner;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Customize {@link CoreTestRunner} to hard code information in the runner.
- *
- * <p>CTSv2 allows parameters to be specified in the AndroidTest.xml file but CTSv1 does not so
- * they have to be hard coded into the runner itself.
- */
-public final class IcuTestRunnerForCtsV1 extends CoreTestRunner {
-
- private static final List<String> EXPECTATIONS_PATHS =
- Collections.singletonList("expectations/icu-known-failures.txt");
-
- @Override
- protected List<String> getExpectationResourcePaths(Bundle args) {
- return EXPECTATIONS_PATHS;
- }
-
- @Override
- protected List<String> getRootClassNames(Bundle args) {
- return Arrays.asList(
- "android.icu.cts.coverage.TestAll",
- "android.icu.dev.test.TestAll");
- }
-}
diff --git a/tests/tests/icu/test-list.txt b/tests/tests/icu/test-list.txt
deleted file mode 100644
index cd47a76..0000000
--- a/tests/tests/icu/test-list.txt
+++ /dev/null
@@ -1,2253 +0,0 @@
-android.icu.cts.coverage.lang.UCharacterTest#testNameAliasing
-android.icu.cts.coverage.lang.UCharacterTest#testToTitleCase_Locale_String_BreakIterator_I
-android.icu.cts.coverage.lang.UCharacterTest#testToTitleCase_String_BreakIterator_en
-android.icu.cts.coverage.lang.UCharacterTest#testToTitleCase_String_BreakIterator_nl
-android.icu.cts.coverage.text.AlphabeticIndexTest#testAddLabels_Locale
-android.icu.cts.coverage.text.AlphabeticIndexTest#testFlowLabels
-android.icu.cts.coverage.text.AlphabeticIndexTest#testGetRecordCount_empty
-android.icu.cts.coverage.text.AlphabeticIndexTest#testGetRecordCount_withRecords
-android.icu.cts.coverage.text.DateFormatSymbolsTest#testSetEraNames_defensivelyCopies
-android.icu.cts.coverage.text.DateFormatSymbolsTest#testYearNames_defensivelyCopies
-android.icu.cts.coverage.text.DateIntervalFormatTest#testGetInstance_String_DateIntervalInfo
-android.icu.cts.coverage.text.DateIntervalFormatTest#testGetInstance_String_Locale_DateIntervalInfo
-android.icu.cts.coverage.text.DateIntervalFormatTest#testParseObject_notSupported
-android.icu.cts.coverage.text.LocaleDisplayNamesTest#testGetInstance
-android.icu.cts.coverage.text.LocaleDisplayNamesTest#testGetLocale
-android.icu.cts.coverage.text.LocaleDisplayNamesTest#testKeyDisplayName
-android.icu.cts.coverage.text.LocaleDisplayNamesTest#testKeyValueDisplayName
-android.icu.cts.coverage.text.LocaleDisplayNamesTest#testLocaleDisplayName
-android.icu.cts.coverage.text.LocaleDisplayNamesTest#testScriptDisplayName_Int
-android.icu.cts.coverage.text.LocaleDisplayNamesTest#testScriptDisplayName_String
-android.icu.cts.coverage.text.LocaleDisplayNamesTest#testVariantDisplayName
-android.icu.cts.coverage.text.RelativeDateTimeFormatterTest#testGetInstance
-android.icu.cts.coverage.text.TimeZoneNamesTest#testGetAvailableMetaZoneIDs
-android.icu.cts.coverage.text.TimeZoneNamesTest#testGetAvailableMetaZoneIDs_String
-android.icu.cts.coverage.text.TimeZoneNamesTest#testGetInstance_Locale
-android.icu.cts.coverage.text.TimeZoneNamesTest#testGetMetaZoneDisplayName
-android.icu.cts.coverage.text.TimeZoneNamesTest#testGetMetaZoneID
-android.icu.cts.coverage.text.TimeZoneNamesTest#testGetTimeZoneDisplayName
-android.icu.cts.coverage.text.UnicodeSetTest#testAddAll_CharacterSequences
-android.icu.cts.coverage.text.UnicodeSetTest#testCompareTo
-android.icu.cts.coverage.util.CurrencyTest#testGetDefaultFractionDigits_CurrencyUsage
-android.icu.cts.coverage.util.CurrencyTest#testGetName_Locale_Int_String_BooleanArray
-android.icu.cts.coverage.util.CurrencyTest#testGetRoundingIncrement
-android.icu.cts.coverage.util.CurrencyTest#testGetRoundingIncrement_CurrencyUsage
-android.icu.dev.test.bidi.BiDiConformanceTest#TestBidiCharacterTest
-android.icu.dev.test.bidi.BiDiConformanceTest#TestBidiTest
-android.icu.dev.test.bidi.TestBidi#testBidi
-android.icu.dev.test.bidi.TestCharFromDirProp#testCharFromDirProp
-android.icu.dev.test.bidi.TestClassOverride#testClassOverride
-android.icu.dev.test.bidi.TestContext#testContext
-android.icu.dev.test.bidi.TestFailureRecovery#testFailureRecovery
-android.icu.dev.test.bidi.TestInverse#testInverse
-android.icu.dev.test.bidi.TestMultipleParagraphs#testMultipleParagraphs
-android.icu.dev.test.bidi.TestReorderArabicMathSymbols#testReorderArabicMathSymbols
-android.icu.dev.test.bidi.TestReorderingMode#testReorderingMode
-android.icu.dev.test.bidi.TestReorderRunsOnly#testReorderRunsOnly
-android.icu.dev.test.bidi.TestReorder#testReorder
-android.icu.dev.test.bidi.TestStreaming#testStreaming
-android.icu.dev.test.bigdec.DiagBigDecimal#TestBigDecimal
-android.icu.dev.test.calendar.AstroTest#TestBasics
-android.icu.dev.test.calendar.AstroTest#TestCoordinates
-android.icu.dev.test.calendar.AstroTest#TestCoverage
-android.icu.dev.test.calendar.AstroTest#TestLunarPosition
-android.icu.dev.test.calendar.AstroTest#TestMoonAge
-android.icu.dev.test.calendar.AstroTest#TestSolarLongitude
-android.icu.dev.test.calendar.AstroTest#TestSunriseTimes
-android.icu.dev.test.calendar.CalendarRegression#Test4031502
-android.icu.dev.test.calendar.CalendarRegression#Test4035301
-android.icu.dev.test.calendar.CalendarRegression#Test4040996
-android.icu.dev.test.calendar.CalendarRegression#Test4051765
-android.icu.dev.test.calendar.CalendarRegression#Test4059654
-android.icu.dev.test.calendar.CalendarRegression#Test4061476
-android.icu.dev.test.calendar.CalendarRegression#Test4070502
-android.icu.dev.test.calendar.CalendarRegression#Test4071197
-android.icu.dev.test.calendar.CalendarRegression#Test4071385
-android.icu.dev.test.calendar.CalendarRegression#Test4073929
-android.icu.dev.test.calendar.CalendarRegression#Test4083167
-android.icu.dev.test.calendar.CalendarRegression#Test4086724
-android.icu.dev.test.calendar.CalendarRegression#Test4092362
-android.icu.dev.test.calendar.CalendarRegression#Test4095407
-android.icu.dev.test.calendar.CalendarRegression#Test4096231
-android.icu.dev.test.calendar.CalendarRegression#Test4096539
-android.icu.dev.test.calendar.CalendarRegression#Test4100311
-android.icu.dev.test.calendar.CalendarRegression#Test4103271
-android.icu.dev.test.calendar.CalendarRegression#Test4106136
-android.icu.dev.test.calendar.CalendarRegression#Test4108764
-android.icu.dev.test.calendar.CalendarRegression#Test4114578
-android.icu.dev.test.calendar.CalendarRegression#Test4118384
-android.icu.dev.test.calendar.CalendarRegression#Test4125881
-android.icu.dev.test.calendar.CalendarRegression#Test4125892
-android.icu.dev.test.calendar.CalendarRegression#Test4136399
-android.icu.dev.test.calendar.CalendarRegression#Test4141665
-android.icu.dev.test.calendar.CalendarRegression#Test4142933
-android.icu.dev.test.calendar.CalendarRegression#Test4145158
-android.icu.dev.test.calendar.CalendarRegression#Test4145983
-android.icu.dev.test.calendar.CalendarRegression#Test4147269
-android.icu.dev.test.calendar.CalendarRegression#Test4149677
-android.icu.dev.test.calendar.CalendarRegression#Test4162587
-android.icu.dev.test.calendar.CalendarRegression#Test4165343
-android.icu.dev.test.calendar.CalendarRegression#Test4166109
-android.icu.dev.test.calendar.CalendarRegression#Test4167060
-android.icu.dev.test.calendar.CalendarRegression#Test4173516
-android.icu.dev.test.calendar.CalendarRegression#Test4174361
-android.icu.dev.test.calendar.CalendarRegression#Test4177484
-android.icu.dev.test.calendar.CalendarRegression#Test4197699
-android.icu.dev.test.calendar.CalendarRegression#Test4209071
-android.icu.dev.test.calendar.CalendarRegression#Test4288792
-android.icu.dev.test.calendar.CalendarRegression#Test9019
-android.icu.dev.test.calendar.CalendarRegression#TestCalendarType6816
-android.icu.dev.test.calendar.CalendarRegression#TestDateFormatFactoryJ26
-android.icu.dev.test.calendar.CalendarRegression#TestGetKeywordValuesForLocale
-android.icu.dev.test.calendar.CalendarRegression#TestJ438
-android.icu.dev.test.calendar.CalendarRegression#TestJ9
-android.icu.dev.test.calendar.CalendarRegression#TestRegistration
-android.icu.dev.test.calendar.CalendarRegression#TestSerialization3474
-android.icu.dev.test.calendar.CalendarRegression#TestT5555
-android.icu.dev.test.calendar.CalendarRegression#TestT8057
-android.icu.dev.test.calendar.CalendarRegression#TestT8596
-android.icu.dev.test.calendar.CalendarRegression#TestT9403
-android.icu.dev.test.calendar.CalendarRegression#TestT9452
-android.icu.dev.test.calendar.CalendarRegression#TestT9968
-android.icu.dev.test.calendar.CalendarRegression#TestTimeStamp
-android.icu.dev.test.calendar.CalendarRegression#TestWeekendData_10560
-android.icu.dev.test.calendar.CalendarRegression#TestYearJump3279
-android.icu.dev.test.calendar.ChineseTest#Test6510
-android.icu.dev.test.calendar.ChineseTest#TestAdd
-android.icu.dev.test.calendar.ChineseTest#TestCoverage
-android.icu.dev.test.calendar.ChineseTest#TestFormat
-android.icu.dev.test.calendar.ChineseTest#TestInitWithCurrentTime
-android.icu.dev.test.calendar.ChineseTest#TestJulianDayMapping
-android.icu.dev.test.calendar.ChineseTest#TestLimits
-android.icu.dev.test.calendar.ChineseTest#TestMapping
-android.icu.dev.test.calendar.ChineseTest#TestOutOfRange
-android.icu.dev.test.calendar.ChineseTest#TestResolution
-android.icu.dev.test.calendar.ChineseTest#TestRoll
-android.icu.dev.test.calendar.ChineseTest#TestScratch
-android.icu.dev.test.calendar.ChineseTest#TestZeroDOM
-android.icu.dev.test.calendar.CompatibilityTest#TestActualMinMax
-android.icu.dev.test.calendar.CompatibilityTest#TestAdd520
-android.icu.dev.test.calendar.CompatibilityTest#TestAddAcrossOffsetTransitions
-android.icu.dev.test.calendar.CompatibilityTest#TestAddSetGet0610
-android.icu.dev.test.calendar.CompatibilityTest#TestAddSetOrder621
-android.icu.dev.test.calendar.CompatibilityTest#TestClonesUnique908
-android.icu.dev.test.calendar.CompatibilityTest#TestComputeJulianDay4406
-android.icu.dev.test.calendar.CompatibilityTest#TestDisambiguation765
-android.icu.dev.test.calendar.CompatibilityTest#TestDOW943
-android.icu.dev.test.calendar.CompatibilityTest#TestDOWProgression
-android.icu.dev.test.calendar.CompatibilityTest#TestEpochStartFields
-android.icu.dev.test.calendar.CompatibilityTest#TestFields060
-android.icu.dev.test.calendar.CompatibilityTest#TestFieldSet4781
-android.icu.dev.test.calendar.CompatibilityTest#TestGenericAPI
-android.icu.dev.test.calendar.CompatibilityTest#TestGMTvsLocal4064654
-android.icu.dev.test.calendar.CompatibilityTest#TestGregorianChange768
-android.icu.dev.test.calendar.CompatibilityTest#TestGregorianChangeover
-android.icu.dev.test.calendar.CompatibilityTest#TestMapping
-android.icu.dev.test.calendar.CompatibilityTest#TestRog
-android.icu.dev.test.calendar.CompatibilityTest#TestRoll
-android.icu.dev.test.calendar.CompatibilityTest#TestSecondsZero121
-android.icu.dev.test.calendar.CompatibilityTest#TestSerialize337
-android.icu.dev.test.calendar.CopticTest#Test6379
-android.icu.dev.test.calendar.CopticTest#TestAddSet
-android.icu.dev.test.calendar.CopticTest#TestBasic
-android.icu.dev.test.calendar.CopticTest#TestCases
-android.icu.dev.test.calendar.CopticTest#TestCopticToJD
-android.icu.dev.test.calendar.CopticTest#TestCoverage
-android.icu.dev.test.calendar.CopticTest#TestEraStart
-android.icu.dev.test.calendar.CopticTest#TestLimits
-android.icu.dev.test.calendar.CopticTest#TestYear
-android.icu.dev.test.calendar.DataDrivenCalendarTest#TestCalendarConversion
-android.icu.dev.test.calendar.DataDrivenCalendarTest#TestCalendarOperations
-android.icu.dev.test.calendar.EthiopicTest#TestAddSet
-android.icu.dev.test.calendar.EthiopicTest#TestBasic
-android.icu.dev.test.calendar.EthiopicTest#TestCases
-android.icu.dev.test.calendar.EthiopicTest#TestCoverage
-android.icu.dev.test.calendar.EthiopicTest#TestEraStart
-android.icu.dev.test.calendar.EthiopicTest#TestJD
-android.icu.dev.test.calendar.EthiopicTest#TestLimits
-android.icu.dev.test.calendar.HebrewTest#Test1624
-android.icu.dev.test.calendar.HebrewTest#TestAdd
-android.icu.dev.test.calendar.HebrewTest#TestCases
-android.icu.dev.test.calendar.HebrewTest#TestCoverage
-android.icu.dev.test.calendar.HebrewTest#TestDefaultFieldValues
-android.icu.dev.test.calendar.HebrewTest#TestElulMonth
-android.icu.dev.test.calendar.HebrewTest#TestLimits
-android.icu.dev.test.calendar.HebrewTest#TestMonthMovement
-android.icu.dev.test.calendar.HebrewTest#TestMonthValidation
-android.icu.dev.test.calendar.HebrewTest#TestRoll
-android.icu.dev.test.calendar.HebrewTest#TestTimeFields
-android.icu.dev.test.calendar.HolidayTest#TestAPI
-android.icu.dev.test.calendar.HolidayTest#TestCoverage
-android.icu.dev.test.calendar.HolidayTest#TestDisplayName
-android.icu.dev.test.calendar.HolidayTest#TestEaster
-android.icu.dev.test.calendar.HolidayTest#TestIsOn
-android.icu.dev.test.calendar.IBMCalendarTest#TestAddAcrossZoneTransition
-android.icu.dev.test.calendar.IBMCalendarTest#TestAddRollEra0AndEraBounds
-android.icu.dev.test.calendar.IBMCalendarTest#TestAmbiguousWallTimeAPIs
-android.icu.dev.test.calendar.IBMCalendarTest#TestBuddhist
-android.icu.dev.test.calendar.IBMCalendarTest#TestBuddhistCoverage
-android.icu.dev.test.calendar.IBMCalendarTest#TestBuddhistLimits
-android.icu.dev.test.calendar.IBMCalendarTest#TestComparable
-android.icu.dev.test.calendar.IBMCalendarTest#TestCoverage
-android.icu.dev.test.calendar.IBMCalendarTest#TestFieldDifference
-android.icu.dev.test.calendar.IBMCalendarTest#TestGregorianLimits
-android.icu.dev.test.calendar.IBMCalendarTest#TestISO8601
-android.icu.dev.test.calendar.IBMCalendarTest#TestJapanese
-android.icu.dev.test.calendar.IBMCalendarTest#TestJB1684
-android.icu.dev.test.calendar.IBMCalendarTest#TestJB4541
-android.icu.dev.test.calendar.IBMCalendarTest#TestLeapFieldDifference
-android.icu.dev.test.calendar.IBMCalendarTest#TestMalaysianInstance
-android.icu.dev.test.calendar.IBMCalendarTest#TestRepeatedWallTime
-android.icu.dev.test.calendar.IBMCalendarTest#TestSimpleDateFormatCoverage
-android.icu.dev.test.calendar.IBMCalendarTest#TestSkippedWallTime
-android.icu.dev.test.calendar.IBMCalendarTest#TestTaiwan
-android.icu.dev.test.calendar.IBMCalendarTest#TestTaiwanCoverage
-android.icu.dev.test.calendar.IBMCalendarTest#TestTaiwanLimits
-android.icu.dev.test.calendar.IBMCalendarTest#TestThaiDefault
-android.icu.dev.test.calendar.IBMCalendarTest#TestTimeZoneTransitionAdd
-android.icu.dev.test.calendar.IBMCalendarTest#TestTypes
-android.icu.dev.test.calendar.IBMCalendarTest#TestWeekData
-android.icu.dev.test.calendar.IBMCalendarTest#TestWeekend
-android.icu.dev.test.calendar.IBMCalendarTest#TestWeekShift
-android.icu.dev.test.calendar.IBMCalendarTest#TestZoneMeta
-android.icu.dev.test.calendar.IndianTest#TestBasic
-android.icu.dev.test.calendar.IndianTest#TestCases
-android.icu.dev.test.calendar.IndianTest#TestCoverage
-android.icu.dev.test.calendar.IndianTest#TestCoverage12424
-android.icu.dev.test.calendar.IndianTest#TestLimits
-android.icu.dev.test.calendar.IndianTest#TestYear
-android.icu.dev.test.calendar.IndianTest#TestYearEdge
-android.icu.dev.test.calendar.IslamicTest#Test7427
-android.icu.dev.test.calendar.IslamicTest#Test8822
-android.icu.dev.test.calendar.IslamicTest#TestBasic
-android.icu.dev.test.calendar.IslamicTest#TestCivilCases
-android.icu.dev.test.calendar.IslamicTest#TestCoverage
-android.icu.dev.test.calendar.IslamicTest#TestCreationByLocale
-android.icu.dev.test.calendar.IslamicTest#TestIslamicTabularDates
-android.icu.dev.test.calendar.IslamicTest#TestIslamicUmAlQura
-android.icu.dev.test.calendar.IslamicTest#TestLimits
-android.icu.dev.test.calendar.IslamicTest#TestRoll
-android.icu.dev.test.calendar.IslamicTest#TestSerialization8449
-android.icu.dev.test.calendar.JapaneseTest#Test3860
-android.icu.dev.test.calendar.JapaneseTest#Test5345calendar
-android.icu.dev.test.calendar.JapaneseTest#Test5345parse
-android.icu.dev.test.calendar.JapaneseTest#TestCoverage
-android.icu.dev.test.calendar.JapaneseTest#TestJapaneseYear3282
-android.icu.dev.test.calendar.JapaneseTest#TestLimits
-android.icu.dev.test.calendar.PersianTest#TestCoverage12424
-android.icu.dev.test.calendar.PersianTest#TestMapping
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestArabic
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestBufferOverflow
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestBug6889
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestBug6954
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestBug9267
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestC1Bytes
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestCharsetRecog_UTF_16_LE_Match
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestConstruction
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestDetection
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestFreshDetectorEachTime
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestHebrew
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestInputFilter
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestJapanese
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestMultithreaded
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestReusingDetector
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestShortInput
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestUTF16
-android.icu.dev.test.charsetdet.TestCharsetDetector#TestUTF8
-android.icu.dev.test.collator.AlphabeticIndexTest#TestA
-android.icu.dev.test.collator.AlphabeticIndexTest#TestBasics
-android.icu.dev.test.collator.AlphabeticIndexTest#TestBuckets
-android.icu.dev.test.collator.AlphabeticIndexTest#TestChineseUnihan
-android.icu.dev.test.collator.AlphabeticIndexTest#TestChineseZhuyin
-android.icu.dev.test.collator.AlphabeticIndexTest#TestClientSupport
-android.icu.dev.test.collator.AlphabeticIndexTest#TestEmpty
-android.icu.dev.test.collator.AlphabeticIndexTest#TestFirstCharacters
-android.icu.dev.test.collator.AlphabeticIndexTest#TestFirstScriptCharacters
-android.icu.dev.test.collator.AlphabeticIndexTest#TestFrozenCollator
-android.icu.dev.test.collator.AlphabeticIndexTest#TestHaniFirst
-android.icu.dev.test.collator.AlphabeticIndexTest#TestIndexCharactersList
-android.icu.dev.test.collator.AlphabeticIndexTest#TestInflow
-android.icu.dev.test.collator.AlphabeticIndexTest#TestJapaneseKanji
-android.icu.dev.test.collator.AlphabeticIndexTest#TestNoLabels
-android.icu.dev.test.collator.AlphabeticIndexTest#TestPinyinFirst
-android.icu.dev.test.collator.AlphabeticIndexTest#TestSchSt
-android.icu.dev.test.collator.AlphabeticIndexTest#TestSimplified
-android.icu.dev.test.collator.AlphabeticIndexTest#TestTraditional
-android.icu.dev.test.collator.AlphabeticIndexTest#TestZZZ
-android.icu.dev.test.collator.CollationAPITest#TestBadKeywords
-android.icu.dev.test.collator.CollationAPITest#TestBounds
-android.icu.dev.test.collator.CollationAPITest#TestClone
-android.icu.dev.test.collator.CollationAPITest#TestCollationKey
-android.icu.dev.test.collator.CollationAPITest#TestCompare
-android.icu.dev.test.collator.CollationAPITest#TestCreateCollator
-android.icu.dev.test.collator.CollationAPITest#TestDecomposition
-android.icu.dev.test.collator.CollationAPITest#TestDuplicate
-android.icu.dev.test.collator.CollationAPITest#TestElemIter
-android.icu.dev.test.collator.CollationAPITest#TestGetAll
-android.icu.dev.test.collator.CollationAPITest#TestGetContractions
-android.icu.dev.test.collator.CollationAPITest#TestGetKeywordValues
-android.icu.dev.test.collator.CollationAPITest#TestGetLocale
-android.icu.dev.test.collator.CollationAPITest#TestGetTailoredSet
-android.icu.dev.test.collator.CollationAPITest#TestHashCode
-android.icu.dev.test.collator.CollationAPITest#TestIterNumeric
-android.icu.dev.test.collator.CollationAPITest#TestJunkCollator
-android.icu.dev.test.collator.CollationAPITest#TestMaxVariable
-android.icu.dev.test.collator.CollationAPITest#TestProperty
-android.icu.dev.test.collator.CollationAPITest#TestRawCollationKey
-android.icu.dev.test.collator.CollationAPITest#TestRuleBasedColl
-android.icu.dev.test.collator.CollationAPITest#TestRules
-android.icu.dev.test.collator.CollationAPITest#TestSafeClone
-android.icu.dev.test.collator.CollationAPITest#TestSetDecomposition
-android.icu.dev.test.collator.CollationAPITest#TestSetGet
-android.icu.dev.test.collator.CollationAPITest#TestSetStrength
-android.icu.dev.test.collator.CollationAPITest#TestSubClass
-android.icu.dev.test.collator.CollationAPITest#TestVariableTopSetting
-android.icu.dev.test.collator.CollationChineseTest#TestPinYin
-android.icu.dev.test.collator.CollationCurrencyTest#TestCurrency
-android.icu.dev.test.collator.CollationDummyTest#TestExtra
-android.icu.dev.test.collator.CollationDummyTest#TestIdentical
-android.icu.dev.test.collator.CollationDummyTest#TestJB1401
-android.icu.dev.test.collator.CollationDummyTest#TestJB581
-android.icu.dev.test.collator.CollationDummyTest#TestPrimary
-android.icu.dev.test.collator.CollationDummyTest#TestSecondary
-android.icu.dev.test.collator.CollationDummyTest#TestSurrogates
-android.icu.dev.test.collator.CollationDummyTest#TestTertiary
-android.icu.dev.test.collator.CollationDummyTest#TestVariableTop
-android.icu.dev.test.collator.CollationEnglishTest#TestPrimary
-android.icu.dev.test.collator.CollationEnglishTest#TestSecondary
-android.icu.dev.test.collator.CollationEnglishTest#TestTertiary
-android.icu.dev.test.collator.CollationFinnishTest#TestPrimary
-android.icu.dev.test.collator.CollationFinnishTest#TestTertiary
-android.icu.dev.test.collator.CollationFrenchTest#TestContinuationReordering
-android.icu.dev.test.collator.CollationFrenchTest#TestExtra
-android.icu.dev.test.collator.CollationFrenchTest#TestSecondary
-android.icu.dev.test.collator.CollationFrenchTest#TestTertiary
-android.icu.dev.test.collator.CollationGermanTest#TestPrimary
-android.icu.dev.test.collator.CollationGermanTest#TestSecondary
-android.icu.dev.test.collator.CollationGermanTest#TestTertiary
-android.icu.dev.test.collator.CollationIteratorTest#TestClearBuffers
-android.icu.dev.test.collator.CollationIteratorTest#TestDiscontiguous
-android.icu.dev.test.collator.CollationIteratorTest#TestMaxExpansion
-android.icu.dev.test.collator.CollationIteratorTest#TestNormalization
-android.icu.dev.test.collator.CollationIteratorTest#TestNormalizedUnicodeChar
-android.icu.dev.test.collator.CollationIteratorTest#TestOffset
-android.icu.dev.test.collator.CollationIteratorTest#TestPrevious
-android.icu.dev.test.collator.CollationIteratorTest#TestSearchCollatorElements
-android.icu.dev.test.collator.CollationIteratorTest#TestSetText
-android.icu.dev.test.collator.CollationIteratorTest#TestUnicodeChar
-android.icu.dev.test.collator.CollationKanaTest#TestBase
-android.icu.dev.test.collator.CollationKanaTest#TestChooonKigoo
-android.icu.dev.test.collator.CollationKanaTest#TestCommonCharacters
-android.icu.dev.test.collator.CollationKanaTest#TestKatakanaHiragana
-android.icu.dev.test.collator.CollationKanaTest#TestPlainDakutenHandakuten
-android.icu.dev.test.collator.CollationKanaTest#TestSmallLarge
-android.icu.dev.test.collator.CollationKanaTest#TestTertiary
-android.icu.dev.test.collator.CollationMiscTest#Test3249
-android.icu.dev.test.collator.CollationMiscTest#Test6179
-android.icu.dev.test.collator.CollationMiscTest#TestBefore
-android.icu.dev.test.collator.CollationMiscTest#TestBeforePinyin
-android.icu.dev.test.collator.CollationMiscTest#TestBeforePrefixFailure
-android.icu.dev.test.collator.CollationMiscTest#TestBeforeRuleWithScriptReordering
-android.icu.dev.test.collator.CollationMiscTest#TestBlackBird
-android.icu.dev.test.collator.CollationMiscTest#TestBocsuCoverage
-android.icu.dev.test.collator.CollationMiscTest#TestCase
-android.icu.dev.test.collator.CollationMiscTest#TestChMove
-android.icu.dev.test.collator.CollationMiscTest#TestCollationKeyEquals
-android.icu.dev.test.collator.CollationMiscTest#TestCollationKeyHashCode
-android.icu.dev.test.collator.CollationMiscTest#TestComposeDecompose
-android.icu.dev.test.collator.CollationMiscTest#TestContraction
-android.icu.dev.test.collator.CollationMiscTest#TestContractionClosure
-android.icu.dev.test.collator.CollationMiscTest#TestContractionEndCompare
-android.icu.dev.test.collator.CollationMiscTest#TestCyrillicTailoring
-android.icu.dev.test.collator.CollationMiscTest#TestEmptyRule
-android.icu.dev.test.collator.CollationMiscTest#TestEquivalentReorderingScripts
-android.icu.dev.test.collator.CollationMiscTest#TestExpansion
-android.icu.dev.test.collator.CollationMiscTest#TestExtremeCompression
-android.icu.dev.test.collator.CollationMiscTest#TestFCDProblem
-android.icu.dev.test.collator.CollationMiscTest#TestFrozeness
-android.icu.dev.test.collator.CollationMiscTest#TestFunkyA
-android.icu.dev.test.collator.CollationMiscTest#TestGetBound
-android.icu.dev.test.collator.CollationMiscTest#TestGreekFirstReorder
-android.icu.dev.test.collator.CollationMiscTest#TestGreekFirstReorderCloning
-android.icu.dev.test.collator.CollationMiscTest#TestGreekLastReorder
-android.icu.dev.test.collator.CollationMiscTest#TestHangulTailoring
-android.icu.dev.test.collator.CollationMiscTest#TestHaniReorder
-android.icu.dev.test.collator.CollationMiscTest#TestHaniReorderWithOtherRules
-android.icu.dev.test.collator.CollationMiscTest#TestHungarianTailoring
-android.icu.dev.test.collator.CollationMiscTest#TestIdenticalCompare
-android.icu.dev.test.collator.CollationMiscTest#TestImplicitTailoring
-android.icu.dev.test.collator.CollationMiscTest#TestIncompleteCnt
-android.icu.dev.test.collator.CollationMiscTest#TestIncrementalNormalize
-android.icu.dev.test.collator.CollationMiscTest#TestInvalidListsAndRanges
-android.icu.dev.test.collator.CollationMiscTest#TestJ3087
-android.icu.dev.test.collator.CollationMiscTest#TestJ3347
-android.icu.dev.test.collator.CollationMiscTest#TestJ4960
-android.icu.dev.test.collator.CollationMiscTest#TestJ5367
-android.icu.dev.test.collator.CollationMiscTest#TestJ815
-android.icu.dev.test.collator.CollationMiscTest#TestJB5298
-android.icu.dev.test.collator.CollationMiscTest#TestLocaleRuleBasedCollators
-android.icu.dev.test.collator.CollationMiscTest#TestMaxVariable
-android.icu.dev.test.collator.CollationMiscTest#TestMerge
-android.icu.dev.test.collator.CollationMiscTest#TestMergeSortKeys
-android.icu.dev.test.collator.CollationMiscTest#TestMultipleReorder
-android.icu.dev.test.collator.CollationMiscTest#TestNewJapanese
-android.icu.dev.test.collator.CollationMiscTest#TestNonChars
-android.icu.dev.test.collator.CollationMiscTest#TestNonLeadBytesDuringCollationReordering
-android.icu.dev.test.collator.CollationMiscTest#TestNonScriptReorder
-android.icu.dev.test.collator.CollationMiscTest#TestNumericCollation
-android.icu.dev.test.collator.CollationMiscTest#TestOptimize
-android.icu.dev.test.collator.CollationMiscTest#TestPinyinProblem
-android.icu.dev.test.collator.CollationMiscTest#TestPrefix
-android.icu.dev.test.collator.CollationMiscTest#TestPrefixCompose
-android.icu.dev.test.collator.CollationMiscTest#TestQuoteAndSpace
-android.icu.dev.test.collator.CollationMiscTest#TestRawCollationKeyCompareTo
-android.icu.dev.test.collator.CollationMiscTest#TestReorderingAPI
-android.icu.dev.test.collator.CollationMiscTest#TestReorderingAPIWithRuleCreatedCollator
-android.icu.dev.test.collator.CollationMiscTest#TestRuleOptions
-android.icu.dev.test.collator.CollationMiscTest#TestSameStrengthList
-android.icu.dev.test.collator.CollationMiscTest#TestSameStrengthListQuoted
-android.icu.dev.test.collator.CollationMiscTest#TestSameStrengthListQwerty
-android.icu.dev.test.collator.CollationMiscTest#TestSameStrengthListRanges
-android.icu.dev.test.collator.CollationMiscTest#TestSameStrengthListRangesWithSupplementalCharacters
-android.icu.dev.test.collator.CollationMiscTest#TestSameStrengthListWithSupplementalCharacters
-android.icu.dev.test.collator.CollationMiscTest#TestShifted
-android.icu.dev.test.collator.CollationMiscTest#TestSpecialCharacters
-android.icu.dev.test.collator.CollationMiscTest#TestStrCollIdenticalPrefix
-android.icu.dev.test.collator.CollationMiscTest#TestSuppressContractions
-android.icu.dev.test.collator.CollationMiscTest#TestSurrogates
-android.icu.dev.test.collator.CollationMiscTest#TestTibetanConformance
-android.icu.dev.test.collator.CollationMiscTest#TestUCAPrecontext
-android.icu.dev.test.collator.CollationMiscTest#TestUnknownCollationKeyword
-android.icu.dev.test.collator.CollationMiscTest#TestUpperFirstQuaternary
-android.icu.dev.test.collator.CollationMiscTest#TestVariableTop
-android.icu.dev.test.collator.CollationMiscTest#TestVariableTopSetting
-android.icu.dev.test.collator.CollationMiscTest#TestVI5913
-android.icu.dev.test.collator.CollationMonkeyTest#TestCollationKey
-android.icu.dev.test.collator.CollationMonkeyTest#TestCompare
-android.icu.dev.test.collator.CollationMonkeyTest#TestRules
-android.icu.dev.test.collator.CollationRegressionTest#Test4048446
-android.icu.dev.test.collator.CollationRegressionTest#Test4051866
-android.icu.dev.test.collator.CollationRegressionTest#Test4053636
-android.icu.dev.test.collator.CollationRegressionTest#Test4054238
-android.icu.dev.test.collator.CollationRegressionTest#Test4054734
-android.icu.dev.test.collator.CollationRegressionTest#Test4054736
-android.icu.dev.test.collator.CollationRegressionTest#Test4058613
-android.icu.dev.test.collator.CollationRegressionTest#Test4059820
-android.icu.dev.test.collator.CollationRegressionTest#Test4060154
-android.icu.dev.test.collator.CollationRegressionTest#Test4062418
-android.icu.dev.test.collator.CollationRegressionTest#Test4065540
-android.icu.dev.test.collator.CollationRegressionTest#Test4066189
-android.icu.dev.test.collator.CollationRegressionTest#Test4066696
-android.icu.dev.test.collator.CollationRegressionTest#Test4076676
-android.icu.dev.test.collator.CollationRegressionTest#Test4078588
-android.icu.dev.test.collator.CollationRegressionTest#Test4079231
-android.icu.dev.test.collator.CollationRegressionTest#Test4081866
-android.icu.dev.test.collator.CollationRegressionTest#Test4087241
-android.icu.dev.test.collator.CollationRegressionTest#Test4087243
-android.icu.dev.test.collator.CollationRegressionTest#Test4092260
-android.icu.dev.test.collator.CollationRegressionTest#Test4095316
-android.icu.dev.test.collator.CollationRegressionTest#Test4101940
-android.icu.dev.test.collator.CollationRegressionTest#Test4103436
-android.icu.dev.test.collator.CollationRegressionTest#Test4114076
-android.icu.dev.test.collator.CollationRegressionTest#Test4114077
-android.icu.dev.test.collator.CollationRegressionTest#Test4124632
-android.icu.dev.test.collator.CollationRegressionTest#Test4132736
-android.icu.dev.test.collator.CollationRegressionTest#Test4133509
-android.icu.dev.test.collator.CollationRegressionTest#Test4139572
-android.icu.dev.test.collator.CollationRegressionTest#Test4141640
-android.icu.dev.test.collator.CollationRegressionTest#Test4171974
-android.icu.dev.test.collator.CollationRegressionTest#Test4179216
-android.icu.dev.test.collator.CollationRegressionTest#Test4179686
-android.icu.dev.test.collator.CollationRegressionTest#Test4216006
-android.icu.dev.test.collator.CollationRegressionTest#Test4244884
-android.icu.dev.test.collator.CollationRegressionTest#Test4663220
-android.icu.dev.test.collator.CollationRegressionTest#Test8484
-android.icu.dev.test.collator.CollationRegressionTest#TestBeforeWithTooStrongAfter
-android.icu.dev.test.collator.CollationRegressionTest#TestBengaliSortKey
-android.icu.dev.test.collator.CollationRegressionTest#TestCaseFirstCompression
-android.icu.dev.test.collator.CollationRegressionTest#TestTrailingComment
-android.icu.dev.test.collator.CollationServiceTest#TestGetFunctionalEquivalent
-android.icu.dev.test.collator.CollationServiceTest#TestGetKeywordValues
-android.icu.dev.test.collator.CollationServiceTest#TestRegister
-android.icu.dev.test.collator.CollationServiceTest#TestRegisterFactory
-android.icu.dev.test.collator.CollationServiceTest#TestSeparateTrees
-android.icu.dev.test.collator.CollationSpanishTest#TestPrimary
-android.icu.dev.test.collator.CollationSpanishTest#TestTertiary
-android.icu.dev.test.collator.CollationTest#TestCollationWeights
-android.icu.dev.test.collator.CollationTest#TestFCD
-android.icu.dev.test.collator.CollationTest#TestImplicits
-android.icu.dev.test.collator.CollationTest#TestMinMax
-android.icu.dev.test.collator.CollationTest#TestRootElements
-android.icu.dev.test.collator.CollationTest#TestShortFCDData
-android.icu.dev.test.collator.CollationTest#TestSubSequence
-android.icu.dev.test.collator.CollationTest#TestTailoredElements
-android.icu.dev.test.collator.CollationThaiTest#TestCornerCases
-android.icu.dev.test.collator.CollationThaiTest#TestDictionary
-android.icu.dev.test.collator.CollationThaiTest#TestInvalidThai
-android.icu.dev.test.collator.CollationThaiTest#TestReordering
-android.icu.dev.test.collator.CollationThreadTest#testFrozen
-android.icu.dev.test.collator.CollationThreadTest#testThreads
-android.icu.dev.test.collator.CollationTurkishTest#TestPrimary
-android.icu.dev.test.collator.CollationTurkishTest#TestTertiary
-android.icu.dev.test.collator.G7CollationTest#TestDemo1
-android.icu.dev.test.collator.G7CollationTest#TestDemo2
-android.icu.dev.test.collator.G7CollationTest#TestDemo3
-android.icu.dev.test.collator.G7CollationTest#TestDemo4
-android.icu.dev.test.collator.LotusCollationKoreanTest#TestTertiary
-android.icu.dev.test.collator.UCAConformanceTest#TestRulesNonIgnorable
-android.icu.dev.test.collator.UCAConformanceTest#TestRulesShifted
-android.icu.dev.test.collator.UCAConformanceTest#TestTableNonIgnorable
-android.icu.dev.test.collator.UCAConformanceTest#TestTableShifted
-android.icu.dev.test.compression.DecompressionTest#TestDecompress
-android.icu.dev.test.compression.DecompressionTest#TestDecompression
-android.icu.dev.test.compression.ExhaustiveTest#testIterative
-android.icu.dev.test.compression.ExhaustiveTest#testMultipass
-android.icu.dev.test.compression.ExhaustiveTest#testSimple
-android.icu.dev.test.duration.DataReadWriteTest#testBool
-android.icu.dev.test.duration.DataReadWriteTest#testBoolArray
-android.icu.dev.test.duration.DataReadWriteTest#testCharacter
-android.icu.dev.test.duration.DataReadWriteTest#testCharacterArray
-android.icu.dev.test.duration.DataReadWriteTest#testNamedIndex
-android.icu.dev.test.duration.DataReadWriteTest#testNamedIndexArray
-android.icu.dev.test.duration.DataReadWriteTest#testOmittedFields
-android.icu.dev.test.duration.DataReadWriteTest#testOpenClose
-android.icu.dev.test.duration.DataReadWriteTest#testString
-android.icu.dev.test.duration.DataReadWriteTest#testStringArray
-android.icu.dev.test.duration.DataReadWriteTest#testStringTable
-android.icu.dev.test.duration.ICUDurationTest#TestBadLocaleError
-android.icu.dev.test.duration.ICUDurationTest#TestBadObjectError
-android.icu.dev.test.duration.ICUDurationTest#TestBasics
-android.icu.dev.test.duration.ICUDurationTest#TestDurationFormat
-android.icu.dev.test.duration.ICUDurationTest#TestFromNowTo
-android.icu.dev.test.duration.ICUDurationTest#TestResourceWithCalendar
-android.icu.dev.test.duration.ICUDurationTest#TestSimpleXMLDuration
-android.icu.dev.test.duration.ICUDurationTest#TestXMLDuration
-android.icu.dev.test.duration.languages.Test_en#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_en#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_en#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_en#testHalfUnits
-android.icu.dev.test.duration.languages.Test_en#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_en#testMediumForms
-android.icu.dev.test.duration.languages.Test_en#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_en#testShortForms
-android.icu.dev.test.duration.languages.Test_es#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_es#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_es#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_es#testHalfUnits
-android.icu.dev.test.duration.languages.Test_es#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_es#testMediumForms
-android.icu.dev.test.duration.languages.Test_es#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_es#testShortForms
-android.icu.dev.test.duration.languages.Test_fr#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_fr#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_fr#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_fr#testHalfUnits
-android.icu.dev.test.duration.languages.Test_fr#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_fr#testMediumForms
-android.icu.dev.test.duration.languages.Test_fr#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_fr#testShortForms
-android.icu.dev.test.duration.languages.Test_he_IL#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_he_IL#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_he_IL#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_he_IL#testHalfUnits
-android.icu.dev.test.duration.languages.Test_he_IL#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_he_IL#testMediumForms
-android.icu.dev.test.duration.languages.Test_he_IL#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_he_IL#testShortForms
-android.icu.dev.test.duration.languages.Test_hi#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_hi#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_hi#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_hi#testHalfUnits
-android.icu.dev.test.duration.languages.Test_hi#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_hi#testMediumForms
-android.icu.dev.test.duration.languages.Test_hi#testMonthNames
-android.icu.dev.test.duration.languages.Test_hi#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_hi#testShortForms
-android.icu.dev.test.duration.languages.Test_it#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_it#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_it#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_it#testHalfUnits
-android.icu.dev.test.duration.languages.Test_it#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_it#testMediumForms
-android.icu.dev.test.duration.languages.Test_it#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_it#testShortForms
-android.icu.dev.test.duration.languages.Test_ja#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_ja#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_ja#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_ja#testHalfUnits
-android.icu.dev.test.duration.languages.Test_ja#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_ja#testMediumForms
-android.icu.dev.test.duration.languages.Test_ja#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_ja#testNoMillis
-android.icu.dev.test.duration.languages.Test_ja#testOmitZeros
-android.icu.dev.test.duration.languages.Test_ja#testShortForms
-android.icu.dev.test.duration.languages.Test_ko#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_ko#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_ko#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_ko#testHalfUnits
-android.icu.dev.test.duration.languages.Test_ko#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_ko#testMediumForms
-android.icu.dev.test.duration.languages.Test_ko#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_ko#testShortForms
-android.icu.dev.test.duration.languages.Test_zh_Hans_SG#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_zh_Hans_SG#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_zh_Hans_SG#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_zh_Hans_SG#testHalfUnits
-android.icu.dev.test.duration.languages.Test_zh_Hans_SG#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_zh_Hans_SG#testMediumForms
-android.icu.dev.test.duration.languages.Test_zh_Hans_SG#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_zh_Hans_SG#testShortForms
-android.icu.dev.test.duration.languages.Test_zh_Hans#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_zh_Hans#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_zh_Hans#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_zh_Hans#testHalfUnits
-android.icu.dev.test.duration.languages.Test_zh_Hans#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_zh_Hans#testMediumForms
-android.icu.dev.test.duration.languages.Test_zh_Hans#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_zh_Hans#testShortForms
-android.icu.dev.test.duration.languages.Test_zh_Hant_HK#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_zh_Hant_HK#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_zh_Hant_HK#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_zh_Hant_HK#testHalfUnits
-android.icu.dev.test.duration.languages.Test_zh_Hant_HK#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_zh_Hant_HK#testMediumForms
-android.icu.dev.test.duration.languages.Test_zh_Hant_HK#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_zh_Hant_HK#testShortForms
-android.icu.dev.test.duration.languages.Test_zh_Hant#testCustomMinutes
-android.icu.dev.test.duration.languages.Test_zh_Hant#testFractionalUnits
-android.icu.dev.test.duration.languages.Test_zh_Hant#testFullPluralizedForms
-android.icu.dev.test.duration.languages.Test_zh_Hant#testHalfUnits
-android.icu.dev.test.duration.languages.Test_zh_Hant#testLimitedUnits
-android.icu.dev.test.duration.languages.Test_zh_Hant#testMediumForms
-android.icu.dev.test.duration.languages.Test_zh_Hant#testMultipleUnits
-android.icu.dev.test.duration.languages.Test_zh_Hant#testShortForms
-android.icu.dev.test.duration.PeriodBuilderFactoryTest#testBuilderFactoryPeriodConstruction
-android.icu.dev.test.duration.PeriodBuilderFactoryTest#testSetAvailableUnitRange
-android.icu.dev.test.duration.PeriodBuilderFactoryTest#testSetUnitIsAvailable
-android.icu.dev.test.duration.PeriodTest#testAnd
-android.icu.dev.test.duration.PeriodTest#testFuturePast
-android.icu.dev.test.duration.PeriodTest#testInvalidCount
-android.icu.dev.test.duration.PeriodTest#testIsSet
-android.icu.dev.test.duration.PeriodTest#testMoreLessThan
-android.icu.dev.test.duration.ResourceBasedPeriodFormatterDataServiceTest#testAvailable
-android.icu.dev.test.format.BigNumberFormatTest#Test4161100
-android.icu.dev.test.format.BigNumberFormatTest#TestAlphaBigDecimal
-android.icu.dev.test.format.BigNumberFormatTest#TestBigDecimalJ28
-android.icu.dev.test.format.BigNumberFormatTest#TestBigDecimalRounding
-android.icu.dev.test.format.BigNumberFormatTest#TestExponent
-android.icu.dev.test.format.BigNumberFormatTest#TestPad
-android.icu.dev.test.format.BigNumberFormatTest#TestPatterns
-android.icu.dev.test.format.BigNumberFormatTest#TestScientific
-android.icu.dev.test.format.BigNumberFormatTest#TestSecondaryGrouping
-android.icu.dev.test.format.CompactDecimalFormatTest#TestACoreCompactFormat
-android.icu.dev.test.format.CompactDecimalFormatTest#TestArabicLongStyle
-android.icu.dev.test.format.CompactDecimalFormatTest#TestCharacterIterator
-android.icu.dev.test.format.CompactDecimalFormatTest#TestCsShort
-android.icu.dev.test.format.CompactDecimalFormatTest#TestDefaultSignificantDigits
-android.icu.dev.test.format.CompactDecimalFormatTest#TestEnglishShort
-android.icu.dev.test.format.CompactDecimalFormatTest#TestEquals
-android.icu.dev.test.format.CompactDecimalFormatTest#TestFieldPosition
-android.icu.dev.test.format.CompactDecimalFormatTest#TestJapaneseShort
-android.icu.dev.test.format.CompactDecimalFormatTest#TestSerbianLong
-android.icu.dev.test.format.CompactDecimalFormatTest#TestSerbianLongNegative
-android.icu.dev.test.format.CompactDecimalFormatTest#TestSerbianShort
-android.icu.dev.test.format.CompactDecimalFormatTest#TestSkLong
-android.icu.dev.test.format.CompactDecimalFormatTest#TestSwahiliShort
-android.icu.dev.test.format.CompactDecimalFormatTest#TestSwahiliShortNegative
-android.icu.dev.test.format.DataDrivenFormatTest#TestConsistentPivot
-android.icu.dev.test.format.DataDrivenFormatTest#TestDateFormatBasic
-android.icu.dev.test.format.DataDrivenFormatTest#TestFormatRelative
-android.icu.dev.test.format.DataDrivenFormatTest#TestHebrew
-android.icu.dev.test.format.DataDrivenFormatTest#TestMoreDateParse
-android.icu.dev.test.format.DataDrivenFormatTest#TestYearLengths
-android.icu.dev.test.format.DateFormatMiscTests#Test4097450
-android.icu.dev.test.format.DateFormatMiscTests#Test4099975new
-android.icu.dev.test.format.DateFormatMiscTests#Test4117335
-android.icu.dev.test.format.DateFormatRegressionTestJ#Test4103926
-android.icu.dev.test.format.DateFormatRegressionTestJ#Test4148168
-android.icu.dev.test.format.DateFormatRegressionTestJ#Test4213086
-android.icu.dev.test.format.DateFormatRegressionTestJ#Test4250359
-android.icu.dev.test.format.DateFormatRegressionTestJ#Test4253490
-android.icu.dev.test.format.DateFormatRegressionTestJ#Test4266432
-android.icu.dev.test.format.DateFormatRegressionTestJ#Test4358730
-android.icu.dev.test.format.DateFormatRegressionTestJ#Test4375399
-android.icu.dev.test.format.DateFormatRegressionTestJ#Test4468663
-android.icu.dev.test.format.DateFormatRegressionTest#Test4029195
-android.icu.dev.test.format.DateFormatRegressionTest#Test4052408
-android.icu.dev.test.format.DateFormatRegressionTest#Test4056591
-android.icu.dev.test.format.DateFormatRegressionTest#Test4059917
-android.icu.dev.test.format.DateFormatRegressionTest#Test4060212
-android.icu.dev.test.format.DateFormatRegressionTest#Test4061287
-android.icu.dev.test.format.DateFormatRegressionTest#Test4065240
-android.icu.dev.test.format.DateFormatRegressionTest#Test4071441
-android.icu.dev.test.format.DateFormatRegressionTest#Test4073003
-android.icu.dev.test.format.DateFormatRegressionTest#Test4089106
-android.icu.dev.test.format.DateFormatRegressionTest#Test4100302
-android.icu.dev.test.format.DateFormatRegressionTest#Test4101483
-android.icu.dev.test.format.DateFormatRegressionTest#Test4103340
-android.icu.dev.test.format.DateFormatRegressionTest#Test4103341
-android.icu.dev.test.format.DateFormatRegressionTest#Test4104136
-android.icu.dev.test.format.DateFormatRegressionTest#Test4104522
-android.icu.dev.test.format.DateFormatRegressionTest#Test4106807
-android.icu.dev.test.format.DateFormatRegressionTest#Test4108407
-android.icu.dev.test.format.DateFormatRegressionTest#Test4134203
-android.icu.dev.test.format.DateFormatRegressionTest#Test4151631
-android.icu.dev.test.format.DateFormatRegressionTest#Test4151706
-android.icu.dev.test.format.DateFormatRegressionTest#Test4162071
-android.icu.dev.test.format.DateFormatRegressionTest#Test4182066
-android.icu.dev.test.format.DateFormatRegressionTest#Test4210209
-android.icu.dev.test.format.DateFormatRegressionTest#Test5006GetShortMonths
-android.icu.dev.test.format.DateFormatRegressionTest#Test714
-android.icu.dev.test.format.DateFormatRegressionTest#TestDangiFormat
-android.icu.dev.test.format.DateFormatRegressionTest#Test_GEec
-android.icu.dev.test.format.DateFormatRegressionTest#TestHindiArabicDigits
-android.icu.dev.test.format.DateFormatRegressionTest#TestParsing
-android.icu.dev.test.format.DateFormatRegressionTest#TestT10110
-android.icu.dev.test.format.DateFormatRegressionTest#TestT10239
-android.icu.dev.test.format.DateFormatRegressionTest#TestT10334
-android.icu.dev.test.format.DateFormatRegressionTest#TestT10619
-android.icu.dev.test.format.DateFormatRegressionTest#TestT10906
-android.icu.dev.test.format.DateFormatRegressionTest#TestT11363
-android.icu.dev.test.format.DateFormatRegressionTest#TestT5683
-android.icu.dev.test.format.DateFormatRoundTripTest#TestDateFormatRoundTrip
-android.icu.dev.test.format.DateFormatTest#Test10632
-android.icu.dev.test.format.DateFormatTest#Test6880
-android.icu.dev.test.format.DateFormatTest#TestBadInput135
-android.icu.dev.test.format.DateFormatTest#TestBadInput135a
-android.icu.dev.test.format.DateFormatTest#TestCalendarType
-android.icu.dev.test.format.DateFormatTest#TestChineseDateFormatLocalizedPatternChars
-android.icu.dev.test.format.DateFormatTest#TestChineseDateFormatSymbols
-android.icu.dev.test.format.DateFormatTest#TestContext
-android.icu.dev.test.format.DateFormatTest#TestCoverage
-android.icu.dev.test.format.DateFormatTest#TestCzechMonths459
-android.icu.dev.test.format.DateFormatTest#TestDateFormatCalendar
-android.icu.dev.test.format.DateFormatTest#TestDateFormatLeniency
-android.icu.dev.test.format.DateFormatTest#TestDateFormatNone
-android.icu.dev.test.format.DateFormatTest#TestDateFormatZone061
-android.icu.dev.test.format.DateFormatTest#TestDateFormatZone146
-android.icu.dev.test.format.DateFormatTest#TestDayOfYearPattern195
-android.icu.dev.test.format.DateFormatTest#TestDotAndAtLeniency
-android.icu.dev.test.format.DateFormatTest#TestEquals
-android.icu.dev.test.format.DateFormatTest#TestEras
-android.icu.dev.test.format.DateFormatTest#TestErrorChecking
-android.icu.dev.test.format.DateFormatTest#TestExactCountFormat
-android.icu.dev.test.format.DateFormatTest#TestFieldPosition
-android.icu.dev.test.format.DateFormatTest#TestFormalChineseDate
-android.icu.dev.test.format.DateFormatTest#TestFormattingLocaleTimeSeparator
-android.icu.dev.test.format.DateFormatTest#TestFormatToCharacterIterator
-android.icu.dev.test.format.DateFormatTest#TestFormatToCharacterIteratorCoverage
-android.icu.dev.test.format.DateFormatTest#TestGeneral
-android.icu.dev.test.format.DateFormatTest#TestGenericTime
-android.icu.dev.test.format.DateFormatTest#TestGenericTimeZoneOrder
-android.icu.dev.test.format.DateFormatTest#TestGetPatternInstance
-android.icu.dev.test.format.DateFormatTest#TestGMTParsing
-android.icu.dev.test.format.DateFormatTest#TestGreekMay
-android.icu.dev.test.format.DateFormatTest#TestInvalidPattern
-android.icu.dev.test.format.DateFormatTest#TestISOEra
-android.icu.dev.test.format.DateFormatTest#TestLetterDPattern212
-android.icu.dev.test.format.DateFormatTest#TestLocaleDateFormat
-android.icu.dev.test.format.DateFormatTest#TestLongContiguousNumericPattern
-android.icu.dev.test.format.DateFormatTest#TestLongNumericPattern
-android.icu.dev.test.format.DateFormatTest#TestMonthPatterns
-android.icu.dev.test.format.DateFormatTest#TestNarrowNames
-android.icu.dev.test.format.DateFormatTest#TestNonGregoFmtParse
-android.icu.dev.test.format.DateFormatTest#TestOfCalendarField
-android.icu.dev.test.format.DateFormatTest#TestOverrideNumberForamt
-android.icu.dev.test.format.DateFormatTest#TestParseLeniencyAPIs
-android.icu.dev.test.format.DateFormatTest#TestParseMultiPatternMatch
-android.icu.dev.test.format.DateFormatTest#TestParsePosition
-android.icu.dev.test.format.DateFormatTest#TestPartialParse994
-android.icu.dev.test.format.DateFormatTest#TestPatterns
-android.icu.dev.test.format.DateFormatTest#TestQuarters
-android.icu.dev.test.format.DateFormatTest#TestQuotePattern161
-android.icu.dev.test.format.DateFormatTest#TestRelativeDateFormat
-android.icu.dev.test.format.DateFormatTest#TestRoundtripWithCalendar
-android.icu.dev.test.format.DateFormatTest#TestRunTogetherPattern917
-android.icu.dev.test.format.DateFormatTest#TestRunTogetherPattern985
-android.icu.dev.test.format.DateFormatTest#TestShortDays
-android.icu.dev.test.format.DateFormatTest#TestSimpleDateFormatConstructor_String_String_ULocale
-android.icu.dev.test.format.DateFormatTest#TestSpaceParsing
-android.icu.dev.test.format.DateFormatTest#TestStandAloneDays
-android.icu.dev.test.format.DateFormatTest#TestStandAloneMonths
-android.icu.dev.test.format.DateFormatTest#TestTimeZoneDisplayName
-android.icu.dev.test.format.DateFormatTest#TestTwoDigitWOY
-android.icu.dev.test.format.DateFormatTest#TestTwoDigitYear
-android.icu.dev.test.format.DateFormatTest#TestTwoDigitYearDSTParse
-android.icu.dev.test.format.DateFormatTest#TestWallyWedel
-android.icu.dev.test.format.DateFormatTest#TestWhiteSpaceParsing
-android.icu.dev.test.format.DateIntervalFormatTest#TestClone
-android.icu.dev.test.format.DateIntervalFormatTest#TestCloseAsThawed
-android.icu.dev.test.format.DateIntervalFormatTest#TestConstructor
-android.icu.dev.test.format.DateIntervalFormatTest#TestDateIntervalCoverage
-android.icu.dev.test.format.DateIntervalFormatTest#TestDateIntervalInfoEquals
-android.icu.dev.test.format.DateIntervalFormatTest#TestFormat
-android.icu.dev.test.format.DateIntervalFormatTest#TestFormatCLDR
-android.icu.dev.test.format.DateIntervalFormatTest#TestFormatUserDII
-android.icu.dev.test.format.DateIntervalFormatTest#TestFPos_SkelWithSeconds
-android.icu.dev.test.format.DateIntervalFormatTest#TestGetIntervalPattern
-android.icu.dev.test.format.DateIntervalFormatTest#TestGetSetTimeZone
-android.icu.dev.test.format.DateIntervalFormatTest#TestHashCode
-android.icu.dev.test.format.DateIntervalFormatTest#TestIsFrozen
-android.icu.dev.test.format.DateIntervalFormatTest#TestPattternInfoEquals
-android.icu.dev.test.format.DateIntervalFormatTest#TestSetFallbackIntervalPattern
-android.icu.dev.test.format.DateIntervalFormatTest#TestSetIntervalPattern
-android.icu.dev.test.format.DateIntervalFormatTest#TestSetIntervalPatternNoSideEffect
-android.icu.dev.test.format.DateIntervalFormatTest#TestStress
-android.icu.dev.test.format.DateIntervalFormatTest#TestT6396
-android.icu.dev.test.format.DateIntervalFormatTest#TestTicket11583
-android.icu.dev.test.format.DateIntervalFormatTest#TestTicket9914
-android.icu.dev.test.format.DateIntervalFormatTest#TestTicket9919GetInstance
-android.icu.dev.test.format.DateIntervalFormatTest#TestTicket9919Setter
-android.icu.dev.test.format.DateTimeGeneratorTest#TestAllFieldPatterns
-android.icu.dev.test.format.DateTimeGeneratorTest#TestBasic
-android.icu.dev.test.format.DateTimeGeneratorTest#TestCheckFrozen
-android.icu.dev.test.format.DateTimeGeneratorTest#TestClone
-android.icu.dev.test.format.DateTimeGeneratorTest#TestEmpty
-android.icu.dev.test.format.DateTimeGeneratorTest#TestFreezeAndCloneAsThawed
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetAppendItemFormat
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetAppendItemName
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetBaseSkeleton
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetBaseSkeletons
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetDecimal
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetFields
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetInstance
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetRedundants
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetSkeleton
-android.icu.dev.test.format.DateTimeGeneratorTest#TestGetSkeletons
-android.icu.dev.test.format.DateTimeGeneratorTest#TestHasDateAndTimeFields
-android.icu.dev.test.format.DateTimeGeneratorTest#TestIsSingleField
-android.icu.dev.test.format.DateTimeGeneratorTest#TestJavaLocale
-android.icu.dev.test.format.DateTimeGeneratorTest#TestOptions
-android.icu.dev.test.format.DateTimeGeneratorTest#TestOrdering
-android.icu.dev.test.format.DateTimeGeneratorTest#TestPatternParser
-android.icu.dev.test.format.DateTimeGeneratorTest#TestReplacingZoneString
-android.icu.dev.test.format.DateTimeGeneratorTest#TestRoot
-android.icu.dev.test.format.DateTimeGeneratorTest#TestSet
-android.icu.dev.test.format.DateTimeGeneratorTest#TestSimple
-android.icu.dev.test.format.DateTimeGeneratorTest#TestT7169
-android.icu.dev.test.format.DateTimeGeneratorTest#TestToString
-android.icu.dev.test.format.DateTimeGeneratorTest#TestVariableCharacters
-android.icu.dev.test.format.DateTimeGeneratorTest#TestVariableField_String
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestBreakIterator
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestCalendar
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestCollator
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestCurrency
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestDateFormat
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestDefault
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestDisplayName
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestFreezable
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestJB5380
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestNumberFormat
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestResourceBundle
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestSetLocales
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestTerritory
-android.icu.dev.test.format.GlobalizationPreferencesTest#TestTimeZone
-android.icu.dev.test.format.IntlTestDateFormatAPIC#TestNameHiding
-android.icu.dev.test.format.IntlTestDateFormatAPI#TestAPI
-android.icu.dev.test.format.IntlTestDateFormatAPI#TestEquals
-android.icu.dev.test.format.IntlTestDateFormatSymbols#TestConstructorWithCalendar
-android.icu.dev.test.format.IntlTestDateFormatSymbols#TestGetEraNames
-android.icu.dev.test.format.IntlTestDateFormatSymbols#TestGetMonths
-android.icu.dev.test.format.IntlTestDateFormatSymbols#TestGetMonths2
-android.icu.dev.test.format.IntlTestDateFormatSymbols#TestGetWeekdays2
-android.icu.dev.test.format.IntlTestDateFormatSymbols#TestSymbols
-android.icu.dev.test.format.IntlTestDateFormat#TestAvailableLocales
-android.icu.dev.test.format.IntlTestDateFormat#TestFormat
-android.icu.dev.test.format.IntlTestDateFormat#TestRoundtrip
-android.icu.dev.test.format.IntlTestDateFormat#TestULocale
-android.icu.dev.test.format.IntlTestDecimalFormatAPIC#TestAPI
-android.icu.dev.test.format.IntlTestDecimalFormatAPIC#testFormatToCharacterIterator
-android.icu.dev.test.format.IntlTestDecimalFormatAPIC#TestRounding
-android.icu.dev.test.format.IntlTestDecimalFormatAPI#TestAPI
-android.icu.dev.test.format.IntlTestDecimalFormatAPI#testJB1871
-android.icu.dev.test.format.IntlTestDecimalFormatAPI#testJB4971
-android.icu.dev.test.format.IntlTestDecimalFormatAPI#testJB6134
-android.icu.dev.test.format.IntlTestDecimalFormatAPI#testJB6354
-android.icu.dev.test.format.IntlTestDecimalFormatAPI#testJB6648
-android.icu.dev.test.format.IntlTestDecimalFormatSymbolsC#TestSymbols
-android.icu.dev.test.format.IntlTestDecimalFormatSymbols#testCoverage
-android.icu.dev.test.format.IntlTestDecimalFormatSymbols#TestSymbols
-android.icu.dev.test.format.IntlTestNumberFormatAPI#TestAPI
-android.icu.dev.test.format.IntlTestNumberFormatAPI#TestCoverage
-android.icu.dev.test.format.IntlTestNumberFormat#TestAvailableLocales
-android.icu.dev.test.format.IntlTestNumberFormat#TestLocale
-android.icu.dev.test.format.IntlTestNumberFormat#TestMonster
-android.icu.dev.test.format.IntlTestSimpleDateFormatAPI#TestAPI
-android.icu.dev.test.format.IntlTestSimpleDateFormatAPI#TestCoverage
-android.icu.dev.test.format.ListFormatterTest#Test9946
-android.icu.dev.test.format.ListFormatterTest#TestBasic
-android.icu.dev.test.format.ListFormatterTest#TestCreatePatternForNumItems
-android.icu.dev.test.format.ListFormatterTest#TestEnglish
-android.icu.dev.test.format.ListFormatterTest#TestFromList
-android.icu.dev.test.format.ListFormatterTest#TestGetLocale
-android.icu.dev.test.format.ListFormatterTest#TestGetPatternForNumItemsException
-android.icu.dev.test.format.ListFormatterTest#TestJapanese
-android.icu.dev.test.format.ListFormatterTest#TestPatternOutOfOrder
-android.icu.dev.test.format.ListFormatterTest#TestSpecial
-android.icu.dev.test.format.MeasureUnitTest#Test10219FractionalPlurals
-android.icu.dev.test.format.MeasureUnitTest#testAUnit
-android.icu.dev.test.format.MeasureUnitTest#TestCompatible53_1
-android.icu.dev.test.format.MeasureUnitTest#TestCompatible54_1
-android.icu.dev.test.format.MeasureUnitTest#TestCompatible55_1
-android.icu.dev.test.format.MeasureUnitTest#TestCompatible56_1
-android.icu.dev.test.format.MeasureUnitTest#testCurrencies
-android.icu.dev.test.format.MeasureUnitTest#testCurrencyFormatLocale
-android.icu.dev.test.format.MeasureUnitTest#testCurrencyFormatStandInForMeasureFormat
-android.icu.dev.test.format.MeasureUnitTest#testDoubleZero
-android.icu.dev.test.format.MeasureUnitTest#testEqHashCode
-android.icu.dev.test.format.MeasureUnitTest#testEqHashCodeOfMeasure
-android.icu.dev.test.format.MeasureUnitTest#TestExamplesInDocs
-android.icu.dev.test.format.MeasureUnitTest#testFieldPosition
-android.icu.dev.test.format.MeasureUnitTest#testFieldPositionMultiple
-android.icu.dev.test.format.MeasureUnitTest#testFormatMeasuresOneArg
-android.icu.dev.test.format.MeasureUnitTest#testFormatMeasuresZeroArg
-android.icu.dev.test.format.MeasureUnitTest#TestFormatPeriodEn
-android.icu.dev.test.format.MeasureUnitTest#testFormatSingleArg
-android.icu.dev.test.format.MeasureUnitTest#testGetLocale
-android.icu.dev.test.format.MeasureUnitTest#testGram
-android.icu.dev.test.format.MeasureUnitTest#TestGreek
-android.icu.dev.test.format.MeasureUnitTest#testIndividualPluralFallback
-android.icu.dev.test.format.MeasureUnitTest#testMultiples
-android.icu.dev.test.format.MeasureUnitTest#testNumeratorPlurals
-android.icu.dev.test.format.MeasureUnitTest#testOldFormatBadArg
-android.icu.dev.test.format.MeasureUnitTest#testOldFormatWithArray
-android.icu.dev.test.format.MeasureUnitTest#testOldFormatWithList
-android.icu.dev.test.format.MeasureUnitTest#testParseObject
-android.icu.dev.test.format.MeasureUnitTest#TestSerial
-android.icu.dev.test.format.MeasureUnitTest#TestSerialFormatWidthEnum
-android.icu.dev.test.format.MeasureUnitTest#testSimplePer
-android.icu.dev.test.format.MeasureUnitTest#testUnitPerUnitResolution
-android.icu.dev.test.format.MessagePatternUtilTest#TestChoiceArg
-android.icu.dev.test.format.MessagePatternUtilTest#TestComplexArgs
-android.icu.dev.test.format.MessagePatternUtilTest#TestHello
-android.icu.dev.test.format.MessagePatternUtilTest#TestHelloWithApos
-android.icu.dev.test.format.MessagePatternUtilTest#TestHelloWithQuote
-android.icu.dev.test.format.MessagePatternUtilTest#TestNoneArg
-android.icu.dev.test.format.MessagePatternUtilTest#TestPluralArg
-android.icu.dev.test.format.MessagePatternUtilTest#TestPluralVariantsByType
-android.icu.dev.test.format.MessagePatternUtilTest#TestSelectArg
-android.icu.dev.test.format.MessagePatternUtilTest#TestSelectOrdinalArg
-android.icu.dev.test.format.MessagePatternUtilTest#TestSelectVariantsByType
-android.icu.dev.test.format.MessagePatternUtilTest#TestSimpleArg
-android.icu.dev.test.format.MessageRegression#Test4031438
-android.icu.dev.test.format.MessageRegression#Test4052223
-android.icu.dev.test.format.MessageRegression#Test4074764
-android.icu.dev.test.format.MessageRegression#Test4094906
-android.icu.dev.test.format.MessageRegression#Test4104976
-android.icu.dev.test.format.MessageRegression#Test4105380
-android.icu.dev.test.format.MessageRegression#Test4106659
-android.icu.dev.test.format.MessageRegression#Test4106660
-android.icu.dev.test.format.MessageRegression#Test4106661
-android.icu.dev.test.format.MessageRegression#Test4111739
-android.icu.dev.test.format.MessageRegression#Test4112104
-android.icu.dev.test.format.MessageRegression#Test4113018
-android.icu.dev.test.format.MessageRegression#Test4114739
-android.icu.dev.test.format.MessageRegression#Test4114743
-android.icu.dev.test.format.MessageRegression#Test4116444
-android.icu.dev.test.format.MessageRegression#Test4118592
-android.icu.dev.test.format.MessageRegression#Test4118594
-android.icu.dev.test.format.MessageRegression#Test4120552
-android.icu.dev.test.format.MessageRegression#Test4142938
-android.icu.dev.test.format.MessageRegression#Test4169959
-android.icu.dev.test.format.MessageRegression#test4232154
-android.icu.dev.test.format.MessageRegression#test4293229
-android.icu.dev.test.format.MessageRegression#testBugTestsWithNamesArguments
-android.icu.dev.test.format.MessageRegression#TestChoicePatternQuote
-android.icu.dev.test.format.MessageRegression#TestSerialization
-android.icu.dev.test.format.NumberFormatRegistrationTest#TestRegistration
-android.icu.dev.test.format.NumberFormatRegressionTest#Test4161100
-android.icu.dev.test.format.NumberFormatRegressionTest#Test4408066
-android.icu.dev.test.format.NumberFormatRegressionTest#TestJ691
-android.icu.dev.test.format.NumberFormatRegressionTest#TestJB5509
-android.icu.dev.test.format.NumberFormatRegressionTest#TestNBSPInPattern
-android.icu.dev.test.format.NumberFormatRegressionTest#TestSurrogatesParsing
-android.icu.dev.test.format.NumberFormatRegressionTest#TestT5698
-android.icu.dev.test.format.NumberFormatRegressionTest#TestT9293
-android.icu.dev.test.format.NumberFormatRoundTripTest#TestNumberFormatRoundTrip
-android.icu.dev.test.format.NumberFormatSpecificationTest#TestBasicPatterns
-android.icu.dev.test.format.NumberFormatSpecificationTest#TestNfSetters
-android.icu.dev.test.format.NumberFormatSpecificationTest#TestPadding
-android.icu.dev.test.format.NumberFormatSpecificationTest#TestPercent
-android.icu.dev.test.format.NumberFormatSpecificationTest#TestPerMilli
-android.icu.dev.test.format.NumberFormatSpecificationTest#TestRounding
-android.icu.dev.test.format.NumberFormatSpecificationTest#TestScientificNotation
-android.icu.dev.test.format.NumberFormatSpecificationTest#TestSignificantDigits
-android.icu.dev.test.format.NumberFormatTest#Test10419RoundingWith0FractionDigits
-android.icu.dev.test.format.NumberFormatTest#Test6816
-android.icu.dev.test.format.NumberFormatTest#TestAccountingCurrency
-android.icu.dev.test.format.NumberFormatTest#TestBigDecimalRounding
-android.icu.dev.test.format.NumberFormatTest#TestBug9936
-android.icu.dev.test.format.NumberFormatTest#TestCases
-android.icu.dev.test.format.NumberFormatTest#TestCompatibleCurrencies
-android.icu.dev.test.format.NumberFormatTest#TestComplexCurrency
-android.icu.dev.test.format.NumberFormatTest#TestContext
-android.icu.dev.test.format.NumberFormatTest#TestCoverage
-android.icu.dev.test.format.NumberFormatTest#TestCurrency
-android.icu.dev.test.format.NumberFormatTest#TestCurrencyAmountCoverage
-android.icu.dev.test.format.NumberFormatTest#TestCurrencyFormatForMixParsing
-android.icu.dev.test.format.NumberFormatTest#TestCurrencyFractionDigits
-android.icu.dev.test.format.NumberFormatTest#TestCurrencyIsoPluralFormat
-android.icu.dev.test.format.NumberFormatTest#TestCurrencyKeyword
-android.icu.dev.test.format.NumberFormatTest#TestCurrencyObject
-android.icu.dev.test.format.NumberFormatTest#TestCurrencyPatterns
-android.icu.dev.test.format.NumberFormatTest#TestCurrencyPlurals
-android.icu.dev.test.format.NumberFormatTest#TestCurrencySign
-android.icu.dev.test.format.NumberFormatTest#TestCurrencyUsage
-android.icu.dev.test.format.NumberFormatTest#TestCurrFmtNegSameAsPositive
-android.icu.dev.test.format.NumberFormatTest#TestCustomCurrencySignAndSeparator
-android.icu.dev.test.format.NumberFormatTest#TestDataDrivenICU
-android.icu.dev.test.format.NumberFormatTest#TestDecimalFormatCurrencyParse
-android.icu.dev.test.format.NumberFormatTest#TestExplicitParents
-android.icu.dev.test.format.NumberFormatTest#TestExponent
-android.icu.dev.test.format.NumberFormatTest#TestExponential
-android.icu.dev.test.format.NumberFormatTest#TestExponentParse
-android.icu.dev.test.format.NumberFormatTest#TestFieldPositionCurrency
-android.icu.dev.test.format.NumberFormatTest#TestFieldPositionDecimal
-android.icu.dev.test.format.NumberFormatTest#TestFieldPositionFraction
-android.icu.dev.test.format.NumberFormatTest#TestFieldPositionFractionButInteger
-android.icu.dev.test.format.NumberFormatTest#TestFieldPositionInteger
-android.icu.dev.test.format.NumberFormatTest#TestFormat
-android.icu.dev.test.format.NumberFormatTest#TestFormatAbstractImplCoverage
-android.icu.dev.test.format.NumberFormatTest#TestFormatToCharacterIteratorIssue11805
-android.icu.dev.test.format.NumberFormatTest#TestFormatToCharacterIteratorThread
-android.icu.dev.test.format.NumberFormatTest#TestGetAvailableLocales
-android.icu.dev.test.format.NumberFormatTest#TestGetInstance
-android.icu.dev.test.format.NumberFormatTest#TestIllegalPatterns
-android.icu.dev.test.format.NumberFormatTest#TestJB3832
-android.icu.dev.test.format.NumberFormatTest#TestJB5251
-android.icu.dev.test.format.NumberFormatTest#TestJB5358
-android.icu.dev.test.format.NumberFormatTest#TestLenientSymbolParsing
-android.icu.dev.test.format.NumberFormatTest#TestMiscCurrencyParsing
-android.icu.dev.test.format.NumberFormatTest#TestMultiCurrencySign
-android.icu.dev.test.format.NumberFormatTest#TestNegZeroRounding
-android.icu.dev.test.format.NumberFormatTest#TestNumberFormatFactory
-android.icu.dev.test.format.NumberFormatTest#TestNumberFormatTestTupleToString
-android.icu.dev.test.format.NumberFormatTest#TestNumberingSystemCoverage
-android.icu.dev.test.format.NumberFormatTest#TestNumberingSystems
-android.icu.dev.test.format.NumberFormatTest#TestPad
-android.icu.dev.test.format.NumberFormatTest#TestParse
-android.icu.dev.test.format.NumberFormatTest#TestParseCurrency
-android.icu.dev.test.format.NumberFormatTest#TestParseCurrencyTrailingSymbol
-android.icu.dev.test.format.NumberFormatTest#TestParseMaxDigits
-android.icu.dev.test.format.NumberFormatTest#TestParseNegativeWithAlternativeMinusSign
-android.icu.dev.test.format.NumberFormatTest#TestParseNegativeWithFaLocale
-android.icu.dev.test.format.NumberFormatTest#TestParseRequiredDecimalPoint
-android.icu.dev.test.format.NumberFormatTest#TestParseReturnType
-android.icu.dev.test.format.NumberFormatTest#TestParseSignsAndMarks
-android.icu.dev.test.format.NumberFormatTest#TestPatterns
-android.icu.dev.test.format.NumberFormatTest#TestPatterns2
-android.icu.dev.test.format.NumberFormatTest#TestPerMill
-android.icu.dev.test.format.NumberFormatTest#TestQuotes
-android.icu.dev.test.format.NumberFormatTest#TestRegistration
-android.icu.dev.test.format.NumberFormatTest#TestRounding
-android.icu.dev.test.format.NumberFormatTest#TestRounding487
-android.icu.dev.test.format.NumberFormatTest#TestRoundingBehavior
-android.icu.dev.test.format.NumberFormatTest#TestRoundingMode
-android.icu.dev.test.format.NumberFormatTest#TestRoundingPattern
-android.icu.dev.test.format.NumberFormatTest#TestRoundingScientific10542
-android.icu.dev.test.format.NumberFormatTest#TestRoundUnnecessarytIssue11808
-android.icu.dev.test.format.NumberFormatTest#TestScientific
-android.icu.dev.test.format.NumberFormatTest#TestScientific2
-android.icu.dev.test.format.NumberFormatTest#TestScientificGrouping
-android.icu.dev.test.format.NumberFormatTest#TestSecondaryGrouping
-android.icu.dev.test.format.NumberFormatTest#TestSetCurrency
-android.icu.dev.test.format.NumberFormatTest#TestSetMinimumIntegerDigits
-android.icu.dev.test.format.NumberFormatTest#TestShowZero
-android.icu.dev.test.format.NumberFormatTest#TestSignificantDigits
-android.icu.dev.test.format.NumberFormatTest#TestSimpleNumberFormatFactory
-android.icu.dev.test.format.NumberFormatTest#TestSpaceParsing
-android.icu.dev.test.format.NumberFormatTest#TestStrictParse
-android.icu.dev.test.format.NumberFormatTest#TestThreadedFormat
-android.icu.dev.test.format.NumberFormatTest#TestWhiteSpaceParsing
-android.icu.dev.test.format.NumberRegression#Test4052223
-android.icu.dev.test.format.NumberRegression#Test4059870
-android.icu.dev.test.format.NumberRegression#Test4061302
-android.icu.dev.test.format.NumberRegression#Test4062486
-android.icu.dev.test.format.NumberRegression#Test4066646
-android.icu.dev.test.format.NumberRegression#Test4068693
-android.icu.dev.test.format.NumberRegression#Test4069754
-android.icu.dev.test.format.NumberRegression#Test4070798
-android.icu.dev.test.format.NumberRegression#Test4071005
-android.icu.dev.test.format.NumberRegression#Test4071014
-android.icu.dev.test.format.NumberRegression#Test4071492
-android.icu.dev.test.format.NumberRegression#Test4071859
-android.icu.dev.test.format.NumberRegression#Test4074454
-android.icu.dev.test.format.NumberRegression#Test4074620
-android.icu.dev.test.format.NumberRegression#Test4075713
-android.icu.dev.test.format.NumberRegression#Test4083018
-android.icu.dev.test.format.NumberRegression#Test4086575
-android.icu.dev.test.format.NumberRegression#Test4087244
-android.icu.dev.test.format.NumberRegression#Test4087245
-android.icu.dev.test.format.NumberRegression#Test4087251
-android.icu.dev.test.format.NumberRegression#Test4087535
-android.icu.dev.test.format.NumberRegression#Test4088161
-android.icu.dev.test.format.NumberRegression#Test4088503
-android.icu.dev.test.format.NumberRegression#Test4090489
-android.icu.dev.test.format.NumberRegression#Test4090504
-android.icu.dev.test.format.NumberRegression#Test4092480
-android.icu.dev.test.format.NumberRegression#Test4092561
-android.icu.dev.test.format.NumberRegression#Test4093610
-android.icu.dev.test.format.NumberRegression#Test4095713
-android.icu.dev.test.format.NumberRegression#Test4098741
-android.icu.dev.test.format.NumberRegression#Test4099404
-android.icu.dev.test.format.NumberRegression#Test4101481
-android.icu.dev.test.format.NumberRegression#Test4106658
-android.icu.dev.test.format.NumberRegression#Test4106662
-android.icu.dev.test.format.NumberRegression#Test4106664
-android.icu.dev.test.format.NumberRegression#Test4106667
-android.icu.dev.test.format.NumberRegression#Test4108738
-android.icu.dev.test.format.NumberRegression#Test4110936
-android.icu.dev.test.format.NumberRegression#Test4114639
-android.icu.dev.test.format.NumberRegression#Test4122840
-android.icu.dev.test.format.NumberRegression#Test4125885
-android.icu.dev.test.format.NumberRegression#Test4134034
-android.icu.dev.test.format.NumberRegression#Test4134300
-android.icu.dev.test.format.NumberRegression#Test4140009
-android.icu.dev.test.format.NumberRegression#Test4141750
-android.icu.dev.test.format.NumberRegression#Test4145457
-android.icu.dev.test.format.NumberRegression#Test4147295
-android.icu.dev.test.format.NumberRegression#Test4147706
-android.icu.dev.test.format.NumberRegression#Test4162198
-android.icu.dev.test.format.NumberRegression#Test4162852
-android.icu.dev.test.format.NumberRegression#Test4167494
-android.icu.dev.test.format.NumberRegression#Test4170798
-android.icu.dev.test.format.NumberRegression#Test4176114
-android.icu.dev.test.format.NumberRegression#Test4179818
-android.icu.dev.test.format.NumberRegression#Test4185761
-android.icu.dev.test.format.NumberRegression#Test4212072
-android.icu.dev.test.format.NumberRegression#Test4216742
-android.icu.dev.test.format.NumberRegression#Test4217661
-android.icu.dev.test.format.NumberRegression#test4233840
-android.icu.dev.test.format.NumberRegression#test4241880
-android.icu.dev.test.format.NumberRegression#Test4243011
-android.icu.dev.test.format.NumberRegression#Test4243108
-android.icu.dev.test.format.NumberRegression#test4330377
-android.icu.dev.test.format.PluralFormatTest#TestEquals
-android.icu.dev.test.format.PluralFormatTest#TestGetLocale
-android.icu.dev.test.format.PluralFormatTest#TestGetPluralRules
-android.icu.dev.test.format.PluralFormatTest#TestOneFormLocales
-android.icu.dev.test.format.PluralFormatTest#TestPaucal1_234
-android.icu.dev.test.format.PluralFormatTest#TestPaucal1_2_34
-android.icu.dev.test.format.PluralFormatTest#TestPaucalExcept11_14
-android.icu.dev.test.format.PluralFormatTest#TestPaucalRu
-android.icu.dev.test.format.PluralFormatTest#TestSetLocale
-android.icu.dev.test.format.PluralFormatTest#TestSingular01Locales
-android.icu.dev.test.format.PluralFormatTest#TestSingular1Locales
-android.icu.dev.test.format.PluralFormatTest#TestSingularDual
-android.icu.dev.test.format.PluralFormatTest#TestSingularPaucal
-android.icu.dev.test.format.PluralFormatTest#TestSingularZeroSome
-android.icu.dev.test.format.PluralFormatTest#TestSpecial12_19
-android.icu.dev.test.format.PluralFormatTest#TestZeroSingularLocales
-android.icu.dev.test.format.PluralFormatUnitTest#TestApplyPatternAndFormat
-android.icu.dev.test.format.PluralFormatUnitTest#TestConstructor
-android.icu.dev.test.format.PluralFormatUnitTest#TestDecimals
-android.icu.dev.test.format.PluralFormatUnitTest#TestEquals
-android.icu.dev.test.format.PluralFormatUnitTest#TestExtendedPluralFormat
-android.icu.dev.test.format.PluralFormatUnitTest#TestExtendedPluralFormatParsing
-android.icu.dev.test.format.PluralFormatUnitTest#TestNegative
-android.icu.dev.test.format.PluralFormatUnitTest#TestOrdinalFormat
-android.icu.dev.test.format.PluralFormatUnitTest#TestParse
-android.icu.dev.test.format.PluralFormatUnitTest#TestPattern
-android.icu.dev.test.format.PluralFormatUnitTest#TestSamples
-android.icu.dev.test.format.PluralFormatUnitTest#TestSetLocale
-android.icu.dev.test.format.PluralRangesTest#TestBasic
-android.icu.dev.test.format.PluralRangesTest#TestFormatting
-android.icu.dev.test.format.PluralRangesTest#TestLocaleData
-android.icu.dev.test.format.PluralRangesTest#TestRangePattern
-android.icu.dev.test.format.PluralRulesTest#testAvailableULocales
-android.icu.dev.test.format.PluralRulesTest#TestBasicFraction
-android.icu.dev.test.format.PluralRulesTest#testBuiltInRules
-android.icu.dev.test.format.PluralRulesTest#TestCreateRules
-android.icu.dev.test.format.PluralRulesTest#testEquality
-android.icu.dev.test.format.PluralRulesTest#TestEquals
-android.icu.dev.test.format.PluralRulesTest#testFunctionalEquivalent
-android.icu.dev.test.format.PluralRulesTest#TestGetAllKeywordValues
-android.icu.dev.test.format.PluralRulesTest#TestGetSamples
-android.icu.dev.test.format.PluralRulesTest#TestGetUniqueKeywordValue
-android.icu.dev.test.format.PluralRulesTest#TestHashCode
-android.icu.dev.test.format.PluralRulesTest#testInequality
-android.icu.dev.test.format.PluralRulesTest#testJavaLocaleFactory
-android.icu.dev.test.format.PluralRulesTest#TestKeywords
-android.icu.dev.test.format.PluralRulesTest#TestLimitedAndSamplesConsistency
-android.icu.dev.test.format.PluralRulesTest#TestLocales
-android.icu.dev.test.format.PluralRulesTest#testOperands
-android.icu.dev.test.format.PluralRulesTest#TestOrdinal
-android.icu.dev.test.format.PluralRulesTest#TestParseDescription
-android.icu.dev.test.format.PluralRulesTest#testParseEmpty
-android.icu.dev.test.format.PluralRulesTest#testParsing
-android.icu.dev.test.format.PluralRulesTest#testSamples
-android.icu.dev.test.format.PluralRulesTest#TestSerial
-android.icu.dev.test.format.PluralRulesTest#TestSerialization
-android.icu.dev.test.format.PluralRulesTest#testSyntaxRestrictions
-android.icu.dev.test.format.PluralRulesTest#testUniqueRules
-android.icu.dev.test.format.RbnfLenientScannerTest#TestAllLocales
-android.icu.dev.test.format.RbnfLenientScannerTest#TestDefaultProvider
-android.icu.dev.test.format.RbnfLenientScannerTest#TestDurations
-android.icu.dev.test.format.RbnfLenientScannerTest#TestEnglishSpellout
-android.icu.dev.test.format.RbnfLenientScannerTest#TestFrenchSpellout
-android.icu.dev.test.format.RbnfLenientScannerTest#TestGermanSpellout
-android.icu.dev.test.format.RBNFParseTest#TestLenientParse
-android.icu.dev.test.format.RBNFParseTest#TestParse
-android.icu.dev.test.format.RbnfRoundTripTest#TestDurationsRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestDutchSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestEnglishSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestFrenchSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestGermanSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestGreekSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestHebrewNumberingRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestItalianSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestJapaneseSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestRussianSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestSpanishSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestSwedishSpelloutRT
-android.icu.dev.test.format.RbnfRoundTripTest#TestSwissFrenchSpelloutRT
-android.icu.dev.test.format.RbnfTest#TestAllLocales
-android.icu.dev.test.format.RbnfTest#TestBigNumbers
-android.icu.dev.test.format.RbnfTest#TestChineseProcess
-android.icu.dev.test.format.RbnfTest#TestContext
-android.icu.dev.test.format.RbnfTest#TestCoverage
-android.icu.dev.test.format.RbnfTest#TestDurations
-android.icu.dev.test.format.RbnfTest#TestEnglishSpellout
-android.icu.dev.test.format.RbnfTest#TestEquals
-android.icu.dev.test.format.RbnfTest#TestFractionalRuleSet
-android.icu.dev.test.format.RbnfTest#TestFrenchSpellout
-android.icu.dev.test.format.RbnfTest#TestGermanSpellout
-android.icu.dev.test.format.RbnfTest#TestGetNameListForLocale
-android.icu.dev.test.format.RbnfTest#TestGetRuleDisplayNameLocales
-android.icu.dev.test.format.RbnfTest#TestGetRulesSetDisplayName
-android.icu.dev.test.format.RbnfTest#TestInfinityNaN
-android.icu.dev.test.format.RbnfTest#TestItalianSpellout
-android.icu.dev.test.format.RbnfTest#TestMultiplePluralRules
-android.icu.dev.test.format.RbnfTest#TestOrdinalAbbreviations
-android.icu.dev.test.format.RbnfTest#TestPluralRules
-android.icu.dev.test.format.RbnfTest#TestRounding
-android.icu.dev.test.format.RbnfTest#TestRuleSetDisplayName
-android.icu.dev.test.format.RbnfTest#TestSetDecimalFormatSymbols
-android.icu.dev.test.format.RbnfTest#TestSmallValues
-android.icu.dev.test.format.RbnfTest#TestSpanishSpellout
-android.icu.dev.test.format.RbnfTest#TestSwedishSpellout
-android.icu.dev.test.format.RbnfTest#TestSwissFrenchSpellout
-android.icu.dev.test.format.RbnfTest#TestThaiSpellout
-android.icu.dev.test.format.RbnfTest#TestTrailingSemicolon
-android.icu.dev.test.format.RbnfTest#TestUndefinedSpellout
-android.icu.dev.test.format.RbnfTest#TestVariableDecimalPoint
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestBadDisplayContext
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestCombineDateAndTime
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestCustomNumberFormat
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestFormatWithoutQuantityIllegalArgument
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestFormatWithQuantityIllegalArgument
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestGetters
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestJavaLocale
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithoutQuantity
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithoutQuantityCaps
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithoutQuantityNarrow
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithoutQuantityShort
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithQuantity
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithQuantityCaps
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithQuantityNarrow
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithQuantityShort
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithQuantitySr
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestRelativeDateWithQuantitySrFallback
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestSidewaysDataLoading
-android.icu.dev.test.format.RelativeDateTimeFormatterTest#TestTwoBeforeTwoAfter
-android.icu.dev.test.format.ScientificNumberFormatterTest#TestBasic
-android.icu.dev.test.format.ScientificNumberFormatterTest#TestFarsi
-android.icu.dev.test.format.ScientificNumberFormatterTest#TestFixedDecimalMarkup
-android.icu.dev.test.format.ScientificNumberFormatterTest#TestFixedDecimalSuperscript
-android.icu.dev.test.format.ScientificNumberFormatterTest#TestPlusSignInExponentMarkup
-android.icu.dev.test.format.ScientificNumberFormatterTest#TestPlusSignInExponentSuperscript
-android.icu.dev.test.format.SelectFormatAPITest#TestApplyPatternToPattern
-android.icu.dev.test.format.SelectFormatAPITest#TestConstructors
-android.icu.dev.test.format.SelectFormatAPITest#TestEquals
-android.icu.dev.test.format.SelectFormatAPITest#TestFormat
-android.icu.dev.test.format.SelectFormatAPITest#TestHashCode
-android.icu.dev.test.format.SelectFormatAPITest#TestParseObject
-android.icu.dev.test.format.SelectFormatAPITest#TestToPattern
-android.icu.dev.test.format.SelectFormatAPITest#TestToString
-android.icu.dev.test.format.SelectFormatUnitTest#TestApplyFormat
-android.icu.dev.test.format.SelectFormatUnitTest#TestInvalidKeyword
-android.icu.dev.test.format.SelectFormatUnitTest#TestPatternSyntax
-android.icu.dev.test.format.TestMessageFormat#TestAdopt
-android.icu.dev.test.format.TestMessageFormat#testApostropheInPluralAndSelect
-android.icu.dev.test.format.TestMessageFormat#TestApostropheMode
-android.icu.dev.test.format.TestMessageFormat#TestAutoQuoteApostrophe
-android.icu.dev.test.format.TestMessageFormat#TestBug1
-android.icu.dev.test.format.TestMessageFormat#TestBug2
-android.icu.dev.test.format.TestMessageFormat#TestBug3
-android.icu.dev.test.format.TestMessageFormat#TestClone
-android.icu.dev.test.format.TestMessageFormat#TestCompatibleApostrophe
-android.icu.dev.test.format.TestMessageFormat#TestDecimals
-android.icu.dev.test.format.TestMessageFormat#TestEquals
-android.icu.dev.test.format.TestMessageFormat#TestFormat
-android.icu.dev.test.format.TestMessageFormat#testFormatNamedArguments
-android.icu.dev.test.format.TestMessageFormat#TestFormatToCharacterIterator
-android.icu.dev.test.format.TestMessageFormat#TestGetFormatByArgumentName
-android.icu.dev.test.format.TestMessageFormat#TestHashCode
-android.icu.dev.test.format.TestMessageFormat#TestMessagePatternAutoQuoteApostropheDeep
-android.icu.dev.test.format.TestMessageFormat#TestMessagePatternFreezable
-android.icu.dev.test.format.TestMessageFormat#TestMessagePatternNamedAndNumberedArguments
-android.icu.dev.test.format.TestMessageFormat#TestMessagePatternParseChoiceStyle
-android.icu.dev.test.format.TestMessageFormat#TestMessagePatternPartCoverage
-android.icu.dev.test.format.TestMessageFormat#TestMsgFormatChoice
-android.icu.dev.test.format.TestMessageFormat#testNamedArguments
-android.icu.dev.test.format.TestMessageFormat#testNestedFormatsInPluralFormat
-android.icu.dev.test.format.TestMessageFormat#TestNotEquals
-android.icu.dev.test.format.TestMessageFormat#TestNullArgs
-android.icu.dev.test.format.TestMessageFormat#testNumericFormatWithMap
-android.icu.dev.test.format.TestMessageFormat#testNumericOnlyMethods
-android.icu.dev.test.format.TestMessageFormat#TestParse
-android.icu.dev.test.format.TestMessageFormat#testParseNamedArguments
-android.icu.dev.test.format.TestMessageFormat#TestPattern
-android.icu.dev.test.format.TestMessageFormat#testPluralFormat
-android.icu.dev.test.format.TestMessageFormat#testPluralFormatToPattern
-android.icu.dev.test.format.TestMessageFormat#TestRBNF
-android.icu.dev.test.format.TestMessageFormat#TestSample
-android.icu.dev.test.format.TestMessageFormat#testSelectFormat
-android.icu.dev.test.format.TestMessageFormat#testSelectFormatToPattern
-android.icu.dev.test.format.TestMessageFormat#TestSelectOrdinal
-android.icu.dev.test.format.TestMessageFormat#TestSetFormat
-android.icu.dev.test.format.TestMessageFormat#TestSetGetFormats
-android.icu.dev.test.format.TestMessageFormat#TestSetLocale
-android.icu.dev.test.format.TestMessageFormat#TestSimpleFormat
-android.icu.dev.test.format.TestMessageFormat#TestStaticFormat
-android.icu.dev.test.format.TestMessageFormat#TestTrimArgumentName
-android.icu.dev.test.format.TestMessageFormat#TestUnlimitedArgsAndSubformats
-android.icu.dev.test.format.TimeUnitTest#Test10219FactionalPluralsParse
-android.icu.dev.test.format.TimeUnitTest#Test10219FractionalPlurals
-android.icu.dev.test.format.TimeUnitTest#TestAPI
-android.icu.dev.test.format.TimeUnitTest#TestBasic
-android.icu.dev.test.format.TimeUnitTest#TestBritishShortHourFallback
-android.icu.dev.test.format.TimeUnitTest#TestClone
-android.icu.dev.test.format.TimeUnitTest#TestEqHashCode
-android.icu.dev.test.format.TimeUnitTest#TestFormat
-android.icu.dev.test.format.TimeUnitTest#TestGetLocale
-android.icu.dev.test.format.TimeUnitTest#TestGreek
-android.icu.dev.test.format.TimeUnitTest#TestGreekWithSanitization
-android.icu.dev.test.format.TimeUnitTest#TestSetLocale
-android.icu.dev.test.format.TimeUnitTest#TestSetNumberFormat
-android.icu.dev.test.format.TimeUnitTest#TestSetup
-android.icu.dev.test.format.TimeUnitTest#TestStandInForMeasureFormat
-android.icu.dev.test.format.TimeUnitTest#TestTimeUnitFormat
-android.icu.dev.test.format.TimeZoneFormatTest#TestAPI
-android.icu.dev.test.format.TimeZoneFormatTest#TestFormat
-android.icu.dev.test.format.TimeZoneFormatTest#TestFormatTZDBNames
-android.icu.dev.test.format.TimeZoneFormatTest#TestInheritedFormat
-android.icu.dev.test.format.TimeZoneFormatTest#TestISOFormat
-android.icu.dev.test.format.TimeZoneFormatTest#TestParse
-android.icu.dev.test.format.TimeZoneFormatTest#TestParseCoverage
-android.icu.dev.test.format.TimeZoneFormatTest#TestTimeRoundTrip
-android.icu.dev.test.format.TimeZoneFormatTest#TestTimeZoneRoundTrip
-android.icu.dev.test.format.TimeZoneFormatTest#TestTZDBNamesThreading
-android.icu.dev.test.iterator.TestUCharacterIterator#TestClone
-android.icu.dev.test.iterator.TestUCharacterIterator#TestIteration
-android.icu.dev.test.iterator.TestUCharacterIterator#TestIterationUChar32
-android.icu.dev.test.iterator.TestUCharacterIterator#TestJitterbug1952
-android.icu.dev.test.iterator.TestUCharacterIterator#TestPreviousNext
-android.icu.dev.test.iterator.TestUCharacterIterator#TestUCharacterIteratorWrapper
-android.icu.dev.test.lang.TestUScriptRun#TestContstruction
-android.icu.dev.test.lang.TestUScriptRun#TestReset
-android.icu.dev.test.lang.TestUScriptRun#TestRuns
-android.icu.dev.test.lang.TestUScript#TestAllCodepoints
-android.icu.dev.test.lang.TestUScript#TestGetCode
-android.icu.dev.test.lang.TestUScript#TestGetName
-android.icu.dev.test.lang.TestUScript#TestGetScript
-android.icu.dev.test.lang.TestUScript#TestGetScriptExtensions
-android.icu.dev.test.lang.TestUScript#TestGetScriptOfCharsWithScriptExtensions
-android.icu.dev.test.lang.TestUScript#TestGetShortName
-android.icu.dev.test.lang.TestUScript#TestHasScript
-android.icu.dev.test.lang.TestUScript#TestLocaleGetCode
-android.icu.dev.test.lang.TestUScript#TestMultipleCode
-android.icu.dev.test.lang.TestUScript#TestNewCode
-android.icu.dev.test.lang.TestUScript#TestScriptMetadata
-android.icu.dev.test.lang.TestUScript#TestScriptMetadataAPI
-android.icu.dev.test.lang.TestUScript#TestScriptNames
-android.icu.dev.test.lang.UCharacterCaseTest#TestCharacter
-android.icu.dev.test.lang.UCharacterCaseTest#TestDutchTitle
-android.icu.dev.test.lang.UCharacterCaseTest#TestFolding
-android.icu.dev.test.lang.UCharacterCaseTest#TestLower
-android.icu.dev.test.lang.UCharacterCaseTest#TestSpecial
-android.icu.dev.test.lang.UCharacterCaseTest#TestSpecialCasingTxt
-android.icu.dev.test.lang.UCharacterCaseTest#TestTitle
-android.icu.dev.test.lang.UCharacterCaseTest#TestTitleRegression
-android.icu.dev.test.lang.UCharacterCaseTest#TestUpper
-android.icu.dev.test.lang.UCharacterCaseTest#TestUpperLower
-android.icu.dev.test.lang.UCharacterCategoryTest#TestToString
-android.icu.dev.test.lang.UCharacterDirectionTest#TestToString
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestCharCount
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestCodePointAtBefore
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestCodePointCount
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestIsHighSurrogate
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestIsLowSurrogate
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestIsSupplementaryCodePoint
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestIsSurrogatePair
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestIsValidCodePoint
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestOffsetByCodePoints
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestToChars
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestToCodePoint
-android.icu.dev.test.lang.UCharacterSurrogateTest#TestUnicodeBlockForName
-android.icu.dev.test.lang.UCharacterTest#TestAdditionalProperties
-android.icu.dev.test.lang.UCharacterTest#TestBase
-android.icu.dev.test.lang.UCharacterTest#TestBidiPairedBracketType
-android.icu.dev.test.lang.UCharacterTest#TestBlockData
-android.icu.dev.test.lang.UCharacterTest#TestCodePoint
-android.icu.dev.test.lang.UCharacterTest#TestCodePointAt
-android.icu.dev.test.lang.UCharacterTest#TestCodePointBefore
-android.icu.dev.test.lang.UCharacterTest#TestCodePointCount
-android.icu.dev.test.lang.UCharacterTest#TestConsistency
-android.icu.dev.test.lang.UCharacterTest#TestCoverage
-android.icu.dev.test.lang.UCharacterTest#TestDefined
-android.icu.dev.test.lang.UCharacterTest#TestDigits
-android.icu.dev.test.lang.UCharacterTest#TestForName
-android.icu.dev.test.lang.UCharacterTest#TestGetAge
-android.icu.dev.test.lang.UCharacterTest#TestGetCombiningClass
-android.icu.dev.test.lang.UCharacterTest#TestGetEuropeanDigit
-android.icu.dev.test.lang.UCharacterTest#TestGetHanNumericValue
-android.icu.dev.test.lang.UCharacterTest#TestGetInstance
-android.icu.dev.test.lang.UCharacterTest#TestGetIntPropertyMaxValue
-android.icu.dev.test.lang.UCharacterTest#TestGetIntPropertyValue
-android.icu.dev.test.lang.UCharacterTest#TestGetISOComment
-android.icu.dev.test.lang.UCharacterTest#TestGetName
-android.icu.dev.test.lang.UCharacterTest#TestGetNumericValue
-android.icu.dev.test.lang.UCharacterTest#TestGetProperty
-android.icu.dev.test.lang.UCharacterTest#TestGetUnicodeNumericValue
-android.icu.dev.test.lang.UCharacterTest#TestHasBinaryProperty
-android.icu.dev.test.lang.UCharacterTest#TestIdentifier
-android.icu.dev.test.lang.UCharacterTest#TestIsBMP
-android.icu.dev.test.lang.UCharacterTest#TestIsFrozen
-android.icu.dev.test.lang.UCharacterTest#TestIsLegal
-android.icu.dev.test.lang.UCharacterTest#TestISOControl
-android.icu.dev.test.lang.UCharacterTest#TestIteration
-android.icu.dev.test.lang.UCharacterTest#TestLetterNumber
-android.icu.dev.test.lang.UCharacterTest#TestMirror
-android.icu.dev.test.lang.UCharacterTest#TestNameIteration
-android.icu.dev.test.lang.UCharacterTest#TestNames
-android.icu.dev.test.lang.UCharacterTest#TestNextCaseMapCP
-android.icu.dev.test.lang.UCharacterTest#TestNumeric
-android.icu.dev.test.lang.UCharacterTest#TestNumericProperties
-android.icu.dev.test.lang.UCharacterTest#TestOf
-android.icu.dev.test.lang.UCharacterTest#TestPatternProperties
-android.icu.dev.test.lang.UCharacterTest#TestPrint
-android.icu.dev.test.lang.UCharacterTest#TestPropertyValues
-android.icu.dev.test.lang.UCharacterTest#TestReset
-android.icu.dev.test.lang.UCharacterTest#TestSetLimit
-android.icu.dev.test.lang.UCharacterTest#TestSpaces
-android.icu.dev.test.lang.UCharacterTest#TestSupplementary
-android.icu.dev.test.lang.UCharacterTest#TestToChars
-android.icu.dev.test.lang.UCharacterTest#TestToLowerCase
-android.icu.dev.test.lang.UCharacterTest#TestToString
-android.icu.dev.test.lang.UCharacterTest#TestToTitleCaseCoverage
-android.icu.dev.test.lang.UCharacterTest#TestToUpperCase
-android.icu.dev.test.lang.UCharacterTest#TestUCharFromNameUnderflow
-android.icu.dev.test.lang.UCharacterTest#TestUnicodeData
-android.icu.dev.test.lang.UCharacterTest#TestVersion
-android.icu.dev.test.lang.UCharacterTest#TestXSymbolTable
-android.icu.dev.test.lang.UCharacterThreadTest#TestUCharactersGetName
-android.icu.dev.test.lang.UnicodeSetStringSpanTest#TestInterestingStringSpan
-android.icu.dev.test.lang.UnicodeSetStringSpanTest#TestSimpleStringSpan
-android.icu.dev.test.lang.UnicodeSetStringSpanTest#TestSimpleStringSpanAndFreeze
-android.icu.dev.test.lang.UnicodeSetStringSpanTest#TestSimpleStringSpanSlow
-android.icu.dev.test.lang.UnicodeSetStringSpanTest#TestSpan
-android.icu.dev.test.lang.UnicodeSetStringSpanTest#TestSpanAndCount
-android.icu.dev.test.lang.UnicodeSetStringSpanTest#TestStringWithUnpairedSurrogateSpan
-android.icu.dev.test.lang.UnicodeSetTest#TestAddCollection
-android.icu.dev.test.lang.UnicodeSetTest#TestAddRemove
-android.icu.dev.test.lang.UnicodeSetTest#TestAPI
-android.icu.dev.test.lang.UnicodeSetTest#TestAStringRange
-android.icu.dev.test.lang.UnicodeSetTest#TestCategories
-android.icu.dev.test.lang.UnicodeSetTest#TestCharSequenceArgs
-android.icu.dev.test.lang.UnicodeSetTest#TestClone
-android.icu.dev.test.lang.UnicodeSetTest#TestCloseOver
-android.icu.dev.test.lang.UnicodeSetTest#TestCodePoints
-android.icu.dev.test.lang.UnicodeSetTest#TestComparison
-android.icu.dev.test.lang.UnicodeSetTest#TestConstants
-android.icu.dev.test.lang.UnicodeSetTest#TestContains
-android.icu.dev.test.lang.UnicodeSetTest#TestContainsString
-android.icu.dev.test.lang.UnicodeSetTest#TestCountIn
-android.icu.dev.test.lang.UnicodeSetTest#TestEscapePattern
-android.icu.dev.test.lang.UnicodeSetTest#TestExhaustive
-android.icu.dev.test.lang.UnicodeSetTest#testForSpanGaps
-android.icu.dev.test.lang.UnicodeSetTest#TestFrozen
-android.icu.dev.test.lang.UnicodeSetTest#TestGenerics
-android.icu.dev.test.lang.UnicodeSetTest#TestGetSet
-android.icu.dev.test.lang.UnicodeSetTest#TestHangulSyllable
-android.icu.dev.test.lang.UnicodeSetTest#TestIndexOf
-android.icu.dev.test.lang.UnicodeSetTest#TestIteration
-android.icu.dev.test.lang.UnicodeSetTest#TestMinimalRep
-android.icu.dev.test.lang.UnicodeSetTest#TestPatterns
-android.icu.dev.test.lang.UnicodeSetTest#TestPosixClasses
-android.icu.dev.test.lang.UnicodeSetTest#TestPropertyAccess
-android.icu.dev.test.lang.UnicodeSetTest#TestPropertySet
-android.icu.dev.test.lang.UnicodeSetTest#TestRangeConstructor
-android.icu.dev.test.lang.UnicodeSetTest#TestReplaceAndDelete
-android.icu.dev.test.lang.UnicodeSetTest#TestScriptNames
-android.icu.dev.test.lang.UnicodeSetTest#TestScriptSet
-android.icu.dev.test.lang.UnicodeSetTest#TestSetRelation
-android.icu.dev.test.lang.UnicodeSetTest#TestSetSpeed
-android.icu.dev.test.lang.UnicodeSetTest#TestStrings
-android.icu.dev.test.lang.UnicodeSetTest#TestSurrogate
-android.icu.dev.test.lang.UnicodeSetTest#TestSymbolTable
-android.icu.dev.test.lang.UnicodeSetTest#TestToPattern
-android.icu.dev.test.lang.UnicodeSetTest#TestUnicodeSetStrings
-android.icu.dev.test.lang.UPropertyAliasesTest#TestPropertyNames
-android.icu.dev.test.lang.UPropertyAliasesTest#TestUnknownPropertyNames
-android.icu.dev.test.lang.UTF16Test#TestAppend
-android.icu.dev.test.lang.UTF16Test#TestBounds
-android.icu.dev.test.lang.UTF16Test#TestCaseCompare
-android.icu.dev.test.lang.UTF16Test#TestCharAt
-android.icu.dev.test.lang.UTF16Test#TestCodePointCompare
-android.icu.dev.test.lang.UTF16Test#TestCountCodePoint
-android.icu.dev.test.lang.UTF16Test#TestDelete
-android.icu.dev.test.lang.UTF16Test#TestfindOffset
-android.icu.dev.test.lang.UTF16Test#TestGetCharCountSurrogate
-android.icu.dev.test.lang.UTF16Test#TestHasMoreCodePointsThan
-android.icu.dev.test.lang.UTF16Test#TestIndexOf
-android.icu.dev.test.lang.UTF16Test#TestInsert
-android.icu.dev.test.lang.UTF16Test#TestMoveCodePointOffset
-android.icu.dev.test.lang.UTF16Test#TestNewString
-android.icu.dev.test.lang.UTF16Test#TestReplace
-android.icu.dev.test.lang.UTF16Test#TestReverse
-android.icu.dev.test.lang.UTF16Test#TestSetCharAt
-android.icu.dev.test.lang.UTF16Test#TestStringComparator
-android.icu.dev.test.lang.UTF16Test#TestUtilities
-android.icu.dev.test.lang.UTF16Test#TestValueOf
-android.icu.dev.test.normalizer.BasicTest#TestBengali
-android.icu.dev.test.normalizer.BasicTest#TestBugJ2068
-android.icu.dev.test.normalizer.BasicTest#TestBugJ2324
-android.icu.dev.test.normalizer.BasicTest#TestCanonCompose
-android.icu.dev.test.normalizer.BasicTest#TestCanonIterData
-android.icu.dev.test.normalizer.BasicTest#TestCheckFCD
-android.icu.dev.test.normalizer.BasicTest#TestCombiningMarks
-android.icu.dev.test.normalizer.BasicTest#TestCompare
-android.icu.dev.test.normalizer.BasicTest#TestCompareDebug
-android.icu.dev.test.normalizer.BasicTest#TestCompatCompose
-android.icu.dev.test.normalizer.BasicTest#TestCompatDecomp
-android.icu.dev.test.normalizer.BasicTest#TestComposition
-android.icu.dev.test.normalizer.BasicTest#TestCompositionExclusion
-android.icu.dev.test.normalizer.BasicTest#TestConcatenate
-android.icu.dev.test.normalizer.BasicTest#TestCustomComp
-android.icu.dev.test.normalizer.BasicTest#TestCustomFCC
-android.icu.dev.test.normalizer.BasicTest#TestDebugIter
-android.icu.dev.test.normalizer.BasicTest#TestDebugIterOld
-android.icu.dev.test.normalizer.BasicTest#TestDebugStatic
-android.icu.dev.test.normalizer.BasicTest#TestDecomp
-android.icu.dev.test.normalizer.BasicTest#TestExplodingBase
-android.icu.dev.test.normalizer.BasicTest#TestFCD
-android.icu.dev.test.normalizer.BasicTest#TestFCNFKCClosure
-android.icu.dev.test.normalizer.BasicTest#TestFilteredAppend
-android.icu.dev.test.normalizer.BasicTest#TestFilteredNormalizer2
-android.icu.dev.test.normalizer.BasicTest#TestFindFoldFCDExceptions
-android.icu.dev.test.normalizer.BasicTest#TestGetCombiningClass
-android.icu.dev.test.normalizer.BasicTest#TestGetDecomposition
-android.icu.dev.test.normalizer.BasicTest#TestGetEasyToUseInstance
-android.icu.dev.test.normalizer.BasicTest#TestGetRawDecomposition
-android.icu.dev.test.normalizer.BasicTest#TestHangulCompose
-android.icu.dev.test.normalizer.BasicTest#TestHangulDecomp
-android.icu.dev.test.normalizer.BasicTest#TestNFC
-android.icu.dev.test.normalizer.BasicTest#TestNFD
-android.icu.dev.test.normalizer.BasicTest#TestNone
-android.icu.dev.test.normalizer.BasicTest#TestNoneNormalizer
-android.icu.dev.test.normalizer.BasicTest#TestNoopNormalizer2
-android.icu.dev.test.normalizer.BasicTest#TestNormalizerAPI
-android.icu.dev.test.normalizer.BasicTest#TestPreviousNext
-android.icu.dev.test.normalizer.BasicTest#TestPreviousNextJCI
-android.icu.dev.test.normalizer.BasicTest#TestQuickCheckPerCP
-android.icu.dev.test.normalizer.BasicTest#TestQuickCheckResultMAYBE
-android.icu.dev.test.normalizer.BasicTest#TestQuickCheckResultNO
-android.icu.dev.test.normalizer.BasicTest#TestQuickCheckResultYES
-android.icu.dev.test.normalizer.BasicTest#TestQuickCheckStringResult
-android.icu.dev.test.normalizer.BasicTest#TestReturnFailure
-android.icu.dev.test.normalizer.BasicTest#TestSerializedSet
-android.icu.dev.test.normalizer.BasicTest#TestSkippable
-android.icu.dev.test.normalizer.BasicTest#TestTibetan
-android.icu.dev.test.normalizer.BasicTest#TestVerisign
-android.icu.dev.test.normalizer.BasicTest#TestZeroIndex
-android.icu.dev.test.normalizer.ConformanceTest#TestConformance
-android.icu.dev.test.normalizer.ConformanceTest#TestConformance_3_2
-android.icu.dev.test.normalizer.NormalizationMonkeyTest#TestNormalize
-android.icu.dev.test.normalizer.NormalizerRegressionTests#TestJB4472
-android.icu.dev.test.normalizer.TestCanonicalIterator#TestBasic
-android.icu.dev.test.normalizer.TestCanonicalIterator#TestExhaustive
-android.icu.dev.test.normalizer.TestCanonicalIterator#TestSpeed
-android.icu.dev.test.normalizer.TestDeprecatedNormalizerAPI#TestComposedCharIter
-android.icu.dev.test.normalizer.TestDeprecatedNormalizerAPI#TestNormalizerAPI
-android.icu.dev.test.normalizer.TestDeprecatedNormalizerAPI#TestRoundTrip
-android.icu.dev.test.normalizer.UTS46Test#TestAPI
-android.icu.dev.test.normalizer.UTS46Test#TestNotSTD3
-android.icu.dev.test.normalizer.UTS46Test#TestSomeCases
-android.icu.dev.test.rbbi.BreakIteratorRegTest#TestRegUnreg
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4068133
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4086052
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4097779
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4097920
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4098467Characters
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4098467Words
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4111338
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4117554Lines
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4143071
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4146175Lines
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4152117
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4152416
-android.icu.dev.test.rbbi.BreakIteratorTest#TestBug4153072
-android.icu.dev.test.rbbi.BreakIteratorTest#TestCharacterBreak
-android.icu.dev.test.rbbi.BreakIteratorTest#TestEmptyString
-android.icu.dev.test.rbbi.BreakIteratorTest#TestEndBehavior
-android.icu.dev.test.rbbi.BreakIteratorTest#TestFilteredBreakIteratorBuilder
-android.icu.dev.test.rbbi.BreakIteratorTest#TestGetAvailableLocales
-android.icu.dev.test.rbbi.BreakIteratorTest#TestLettersAndDigits
-android.icu.dev.test.rbbi.BreakIteratorTest#TestLineBreak
-android.icu.dev.test.rbbi.BreakIteratorTest#TestLineBreakContractions
-android.icu.dev.test.rbbi.BreakIteratorTest#TestNullLocale
-android.icu.dev.test.rbbi.BreakIteratorTest#TestPreceding
-android.icu.dev.test.rbbi.BreakIteratorTest#TestSentenceInvariants
-android.icu.dev.test.rbbi.BreakIteratorTest#TestT5615
-android.icu.dev.test.rbbi.BreakIteratorTest#TestTitleBreak
-android.icu.dev.test.rbbi.RBBIAPITest#TestCloneEquals
-android.icu.dev.test.rbbi.RBBIAPITest#TestFirstNextFollowing
-android.icu.dev.test.rbbi.RBBIAPITest#TestGetSetText
-android.icu.dev.test.rbbi.RBBIAPITest#TestHashCode
-android.icu.dev.test.rbbi.RBBIAPITest#TestIsBoundary
-android.icu.dev.test.rbbi.RBBIAPITest#TestLastPreviousPreceding
-android.icu.dev.test.rbbi.RBBIAPITest#TestRuleStatus
-android.icu.dev.test.rbbi.RBBIAPITest#TestToString
-android.icu.dev.test.rbbi.RBBITestExtended#TestExtended
-android.icu.dev.test.rbbi.RBBITestMonkey#TestCharMonkey
-android.icu.dev.test.rbbi.RBBITestMonkey#TestLineMonkey
-android.icu.dev.test.rbbi.RBBITestMonkey#TestRTCharMonkey
-android.icu.dev.test.rbbi.RBBITestMonkey#TestRTLineMonkey
-android.icu.dev.test.rbbi.RBBITestMonkey#TestRTSentMonkey
-android.icu.dev.test.rbbi.RBBITestMonkey#TestRTWordMonkey
-android.icu.dev.test.rbbi.RBBITestMonkey#TestSentMonkey
-android.icu.dev.test.rbbi.RBBITestMonkey#TestWordMonkey
-android.icu.dev.test.rbbi.RBBITest#TestClone
-android.icu.dev.test.rbbi.RBBITest#TestCurrent
-android.icu.dev.test.rbbi.RBBITest#TestDefaultRuleBasedCharacterIteration
-android.icu.dev.test.rbbi.RBBITest#TestDefaultRuleBasedLineIteration
-android.icu.dev.test.rbbi.RBBITest#TestDefaultRuleBasedSentenceIteration
-android.icu.dev.test.rbbi.RBBITest#TestDefaultRuleBasedWordIteration
-android.icu.dev.test.rbbi.RBBITest#TestDump
-android.icu.dev.test.rbbi.RBBITest#TestEquals
-android.icu.dev.test.rbbi.RBBITest#TestFirst
-android.icu.dev.test.rbbi.RBBITest#TestFollowing
-android.icu.dev.test.rbbi.RBBITest#TestLast
-android.icu.dev.test.rbbi.RBBITest#TestPreceding
-android.icu.dev.test.rbbi.RBBITest#TestTailoredBreaks
-android.icu.dev.test.rbbi.RBBITest#TestThaiDictionaryBreakIterator
-android.icu.dev.test.search.SearchTest#TestBasic
-android.icu.dev.test.search.SearchTest#TestBreakIterator
-android.icu.dev.test.search.SearchTest#TestBreakIteratorCanonical
-android.icu.dev.test.search.SearchTest#TestCanonical
-android.icu.dev.test.search.SearchTest#TestCollator
-android.icu.dev.test.search.SearchTest#TestCollatorCanonical
-android.icu.dev.test.search.SearchTest#TestCompositeBoundaries
-android.icu.dev.test.search.SearchTest#TestCompositeBoundariesCanonical
-android.icu.dev.test.search.SearchTest#TestConstructor
-android.icu.dev.test.search.SearchTest#TestContraction
-android.icu.dev.test.search.SearchTest#TestContractionCanonical
-android.icu.dev.test.search.SearchTest#TestDiactricMatch
-android.icu.dev.test.search.SearchTest#TestGetMatch
-android.icu.dev.test.search.SearchTest#TestGetSetAttribute
-android.icu.dev.test.search.SearchTest#TestGetSetOffset
-android.icu.dev.test.search.SearchTest#TestGetSetOffsetCanonical
-android.icu.dev.test.search.SearchTest#TestIgnorable
-android.icu.dev.test.search.SearchTest#TestIndicPrefixMatch
-android.icu.dev.test.search.SearchTest#TestInitialization
-android.icu.dev.test.search.SearchTest#TestNormCanonical
-android.icu.dev.test.search.SearchTest#TestNormExact
-android.icu.dev.test.search.SearchTest#TestOpenClose
-android.icu.dev.test.search.SearchTest#TestOverlap
-android.icu.dev.test.search.SearchTest#TestOverlapCanonical
-android.icu.dev.test.search.SearchTest#TestPattern
-android.icu.dev.test.search.SearchTest#TestPatternCanonical
-android.icu.dev.test.search.SearchTest#TestReset
-android.icu.dev.test.search.SearchTest#TestSetMatch
-android.icu.dev.test.search.SearchTest#TestStrength
-android.icu.dev.test.search.SearchTest#TestStrengthCanonical
-android.icu.dev.test.search.SearchTest#TestSubClass
-android.icu.dev.test.search.SearchTest#TestSupplementary
-android.icu.dev.test.search.SearchTest#TestSupplementaryCanonical
-android.icu.dev.test.search.SearchTest#TestText
-android.icu.dev.test.search.SearchTest#TestTextCanonical
-android.icu.dev.test.search.SearchTest#TestUsingSearchCollator
-android.icu.dev.test.search.SearchTest#TestVariable
-android.icu.dev.test.search.SearchTest#TestVariableCanonical
-android.icu.dev.test.shaping.ArabicShapingRegTest#TestEquals
-android.icu.dev.test.shaping.ArabicShapingRegTest#TestError
-android.icu.dev.test.shaping.ArabicShapingRegTest#TestPreflight
-android.icu.dev.test.shaping.ArabicShapingRegTest#TestShape
-android.icu.dev.test.shaping.ArabicShapingRegTest#TestStandard
-android.icu.dev.test.stringprep.IDNAConformanceTest#TestConformance
-android.icu.dev.test.stringprep.TestIDNARef#TestChaining
-android.icu.dev.test.stringprep.TestIDNARef#TestCompare
-android.icu.dev.test.stringprep.TestIDNARef#TestConformance
-android.icu.dev.test.stringprep.TestIDNARef#TestErrorCases
-android.icu.dev.test.stringprep.TestIDNARef#TestIDNToASCII
-android.icu.dev.test.stringprep.TestIDNARef#TestIDNToUnicode
-android.icu.dev.test.stringprep.TestIDNARef#TestNamePrepConformance
-android.icu.dev.test.stringprep.TestIDNARef#TestRootLabelSeparator
-android.icu.dev.test.stringprep.TestIDNARef#TestToASCII
-android.icu.dev.test.stringprep.TestIDNARef#TestToUnicode
-android.icu.dev.test.stringprep.TestIDNA#TestChaining
-android.icu.dev.test.stringprep.TestIDNA#TestCompare
-android.icu.dev.test.stringprep.TestIDNA#TestCompareRefImpl
-android.icu.dev.test.stringprep.TestIDNA#TestConformance
-android.icu.dev.test.stringprep.TestIDNA#TestConvertIDNToASCII
-android.icu.dev.test.stringprep.TestIDNA#TestConvertIDNToUnicode
-android.icu.dev.test.stringprep.TestIDNA#TestConvertToASCII
-android.icu.dev.test.stringprep.TestIDNA#TestConvertToUnicode
-android.icu.dev.test.stringprep.TestIDNA#TestDebug
-android.icu.dev.test.stringprep.TestIDNA#TestErrorCases
-android.icu.dev.test.stringprep.TestIDNA#TestIDNACompare
-android.icu.dev.test.stringprep.TestIDNA#TestIDNToASCII
-android.icu.dev.test.stringprep.TestIDNA#TestIDNToUnicode
-android.icu.dev.test.stringprep.TestIDNA#TestJB4475
-android.icu.dev.test.stringprep.TestIDNA#TestJB4490
-android.icu.dev.test.stringprep.TestIDNA#TestJB5273
-android.icu.dev.test.stringprep.TestIDNA#TestLength
-android.icu.dev.test.stringprep.TestIDNA#TestNamePrepConformance
-android.icu.dev.test.stringprep.TestIDNA#TestRootLabelSeparator
-android.icu.dev.test.stringprep.TestIDNA#TestToASCII
-android.icu.dev.test.stringprep.TestIDNA#TestToUnicode
-android.icu.dev.test.stringprep.TestStringPrepProfiles#TestProfiles
-android.icu.dev.test.stringprep.TestStringPrep#TestCISPrep
-android.icu.dev.test.stringprep.TestStringPrep#TestCoverage
-android.icu.dev.test.stringprep.TestStringPrep#TestCSPrep
-android.icu.dev.test.stringprep.TestStringPrep#TestGetError
-android.icu.dev.test.stringprep.TestStringPrep#TestGetInstance
-android.icu.dev.test.stringprep.TestStringPrep#TestNFS4MixedPrep
-android.icu.dev.test.stringprep.TestStringPrep#TestPrepare
-android.icu.dev.test.stringprep.TestStringPrep#TestSetPreContext
-android.icu.dev.test.stringprep.TestStringPrep#TestStringPrepParseException
-android.icu.dev.test.stringprep.TestStringPrep#TestStringPrepParseExceptionEquals
-android.icu.dev.test.text.SpoofCheckerTest#TestAllowedChars
-android.icu.dev.test.text.SpoofCheckerTest#TestAllowedLocales
-android.icu.dev.test.text.SpoofCheckerTest#TestAreConfusable
-android.icu.dev.test.text.SpoofCheckerTest#TestAreConfusable1
-android.icu.dev.test.text.SpoofCheckerTest#TestBug11635
-android.icu.dev.test.text.SpoofCheckerTest#TestCheck
-android.icu.dev.test.text.SpoofCheckerTest#TestCheckResultToString11447
-android.icu.dev.test.text.SpoofCheckerTest#TestComparator
-android.icu.dev.test.text.SpoofCheckerTest#testConfData
-android.icu.dev.test.text.SpoofCheckerTest#TestGetSetAllowedChars
-android.icu.dev.test.text.SpoofCheckerTest#TestGetSetChecks
-android.icu.dev.test.text.SpoofCheckerTest#TestGetSetChecks1
-android.icu.dev.test.text.SpoofCheckerTest#TestGetSkeleton
-android.icu.dev.test.text.SpoofCheckerTest#TestIdentifierInfo
-android.icu.dev.test.text.SpoofCheckerTest#TestInvisible
-android.icu.dev.test.text.SpoofCheckerTest#TestMixedNumbers
-android.icu.dev.test.text.SpoofCheckerTest#TestOpenFromSourceRules
-android.icu.dev.test.text.SpoofCheckerTest#TestRestrictionLevel
-android.icu.dev.test.text.SpoofCheckerTest#TestSkeleton
-android.icu.dev.test.text.SpoofCheckerTest#TestSpoofAPI
-android.icu.dev.test.text.SpoofCheckerTest#TestUSpoof
-android.icu.dev.test.timescale.TimeScaleAPITest#TestBigDecimalFromBigDecimal
-android.icu.dev.test.timescale.TimeScaleAPITest#TestBigDecimalFromDouble
-android.icu.dev.test.timescale.TimeScaleAPITest#TestBigDecimalFromLong
-android.icu.dev.test.timescale.TimeScaleAPITest#TestFromLong
-android.icu.dev.test.timescale.TimeScaleAPITest#TestGetTimeScale
-android.icu.dev.test.timescale.TimeScaleAPITest#TestToBigDecimalFromBigDecimal
-android.icu.dev.test.timescale.TimeScaleAPITest#TestToBigDecimalFromLong
-android.icu.dev.test.timescale.TimeScaleAPITest#TestToBigDecimalTrunc
-android.icu.dev.test.timescale.TimeScaleAPITest#TestToLong
-android.icu.dev.test.timescale.TimeScaleDataTest#TestDotNet
-android.icu.dev.test.timescale.TimeScaleDataTest#TestEpochOffsets
-android.icu.dev.test.timescale.TimeScaleDataTest#TestFromLimits
-android.icu.dev.test.timescale.TimeScaleDataTest#TestToLimits
-android.icu.dev.test.timescale.TimeScaleMonkeyTest#TestRoundTrip
-android.icu.dev.test.timezone.TimeZoneBoundaryTest#TestBoundaries
-android.icu.dev.test.timezone.TimeZoneBoundaryTest#TestNewRules
-android.icu.dev.test.timezone.TimeZoneBoundaryTest#TestStepwise
-android.icu.dev.test.timezone.TimeZoneOffsetLocalTest#TestGetOffsetAroundTransition
-android.icu.dev.test.timezone.TimeZoneRegression#Test4052967
-android.icu.dev.test.timezone.TimeZoneRegression#Test4073209
-android.icu.dev.test.timezone.TimeZoneRegression#Test4073215
-android.icu.dev.test.timezone.TimeZoneRegression#Test4084933
-android.icu.dev.test.timezone.TimeZoneRegression#Test4096952
-android.icu.dev.test.timezone.TimeZoneRegression#Test4109314
-android.icu.dev.test.timezone.TimeZoneRegression#Test4126678
-android.icu.dev.test.timezone.TimeZoneRegression#Test4151406
-android.icu.dev.test.timezone.TimeZoneRegression#Test4151429
-android.icu.dev.test.timezone.TimeZoneRegression#Test4154525
-android.icu.dev.test.timezone.TimeZoneRegression#Test4154537
-android.icu.dev.test.timezone.TimeZoneRegression#Test4154542
-android.icu.dev.test.timezone.TimeZoneRegression#Test4154650
-android.icu.dev.test.timezone.TimeZoneRegression#Test4159922
-android.icu.dev.test.timezone.TimeZoneRegression#Test4162593
-android.icu.dev.test.timezone.TimeZoneRegression#Test4173604
-android.icu.dev.test.timezone.TimeZoneRegression#Test4176686
-android.icu.dev.test.timezone.TimeZoneRegression#Test4184229
-android.icu.dev.test.timezone.TimeZoneRegression#Test4208960
-android.icu.dev.test.timezone.TimeZoneRegression#TestJ449
-android.icu.dev.test.timezone.TimeZoneRegression#TestJ5134
-android.icu.dev.test.timezone.TimeZoneRegression#TestJohannesburg
-android.icu.dev.test.timezone.TimeZoneRegression#TestT5280
-android.icu.dev.test.timezone.TimeZoneRegression#TestT5432
-android.icu.dev.test.timezone.TimeZoneRegression#TestT7107
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestBasicTimeZoneCoverage
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestGetSimpleRules
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestHasEquivalentTransitions
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestHistoricalRuleBasedTimeZone
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestOlsonTransition
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestRBTZTransition
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestSimpleRuleBasedTimeZone
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestSimpleTimeZoneCoverage
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestT6216
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestT6669
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestT8943
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestTimeZoneRuleCoverage
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestVTimeZoneCoverage
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestVTimeZoneHeaderProps
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestVTimeZoneParse
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestVTimeZoneRoundTrip
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestVTimeZoneRoundTripPartial
-android.icu.dev.test.timezone.TimeZoneRuleTest#TestVTimeZoneSimpleWrite
-android.icu.dev.test.timezone.TimeZoneTest#TestAlternateRules
-android.icu.dev.test.timezone.TimeZoneTest#TestCanonicalID
-android.icu.dev.test.timezone.TimeZoneTest#TestCountries
-android.icu.dev.test.timezone.TimeZoneTest#TestCoverage
-android.icu.dev.test.timezone.TimeZoneTest#TestCustomParse
-android.icu.dev.test.timezone.TimeZoneTest#TestDisplayName
-android.icu.dev.test.timezone.TimeZoneTest#TestDisplayName2
-android.icu.dev.test.timezone.TimeZoneTest#TestDisplayNamesMeta
-android.icu.dev.test.timezone.TimeZoneTest#TestDSTSavings
-android.icu.dev.test.timezone.TimeZoneTest#TestEquivalencyGroups
-android.icu.dev.test.timezone.TimeZoneTest#TestFebruary
-android.icu.dev.test.timezone.TimeZoneTest#TestFractionalDST
-android.icu.dev.test.timezone.TimeZoneTest#TestFreezable
-android.icu.dev.test.timezone.TimeZoneTest#TestGenericAPI
-android.icu.dev.test.timezone.TimeZoneTest#TestGetAvailableIDs913
-android.icu.dev.test.timezone.TimeZoneTest#TestGetAvailableIDsNew
-android.icu.dev.test.timezone.TimeZoneTest#TestGetIDForWindowsID
-android.icu.dev.test.timezone.TimeZoneTest#TestGetOffsetDate
-android.icu.dev.test.timezone.TimeZoneTest#TestGetRegion
-android.icu.dev.test.timezone.TimeZoneTest#TestGetWindowsID
-android.icu.dev.test.timezone.TimeZoneTest#TestHashCode
-android.icu.dev.test.timezone.TimeZoneTest#TestMark
-android.icu.dev.test.timezone.TimeZoneTest#TestObservesDaylightTime
-android.icu.dev.test.timezone.TimeZoneTest#TestOddTimeZoneNames
-android.icu.dev.test.timezone.TimeZoneTest#TestPRTOffset
-android.icu.dev.test.timezone.TimeZoneTest#TestRuleAPI
-android.icu.dev.test.timezone.TimeZoneTest#TestSetDefault
-android.icu.dev.test.timezone.TimeZoneTest#TestShortZoneIDs
-android.icu.dev.test.timezone.TimeZoneTest#TestSimpleTimeZoneSerialization
-android.icu.dev.test.timezone.TimeZoneTest#TestVariousAPI518
-android.icu.dev.test.timezone.TimeZoneTest#TestZoneFields
-android.icu.dev.test.timezone.TimeZoneTest#TestZoneMeta
-android.icu.dev.test.translit.AnyScriptTest#TestCommonDigits
-android.icu.dev.test.translit.AnyScriptTest#TestContext
-android.icu.dev.test.translit.AnyScriptTest#TestForWidth
-android.icu.dev.test.translit.AnyScriptTest#TestScripts
-android.icu.dev.test.translit.CompoundTransliteratorTest#TestConstruction
-android.icu.dev.test.translit.CompoundTransliteratorTest#TestGetTransliterator
-android.icu.dev.test.translit.CompoundTransliteratorTest#TestTransliterate
-android.icu.dev.test.translit.ErrorTest#TestRBTErrors
-android.icu.dev.test.translit.ErrorTest#TestTransliteratorErrors
-android.icu.dev.test.translit.ErrorTest#TestUnicodeSetErrors
-android.icu.dev.test.translit.JamoTest#TestJamo
-android.icu.dev.test.translit.JamoTest#TestPiecemeal
-android.icu.dev.test.translit.JamoTest#TestRealText
-android.icu.dev.test.translit.JamoTest#TestRoundTrip
-android.icu.dev.test.translit.RegexUtilitiesTest#TestBnf
-android.icu.dev.test.translit.RegexUtilitiesTest#TestCharacters
-android.icu.dev.test.translit.RegexUtilitiesTest#TestConstruction
-android.icu.dev.test.translit.RegexUtilitiesTest#TestUnicodeProperties
-android.icu.dev.test.translit.ReplaceableTest#Test
-android.icu.dev.test.translit.ReplaceableTest#Test5789
-android.icu.dev.test.translit.RoundTripTest#TestArabic
-android.icu.dev.test.translit.RoundTripTest#TestCyrillic
-android.icu.dev.test.translit.RoundTripTest#TestDevanagariLatin
-android.icu.dev.test.translit.RoundTripTest#Testel
-android.icu.dev.test.translit.RoundTripTest#TestGreek
-android.icu.dev.test.translit.RoundTripTest#TestGreekUNGEGN
-android.icu.dev.test.translit.RoundTripTest#TestHan
-android.icu.dev.test.translit.RoundTripTest#TestHangul
-android.icu.dev.test.translit.RoundTripTest#TestHangul2
-android.icu.dev.test.translit.RoundTripTest#TestHebrew
-android.icu.dev.test.translit.RoundTripTest#TestHiragana
-android.icu.dev.test.translit.RoundTripTest#TestInterIndic
-android.icu.dev.test.translit.RoundTripTest#TestJamo
-android.icu.dev.test.translit.RoundTripTest#TestKana
-android.icu.dev.test.translit.RoundTripTest#TestKatakana
-android.icu.dev.test.translit.RoundTripTest#TestSingle
-android.icu.dev.test.translit.RoundTripTest#TestThai
-android.icu.dev.test.translit.TestUnicodeProperty#TestBasic
-android.icu.dev.test.translit.TestUnicodeProperty#TestSymbolTable
-android.icu.dev.test.translit.TestUnicodeProperty#TestSymbolTable2
-android.icu.dev.test.translit.ThreadTest#TestAnyTranslit
-android.icu.dev.test.translit.ThreadTest#TestThreads
-android.icu.dev.test.translit.TransliteratorTest#TestAliasInverseID
-android.icu.dev.test.translit.TransliteratorTest#TestAlternateSyntax
-android.icu.dev.test.translit.TransliteratorTest#TestAnchorMasking
-android.icu.dev.test.translit.TransliteratorTest#TestAnchors
-android.icu.dev.test.translit.TransliteratorTest#TestAny
-android.icu.dev.test.translit.TransliteratorTest#TestAnyX
-android.icu.dev.test.translit.TransliteratorTest#TestArbitraryVariableValues
-android.icu.dev.test.translit.TransliteratorTest#TestBeginEnd
-android.icu.dev.test.translit.TransliteratorTest#TestBeginEndToRules
-android.icu.dev.test.translit.TransliteratorTest#TestCaseMap
-android.icu.dev.test.translit.TransliteratorTest#TestCasing
-android.icu.dev.test.translit.TransliteratorTest#TestCharUtils
-android.icu.dev.test.translit.TransliteratorTest#TestChinese
-android.icu.dev.test.translit.TransliteratorTest#TestCompoundFilter
-android.icu.dev.test.translit.TransliteratorTest#TestCompoundFilterID
-android.icu.dev.test.translit.TransliteratorTest#TestCompoundHex
-android.icu.dev.test.translit.TransliteratorTest#TestCompoundInverse
-android.icu.dev.test.translit.TransliteratorTest#TestCompoundInverseID
-android.icu.dev.test.translit.TransliteratorTest#TestCompoundKana
-android.icu.dev.test.translit.TransliteratorTest#TestCompoundLatinRT
-android.icu.dev.test.translit.TransliteratorTest#TestCompoundRBT
-android.icu.dev.test.translit.TransliteratorTest#TestContext
-android.icu.dev.test.translit.TransliteratorTest#TestCopyJ476
-android.icu.dev.test.translit.TransliteratorTest#TestCoverage
-android.icu.dev.test.translit.TransliteratorTest#TestCreateInstance
-android.icu.dev.test.translit.TransliteratorTest#TestCursorOffset
-android.icu.dev.test.translit.TransliteratorTest#TestDevanagariLatinRT
-android.icu.dev.test.translit.TransliteratorTest#TestDisplayName
-android.icu.dev.test.translit.TransliteratorTest#TestEmptyContext
-android.icu.dev.test.translit.TransliteratorTest#TestEscape
-android.icu.dev.test.translit.TransliteratorTest#TestFilterIDs
-android.icu.dev.test.translit.TransliteratorTest#TestFiltering
-android.icu.dev.test.translit.TransliteratorTest#TestFunction
-android.icu.dev.test.translit.TransliteratorTest#TestGetAvailableTargets
-android.icu.dev.test.translit.TransliteratorTest#TestGetAvailableVariants
-android.icu.dev.test.translit.TransliteratorTest#TestGurmukhiDevanagari
-android.icu.dev.test.translit.TransliteratorTest#TestHalfwidthFullwidth
-android.icu.dev.test.translit.TransliteratorTest#TestHangul
-android.icu.dev.test.translit.TransliteratorTest#TestHiraganaKatakana
-android.icu.dev.test.translit.TransliteratorTest#TestIDForms
-android.icu.dev.test.translit.TransliteratorTest#TestIncrementalProgress
-android.icu.dev.test.translit.TransliteratorTest#TestInlineSet
-android.icu.dev.test.translit.TransliteratorTest#TestInstantiation
-android.icu.dev.test.translit.TransliteratorTest#TestInterIndic
-android.icu.dev.test.translit.TransliteratorTest#TestInvalidBackRef
-android.icu.dev.test.translit.TransliteratorTest#TestInvalidPostContext
-android.icu.dev.test.translit.TransliteratorTest#TestJ277
-android.icu.dev.test.translit.TransliteratorTest#TestJ329
-android.icu.dev.test.translit.TransliteratorTest#TestKeyboard
-android.icu.dev.test.translit.TransliteratorTest#TestKeyboard2
-android.icu.dev.test.translit.TransliteratorTest#TestKeyboard3
-android.icu.dev.test.translit.TransliteratorTest#TestLiberalizedID
-android.icu.dev.test.translit.TransliteratorTest#TestLocaleInstantiation
-android.icu.dev.test.translit.TransliteratorTest#TestLocaleResource
-android.icu.dev.test.translit.TransliteratorTest#TestMulticharStringSet
-android.icu.dev.test.translit.TransliteratorTest#TestNameMap
-android.icu.dev.test.translit.TransliteratorTest#TestNewEngine
-android.icu.dev.test.translit.TransliteratorTest#TestNextLine
-android.icu.dev.test.translit.TransliteratorTest#TestNFDChainRBT
-android.icu.dev.test.translit.TransliteratorTest#TestNormalizationTransliterator
-android.icu.dev.test.translit.TransliteratorTest#TestNullInverse
-android.icu.dev.test.translit.TransliteratorTest#TestOutputSet
-android.icu.dev.test.translit.TransliteratorTest#TestParseError
-android.icu.dev.test.translit.TransliteratorTest#TestPatternQuoting
-android.icu.dev.test.translit.TransliteratorTest#TestPatternWhitespace
-android.icu.dev.test.translit.TransliteratorTest#TestPositionAPI
-android.icu.dev.test.translit.TransliteratorTest#TestPositionHandling
-android.icu.dev.test.translit.TransliteratorTest#TestPropertySet
-android.icu.dev.test.translit.TransliteratorTest#TestQuantifiedSegment
-android.icu.dev.test.translit.TransliteratorTest#TestQuantifier
-android.icu.dev.test.translit.TransliteratorTest#TestRegisterAlias
-android.icu.dev.test.translit.TransliteratorTest#TestRegistry
-android.icu.dev.test.translit.TransliteratorTest#TestRemove
-android.icu.dev.test.translit.TransliteratorTest#TestRuleBasedInverse
-android.icu.dev.test.translit.TransliteratorTest#TestSanskritLatinRT
-android.icu.dev.test.translit.TransliteratorTest#TestScriptAllCodepoints
-android.icu.dev.test.translit.TransliteratorTest#TestSegments
-android.icu.dev.test.translit.TransliteratorTest#TestSimpleRules
-android.icu.dev.test.translit.TransliteratorTest#TestSourceTargetSet
-android.icu.dev.test.translit.TransliteratorTest#TestSourceTargetSet2
-android.icu.dev.test.translit.TransliteratorTest#TestSourceTargetSetFilter
-android.icu.dev.test.translit.TransliteratorTest#TestSpecialCases
-android.icu.dev.test.translit.TransliteratorTest#TestSTV
-android.icu.dev.test.translit.TransliteratorTest#TestSupplemental
-android.icu.dev.test.translit.TransliteratorTest#TestSurrogateCasing
-android.icu.dev.test.translit.TransliteratorTest#TestT5160
-android.icu.dev.test.translit.TransliteratorTest#TestTeluguLatinRT
-android.icu.dev.test.translit.TransliteratorTest#TestThai
-android.icu.dev.test.translit.TransliteratorTest#TestTitleAccents
-android.icu.dev.test.translit.TransliteratorTest#TestToRules
-android.icu.dev.test.translit.TransliteratorTest#TestToRulesMark
-android.icu.dev.test.translit.TransliteratorTest#TestUndefinedVariable
-android.icu.dev.test.translit.TransliteratorTest#TestUserFunction
-android.icu.dev.test.translit.TransliteratorTest#TestVariableNames
-android.icu.dev.test.translit.TransliteratorTest#TestVariableRange
-android.icu.dev.test.translit.UnicodeMapTest#TestAMonkey
-android.icu.dev.test.translit.UnicodeMapTest#TestCloneAsThawed11721
-android.icu.dev.test.translit.UnicodeMapTest#TestIterations
-android.icu.dev.test.translit.UnicodeMapTest#TestModify
-android.icu.dev.test.translit.UnicodeMapTest#TestRemove
-android.icu.dev.test.util.BytesTrieTest#Test00Builder
-android.icu.dev.test.util.BytesTrieTest#Test10Empty
-android.icu.dev.test.util.BytesTrieTest#Test11_a
-android.icu.dev.test.util.BytesTrieTest#Test12_a_ab
-android.icu.dev.test.util.BytesTrieTest#Test20ShortestBranch
-android.icu.dev.test.util.BytesTrieTest#Test21Branches
-android.icu.dev.test.util.BytesTrieTest#Test22LongSequence
-android.icu.dev.test.util.BytesTrieTest#Test23LongBranch
-android.icu.dev.test.util.BytesTrieTest#Test24ValuesForState
-android.icu.dev.test.util.BytesTrieTest#Test30Compact
-android.icu.dev.test.util.BytesTrieTest#Test40GetUniqueValue
-android.icu.dev.test.util.BytesTrieTest#Test41GetNextBytes
-android.icu.dev.test.util.BytesTrieTest#Test50IteratorFromBranch
-android.icu.dev.test.util.BytesTrieTest#Test51IteratorFromLinearMatch
-android.icu.dev.test.util.BytesTrieTest#Test52TruncatingIteratorFromRoot
-android.icu.dev.test.util.BytesTrieTest#Test53TruncatingIteratorFromLinearMatchShort
-android.icu.dev.test.util.BytesTrieTest#Test54TruncatingIteratorFromLinearMatchLong
-android.icu.dev.test.util.BytesTrieTest#Test59IteratorFromBytes
-android.icu.dev.test.util.CharsTrieTest#Test00Builder
-android.icu.dev.test.util.CharsTrieTest#Test10Empty
-android.icu.dev.test.util.CharsTrieTest#Test11_a
-android.icu.dev.test.util.CharsTrieTest#Test12_a_ab
-android.icu.dev.test.util.CharsTrieTest#Test20ShortestBranch
-android.icu.dev.test.util.CharsTrieTest#Test21Branches
-android.icu.dev.test.util.CharsTrieTest#Test22LongSequence
-android.icu.dev.test.util.CharsTrieTest#Test23LongBranch
-android.icu.dev.test.util.CharsTrieTest#Test24ValuesForState
-android.icu.dev.test.util.CharsTrieTest#Test30Compact
-android.icu.dev.test.util.CharsTrieTest#Test31FirstForCodePoint
-android.icu.dev.test.util.CharsTrieTest#Test32NextForCodePoint
-android.icu.dev.test.util.CharsTrieTest#Test37LargeTrie
-android.icu.dev.test.util.CharsTrieTest#Test40GetUniqueValue
-android.icu.dev.test.util.CharsTrieTest#Test41GetNextChars
-android.icu.dev.test.util.CharsTrieTest#Test50IteratorFromBranch
-android.icu.dev.test.util.CharsTrieTest#Test51IteratorFromLinearMatch
-android.icu.dev.test.util.CharsTrieTest#Test52TruncatingIteratorFromRoot
-android.icu.dev.test.util.CharsTrieTest#Test53TruncatingIteratorFromLinearMatchShort
-android.icu.dev.test.util.CharsTrieTest#Test54TruncatingIteratorFromLinearMatchLong
-android.icu.dev.test.util.CharsTrieTest#Test59IteratorFromChars
-android.icu.dev.test.util.CompactArrayTest#TestByteArrayCoverage
-android.icu.dev.test.util.CompactArrayTest#TestCharArrayCoverage
-android.icu.dev.test.util.CurrencyTest#TestAPI
-android.icu.dev.test.util.CurrencyTest#TestAvailableCurrencyCodes
-android.icu.dev.test.util.CurrencyTest#TestCoverage
-android.icu.dev.test.util.CurrencyTest#TestCurrencyData
-android.icu.dev.test.util.CurrencyTest#TestCurrencyDisplayNames
-android.icu.dev.test.util.CurrencyTest#TestCurrencyInfoCtor
-android.icu.dev.test.util.CurrencyTest#TestCurrencyKeyword
-android.icu.dev.test.util.CurrencyTest#TestCurrencyMetaInfo
-android.icu.dev.test.util.CurrencyTest#testCurrencyMetaInfoRanges
-android.icu.dev.test.util.CurrencyTest#testCurrencyMetaInfoRangesWithLongs
-android.icu.dev.test.util.CurrencyTest#TestDeprecatedCurrencyFormat
-android.icu.dev.test.util.CurrencyTest#TestGetAvailableCurrencies
-android.icu.dev.test.util.CurrencyTest#TestGetDisplayName
-android.icu.dev.test.util.CurrencyTest#TestGetKeywordValues
-android.icu.dev.test.util.CurrencyTest#TestGetNumericCode
-android.icu.dev.test.util.CurrencyTest#TestIsAvailable
-android.icu.dev.test.util.CurrencyTest#TestNames
-android.icu.dev.test.util.CurrencyTest#TestRegistration
-android.icu.dev.test.util.CurrencyTest#TestWithTender
-android.icu.dev.test.util.DebugUtilitiesTest#TestStrings
-android.icu.dev.test.util.GenderInfoTest#TestEmpty
-android.icu.dev.test.util.GenderInfoTest#TestFallback
-android.icu.dev.test.util.GenderInfoTest#TestOne
-android.icu.dev.test.util.GenderInfoTest#TestOther
-android.icu.dev.test.util.ICUBinaryTest#TestReadHeader
-android.icu.dev.test.util.ICUResourceBundleCollationTest#TestFunctionalEquivalent
-android.icu.dev.test.util.ICUResourceBundleCollationTest#TestGetWithFallback
-android.icu.dev.test.util.ICUResourceBundleCollationTest#TestKeywordValues
-android.icu.dev.test.util.ICUResourceBundleCollationTest#TestOpen
-android.icu.dev.test.util.ICUResourceBundleTest#TestAlias
-android.icu.dev.test.util.ICUResourceBundleTest#TestAliases
-android.icu.dev.test.util.ICUResourceBundleTest#TestAliasFallback
-android.icu.dev.test.util.ICUResourceBundleTest#TestBasicTypes
-android.icu.dev.test.util.ICUResourceBundleTest#TestCircularAliases
-android.icu.dev.test.util.ICUResourceBundleTest#TestCLDRStyleAliases
-android.icu.dev.test.util.ICUResourceBundleTest#TestCoverage
-android.icu.dev.test.util.ICUResourceBundleTest#TestFunctionalEquivalent
-android.icu.dev.test.util.ICUResourceBundleTest#TestGetResources
-android.icu.dev.test.util.ICUResourceBundleTest#TestGetWithFallback
-android.icu.dev.test.util.ICUResourceBundleTest#TestICUGetKeysAtTopLevel
-android.icu.dev.test.util.ICUResourceBundleTest#TestICUGetKeysForResourceItem
-android.icu.dev.test.util.ICUResourceBundleTest#TestJavaULocaleBundleLoading
-android.icu.dev.test.util.ICUResourceBundleTest#TestJB3879
-android.icu.dev.test.util.ICUResourceBundleTest#TestJB4102
-android.icu.dev.test.util.ICUResourceBundleTest#TestLoadingStatus
-android.icu.dev.test.util.ICUResourceBundleTest#TestLocaleDisplayNames
-android.icu.dev.test.util.ICUResourceBundleTest#TestNorwegian
-android.icu.dev.test.util.ICUResourceBundleTest#TestOpen
-android.icu.dev.test.util.ICUResourceBundleTest#TestPreventFallback
-android.icu.dev.test.util.ICUResourceBundleTest#TestResourceBundleWrapper
-android.icu.dev.test.util.ICUResourceBundleTest#TestT6844
-android.icu.dev.test.util.ICUResourceBundleTest#TestTable32
-android.icu.dev.test.util.ICUResourceBundleTest#TestUResourceBundleCoverage
-android.icu.dev.test.util.ICUResourceBundleTest#TestXPathAlias
-android.icu.dev.test.util.ICUServiceTest#TestAPI
-android.icu.dev.test.util.ICUServiceTest#TestCoverage
-android.icu.dev.test.util.ICUServiceTest#TestLocale
-android.icu.dev.test.util.ICUServiceTest#TestWrapFactory
-android.icu.dev.test.util.ICUServiceThreadTest#Test00_ConcurrentGet
-android.icu.dev.test.util.ICUServiceThreadTest#Test01_ConcurrentGetVisible
-android.icu.dev.test.util.ICUServiceThreadTest#Test02_ConcurrentGetDisplay
-android.icu.dev.test.util.ICUServiceThreadTest#Test03_ConcurrentRegUnreg
-android.icu.dev.test.util.ICUServiceThreadTest#Test04_WitheringService
-android.icu.dev.test.util.ICUServiceThreadTest#Test05_ConcurrentEverything
-android.icu.dev.test.util.LocaleAliasCollationTest#TestCollation
-android.icu.dev.test.util.LocaleAliasTest#TestCalendar
-android.icu.dev.test.util.LocaleAliasTest#TestDateFormat
-android.icu.dev.test.util.LocaleAliasTest#TestDisplayName
-android.icu.dev.test.util.LocaleAliasTest#TestULocale
-android.icu.dev.test.util.LocaleAliasTest#TestUResourceBundle
-android.icu.dev.test.util.LocaleBuilderTest#TestLocaleBuilder
-android.icu.dev.test.util.LocaleBuilderTest#TestSetLocale
-android.icu.dev.test.util.LocaleDataTest#TestCoverage
-android.icu.dev.test.util.LocaleDataTest#TestEnglishExemplarCharacters
-android.icu.dev.test.util.LocaleDataTest#TestExemplarSet
-android.icu.dev.test.util.LocaleDataTest#TestExemplarSet2
-android.icu.dev.test.util.LocaleDataTest#TestExemplarSetTypes
-android.icu.dev.test.util.LocaleDataTest#TestFallback
-android.icu.dev.test.util.LocaleDataTest#TestLocaleDisplayPattern
-android.icu.dev.test.util.LocaleDataTest#TestMeasurementSystem
-android.icu.dev.test.util.LocaleDataTest#TestPaperSize
-android.icu.dev.test.util.LocaleMatcherTest#Test8288
-android.icu.dev.test.util.LocaleMatcherTest#testAsymmetry
-android.icu.dev.test.util.LocaleMatcherTest#testBasics
-android.icu.dev.test.util.LocaleMatcherTest#testBestMatchForTraditionalChinese
-android.icu.dev.test.util.LocaleMatcherTest#testChinese
-android.icu.dev.test.util.LocaleMatcherTest#testEmpty
-android.icu.dev.test.util.LocaleMatcherTest#testenGB
-android.icu.dev.test.util.LocaleMatcherTest#testExactMatches
-android.icu.dev.test.util.LocaleMatcherTest#testFallback
-android.icu.dev.test.util.LocaleMatcherTest#testFallbacks
-android.icu.dev.test.util.LocaleMatcherTest#testGetBestMatchForList_closeEnoughMatchOnMaximized
-android.icu.dev.test.util.LocaleMatcherTest#testGetBestMatchForList_exactMatch
-android.icu.dev.test.util.LocaleMatcherTest#testGetBestMatchForList_matchOnMaximized
-android.icu.dev.test.util.LocaleMatcherTest#testGetBestMatchForList_matchOnMaximized2
-android.icu.dev.test.util.LocaleMatcherTest#testGetBestMatchForList_noMatchOnMaximized
-android.icu.dev.test.util.LocaleMatcherTest#testGetBestMatchForList_simpleVariantMatch
-android.icu.dev.test.util.LocaleMatcherTest#testGetBestMatchForPortuguese
-android.icu.dev.test.util.LocaleMatcherTest#testGetBestMatch_googlePseudoLocales
-android.icu.dev.test.util.LocaleMatcherTest#testGetBestMatch_regionDistance
-android.icu.dev.test.util.LocaleMatcherTest#testHK
-android.icu.dev.test.util.LocaleMatcherTest#TestLocaleMatcherCoverage
-android.icu.dev.test.util.LocaleMatcherTest#testMatch_exact
-android.icu.dev.test.util.LocaleMatcherTest#testMatchGrandfatheredCode
-android.icu.dev.test.util.LocaleMatcherTest#testMatch_matchOnMazimized
-android.icu.dev.test.util.LocaleMatcherTest#testMatch_none
-android.icu.dev.test.util.LocaleMatcherTest#testOverrideData
-android.icu.dev.test.util.LocaleMatcherTest#testParentLocales
-android.icu.dev.test.util.LocaleMatcherTest#testPerf
-android.icu.dev.test.util.LocaleMatcherTest#testRegionalSpecials
-android.icu.dev.test.util.LocaleMatcherTest#testSpecials
-android.icu.dev.test.util.LocaleMatcherTest#testUndefined
-android.icu.dev.test.util.LocaleMatcherTest#testVariantWithScriptMatch
-android.icu.dev.test.util.LocaleMatcherTest#testVariantWithScriptMatch2
-android.icu.dev.test.util.LocalePriorityListTest#testLanguagePriorityList
-android.icu.dev.test.util.RegionTest#TestAvailableTerritories
-android.icu.dev.test.util.RegionTest#TestContains
-android.icu.dev.test.util.RegionTest#TestGetContainedRegions
-android.icu.dev.test.util.RegionTest#TestGetContainedRegionsWithType
-android.icu.dev.test.util.RegionTest#TestGetContainingRegion
-android.icu.dev.test.util.RegionTest#TestGetContainingRegionWithType
-android.icu.dev.test.util.RegionTest#TestGetInstanceInt
-android.icu.dev.test.util.RegionTest#TestGetInstanceString
-android.icu.dev.test.util.RegionTest#TestGetPreferredValues
-android.icu.dev.test.util.RegionTest#TestKnownRegions
-android.icu.dev.test.util.SimplePatternFormatterTest#TestBigPlaceholder
-android.icu.dev.test.util.SimplePatternFormatterTest#TestFormatReplaceNoOptimization
-android.icu.dev.test.util.SimplePatternFormatterTest#TestFormatReplaceNoOptimizationLeadingPlaceholderUsedTwice
-android.icu.dev.test.util.SimplePatternFormatterTest#TestFormatReplaceNoOptimizationLeadingText
-android.icu.dev.test.util.SimplePatternFormatterTest#TestFormatReplaceNoOptimizationNoOffsets
-android.icu.dev.test.util.SimplePatternFormatterTest#TestFormatReplaceOptimization
-android.icu.dev.test.util.SimplePatternFormatterTest#TestFormatReplaceOptimizationNoOffsets
-android.icu.dev.test.util.SimplePatternFormatterTest#TestFormatUseAppendToAsPlaceholder
-android.icu.dev.test.util.SimplePatternFormatterTest#TestGetTextWithNoPlaceholders
-android.icu.dev.test.util.SimplePatternFormatterTest#TestOnePlaceholder
-android.icu.dev.test.util.SimplePatternFormatterTest#TestQuotingLikeMessageFormat
-android.icu.dev.test.util.SimplePatternFormatterTest#TestSyntaxErrors
-android.icu.dev.test.util.SimplePatternFormatterTest#TestTooFewPlaceholderValues
-android.icu.dev.test.util.SimplePatternFormatterTest#TestWithNoPlaceholders
-android.icu.dev.test.util.SimplePatternFormatterTest#TestWithPlaceholders
-android.icu.dev.test.util.StringTokenizerTest#TestAdd_int
-android.icu.dev.test.util.StringTokenizerTest#TestAdd_int_int
-android.icu.dev.test.util.StringTokenizerTest#TestBug4423
-android.icu.dev.test.util.StringTokenizerTest#TestCharAt
-android.icu.dev.test.util.StringTokenizerTest#TestComplement_int_int
-android.icu.dev.test.util.StringTokenizerTest#TestComplement_String
-android.icu.dev.test.util.StringTokenizerTest#TestConstructors
-android.icu.dev.test.util.StringTokenizerTest#TestContains_int
-android.icu.dev.test.util.StringTokenizerTest#TestContains_int_int
-android.icu.dev.test.util.StringTokenizerTest#TestContainsNone
-android.icu.dev.test.util.StringTokenizerTest#TestCountTokens
-android.icu.dev.test.util.StringTokenizerTest#TestCountTokensNoCoalesce
-android.icu.dev.test.util.StringTokenizerTest#Test_GeneratePattern
-android.icu.dev.test.util.StringTokenizerTest#TestGetRegexEquivalent
-android.icu.dev.test.util.StringTokenizerTest#TestGetSingleCP
-android.icu.dev.test.util.StringTokenizerTest#TestIndexOf
-android.icu.dev.test.util.StringTokenizerTest#TestMatches
-android.icu.dev.test.util.StringTokenizerTest#TestMatchesAt
-android.icu.dev.test.util.StringTokenizerTest#TestMatchRest
-android.icu.dev.test.util.StringTokenizerTest#TestNextDelimiterToken
-android.icu.dev.test.util.StringTokenizerTest#TestNextNewDelimiters
-android.icu.dev.test.util.StringTokenizerTest#TestNextNonDelimiterToken
-android.icu.dev.test.util.StringTokenizerTest#TestNoCoalesce
-android.icu.dev.test.util.StringTokenizerTest#TestRemove
-android.icu.dev.test.util.StringTokenizerTest#TestRemoveAllString
-android.icu.dev.test.util.StringTokenizerTest#TestRetain_int_int
-android.icu.dev.test.util.StringTokenizerTest#TestRetain_String
-android.icu.dev.test.util.StringTokenizerTest#TestSupplementary
-android.icu.dev.test.util.TextTrieMapTest#TestCaseInsensitive
-android.icu.dev.test.util.TextTrieMapTest#TestCaseSensitive
-android.icu.dev.test.util.Trie2Test#TestCharSequenceIterator
-android.icu.dev.test.util.Trie2Test#TestRanges
-android.icu.dev.test.util.Trie2Test#TestTrie2API
-android.icu.dev.test.util.Trie2Test#TestTrie2WritableAPI
-android.icu.dev.test.util.TrieTest#TestDummyCharTrie
-android.icu.dev.test.util.TrieTest#TestDummyIntTrie
-android.icu.dev.test.util.TrieTest#TestIntTrie
-android.icu.dev.test.util.ULocaleCollationTest#TestCollator
-android.icu.dev.test.util.ULocaleCollationTest#TestIllformedLocale
-android.icu.dev.test.util.ULocaleCollationTest#TestNameList
-android.icu.dev.test.util.ULocaleTest#Test4735
-android.icu.dev.test.util.ULocaleTest#TestAcceptLanguage
-android.icu.dev.test.util.ULocaleTest#TestAcceptLanguage2
-android.icu.dev.test.util.ULocaleTest#TestAddLikelySubtags
-android.icu.dev.test.util.ULocaleTest#TestBamBm
-android.icu.dev.test.util.ULocaleTest#TestBasicGetters
-android.icu.dev.test.util.ULocaleTest#TestCalendar
-android.icu.dev.test.util.ULocaleTest#TestCanonicalization
-android.icu.dev.test.util.ULocaleTest#TestCategoryDefault
-android.icu.dev.test.util.ULocaleTest#TestChineseToLocale
-android.icu.dev.test.util.ULocaleTest#TestCLDRVersion
-android.icu.dev.test.util.ULocaleTest#TestComparable
-android.icu.dev.test.util.ULocaleTest#TestCoverage
-android.icu.dev.test.util.ULocaleTest#TestDateFormat
-android.icu.dev.test.util.ULocaleTest#TestDisplayKeyword
-android.icu.dev.test.util.ULocaleTest#TestDisplayLanguageWithDialectCoverage
-android.icu.dev.test.util.ULocaleTest#TestDisplayNames
-android.icu.dev.test.util.ULocaleTest#TestDisplayNameWithDialectCoverage
-android.icu.dev.test.util.ULocaleTest#TestDisplayScriptCoverage
-android.icu.dev.test.util.ULocaleTest#TestDisplayWithKeyword
-android.icu.dev.test.util.ULocaleTest#TestExtension
-android.icu.dev.test.util.ULocaleTest#TestForLanguageTag
-android.icu.dev.test.util.ULocaleTest#TestForLocale
-android.icu.dev.test.util.ULocaleTest#TestGetAvailable
-android.icu.dev.test.util.ULocaleTest#TestGetFallback
-android.icu.dev.test.util.ULocaleTest#TestIsRightToLeft
-android.icu.dev.test.util.ULocaleTest#TestJavaLocaleCompatibility
-android.icu.dev.test.util.ULocaleTest#TestJB3962
-android.icu.dev.test.util.ULocaleTest#TestMinimize
-android.icu.dev.test.util.ULocaleTest#TestNumberFormat
-android.icu.dev.test.util.ULocaleTest#TestObsoleteNames
-android.icu.dev.test.util.ULocaleTest#TestOrientation
-android.icu.dev.test.util.ULocaleTest#TestPrefixes
-android.icu.dev.test.util.ULocaleTest#TestSetULocaleKeywords
-android.icu.dev.test.util.ULocaleTest#TestToLanguageTag
-android.icu.dev.test.util.ULocaleTest#TestToLegacyKey
-android.icu.dev.test.util.ULocaleTest#TestToLegacyType
-android.icu.dev.test.util.ULocaleTest#TestToLocale
-android.icu.dev.test.util.ULocaleTest#TestToUnicodeLocaleKey
-android.icu.dev.test.util.ULocaleTest#TestToUnicodeLocaleType
-android.icu.dev.test.util.ULocaleTest#TestUnicodeLocaleExtension
-android.icu.dev.test.util.UtilityTest#TestAssert
-android.icu.dev.test.util.UtilityTest#TestByteArrayWrapper
-android.icu.dev.test.util.UtilityTest#TestCaseInsensitiveString
-android.icu.dev.test.util.UtilityTest#TestCompareUnsigned
-android.icu.dev.test.util.UtilityTest#TestFormat
-android.icu.dev.test.util.UtilityTest#TestHighBit
-android.icu.dev.test.util.UtilityTest#TestSourceLocation
-android.icu.dev.test.util.UtilityTest#TestUnescape
-android.icu.dev.test.util.UtilityTest#TestUnicodeSet
-android.icu.dev.test.util.VersionInfoTest#TestComparable
-android.icu.dev.test.util.VersionInfoTest#TestCompare
-android.icu.dev.test.util.VersionInfoTest#TestGetter
-android.icu.dev.test.util.VersionInfoTest#TestInstance
-android.icu.dev.test.util.VersionInfoTest#TestMultiThread
-android.icu.dev.test.util.VersionInfoTest#TesttoString
diff --git a/tests/tests/icu/tools/android/icu/cts/tools/GenerateTestCaseXML.java b/tests/tests/icu/tools/android/icu/cts/tools/GenerateTestCaseXML.java
deleted file mode 100644
index 4cd0068..0000000
--- a/tests/tests/icu/tools/android/icu/cts/tools/GenerateTestCaseXML.java
+++ /dev/null
@@ -1,245 +0,0 @@
-package android.icu.cts.tools;
-
-import com.google.common.base.Joiner;
-import com.android.compatibility.common.util.AbiUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-/**
- * Generates an XML file suitable for CTS version 1.
- *
- * <p>A lot of this code is copied from {@code tools/utils/DescriptionGenerator.java} and
- * {@code tools/utils/CollectAllTests.java}. Ideally, that code should have been refactored to make
- * it usable in this case but that would have taken quite a lot of time and given that CTS version 1
- * is going away anyway and CTS version 2 doesn't need an XML file this seemed like the best
- * approach.
- */
-public class GenerateTestCaseXML {
-
- private static final String ATTRIBUTE_RUNNER = "runner";
-
- private static final String ATTRIBUTE_PACKAGE = "appPackageName";
-
- private static final String ATTRIBUTE_NS = "appNameSpace";
-
- static final String TAG_PACKAGE = "TestPackage";
-
- static final String TAG_SUITE = "TestSuite";
-
- static final String TAG_CASE = "TestCase";
-
- static final String TAG_TEST = "Test";
-
- static final String ATTRIBUTE_NAME_VERSION = "version";
-
- static final String ATTRIBUTE_VALUE_VERSION = "1.0";
-
- static final String ATTRIBUTE_NAME_FRAMEWORK = "AndroidFramework";
-
- static final String ATTRIBUTE_VALUE_FRAMEWORK = "Android 1.0";
-
- static final String ATTRIBUTE_NAME = "name";
-
- static final String ATTRIBUTE_ABIS = "abis";
-
- public static void main(String[] args) throws Exception {
- if (args.length != 3) {
- throw new IllegalStateException(
- "... <test-list-path> <architecture> <output-file-path");
- }
-
- String testListPath = args[0];
- String architecture = args[1];
- String outputFilePath = args[2];
-
- File testListFile = new File(testListPath);
- String abis = Joiner.on(" ").join(AbiUtils.getAbisForArch(architecture));
- File testCaseXML = new File(outputFilePath);
-
- TestSuite root = new TestSuite("");
- try (FileReader fileReader = new FileReader(testListFile);
- BufferedReader reader = new BufferedReader(fileReader)) {
-
- String line;
- while ((line = reader.readLine()) != null) {
- int index = line.indexOf('#');
- String className = line.substring(0, index);
- String methodName = line.substring(index + 1);
-
- root.addTest(className, methodName);
- }
- }
-
- Document mDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
-
- Element testPackageElem = mDoc.createElement(TAG_PACKAGE);
- mDoc.appendChild(testPackageElem);
-
- setAttribute(testPackageElem, ATTRIBUTE_NAME_VERSION, ATTRIBUTE_VALUE_VERSION);
- setAttribute(testPackageElem, ATTRIBUTE_NAME_FRAMEWORK, ATTRIBUTE_VALUE_FRAMEWORK);
- setAttribute(testPackageElem, ATTRIBUTE_NAME, "CtsIcuTestCases");
- setAttribute(testPackageElem, ATTRIBUTE_RUNNER, "android.icu.cts.IcuTestRunnerForCtsV1");
- setAttribute(testPackageElem, ATTRIBUTE_PACKAGE, "android.icu.dev.test");
- setAttribute(testPackageElem, ATTRIBUTE_NS, "android.icu.cts");
-
- root.addChildInformation(testPackageElem, abis);
-
- Transformer t = TransformerFactory.newInstance().newTransformer();
-
- // enable indent in result file
- t.setOutputProperty("indent", "yes");
- t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
-
- File directory = testCaseXML.getParentFile();
- if (!directory.exists() && !directory.mkdirs()) {
- throw new IOException("Could not create directory: " + directory);
- }
-
- t.transform(new DOMSource(mDoc), new StreamResult(new FileOutputStream(testCaseXML)));
- }
-
- /**
- * Set the attribute of element.
- *
- * @param elem The element to be set attribute.
- * @param name The attribute name.
- * @param value The attribute value.
- */
- protected static void setAttribute(Node elem, String name, String value) {
- Attr attr = elem.getOwnerDocument().createAttribute(name);
- attr.setNodeValue(value);
-
- elem.getAttributes().setNamedItem(attr);
- }
-
-
- /**
- * The contents of a {@link TestSuite}, may be a {@link TestSuite} or a {@link TestCase}.
- */
- private static abstract class SuiteContent {
-
- private final String name;
-
- private SuiteContent(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public abstract void addInformation(Element parent, String abis);
- }
-
- public static class TestSuite extends SuiteContent {
-
- private Map<String, SuiteContent> name2Content = new TreeMap<>();
-
- public TestSuite(String name) {
- super(name);
- }
-
- public TestSuite getSuite(String name) {
- return getSuiteContent(TestSuite.class, name);
- }
-
- public TestCase getTestCase(String name) {
- return getSuiteContent(TestCase.class, name);
- }
-
- private <S extends SuiteContent> S getSuiteContent(Class<? extends S> contentClass,
- String name) {
- SuiteContent content = name2Content.get(name);
- S s;
- if (content == null) {
- try {
- s = contentClass.getConstructor(String.class).newInstance(name);
- } catch (Exception e) {
- throw new RuntimeException("Could not create instance of " + contentClass, e);
- }
- name2Content.put(name, s);
- } else if (contentClass.isInstance(content)) {
- s = contentClass.cast(content);
- } else {
- throw new IllegalStateException("Expected " + this
- + " to have a TestSuite called '" + name + "' but has "
- + content + " instead");
- }
- return s;
- }
-
- public void addTest(String className, String methodName) {
- int index = className.indexOf('.');
- if (index == -1) {
- TestCase testCase = getTestCase(className);
- testCase.addMethod(methodName);
- } else {
- String suiteName = className.substring(0, index);
- TestSuite childSuite = getSuite(suiteName);
- childSuite.addTest(className.substring(index + 1), methodName);
- }
- }
-
- @Override
- public void addInformation(Element parent, String abis) {
- Element suiteElement = appendElement(parent, TAG_SUITE);
-
- setAttribute(suiteElement, ATTRIBUTE_NAME, getName());
-
- addChildInformation(suiteElement, abis);
- }
-
- public void addChildInformation(Element parent, String abis) {
- for (SuiteContent suiteContent : name2Content.values()) {
- suiteContent.addInformation(parent, abis);
- }
- }
- }
-
- public static class TestCase extends SuiteContent {
-
- private final Set<String> methods = new TreeSet<>();
-
- public TestCase(String name) {
- super(name);
- }
-
- @Override
- public void addInformation(Element parent, String abis) {
- Element testCaseElement = appendElement(parent, TAG_CASE);
- setAttribute(testCaseElement, ATTRIBUTE_NAME, getName());
- setAttribute(testCaseElement, ATTRIBUTE_ABIS, abis);
-
- for (String method : methods) {
- Element testElement = appendElement(testCaseElement, TAG_TEST);
- setAttribute(testElement, ATTRIBUTE_NAME, method);
- }
- }
-
- public void addMethod(String methodName) {
- methods.add(methodName);
- }
- }
-
- private static Element appendElement(Element parent, String tagName) {
- Element testCaseElement = parent.getOwnerDocument().createElement(tagName);
- parent.appendChild(testCaseElement);
- return testCaseElement;
- }
-}
diff --git a/tests/tests/icu/tools/update-test-list.sh b/tests/tests/icu/tools/update-test-list.sh
deleted file mode 100755
index e73cbfb..0000000
--- a/tests/tests/icu/tools/update-test-list.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-# Extract a flat list of tests from a CTSv2 generated host log for use when generating the CTSv1
-# required list of tests.
-ZIP=$1
-
-TMP_DIR=/tmp/update-test-list-$$
-mkdir -p $TMP_DIR
-
-unzip $ZIP host_log.txt -d $TMP_DIR
-
-HOST_LOG=$TMP_DIR/host_log.txt
-
-ICU_DIR=$(dirname $0)/../
-
-grep "ModuleListener.testStarted" $HOST_LOG \
- | sed 's%.*(\([^#]\+\)#\([^)]\+\))%\1#\2%' | sort > $ICU_DIR/test-list.txt
diff --git a/tests/tests/jni/Android.mk b/tests/tests/jni/Android.mk
index 7a9504d..d62a97e 100644
--- a/tests/tests/jni/Android.mk
+++ b/tests/tests/jni/Android.mk
@@ -32,7 +32,13 @@
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
-LOCAL_JNI_SHARED_LIBRARIES := libjnitest libnativehelper_compat_libc++
+LOCAL_JNI_SHARED_LIBRARIES := \
+ libjninamespacea1 \
+ libjninamespacea2 \
+ libjninamespaceb \
+ libjnicommon \
+ libjnitest \
+ libnativehelper_compat_libc++
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -41,4 +47,4 @@
include $(BUILD_CTS_PACKAGE)
# Include the associated library's makefile.
-include $(LOCAL_PATH)/libjnitest/Android.mk
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/jni/libjnicommon/Android.mk b/tests/tests/jni/libjnicommon/Android.mk
new file mode 100644
index 0000000..0f8044e
--- /dev/null
+++ b/tests/tests/jni/libjnicommon/Android.mk
@@ -0,0 +1,37 @@
+# Copyright (C) 2016 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.
+
+#
+# This is the shared library included by the JNI test app.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libjnicommon
+
+# Don't include this package in any configuration by default.
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := common.cpp
+
+LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
+
+LOCAL_SHARED_LIBRARIES := libdl liblog libnativehelper_compat_libc++
+
+LOCAL_SDK_VERSION := 23
+LOCAL_NDK_STL_VARIANT := c++_static
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tests/tests/jni/libjnicommon/common.cpp
similarity index 76%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to tests/tests/jni/libjnicommon/common.cpp
index 1293572..02cdb24 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tests/tests/jni/libjnicommon/common.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -14,6 +14,14 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+#include "common.h"
-struct sock_fprog GetTestSeccompFilterProgram();
+int global = 0;
+
+void incrementGlobal() {
+ ++global;
+}
+
+int getGlobal() {
+ return global;
+}
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tests/tests/jni/libjnicommon/common.h
similarity index 78%
rename from tests/tests/os/jni/seccomp_sample_program.h
rename to tests/tests/jni/libjnicommon/common.h
index 1293572..c82eece 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tests/tests/jni/libjnicommon/common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -14,6 +14,10 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+#ifndef COMMON_H
+#define COMMON_H
-struct sock_fprog GetTestSeccompFilterProgram();
+void incrementGlobal();
+int getGlobal();
+
+#endif // COMMON_H
diff --git a/tests/tests/jni/libjninamespacea1/Android.mk b/tests/tests/jni/libjninamespacea1/Android.mk
new file mode 100644
index 0000000..8016c50
--- /dev/null
+++ b/tests/tests/jni/libjninamespacea1/Android.mk
@@ -0,0 +1,38 @@
+# Copyright (C) 2016 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.
+
+#
+# This is the shared library included by the JNI test app.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libjninamespacea1
+
+# Don't include this package in any configuration by default.
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := namespacea1.cpp
+
+LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) $(LOCAL_PATH)/../libjnicommon/
+
+LOCAL_LDLIBS += -llog
+LOCAL_SHARED_LIBRARIES := libdl liblog libnativehelper_compat_libc++ libjnicommon
+
+LOCAL_SDK_VERSION := 23
+LOCAL_NDK_STL_VARIANT := c++_static
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/jni/libjninamespacea1/namespacea1.cpp b/tests/tests/jni/libjninamespacea1/namespacea1.cpp
new file mode 100644
index 0000000..decb4f1
--- /dev/null
+++ b/tests/tests/jni/libjninamespacea1/namespacea1.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "common.h"
+
+#include <android/log.h>
+#include <jni.h>
+#include <JNIHelp.h>
+
+#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,"namespacea1",__VA_ARGS__)
+
+int global = 0;
+
+jint JNI_OnLoad(JavaVM*, void*) {
+ LOGI("JNI_OnLoad namespacea1");
+ return JNI_VERSION_1_4;
+}
+
+extern "C" JNIEXPORT void JNICALL
+ Java_android_jni_cts_ClassNamespaceA1_incrementGlobal(JNIEnv*, jclass) {
+ incrementGlobal();
+}
+
+extern "C" JNIEXPORT jint JNICALL
+ Java_android_jni_cts_ClassNamespaceA1_getGlobal(JNIEnv*, jclass) {
+ return getGlobal();
+}
diff --git a/tests/tests/jni/libjninamespacea2/Android.mk b/tests/tests/jni/libjninamespacea2/Android.mk
new file mode 100644
index 0000000..9b515c9
--- /dev/null
+++ b/tests/tests/jni/libjninamespacea2/Android.mk
@@ -0,0 +1,38 @@
+# Copyright (C) 2016 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.
+
+#
+# This is the shared library included by the JNI test app.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libjninamespacea2
+
+# Don't include this package in any configuration by default.
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := namespacea2.cpp
+
+LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) $(LOCAL_PATH)/../libjnicommon/
+
+LOCAL_LDLIBS += -llog
+LOCAL_SHARED_LIBRARIES := libdl liblog libnativehelper_compat_libc++ libjnicommon
+
+LOCAL_SDK_VERSION := 23
+LOCAL_NDK_STL_VARIANT := c++_static
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/jni/libjninamespacea2/namespacea2.cpp b/tests/tests/jni/libjninamespacea2/namespacea2.cpp
new file mode 100644
index 0000000..809266e
--- /dev/null
+++ b/tests/tests/jni/libjninamespacea2/namespacea2.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "common.h"
+
+#include <android/log.h>
+#include <jni.h>
+#include <JNIHelp.h>
+
+#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,"namespacea2",__VA_ARGS__)
+
+int global = 0;
+
+jint JNI_OnLoad(JavaVM*, void*) {
+ LOGI("JNI_OnLoad namespacea2");
+ return JNI_VERSION_1_4;
+}
+
+extern "C" JNIEXPORT void JNICALL
+ Java_android_jni_cts_ClassNamespaceA2_incrementGlobal(JNIEnv*, jclass) {
+ incrementGlobal();
+}
+
+extern "C" JNIEXPORT jint JNICALL
+ Java_android_jni_cts_ClassNamespaceA2_getGlobal(JNIEnv*, jclass) {
+ return getGlobal();
+}
diff --git a/tests/tests/jni/libjninamespaceb/Android.mk b/tests/tests/jni/libjninamespaceb/Android.mk
new file mode 100644
index 0000000..4d3e158
--- /dev/null
+++ b/tests/tests/jni/libjninamespaceb/Android.mk
@@ -0,0 +1,38 @@
+# Copyright (C) 2016 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.
+
+#
+# This is the shared library included by the JNI test app.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libjninamespaceb
+
+# Don't include this package in any configuration by default.
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := namespaceb.cpp
+
+LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) $(LOCAL_PATH)/../libjnicommon/
+
+LOCAL_LDLIBS += -llog
+LOCAL_SHARED_LIBRARIES := libdl liblog libnativehelper_compat_libc++ libjnicommon
+
+LOCAL_SDK_VERSION := 23
+LOCAL_NDK_STL_VARIANT := c++_static
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/jni/libjninamespaceb/namespaceb.cpp b/tests/tests/jni/libjninamespaceb/namespaceb.cpp
new file mode 100644
index 0000000..b3bedcb
--- /dev/null
+++ b/tests/tests/jni/libjninamespaceb/namespaceb.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "common.h"
+
+#include <android/log.h>
+#include <jni.h>
+#include <JNIHelp.h>
+
+#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,"namespaceb",__VA_ARGS__)
+
+int global = 0;
+
+jint JNI_OnLoad(JavaVM*, void*) {
+ LOGI("JNI_OnLoad namespaceb");
+ return JNI_VERSION_1_4;
+}
+
+extern "C" JNIEXPORT void JNICALL
+ Java_android_jni_cts_ClassNamespaceB_incrementGlobal(JNIEnv*, jclass) {
+ incrementGlobal();
+}
+
+extern "C" JNIEXPORT jint JNICALL
+ Java_android_jni_cts_ClassNamespaceB_getGlobal(JNIEnv*, jclass) {
+ return getGlobal();
+}
diff --git a/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp b/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
index 8a82706..05b8a4b 100644
--- a/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
+++ b/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
@@ -61,7 +61,7 @@
"libutils.so",
};
-static bool is_directory(const std::string path) {
+static bool is_directory(const std::string& path) {
struct stat sb;
if (stat(path.c_str(), &sb) != -1) {
return S_ISDIR(sb.st_mode);
@@ -70,7 +70,7 @@
return false;
}
-static bool is_libdl(const std::string path) {
+static bool is_libdl(const std::string& path) {
return kSystemLibraryPath + "/libdl.so" == path;
}
@@ -125,7 +125,7 @@
}
static bool check_path(const std::string& library_path,
- const std::unordered_set<std::string> libraries,
+ const std::unordered_set<std::string>& libraries,
std::vector<std::string>* errors) {
bool success = true;
std::list<std::string> dirs = { library_path };
diff --git a/tests/tests/jni/libjnitest/helper.h b/tests/tests/jni/libjnitest/helper.h
index 58a3407..f811055 100644
--- a/tests/tests/jni/libjnitest/helper.h
+++ b/tests/tests/jni/libjnitest/helper.h
@@ -37,7 +37,7 @@
* the given name. The function is static, returns a (char *), and
* takes a (JNIEnv *) named "env".
*/
-#define TEST_DECLARATION(name) static char *test_##name(JNIEnv *env)
+#define TEST_DECLARATION(name) static char *test_##name(JNIEnv *env) /* NOLINT */
/**
* Logs and returns an error message, passed and formatted in printf()
diff --git a/tests/tests/jni/src/android/jni/cts/JniStaticTest.java b/tests/tests/jni/src/android/jni/cts/JniStaticTest.java
index 91ebe73..d2e90c6 100644
--- a/tests/tests/jni/src/android/jni/cts/JniStaticTest.java
+++ b/tests/tests/jni/src/android/jni/cts/JniStaticTest.java
@@ -42,6 +42,13 @@
}
}
+ public void test_linker_namespaces_classloaders() throws Exception {
+ String error = LinkerNamespacesHelper.runClassLoaderNamespaces();
+ if (error != null) {
+ fail(error);
+ }
+ }
+
/**
* Test that accessing classes true JNI works as expected. b/19382130
*/
diff --git a/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java b/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
index 132a21f..754e6b2 100644
--- a/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
+++ b/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
@@ -17,8 +17,11 @@
package android.jni.cts;
import android.content.Context;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.support.test.InstrumentationRegistry;
+import dalvik.system.PathClassLoader;
import java.io.BufferedReader;
import java.io.IOException;
@@ -85,4 +88,139 @@
private static native String runAccessibilityTestImpl(String[] publicSystemLibs,
String[] publicVendorLibs);
+
+ private static void invokeIncrementGlobal(Class<?> clazz) throws Exception {
+ clazz.getMethod("incrementGlobal").invoke(null);
+ }
+ private static int invokeGetGlobal(Class<?> clazz) throws Exception {
+ return (Integer)clazz.getMethod("getGlobal").invoke(null);
+ }
+
+ private static ApplicationInfo getApplicationInfo(String packageName) {
+ PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
+ try {
+ return pm.getApplicationInfo(packageName, 0);
+ } catch (NameNotFoundException nnfe) {
+ throw new RuntimeException(nnfe);
+ }
+ }
+
+ private static String getSourcePath(String packageName) {
+ String sourcePath = getApplicationInfo(packageName).sourceDir;
+ if (sourcePath == null) {
+ throw new IllegalStateException("No source path path found for " + packageName);
+ }
+ return sourcePath;
+ }
+
+ private static String getNativePath(String packageName) {
+ String nativePath = getApplicationInfo(packageName).nativeLibraryDir;
+ if (nativePath == null) {
+ throw new IllegalStateException("No native path path found for " + packageName);
+ }
+ return nativePath;
+ }
+
+ // Verify the behaviour of native library loading in class loaders.
+ // In this test:
+ // - libjninamespacea1, libjninamespacea2 and libjninamespaceb depend on libjnicommon
+ // - loaderA will load ClassNamespaceA1 (loading libjninamespacea1)
+ // - loaderA will load ClassNamespaceA2 (loading libjninamespacea2)
+ // - loaderB will load ClassNamespaceB (loading libjninamespaceb)
+ // - incrementGlobal/getGlobal operate on a static global from libjnicommon
+ // and each class should get its own view on it.
+ //
+ // This is a test case for 2 different scenarios:
+ // - loading native libraries in different class loaders
+ // - loading native libraries in the same class loader
+ // Ideally we would have 2 different tests but JNI doesn't allow loading the same library in
+ // different class loaders. So to keep the number of native libraries manageable we just
+ // re-use the same class loaders for the two tests.
+ public static String runClassLoaderNamespaces() throws Exception {
+ // Test for different class loaders.
+ // Verify that common dependencies get a separate copy in each class loader.
+ // libjnicommon should be loaded twice:
+ // in the namespace for loaderA and the one for loaderB.
+ String apkPath = getSourcePath("android.jni.cts");
+ String nativePath = getNativePath("android.jni.cts");
+ PathClassLoader loaderA = new PathClassLoader(
+ apkPath, nativePath, ClassLoader.getSystemClassLoader());
+ Class<?> testA1Class = loaderA.loadClass("android.jni.cts.ClassNamespaceA1");
+ PathClassLoader loaderB = new PathClassLoader(
+ apkPath, nativePath, ClassLoader.getSystemClassLoader());
+ Class<?> testBClass = loaderB.loadClass("android.jni.cts.ClassNamespaceB");
+
+ int globalA1 = invokeGetGlobal(testA1Class);
+ int globalB = invokeGetGlobal(testBClass);
+ if (globalA1 != 0 || globalB != 0) {
+ return "Expected globals to be 0/0: globalA1=" + globalA1 + " globalB=" + globalB;
+ }
+
+ invokeIncrementGlobal(testA1Class);
+ globalA1 = invokeGetGlobal(testA1Class);
+ globalB = invokeGetGlobal(testBClass);
+ if (globalA1 != 1 || globalB != 0) {
+ return "Expected globals to be 1/0: globalA1=" + globalA1 + " globalB=" + globalB;
+ }
+
+ invokeIncrementGlobal(testBClass);
+ globalA1 = invokeGetGlobal(testA1Class);
+ globalB = invokeGetGlobal(testBClass);
+ if (globalA1 != 1 || globalB != 1) {
+ return "Expected globals to be 1/1: globalA1=" + globalA1 + " globalB=" + globalB;
+ }
+
+ // Test for the same class loaders.
+ // Verify that if we load ClassNamespaceA2 into loaderA we get the same view on the
+ // globals.
+ Class<?> testA2Class = loaderA.loadClass("android.jni.cts.ClassNamespaceA2");
+
+ int globalA2 = invokeGetGlobal(testA2Class);
+ if (globalA1 != 1 || globalA2 !=1) {
+ return "Expected globals to be 1/1: globalA1=" + globalA1 + " globalA2=" + globalA2;
+ }
+
+ invokeIncrementGlobal(testA1Class);
+ globalA1 = invokeGetGlobal(testA1Class);
+ globalA2 = invokeGetGlobal(testA2Class);
+ if (globalA1 != 2 || globalA2 != 2) {
+ return "Expected globals to be 2/2: globalA1=" + globalA1 + " globalA2=" + globalA2;
+ }
+
+ invokeIncrementGlobal(testA2Class);
+ globalA1 = invokeGetGlobal(testA1Class);
+ globalA2 = invokeGetGlobal(testA2Class);
+ if (globalA1 != 3 || globalA2 != 3) {
+ return "Expected globals to be 2/2: globalA1=" + globalA1 + " globalA2=" + globalA2;
+ }
+ // On success we return null.
+ return null;
+ }
+}
+
+class ClassNamespaceA1 {
+ static {
+ System.loadLibrary("jninamespacea1");
+ }
+
+ public static native void incrementGlobal();
+ public static native int getGlobal();
+}
+
+class ClassNamespaceA2 {
+ static {
+ System.loadLibrary("jninamespacea2");
+ }
+
+ public static native void incrementGlobal();
+ public static native int getGlobal();
+}
+
+class ClassNamespaceB {
+ static {
+ System.loadLibrary("jninamespaceb");
+ }
+
+ public static native void incrementGlobal();
+ public static native int getGlobal();
}
diff --git a/tests/tests/keystore/Android.mk b/tests/tests/keystore/Android.mk
index 4688846..8fe7a3b 100644
--- a/tests/tests/keystore/Android.mk
+++ b/tests/tests/keystore/Android.mk
@@ -26,6 +26,7 @@
LOCAL_JAVA_LIBRARIES := bouncycastle
LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-test \
core-tests-support \
ctsdeviceutil \
ctstestrunner \
diff --git a/tools/tradefed-host/tests/Android.mk b/tests/tests/libcorefileio/Android.mk
similarity index 60%
rename from tools/tradefed-host/tests/Android.mk
rename to tests/tests/libcorefileio/Android.mk
index 365deb8..29226bf 100644
--- a/tools/tradefed-host/tests/Android.mk
+++ b/tests/tests/libcorefileio/Android.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 The Android Open Source Project
+# Copyright (C) 2016 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.
@@ -12,16 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-LOCAL_PATH := $(call my-dir)
+LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-# Only compile source java files in this lib.
+# don't include this package in any target
+LOCAL_MODULE_TAGS := optional
+# and when built explicitly put it in the data partition
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE := old-cts-tradefed-tests
-LOCAL_MODULE_TAGS := optional
-LOCAL_JAVA_LIBRARIES := tradefed-prebuilt old-cts-tradefed
-LOCAL_STATIC_JAVA_LIBRARIES := easymock
+LOCAL_PACKAGE_NAME := CtsLibcoreFileIOTestCases
-include $(BUILD_HOST_JAVA_LIBRARY)
\ No newline at end of file
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/libcorefileio/AndroidManifest.xml b/tests/tests/libcorefileio/AndroidManifest.xml
new file mode 100644
index 0000000..411aa9d
--- /dev/null
+++ b/tests/tests/libcorefileio/AndroidManifest.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 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.libcorefileio.cts">
+
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+
+ <application>
+ <uses-library android:name="android.test.runner"/>
+ <service android:name="android.cts.LockHoldingService"
+ android:process=":lockHoldingService"
+ android:permission="android.permission.WRITE_EXTERNAL_STORAGE"
+ />
+ <receiver android:name="android.cts.FileChannelInterProcessLockTest$IntentReceiver">
+
+ <intent-filter>
+ <action android:name="android.cts.CtsLibcoreFileIOTestCases">
+ </action>
+ </intent-filter>
+
+ </receiver>
+ </application>
+
+ <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.libcorefileio.cts">
+ <meta-data android:name="listener"
+ android:value="com.android.cts.runner.CtsTestRunListener"/>
+ </instrumentation>
+
+</manifest>
+
diff --git a/tests/tests/libcorefileio/AndroidTest.xml b/tests/tests/libcorefileio/AndroidTest.xml
new file mode 100644
index 0000000..9baa713
--- /dev/null
+++ b/tests/tests/libcorefileio/AndroidTest.xml
@@ -0,0 +1,23 @@
+<!-- Copyright (C) 2016 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 CTS Legacy Libcore test cases">
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsLibcoreFileIOTestCases.apk" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="android.libcorefileio.cts" />
+ </test>
+</configuration>
\ No newline at end of file
diff --git a/tests/tests/libcorefileio/src/android/cts/FileChannelInterProcessLockTest.java b/tests/tests/libcorefileio/src/android/cts/FileChannelInterProcessLockTest.java
new file mode 100644
index 0000000..4259e4c
--- /dev/null
+++ b/tests/tests/libcorefileio/src/android/cts/FileChannelInterProcessLockTest.java
@@ -0,0 +1,551 @@
+/*
+ * Copyright (C) 2016 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 android.cts;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Environment;
+import android.test.AndroidTestCase;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.channels.FileLock;
+import java.util.concurrent.CountDownLatch;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+
+@SuppressWarnings("deprecation")
+public class FileChannelInterProcessLockTest extends AndroidTestCase {
+
+ /** The directory where file locks are created */
+ final static String DIR_NAME = "CtsFileIOTest";
+
+ /** The name of the file used when acquiring a lock. */
+ final static String FILE_NAME = "file";
+
+ /** The position in the lock file used when acquiring a region lock. */
+ final static int LOCK_POSITION = 10;
+
+ /** The extent of the lock file locked when acquiring a region lock. */
+ final static int LOCK_SIZE = 10;
+
+ /**
+ * This is the maximum waiting time in seconds for the test to wait for a response from
+ * the service. This provides ample amount of time for the service to receive the request from
+ * the test, then act, and respond back.
+ */
+ final static int MAX_WAIT_TIME = 7;
+
+ @Override
+ public void tearDown() throws Exception {
+ stopService();
+ super.tearDown();
+ }
+
+ /**
+ * java.nio.channels.FileChannel#tryLock()
+ *
+ * Obtains a remote lock, then attempts to acquire a local lock on the same file,
+ * and checks the behavior.
+ * checkTryLockBehavior(localLockType, remoteLockType, expectedLocalLockResult)
+ * expectedLockLockResult: {@code true} if the returned lock should be valid,
+ * {@code false} otherwise.
+ */
+ public void test_tryLock() throws Exception {
+ checkTryLockBehavior(LockType.TRY_LOCK, LockType.TRY_LOCK, false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.TRY_LOCK, LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.TRY_LOCK, LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.TRY_LOCK, LockType.LOCK, false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.TRY_LOCK, LockType.LOCK_ON_REGION_WITH_LOCK,
+ false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.TRY_LOCK, LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ false /* expectToGetLock */);
+ }
+
+ /**
+ * java.nio.channels.FileChannel#tryLock(long, long, boolean)
+ *
+ * Obtains a remote lock, then attempts to acquire a local lock on the same file,
+ * and checks the behavior.
+ * checkTryLockBehavior(localLockType, remoteLockType, expectedLocalLockResult)
+ * expectedLockLockResult: {@code true} if the returned lock should be valid,
+ * {@code false} otherwise.
+ */
+ public void test_tryLockJJZ_Exclusive() throws Exception {
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK, LockType.TRY_LOCK,
+ false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.LOCK_ON_REGION_WITH_TRY_LOCK, false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK, true /* expectToGetLock */);
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK, false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK,
+ true /* expectToGetLock */);
+
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK, LockType.LOCK,
+ false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.LOCK_ON_REGION_WITH_LOCK, false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK, true /* expectToGetLock */);
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.SHARED_LOCK_ON_REGION_WITH_LOCK, false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK,
+ true /* expectToGetLock */);
+ }
+
+ /**
+ * java.nio.channels.FileChannel#tryLock(long, long, boolean)
+ *
+ * Obtains a remote lock, then attempts to acquire a local lock on the same file,
+ * and checks the behavior.
+ * checkTryLockBehavior(localLockType, remoteLockType, expectedLocalLockResult)
+ * expectedLockLockResult: {@code true} if the returned lock should be valid,
+ * {@code false} otherwise.
+ */
+ public void test_tryLockJJZ_Shared() throws Exception {
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK, LockType.TRY_LOCK,
+ false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.LOCK_ON_REGION_WITH_TRY_LOCK, false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK, true /* expectToGetLock */);
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK, true /* expectToGetLock */);
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK,
+ true /* expectToGetLock */);
+
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK, LockType.LOCK,
+ false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.LOCK_ON_REGION_WITH_LOCK, false /* expectToGetLock */);
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK, true /* expectToGetLock */);
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.SHARED_LOCK_ON_REGION_WITH_LOCK, true /* expectToGetLock */);
+ checkTryLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ LockType.SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK,
+ true /* expectToGetLock */);
+ }
+
+ /**
+ * java.nio.channels.FileChannel#lock()
+ *
+ * Obtains a remote lock, then attempts to acquire a local lock on the same file,
+ * and checks the behavior.
+ * checkTryLockBehavior(localLockType, remoteLockType, expectedLocalLockResult)
+ * expectedLockLockResult: {@code true} if it blocks the local thread, {@code false} otherwise.
+ */
+ public void test_lock() throws Exception {
+ checkLockBehavior(LockType.LOCK, LockType.LOCK, true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK, LockType.LOCK_ON_REGION_WITH_LOCK,
+ true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK, LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ true /* expectToWait */);
+
+ checkLockBehavior(LockType.LOCK, LockType.TRY_LOCK, true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK, LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK, LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+ true /* expectToWait */);
+ }
+
+ /**
+ * java.nio.channels.FileChannel#lock(long, long, boolean)
+ *
+ * Obtains a remote lock, then attempts to acquire a local lock on the same file,
+ * and checks the behavior.
+ * checkTryLockBehavior(localLockType, remoteLockType, expectedLocalLockResult)
+ * expectedLockLockResult: {@code true} if blocks the local thread, {@code false} otherwise.
+ */
+ public void test_lockJJZ_Exclusive() throws Exception {
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK, LockType.LOCK,
+ true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK, LockType.LOCK_ON_REGION_WITH_LOCK,
+ true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK,
+ LockType.SHARED_LOCK_ON_REGION_WITH_LOCK, true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK,
+ LockType.LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK, false /* expectToWait */);
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK,
+ LockType.SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK, false /* expectToWait */);
+
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK, LockType.TRY_LOCK,
+ true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK, LockType.LOCK_ON_REGION_WITH_TRY_LOCK,
+ true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK,
+ LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK, true /* expectToWait */);
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK,
+ LockType.LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK, false /* expectToWait */);
+ checkLockBehavior(LockType.LOCK_ON_REGION_WITH_LOCK,
+ LockType.SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK,
+ false /* expectToWait */);
+ }
+
+ /**
+ * java.nio.channels.FileChannel#lock(long, long, boolean)
+ *
+ * Obtains a remote lock, then attempts to acquire a local lock on the same file,
+ * and checks the behavior.
+ * checkTryLockBehavior(localLockType, remoteLockType, expectedLocalLockResult)
+ * expectedLockLockResult: {@code true} if blocks the local thread, {@code false} otherwise.
+ */
+ public void test_lockJJZ_Shared() throws Exception {
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK, LockType.LOCK,
+ true /* expectToWait */);
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ LockType.LOCK_ON_REGION_WITH_LOCK, true /* expectToWait */);
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ LockType.SHARED_LOCK_ON_REGION_WITH_LOCK, false /* expectToWait */);
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ LockType.LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK, false /* expectToWait */);
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ LockType.SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK, false /* expectToWait */);
+
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK, LockType.TRY_LOCK,
+ true /* expectToWait */);
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ LockType.LOCK_ON_REGION_WITH_TRY_LOCK, true /* expectToWait */);
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ LockType.SHARED_LOCK_ON_REGION_WITH_TRY_LOCK, false /* expectToWait */);
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ LockType.LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK, false /* expectToWait */);
+ checkLockBehavior(LockType.SHARED_LOCK_ON_REGION_WITH_LOCK,
+ LockType.SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK,
+ false /* expectToWait */);
+ }
+
+ /**
+ * Checks the behavior of java.nio.Channels.FileChannel#tryLock() and #tryLock(J, J, Z)
+ *
+ * @param localLockType the type of lock to be acquired by the test
+ * @param remoteLockType the type of lock to be acquired by the remote service
+ * @param expectToGetLock {@code true}, if the lock should be acquired even when the
+ * service holds a {@code remoteLockType} lock, false otherwise.
+ */
+ private void checkTryLockBehavior(LockType localLockType, LockType remoteLockType,
+ boolean expectToGetLock) throws Exception {
+ IntentReceiver.resetReceiverState();
+
+ // Request that the remote lock be obtained.
+ getContext().startService(new Intent(getContext(), LockHoldingService.class)
+ .putExtra(LockHoldingService.LOCK_TYPE_KEY, remoteLockType));
+
+ // Wait for a signal that the remote lock is definitely held.
+ assertTrue(IntentReceiver.lockHeldLatch.await(MAX_WAIT_TIME, SECONDS));
+
+ // Try to acquire the local lock in all cases and check whether it could be acquired or
+ // not as expected.
+ if (expectToGetLock) {
+ FileLock fileLock = acquire(localLockType);
+ assertNotNull(fileLock);
+ assertTrue(fileLock.isValid());
+ } else {
+ assertNull(acquire(localLockType));
+ }
+ // Release the remote lock.
+ stopService();
+ }
+
+ /**
+ * Checks the java.nio.channels.FileChannel.lock()/lock(J, J, Z) behavior.
+ *
+ * @param localLockType type of lock to be acquired by the test
+ * @param remoteLockType type of lock to be acquired by the remote service.
+ * @param expectToWait {@code true}, if the local thread must wait for the remote
+ * service to release the lock, {@code false} otherwise.
+ */
+ private void checkLockBehavior(LockType localLockType, LockType remoteLockType,
+ boolean expectToWait) throws Exception {
+ IntentReceiver.resetReceiverState();
+
+ // The amount of time the remote service should hold lock.
+ long remoteLockHoldTimeMillis = 5000;
+
+ // The amount of time test should get to try to acquire the lock.
+ long sufficientOverlappingTimeInMillis = 2000;
+
+ // This is the allowable delta in the time between the time recorded after the service
+ // released the lock and the time recorded after the test obtained the lock.
+ long lockReleasedAndReacquiredTimeDeltaInMillis = 500;
+
+ // Tell the service to acquire a remote lock.
+ Intent sendIntent = new Intent(getContext(), LockHoldingService.class)
+ .putExtra(LockHoldingService.TIME_TO_HOLD_LOCK_KEY, remoteLockHoldTimeMillis)
+ .putExtra(LockHoldingService.LOCK_TYPE_KEY, remoteLockType)
+ .putExtra(LockHoldingService.LOCK_BEHAVIOR_RELEASE_AND_NOTIFY_KEY, true);
+
+ getContext().startService(sendIntent);
+
+ // Wait for the service to hold the lock and notify for the same.
+ assertTrue(IntentReceiver.lockHeldLatch.await(MAX_WAIT_TIME, SECONDS));
+
+ long localLockNotObtainedTime = System.currentTimeMillis();
+
+ // Acquire the lock locally.
+ FileLock fileLock = acquire(localLockType);
+ long localLockObtainedTime = System.currentTimeMillis();
+
+ // Wait until the remote lock has definitely been released.
+ assertTrue(IntentReceiver.lockReleasedLatch.await(MAX_WAIT_TIME, SECONDS));
+
+ Bundle remoteLockReleasedBundle = IntentReceiver.lockReleasedBundle;
+ long remoteLockNotReleasedTime =
+ remoteLockReleasedBundle.getLong(LockHoldingService.LOCK_NOT_YET_RELEASED_TIMESTAMP);
+ long remoteLockReleasedTime =
+ remoteLockReleasedBundle.getLong(LockHoldingService.LOCK_DEFINITELY_RELEASED_TIMESTAMP);
+
+ // We want the test to be notified well before the service releases the lock, so that
+ // we can be sure that it tried obtaining the lock before the service actually released it.
+ // Therefore, a two seconds time interval provides the test to get prepare and try to obtain
+ // the lock. If this fails, it doesn't mean they definitely didn't overlap
+ // but we can't be sure and the test may not be valid. This is why we hold the lock
+ // remotely for a long time compared to the delays we expect for intents to propagate
+ // between processes.
+ assertTrue(remoteLockNotReleasedTime - localLockNotObtainedTime >
+ sufficientOverlappingTimeInMillis);
+
+ if (expectToWait) {
+
+ // The remoteLockReleaseTime is captured after the lock was released by the
+ // service. The localLockObtainedTime is captured after the lock was obtained by this
+ // thread. Therefore, there is a degree of slop inherent in the two times. We assert
+ // that they are "close" to each other, but we cannot assert any ordering.
+ assertTrue(Math.abs(localLockObtainedTime - remoteLockReleasedTime) <
+ lockReleasedAndReacquiredTimeDeltaInMillis);
+ } else {
+ // The remoteLockNotReleaseTime is captured before the lock was released by the
+ // service. The localLockObtainedTime is captured after the lock was obtained by this
+ // thread. The local thread should be able to get the lock before the remote thread
+ // definitely release it. If this test fails it may not indicate a problem, but it
+ // indicates we cannot be sure the test was successful the local lock attempt and the
+ // remote lock attempt did not overlap.
+ assertTrue(localLockObtainedTime < remoteLockNotReleasedTime);
+ }
+
+ // Asserting if the fileLock is valid.
+ assertTrue(fileLock.isValid());
+ stopService();
+ }
+
+ /**
+ * Requests and waits for the service to stop
+ */
+ void stopService() throws Exception {
+ getContext().stopService(new Intent(getContext(), LockHoldingService.class));
+ assertTrue(IntentReceiver.onStopLatch.await(MAX_WAIT_TIME, SECONDS));
+ deleteDir();
+ }
+
+ enum LockType {
+
+ /** Equivalent to {@code tryLock()} */
+ TRY_LOCK,
+
+ /** Equivalent to {@code tryLock({@link #LOCK_POSITION}, {@link #LOCK_SIZE}, false)} */
+ LOCK_ON_REGION_WITH_TRY_LOCK,
+
+ /**
+ * Equivalent to {@code tryLock({@code {@link #LOCK_POSITION} + {@link #LOCK_SIZE}},
+ * {@link #LOCK_SIZE}, false)}
+ */
+ LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK,
+
+ /** Equivalent to {@code tryLock({@link #LOCK_POSITION}, {@link #LOCK_SIZE}, true)} */
+ SHARED_LOCK_ON_REGION_WITH_TRY_LOCK,
+
+ /**
+ * Equivalent to {@code tryLock({@code {@link #LOCK_POSITION} + {@link #LOCK_SIZE}},
+ * {@link #LOCK_SIZE}, true)}
+ */
+ SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK,
+
+ /** Equivalent to {@code lock()} */
+ LOCK,
+
+ /** Equivalent to {code lock({@link #LOCK_POSITION}, {@link #LOCK_SIZE}, false)} */
+ LOCK_ON_REGION_WITH_LOCK,
+
+ /**
+ * Equivalent to {@code lock({@code {@link #LOCK_POSITION} + {@link #LOCK_SIZE}},
+ * {@link #LOCK_SIZE}, false)}
+ */
+ LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK,
+
+ /** Equivalent to {@code lock({@link #LOCK_POSITION}, {@link #LOCK_SIZE}, true)} */
+ SHARED_LOCK_ON_REGION_WITH_LOCK,
+
+ /**
+ * Equivalent to {@code lock({@code {@link #LOCK_POSITION} + {@link #LOCK_SIZE}},
+ * {@link #LOCK_SIZE}, true)}
+ */
+ SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK,
+ }
+
+ /**
+ * Tries to acquire a lock of {@code lockType} on the file returned by
+ * {@link #createFileInDir()} method.
+ *
+ * @param lockType a {@link LockType} enum.
+ * Permitted lock types:
+ * {@link LockType#TRY_LOCK}
+ * {@link LockType#LOCK_ON_REGION_WITH_TRY_LOCK}
+ * {@link LockType#LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK}
+ * {@link LockType#SHARED_LOCK_ON_REGION_WITH_TRY_LOCK}
+ * {@link LockType#SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK}
+ * {@link LockType#LOCK}
+ * {@link LockType#LOCK_ON_REGION_WITH_LOCK}
+ * {@link LockType#LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK}
+ * {@link LockType#SHARED_LOCK_ON_REGION_WITH_LOCK}
+ * {@link LockType#SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK}
+ * @return Returns the lock returned by the lock method.
+ * @throws UnsupportedOperationException
+ * If the {@code lockType} is of non recognized type.
+ */
+ static FileLock acquire(LockType lockType) throws IOException {
+ File file = createFileInDir();
+ file.createNewFile();
+ switch (lockType) {
+ case TRY_LOCK:
+ return new FileOutputStream(file).getChannel().tryLock();
+ case LOCK_ON_REGION_WITH_TRY_LOCK:
+ return new FileOutputStream(file).getChannel()
+ .tryLock(LOCK_POSITION, LOCK_SIZE, false /*isShared*/);
+ case LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK:
+ return new FileOutputStream(file).getChannel()
+ .tryLock(LOCK_POSITION + LOCK_SIZE, LOCK_SIZE, false /*isShared*/);
+ case SHARED_LOCK_ON_REGION_WITH_TRY_LOCK:
+ return new FileInputStream(file).getChannel()
+ .tryLock(LOCK_POSITION, LOCK_SIZE, true /*isShared*/);
+ case SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_TRY_LOCK:
+ return new FileInputStream(file).getChannel()
+ .tryLock(LOCK_POSITION + LOCK_SIZE, LOCK_SIZE, true /*isShared*/);
+ case LOCK:
+ return new FileOutputStream(file).getChannel().lock();
+ case LOCK_ON_REGION_WITH_LOCK:
+ return new FileOutputStream(file).getChannel()
+ .lock(LOCK_POSITION, LOCK_SIZE, false /*isShared*/);
+ case LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK:
+ return new FileOutputStream(file).getChannel()
+ .lock(LOCK_POSITION + LOCK_SIZE, LOCK_SIZE, false /*isShared*/);
+ case SHARED_LOCK_ON_REGION_WITH_LOCK:
+ return new FileInputStream(file).getChannel()
+ .lock(LOCK_POSITION, LOCK_SIZE, true /*isShared*/);
+ case SHARED_LOCK_ON_NON_OVERLAPPING_REGION_WITH_LOCK:
+ return new FileInputStream(file).getChannel()
+ .lock(LOCK_POSITION + LOCK_SIZE, LOCK_SIZE, true /*isShared*/);
+ default:
+ throw new UnsupportedOperationException("Unknown lock type");
+ }
+ }
+
+ /**
+ * Creates a file named {@link #FILE_NAME} inside a directory named {@link #DIR_NAME} on
+ * the external storage directory.
+ */
+ static File createFileInDir() throws IOException {
+ File dir = new File(Environment.getExternalStorageDirectory(), DIR_NAME);
+ if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ throw new IOException("External storage is not mounted");
+ } else if (!dir.mkdirs() && !dir.isDirectory()) {
+ throw new IOException("Cannot create directory for device info files");
+ } else {
+ return new File(dir, FILE_NAME);
+ }
+ }
+
+ /**
+ * Deletes the folder {@link #DIR_NAME} on the external storage directory along with all the
+ * files inside it.
+ */
+ static void deleteDir() {
+ File dir = new File(Environment.getExternalStorageDirectory(), DIR_NAME);
+ if (dir.isDirectory()) {
+ String[] children = dir.list();
+ for (String child : children) {
+ new File(dir, child).delete();
+ }
+ dir.delete();
+ }
+ }
+
+ /**
+ * Listens to broadcasts sent by the LockHoldingService and records information / provides
+ * latches so the test code can synchronize until it is informed the service has acted on
+ * requests it has sent.
+ */
+ public static class IntentReceiver extends BroadcastReceiver {
+
+ static CountDownLatch onStartLatch;
+
+ static CountDownLatch onStopLatch;
+
+ static CountDownLatch lockHeldLatch;
+
+ static volatile Bundle lockHeldBundle;
+
+ static CountDownLatch lockReleasedLatch;
+
+ static volatile Bundle lockReleasedBundle;
+
+ /**
+ * Reset the IntentReceiver for a new test. Assumes no intents will be received from prior
+ * tests.
+ */
+ public static synchronized void resetReceiverState() {
+ onStartLatch = new CountDownLatch(1);
+ onStopLatch = new CountDownLatch(1);
+ lockHeldLatch = new CountDownLatch(1);
+ lockReleasedLatch = new CountDownLatch(1);
+ lockHeldBundle = null;
+ lockReleasedBundle = null;
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String msg = intent.getStringExtra(LockHoldingService.NOTIFICATION_KEY);
+ switch (msg) {
+ case LockHoldingService.NOTIFICATION_START:
+ onStartLatch.countDown();
+ break;
+ case LockHoldingService.NOTIFICATION_STOP:
+ onStopLatch.countDown();
+ break;
+ case LockHoldingService.NOTIFICATION_LOCK_HELD:
+ lockHeldBundle = intent.getExtras();
+ lockHeldLatch.countDown();
+ break;
+ case LockHoldingService.NOTIFICATION_LOCK_RELEASED:
+ lockReleasedBundle = intent.getExtras();
+ lockReleasedLatch.countDown();
+ break;
+ }
+ }
+ }
+}
+
diff --git a/tests/tests/libcorefileio/src/android/cts/LockHoldingService.java b/tests/tests/libcorefileio/src/android/cts/LockHoldingService.java
new file mode 100644
index 0000000..6ac73b0
--- /dev/null
+++ b/tests/tests/libcorefileio/src/android/cts/LockHoldingService.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2016 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 android.cts;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+import android.util.Log;
+
+import java.io.IOException;
+import java.nio.channels.FileLock;
+
+/**
+ * A Service that listens for commands from the FileChannelInterProcessLockTest to acquire locks of
+ * different types. It exists to test the behavior when file locks are acquired/released across
+ * multiple processes.
+ */
+public class LockHoldingService extends Service {
+
+ /**
+ * The key of the Bundle extra used to record a time after a lock is released by the service.
+ */
+ static final String LOCK_DEFINITELY_RELEASED_TIMESTAMP = "lockReleasedTimestamp";
+
+ /**
+ * The key of the Bundle extra used to record just before the lock is released by the service.
+ */
+ static final String LOCK_NOT_YET_RELEASED_TIMESTAMP = "lockNotReleasedTimestamp";
+
+ /**
+ * The key of the Bundle extra used to send general notifications to the test.
+ */
+ static final String NOTIFICATION_KEY = "notification";
+
+ /**
+ * The value for the notification sent to the test after the service starts.
+ */
+ static final String NOTIFICATION_START = "onStart";
+
+ /**
+ * The value for the notification sent to the test just before the service stops.
+ */
+ static final String NOTIFICATION_STOP = "onStop";
+
+ /**
+ * The value for the notification sent to the test after the lock is acquired.
+ */
+ static final String NOTIFICATION_LOCK_HELD = "lockHeld";
+
+ /**
+ * The value for the notification sent to the test after the lock is released
+ */
+ static final String NOTIFICATION_LOCK_RELEASED = "lockReleased";
+
+ /**
+ * The key of the Bundle extra used to send time for which the service should wait before
+ * releasing the lock.
+ */
+ static final String TIME_TO_HOLD_LOCK_KEY = "timeToHoldLock";
+
+ /**
+ * The key of the Bundle extra used for the type of lock to be held.
+ */
+ static final String LOCK_TYPE_KEY = "lockType";
+
+ /**
+ * The key of the Bundle extra used to let he service know whether to release the lock after
+ * some time.
+ */
+ static final String LOCK_BEHAVIOR_RELEASE_AND_NOTIFY_KEY = "releaseAndNotify";
+
+ static final String ACTION_TYPE_FOR_INTENT_COMMUNICATION
+ = "android.cts.CtsLibcoreFileIOTestCases";
+
+ final String LOG_MESSAGE_TAG = "CtsLibcoreFileIOTestCases";
+
+ private FileLock fileLock = null;
+
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startID) {
+ try {
+ if (intent.getBooleanExtra(LOCK_BEHAVIOR_RELEASE_AND_NOTIFY_KEY, false)) {
+ acquireLockAndThenWaitThenRelease(intent);
+ } else {
+ acquireLock(intent);
+ }
+ } catch (Exception e) {
+ Log.e(LOG_MESSAGE_TAG, e.getMessage());
+ }
+ return START_STICKY;
+ }
+
+ /**
+ * Acquires the lock asked by the test indefinitely.
+ */
+ private void acquireLock(Intent intent) throws IOException {
+ FileChannelInterProcessLockTest.LockType lockType =
+ (FileChannelInterProcessLockTest.LockType)intent.getSerializableExtra(
+ LOCK_TYPE_KEY);
+
+ // Acquire the lock based on the information contained in the intent received.
+ this.fileLock = FileChannelInterProcessLockTest.acquire(lockType);
+ Intent responseIntent = new Intent().putExtra(NOTIFICATION_KEY, NOTIFICATION_LOCK_HELD)
+ .setAction(ACTION_TYPE_FOR_INTENT_COMMUNICATION);
+ sendBroadcast(responseIntent);
+ }
+
+ /**
+ * Acquires and holds the lock for a time specified by the test. Sends a broadcast message after
+ * releasing the lock.
+ */
+ private void acquireLockAndThenWaitThenRelease(Intent intent)
+ throws IOException, InterruptedException {
+ long lockHoldTimeMillis = intent.getLongExtra(TIME_TO_HOLD_LOCK_KEY, 0);
+
+ // Acquire the lock.
+ FileChannelInterProcessLockTest.LockType lockType =
+ (FileChannelInterProcessLockTest.LockType)intent.getSerializableExtra(
+ LOCK_TYPE_KEY);
+ this.fileLock = FileChannelInterProcessLockTest.acquire(lockType);
+
+ // Signal the lock is now held.
+ Intent heldIntent = new Intent()
+ .putExtra(NOTIFICATION_KEY, NOTIFICATION_LOCK_HELD)
+ .setAction(ACTION_TYPE_FOR_INTENT_COMMUNICATION);
+ sendBroadcast(heldIntent);
+
+ Thread.sleep(lockHoldTimeMillis);
+
+ long lockNotReleasedTimestamp = System.currentTimeMillis();
+
+ // Release the lock
+ fileLock.release();
+
+ long lockReleasedTimestamp = System.currentTimeMillis();
+
+ // Signal the lock is released and some information about timing.
+ Intent releaseIntent = new Intent()
+ .putExtra(NOTIFICATION_KEY, NOTIFICATION_LOCK_RELEASED)
+ .putExtra(LOCK_NOT_YET_RELEASED_TIMESTAMP, lockNotReleasedTimestamp)
+ .putExtra(LOCK_DEFINITELY_RELEASED_TIMESTAMP, lockReleasedTimestamp)
+ .setAction(ACTION_TYPE_FOR_INTENT_COMMUNICATION);
+ sendBroadcast(releaseIntent);
+ }
+
+ @Override
+ public void onDestroy() {
+ try {
+ if (fileLock != null) {
+ fileLock.release();
+ }
+ } catch (IOException e) {
+ Log.e(LOG_MESSAGE_TAG, e.getMessage());
+ }
+ Intent intent = new Intent().putExtra(NOTIFICATION_KEY, NOTIFICATION_STOP)
+ .setAction(ACTION_TYPE_FOR_INTENT_COMMUNICATION);
+ sendBroadcast(intent);
+ }
+}
diff --git a/tests/tests/libcoreoj/Android.mk b/tests/tests/libcoreoj/Android.mk
index 4e289b8..e2af4af 100644
--- a/tests/tests/libcoreoj/Android.mk
+++ b/tests/tests/libcoreoj/Android.mk
@@ -24,7 +24,6 @@
LOCAL_CTS_TEST_PACKAGE := android.libcore.oj
LOCAL_CTS_TARGET_RUNTIME_ARGS := cts_jdwp_test_runtime_target := dalvikvm|\#ABI\#|
LOCAL_CTS_TESTCASE_XML_INPUT := $(LOCAL_PATH)/CtsTestPackage.xml
-LOCAL_JAVA_LANGUAGE_VERSION := 1.8
# Also include the source code as part of the jar. DO NOT REMOVE.
# FIXME: build/core/java_library.mk:14: *** cts/tests/tests/libcoreoj: Target java libraries may not set LOCAL_ASSET_DIR.
#LOCAL_ASSET_DIR := libcore/ojluni/src/test
diff --git a/tests/tests/media/libaudiojni/sl-utils.cpp b/tests/tests/media/libaudiojni/sl-utils.cpp
index 4dbb08d..e6debd9 100644
--- a/tests/tests/media/libaudiojni/sl-utils.cpp
+++ b/tests/tests/media/libaudiojni/sl-utils.cpp
@@ -20,7 +20,7 @@
#include "sl-utils.h"
#include <utils/Mutex.h>
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
// These will wind up in <SLES/OpenSLES_Android.h>
#define SL_ANDROID_SPEAKER_QUAD (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT \
diff --git a/tests/tests/media/src/android/media/cts/BassBoostTest.java b/tests/tests/media/src/android/media/cts/BassBoostTest.java
index c9bffd9..2004cf8 100644
--- a/tests/tests/media/src/android/media/cts/BassBoostTest.java
+++ b/tests/tests/media/src/android/media/cts/BassBoostTest.java
@@ -51,7 +51,7 @@
}
BassBoost eq = null;
try {
- eq = new BassBoost(0, 0);
+ eq = new BassBoost(0, getSessionId());
try {
assertTrue("invalid effect ID", (eq.getId() != 0));
} catch (IllegalStateException e) {
@@ -79,7 +79,7 @@
if (!isBassBoostAvailable()) {
return;
}
- getBassBoost(0);
+ getBassBoost(getSessionId());
try {
if (mBassBoost.getStrengthSupported()) {
short strength = mBassBoost.getRoundedStrength();
@@ -111,7 +111,7 @@
if (!isBassBoostAvailable()) {
return;
}
- getBassBoost(0);
+ getBassBoost(getSessionId());
try {
BassBoost.Settings settings = mBassBoost.getProperties();
String str = settings.toString();
@@ -148,7 +148,7 @@
if (!isBassBoostAvailable()) {
return;
}
- getBassBoost(0);
+ getBassBoost(getSessionId());
mBassBoost.release();
try {
mBassBoost.setStrength(TEST_STRENGTH);
@@ -169,7 +169,7 @@
if (!isBassBoostAvailable()) {
return;
}
- getBassBoost(0);
+ getBassBoost(getSessionId());
try {
mBassBoost.setEnabled(true);
assertTrue("invalid state from getEnabled", mBassBoost.getEnabled());
@@ -188,7 +188,7 @@
if (!isBassBoostAvailable()) {
return;
}
- getBassBoost(0);
+ getBassBoost(getSessionId());
mBassBoost.release();
try {
mBassBoost.setEnabled(true);
@@ -215,7 +215,7 @@
createListenerLooper(true, false, false);
waitForLooperInitialization_l();
- getBassBoost(0);
+ getBassBoost(mSession);
int looperWaitCount = MAX_LOOPER_WAIT_COUNT;
while (mHasControl && (looperWaitCount-- > 0)) {
try {
@@ -241,7 +241,7 @@
mBassBoost2.setEnabled(true);
mIsEnabled = true;
- getBassBoost(0);
+ getBassBoost(mSession);
mBassBoost.setEnabled(false);
int looperWaitCount = MAX_LOOPER_WAIT_COUNT;
while (mIsEnabled && (looperWaitCount-- > 0)) {
@@ -266,7 +266,7 @@
createListenerLooper(false, false, true);
waitForLooperInitialization_l();
- getBassBoost(0);
+ getBassBoost(mSession);
mChangedParameter = -1;
mBassBoost.setStrength(TEST_STRENGTH);
int looperWaitCount = MAX_LOOPER_WAIT_COUNT;
@@ -357,7 +357,8 @@
// after we are done with it.
mLooper = Looper.myLooper();
- mBassBoost2 = new BassBoost(0, 0);
+ mSession = getSessionId();
+ mBassBoost2 = new BassBoost(0, mSession);
assertNotNull("could not create bassboot2", mBassBoost2);
synchronized(mLock) {
@@ -432,4 +433,4 @@
mBassBoost2 = null;
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/tests/media/src/android/media/cts/EqualizerTest.java b/tests/tests/media/src/android/media/cts/EqualizerTest.java
index f07c99e..a8bd98a 100644
--- a/tests/tests/media/src/android/media/cts/EqualizerTest.java
+++ b/tests/tests/media/src/android/media/cts/EqualizerTest.java
@@ -51,7 +51,7 @@
public void test0_0ConstructorAndRelease() throws Exception {
Equalizer eq = null;
try {
- eq = new Equalizer(0, 0);
+ eq = new Equalizer(0, getSessionId());
try {
assertTrue("invalid effect ID", (eq.getId() != 0));
} catch (IllegalStateException e) {
@@ -75,7 +75,7 @@
//Test case 1.0: test setBandLevel() and getBandLevel()
public void test1_0BandLevel() throws Exception {
- getEqualizer(0);
+ getEqualizer(getSessionId());
try {
short numBands = mEqualizer.getNumberOfBands();
assertTrue("not enough bands", numBands >= MIN_NUMBER_OF_BANDS);
@@ -104,7 +104,7 @@
//Test case 1.1: test band frequency
public void test1_1BandFrequency() throws Exception {
- getEqualizer(0);
+ getEqualizer(getSessionId());
try {
short band = mEqualizer.getBand(TEST_FREQUENCY_MILLIHERTZ);
assertTrue("getBand failed", band >= 0);
@@ -129,7 +129,7 @@
//Test case 1.2: test presets
public void test1_2Presets() throws Exception {
- getEqualizer(0);
+ getEqualizer(getSessionId());
try {
short numPresets = mEqualizer.getNumberOfPresets();
assertTrue("getNumberOfPresets failed", numPresets >= MIN_NUMBER_OF_PRESETS);
@@ -154,7 +154,7 @@
//Test case 1.3: test properties
public void test1_3Properties() throws Exception {
- getEqualizer(0);
+ getEqualizer(getSessionId());
try {
Equalizer.Settings settings = mEqualizer.getProperties();
assertTrue("no enough bands", settings.numBands >= MIN_NUMBER_OF_BANDS);
@@ -185,7 +185,7 @@
//Test case 1.4: test setBandLevel() throws exception after release
public void test1_4SetBandLevelAfterRelease() throws Exception {
- getEqualizer(0);
+ getEqualizer(getSessionId());
mEqualizer.release();
try {
mEqualizer.setBandLevel((short)0, (short)0);
@@ -202,7 +202,7 @@
//Test case 2.0: test setEnabled() and getEnabled() in valid state
public void test2_0SetEnabledGetEnabled() throws Exception {
- getEqualizer(0);
+ getEqualizer(getSessionId());
try {
mEqualizer.setEnabled(true);
assertTrue("invalid state from getEnabled", mEqualizer.getEnabled());
@@ -218,7 +218,7 @@
//Test case 2.1: test setEnabled() throws exception after release
public void test2_1SetEnabledAfterRelease() throws Exception {
- getEqualizer(0);
+ getEqualizer(getSessionId());
mEqualizer.release();
try {
mEqualizer.setEnabled(true);
@@ -241,7 +241,7 @@
createListenerLooper(true, false, false);
waitForLooperInitialization_l();
- getEqualizer(0);
+ getEqualizer(mSession);
int looperWaitCount = MAX_LOOPER_WAIT_COUNT;
while (mHasControl && (looperWaitCount-- > 0)) {
try {
@@ -264,7 +264,7 @@
mEqualizer2.setEnabled(true);
mIsEnabled = true;
- getEqualizer(0);
+ getEqualizer(mSession);
mEqualizer.setEnabled(false);
int looperWaitCount = MAX_LOOPER_WAIT_COUNT;
while (mIsEnabled && (looperWaitCount-- > 0)) {
@@ -286,7 +286,7 @@
createListenerLooper(false, false, true);
waitForLooperInitialization_l();
- getEqualizer(0);
+ getEqualizer(mSession);
mChangedParameter = -1;
mEqualizer.setBandLevel((short)0, (short)0);
@@ -377,7 +377,8 @@
// after we are done with it.
mLooper = Looper.myLooper();
- mEqualizer2 = new Equalizer(0, 0);
+ mSession = getSessionId();
+ mEqualizer2 = new Equalizer(0, mSession);
assertNotNull("could not create Equalizer2", mEqualizer2);
synchronized(mLock) {
diff --git a/tests/tests/media/src/android/media/cts/VirtualizerTest.java b/tests/tests/media/src/android/media/cts/VirtualizerTest.java
index 0fc9f31..3fae26c 100644
--- a/tests/tests/media/src/android/media/cts/VirtualizerTest.java
+++ b/tests/tests/media/src/android/media/cts/VirtualizerTest.java
@@ -56,7 +56,7 @@
Virtualizer eq = null;
try {
- eq = new Virtualizer(0, 0);
+ eq = new Virtualizer(0, getSessionId());
try {
assertTrue(" invalid effect ID", (eq.getId() != 0));
} catch (IllegalStateException e) {
@@ -84,7 +84,7 @@
return;
}
- getVirtualizer(0);
+ getVirtualizer(getSessionId());
try {
if (mVirtualizer.getStrengthSupported()) {
short strength = mVirtualizer.getRoundedStrength();
@@ -116,7 +116,7 @@
return;
}
- getVirtualizer(0);
+ getVirtualizer(getSessionId());
try {
Virtualizer.Settings settings = mVirtualizer.getProperties();
String str = settings.toString();
@@ -153,7 +153,7 @@
return;
}
- getVirtualizer(0);
+ getVirtualizer(getSessionId());
mVirtualizer.release();
try {
mVirtualizer.setStrength(TEST_STRENGTH);
@@ -174,7 +174,7 @@
return;
}
- getVirtualizer(0);
+ getVirtualizer(getSessionId());
try {
mVirtualizer.setEnabled(true);
assertTrue(" invalid state from getEnabled", mVirtualizer.getEnabled());
@@ -193,7 +193,7 @@
return;
}
- getVirtualizer(0);
+ getVirtualizer(getSessionId());
mVirtualizer.release();
try {
mVirtualizer.setEnabled(true);
@@ -220,7 +220,7 @@
createListenerLooper(true, false, false);
waitForLooperInitialization_l();
- getVirtualizer(0);
+ getVirtualizer(mSession);
int looperWaitCount = MAX_LOOPER_WAIT_COUNT;
while (mHasControl && (looperWaitCount-- > 0)) {
try {
@@ -247,7 +247,7 @@
mVirtualizer2.setEnabled(true);
mIsEnabled = true;
- getVirtualizer(0);
+ getVirtualizer(mSession);
mVirtualizer.setEnabled(false);
int looperWaitCount = MAX_LOOPER_WAIT_COUNT;
while (mIsEnabled && (looperWaitCount-- > 0)) {
@@ -273,7 +273,7 @@
createListenerLooper(false, false, true);
waitForLooperInitialization_l();
- getVirtualizer(0);
+ getVirtualizer(mSession);
mChangedParameter = -1;
mVirtualizer.setStrength(TEST_STRENGTH);
@@ -615,7 +615,8 @@
// after we are done with it.
mLooper = Looper.myLooper();
- mVirtualizer2 = new Virtualizer(0, 0);
+ mSession = getSessionId();
+ mVirtualizer2 = new Virtualizer(0, mSession);
synchronized(mLock) {
if (mControl) {
diff --git a/tests/tests/nativemedia/sl/Android.mk b/tests/tests/nativemedia/sl/Android.mk
index e782994..2c50cd7 100644
--- a/tests/tests/nativemedia/sl/Android.mk
+++ b/tests/tests/nativemedia/sl/Android.mk
@@ -16,21 +16,14 @@
LOCAL_PATH:= $(call my-dir)
-test_executable := CtsNativeMediaSlTestCases
-list_executable := $(test_executable)_list
-
include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE := $(test_executable)
-LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE := CtsNativeMediaSlTestCases
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
LOCAL_MULTILIB := both
LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
LOCAL_C_INCLUDES := \
- external/gtest/include \
$(call include-path-for, wilhelm) \
$(call include-path-for, wilhelm-ut)
@@ -54,21 +47,3 @@
LOCAL_CFLAGS := -Werror -Wall
include $(BUILD_CTS_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE := $(list_executable)
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
- src/SLObjectCreationTest.cpp
-
-LOCAL_CFLAGS := \
- -DBUILD_ONLY \
- -Werror -Wall
-
-LOCAL_SHARED_LIBRARIES := \
- liblog \
-
-include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tests/tests/nativemedia/sl/src/SLObjectCreationTest.cpp b/tests/tests/nativemedia/sl/src/SLObjectCreationTest.cpp
index d0b3be0..516d86e 100644
--- a/tests/tests/nativemedia/sl/src/SLObjectCreationTest.cpp
+++ b/tests/tests/nativemedia/sl/src/SLObjectCreationTest.cpp
@@ -38,13 +38,10 @@
#include <gtest/gtest.h>
#include <utils/Log.h>
-#if !defined(BUILD_ONLY)
#include "SLES/OpenSLES.h"
#include "SLES/OpenSLES_Android.h"
#include "OpenSLESUT.h"
-#endif
-#if !defined(BUILD_ONLY)
//-----------------------------------------------------------------
/* Checks for error and displays the error code if any */
bool IsOk(SLresult res) {
@@ -309,20 +306,6 @@
(*audioRecorderObj)->Destroy(audioRecorderObj);
}
};
-#else
-class SLObjectCreationTest : public ::testing::Test {
-protected:
- void OutputMixCreation() { }
- void AudioPlayerFromUriCreation() { }
- void AudioPlayerFromFdCreation() { }
- void AudioPlayerFromPcmBqCreation() { }
- void AudioPlayerFromTsAbqCreation() { }
- void AudioPlayerFromUriToPcmBqCreation() { }
- void AudioPlayerFromFdToPcmBqCreation() { }
- void AudioPlayerFromAdtsAbqToPcmBqCreation() { }
- void AudioRecorderCreation(bool) { }
-};
-#endif
//-------------------------------------------------------------------------------------------------
TEST_F(SLObjectCreationTest, testEngineCreation) {
diff --git a/tests/tests/nativemedia/xa/Android.mk b/tests/tests/nativemedia/xa/Android.mk
index f71d853..8ea1062 100644
--- a/tests/tests/nativemedia/xa/Android.mk
+++ b/tests/tests/nativemedia/xa/Android.mk
@@ -16,21 +16,14 @@
LOCAL_PATH:= $(call my-dir)
-test_executable := CtsNativeMediaXaTestCases
-list_executable := $(test_executable)_list
-
include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE:= $(test_executable)
-LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE:= CtsNativeMediaXaTestCases
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
LOCAL_MULTILIB := both
LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
LOCAL_C_INCLUDES := \
- external/gtest/include \
$(call include-path-for, wilhelm) \
$(call include-path-for, wilhelm-ut)
@@ -51,20 +44,3 @@
LOCAL_COMPATIBILITY_SUITE := cts
include $(BUILD_CTS_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE := $(list_executable)
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
- src/XAObjectCreationTest.cpp
-
-LOCAL_CFLAGS := \
- -DBUILD_ONLY \
-
-LOCAL_SHARED_LIBRARIES := \
- liblog \
-
-include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tests/tests/nativemedia/xa/src/XAObjectCreationTest.cpp b/tests/tests/nativemedia/xa/src/XAObjectCreationTest.cpp
index d905451..92ba5aa 100644
--- a/tests/tests/nativemedia/xa/src/XAObjectCreationTest.cpp
+++ b/tests/tests/nativemedia/xa/src/XAObjectCreationTest.cpp
@@ -27,12 +27,9 @@
#include <gtest/gtest.h>
#include <utils/Log.h>
-#if !defined(BUILD_ONLY)
#include "OMXAL/OpenMAXAL.h"
#include "OMXAL/OpenMAXAL_Android.h"
-#endif
-#if !defined(BUILD_ONLY)
//-----------------------------------------------------------------
/* Checks for error and displays the error code if any */
bool IsOk(XAresult res) {
@@ -118,12 +115,6 @@
}
};
-#else
-class XAObjectCreationTest : public ::testing::Test {
-protected:
- void OutputMixCreation() { }
-};
-#endif
//-------------------------------------------------------------------------------------------------
TEST_F(XAObjectCreationTest, testEngineCreation) {
diff --git a/tests/tests/net/jni/NativeDnsJni.c b/tests/tests/net/jni/NativeDnsJni.c
index 4eb3c7a..352c0c5 100644
--- a/tests/tests/net/jni/NativeDnsJni.c
+++ b/tests/tests/net/jni/NativeDnsJni.c
@@ -126,7 +126,7 @@
return JNI_FALSE;
}
- memset(buf, sizeof(buf), 0);
+ memset(buf, 0, sizeof(buf));
res = getnameinfo((const struct sockaddr*)&sa6, sizeof(sa6), buf, sizeof(buf), NULL, 0, flags);
if (res != 0) {
ALOGD("getnameinfo(%s (GoogleDNS) ) gave error %d (%s)", GoogleDNSIpV6Address2,
diff --git a/tests/tests/net/jni/NativeMultinetworkJni.c b/tests/tests/net/jni/NativeMultinetworkJni.c
index ad56b51..6990efa 100644
--- a/tests/tests/net/jni/NativeMultinetworkJni.c
+++ b/tests/tests/net/jni/NativeMultinetworkJni.c
@@ -30,7 +30,7 @@
#include <sys/time.h>
#include <android/multinetwork.h>
-#define UNUSED(X) ((void) X)
+#define UNUSED(X) ((void) (X))
static const char kHostname[] = "connectivitycheck.android.com";
diff --git a/tests/tests/net/src/android/net/http/cts/HttpResponseCacheTest.java b/tests/tests/net/src/android/net/http/cts/HttpResponseCacheTest.java
index 545541d..7987a50 100644
--- a/tests/tests/net/src/android/net/http/cts/HttpResponseCacheTest.java
+++ b/tests/tests/net/src/android/net/http/cts/HttpResponseCacheTest.java
@@ -38,10 +38,11 @@
public final class HttpResponseCacheTest extends TestCase {
private File cacheDir;
- private MockWebServer server = new MockWebServer();
+ private MockWebServer server;
@Override public void setUp() throws Exception {
super.setUp();
+ server = new MockWebServer();
String tmp = System.getProperty("java.io.tmpdir");
cacheDir = new File(tmp, "HttpCache-" + UUID.randomUUID());
cacheDir.mkdirs();
diff --git a/tests/tests/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java b/tests/tests/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java
index f3eb4e9..a074f14 100644
--- a/tests/tests/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java
+++ b/tests/tests/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java
@@ -532,4 +532,15 @@
}
return false;
}
+
+ public void testEnterpriseConfigDoesNotPrintPassword() {
+ WifiEnterpriseConfig enterpriseConfig = new WifiEnterpriseConfig();
+ final String identity = "IdentityIsOkayToBeDisplayedHere";
+ final String password = "PasswordIsNotOkayToBeDisplayedHere";
+ enterpriseConfig.setIdentity(identity);
+ enterpriseConfig.setPassword(password);
+ final String stringRepresentation = enterpriseConfig.toString();
+ assertTrue(stringRepresentation.contains(identity));
+ assertFalse(stringRepresentation.contains(password));
+ }
}
diff --git a/tests/tests/net/src/android/net/wifi/cts/WifiInfoTest.java b/tests/tests/net/src/android/net/wifi/cts/WifiInfoTest.java
index 8719b6b..696d215 100644
--- a/tests/tests/net/src/android/net/wifi/cts/WifiInfoTest.java
+++ b/tests/tests/net/src/android/net/wifi/cts/WifiInfoTest.java
@@ -26,6 +26,7 @@
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiManager.WifiLock;
+import android.net.wifi.WifiSsid;
import android.test.AndroidTestCase;
import java.util.concurrent.Callable;
@@ -123,7 +124,7 @@
SupplicantState.isValidState(wifiInfo.getSupplicantState());
WifiInfo.getDetailedStateOf(SupplicantState.DISCONNECTED);
String ssid = wifiInfo.getSSID();
- if (ssid.startsWith("0x") == false) {
+ if (!ssid.startsWith("0x") && !ssid.equals(WifiSsid.NONE)) {
// Non-hex string should be quoted
assertTrue(ssid.charAt(0) == '"');
assertTrue(ssid.charAt(ssid.length() - 1) == '"');
diff --git a/tests/tests/openglperf/Android.mk b/tests/tests/openglperf/Android.mk
index 56fa568..eea3b86 100644
--- a/tests/tests/openglperf/Android.mk
+++ b/tests/tests/openglperf/Android.mk
@@ -41,10 +41,4 @@
include $(BUILD_CTS_PACKAGE)
-# Make the replica island app and copy it to CTS out dir.
-cts_replica_name := com.replica.replicaisland
-cts_replica_apk := $(CTS_TESTCASES_OUT)/$(cts_replica_name).apk
-$(cts_replica_apk): $(call intermediates-dir-for,APPS,$(cts_replica_name))/package.apk
- $(call copy-file-to-target)
-
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/os/Android.mk b/tests/tests/os/Android.mk
index 4dc87b1..e9a321f 100644
--- a/tests/tests/os/Android.mk
+++ b/tests/tests/os/Android.mk
@@ -45,6 +45,9 @@
#LOCAL_SDK_VERSION := current
LOCAL_JAVA_LIBRARIES += android.test.runner
+# Do not compress minijail policy files.
+LOCAL_AAPT_FLAGS := -0 .policy
+
include $(BUILD_CTS_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/os/assets/minijail/isolated-arm.policy b/tests/tests/os/assets/minijail/isolated-arm.policy
new file mode 100644
index 0000000..2e47d92
--- /dev/null
+++ b/tests/tests/os/assets/minijail/isolated-arm.policy
@@ -0,0 +1,78 @@
+# Minijail Seccomp Policy for isolated_app processes on ARM (32-bit).
+
+access: return EPERM
+ARM_breakpoint: 1
+ARM_cacheflush: 1
+ARM_set_tls: 1
+ARM_usr26: 1
+ARM_usr32: 1
+chmod: return EPERM
+chown32: return EPERM
+chown: return EPERM
+creat: return EPERM
+dup2: 1
+epoll_create: 1
+epoll_wait: 1
+fchown32: return EPERM
+
+# fnctl64: restrict cmd
+fcntl64: arg1 == F_GETFL || arg1 == F_GETFD || arg1 == F_SETFD || arg1 == F_SETLK || arg1 == F_SETLKW || arg1 == F_GETLK || arg1 == F_DUPFD
+
+fork: return EPERM
+fstat64: 1
+fstatat64: 1
+ftruncate64: 1
+futimesat: return EPERM
+getdents: 1
+getdents64: return EPERM
+getegid32: 1
+geteuid32: 1
+getgid32: 1
+getgroups32: 1
+getresgid32: 1
+getresuid32: 1
+getuid32: 1
+lchown32: return EPERM
+lchown: return EPERM
+link: return EPERM
+_llseek: 1
+lstat64: return EPERM
+lstat: return EPERM
+mkdir: return EPERM
+mknod: return EPERM
+
+# mmap2: flags in {MAP_SHARED|MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK|MAP_NORESERVE|MAP_FIXED|MAP_DENYWRITE}
+mmap2: arg3 in 0x24833
+
+_newselect: 1
+open: 1
+pause: 1
+pipe: 1
+poll: 1
+readlink: return EPERM
+recv: 1
+rename: return EPERM
+rmdir: return EPERM
+send: 1
+setfsgid32: return EPERM
+setfsuid32: return EPERM
+setgid32: return EPERM
+setgroups32: return EPERM
+setregid32: return EPERM
+setresgid32: return EPERM
+setresuid32: return EPERM
+setreuid32: return EPERM
+setuid32: return EPERM
+sigaction: 1
+sigprocmask: 1
+sigreturn: 1
+stat64: return EPERM
+statfs64: return EPERM
+stat: return EPERM
+symlink: return EPERM
+truncate64: return EPERM
+ugetrlimit: 1
+unlink: return EPERM
+uselib: return EPERM
+ustat: return EPERM
+utimes: return EPERM
diff --git a/tests/tests/os/assets/minijail/isolated-arm64.policy b/tests/tests/os/assets/minijail/isolated-arm64.policy
new file mode 100644
index 0000000..66be1f7
--- /dev/null
+++ b/tests/tests/os/assets/minijail/isolated-arm64.policy
@@ -0,0 +1,9 @@
+# Minijail Seccomp Policy for isolated_app processes on AARCH64.
+
+getdents64: 1
+getrlimit: 1
+
+# mmap: flags in {MAP_SHARED|MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK|MAP_NORESERVE|MAP_FIXED|MAP_DENYWRITE}
+mmap: arg3 in 0x24833
+
+newfstatat: 1
diff --git a/tests/tests/os/assets/minijail/isolated-common-not-i386.policy b/tests/tests/os/assets/minijail/isolated-common-not-i386.policy
new file mode 100644
index 0000000..c65fd8e
--- /dev/null
+++ b/tests/tests/os/assets/minijail/isolated-common-not-i386.policy
@@ -0,0 +1,37 @@
+# Minijail Seccomp Policy for isolated_app processes on all architectures
+# except I386.
+# This policy is appended to the architecture-specific policy.
+
+accept4: return EPERM
+accept: return EPERM
+bind: return EPERM
+connect: 1
+getsockopt: 1
+listen: return EPERM
+msgctl: return EPERM
+msgget: return EPERM
+msgrcv: return EPERM
+msgsnd: return EPERM
+recvfrom: 1
+recvmsg: 1
+semctl: return EPERM
+semget: return EPERM
+semop: return EPERM
+semtimedop: return EPERM
+sendmsg: 1
+sendto: 1
+
+# setsockopt: level==SOL_SOCKET && optname==SO_PEEK_OFF
+setsockopt: arg1 == 1 && arg2 == 42
+
+shmat: return EPERM
+shmctl: return EPERM
+shmdt: return EPERM
+shmget: return EPERM
+shutdown: 1
+
+# socket: domain==AF_UNIX && protocol == 0
+socket: arg0 == 1 && arg2 == 0
+
+# socketpair: domain==AF_UNIX
+socketpair: arg0 == 1
diff --git a/tests/tests/os/assets/minijail/isolated-common.policy b/tests/tests/os/assets/minijail/isolated-common.policy
new file mode 100644
index 0000000..48cfd49
--- /dev/null
+++ b/tests/tests/os/assets/minijail/isolated-common.policy
@@ -0,0 +1,145 @@
+# Minijail Seccomp Policy for isolated_app processes.
+# This architecture-agnostic policy is appended to every architecture-specific
+# policy.
+
+brk: 1
+capget: 1
+capset: return EPERM
+chdir: return EPERM
+
+# clock_gettime: clk_id=={CLOCK_BOOTTIME,CLOCK_MONOTONIC,CLOCK_MONOTONIC_COARSE,CLOCK_PROCESS_CPUTIME_ID,CLOCK_REALTIME,CLOCK_REALTIME_COARSE}
+clock_gettime: arg0 == 0 || arg0 == 1 || arg0 == 2 || arg0 == 5 || arg0 == 6 || arg0 == 7
+
+clone: 1
+close: 1
+dup: 1
+dup3: 1
+epoll_create1: 1
+epoll_ctl: 1
+epoll_pwait: 1
+execve: return EPERM
+exit: 1
+exit_group: 1
+faccessat: return EPERM
+fallocate: return EPERM
+fchdir: return EPERM
+fchmodat: return EPERM
+fchmod: return EPERM
+fchownat: return EPERM
+fchown: return EPERM
+
+# fnctl: restrict cmd
+fcntl: arg1 == F_GETFL || arg1 == F_GETFD || arg1 == F_SETFD || arg1 == F_SETLK || arg1 == F_SETLKW || arg1 == F_GETLK || arg1 == F_DUPFD
+
+fdatasync: 1
+flock: 1
+fstat: 1
+fsync: 1
+ftruncate: 1
+
+# futex: TODO(rsesek): Restrict op (arg1) to {FUTEX_WAIT,FUTEX_WAKE,FUTEX_REQUEUE,FUTEX_CMP_REQUEUE,
+# FUTEX_WAKE_OP,FUTEX_WAIT_BITSET,FUTEX_WAKE_BITSET} with only these flags allowed:
+# (FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME). Unclear how to express this in minijail.
+futex: 1
+
+getcwd: return EPERM
+getegid: 1
+geteuid: 1
+getgid: 1
+getgroups: 1
+getpid: 1
+getppid: 1
+getpriority: 1
+
+# getrandom: flags==0 || flags & GRND_NONBLOCK
+getrandom: arg2 == 0 || arg2 & 1
+
+getresgid: 1
+getresuid: 1
+getsid: 1
+gettid: 1
+gettimeofday: 1
+getuid: 1
+ioctl: 1
+
+# kill: pid==getpid()
+kill: arg0 == $
+
+linkat: return EPERM
+lookup_dcookie: return EPERM
+lseek: 1
+
+# madvise: advice==MADV_DONTNEED
+madvise: arg2 == 4; return EPERM
+
+memfd_create: return EPERM
+mkdirat: return EPERM
+mknodat: return EPERM
+mlock: 1
+
+# mprotect: prot in {PROT_READ|PROT_WRITE|PROT_EXEC}
+mprotect: arg2 in 0x7
+
+mremap: 1
+msync: 1
+munlock: 1
+munmap: 1
+nanosleep: 1
+openat: 1
+pipe2: 1
+ppoll: 1
+
+# prctl: PR_SET_VMA=0x53564d41, PR_SET_TIMERSLACK_PID={41,43,127} depending on kernel version
+prctl: arg0 == PR_GET_NAME || arg0 == PR_SET_NAME || arg0 == PR_GET_DUMPABLE || arg0 == PR_SET_DUMPABLE || arg0 == PR_SET_PTRACER || arg0 == 0x53564d41 || arg0 == 41 || arg0 == 43 || arg0 == 127
+
+pread64: 1
+pselect6: 1
+ptrace: 1
+pwrite64: 1
+read: 1
+readlinkat: return EPERM
+readv: 1
+renameat: return EPERM
+renameat2: return EPERM
+restart_syscall: 1
+rt_sigaction: 1
+rt_sigprocmask: 1
+rt_sigreturn: 1
+rt_sigtimedwait: 1
+
+# rt_tgsigqueueinfo: tgid==getpid()
+rt_tgsigqueueinfo: arg0 == $
+
+sched_getparam: 1
+sched_getscheduler: 1
+sched_setscheduler: 1
+sched_yield: 1
+seccomp: return EPERM
+setfsgid: return EPERM
+setfsuid: return EPERM
+setgid: return EPERM
+setgroups: return EPERM
+setpriority: 1
+setregid: return EPERM
+setresgid: return EPERM
+setresuid: return EPERM
+setreuid: return EPERM
+set_robust_list: return EPERM
+set_tid_address: 1
+setuid: return EPERM
+sigaltstack: 1
+statfs: return EPERM
+symlinkat: return EPERM
+
+# tgkill: tgid==getpid()
+tgkill: arg0 == $
+
+truncate: return EPERM
+umask: return EPERM
+uname: 1
+unlinkat: return EPERM
+utimensat: return EPERM
+wait4: 1
+waitid: 1
+write: 1
+writev: 1
diff --git a/tests/tests/os/assets/minijail/isolated-i386.policy b/tests/tests/os/assets/minijail/isolated-i386.policy
new file mode 100644
index 0000000..a5798d0
--- /dev/null
+++ b/tests/tests/os/assets/minijail/isolated-i386.policy
@@ -0,0 +1,87 @@
+# Minijail Seccomp Policy for isolated_app processes on I386.
+
+access: return EPERM
+chmod: return EPERM
+chown32: return EPERM
+chown: return EPERM
+creat: return EPERM
+dup2: 1
+epoll_create: 1
+epoll_wait: 1
+fchown32: return EPERM
+
+# fnctl64: restrict cmd
+fcntl64: arg1 == F_GETFL || arg1 == F_GETFD || arg1 == F_SETFD || arg1 == F_SETLK || arg1 == F_SETLKW || arg1 == F_GETLK || arg1 == F_DUPFD
+
+fork: return EPERM
+fstat64: 1
+fstatat64: 1
+ftruncate64: 1
+futimesat: return EPERM
+getdents: 1
+getdents64: return EPERM
+getegid32: 1
+geteuid32: 1
+getgid32: 1
+getgroups32: 1
+getresgid32: 1
+getresuid32: 1
+getuid32: 1
+ioperm: return EPERM
+iopl: return EPERM
+ipc: return EPERM
+lchown32: return EPERM
+lchown: return EPERM
+link: return EPERM
+_llseek: 1
+lstat64: return EPERM
+lstat: return EPERM
+mkdir: return EPERM
+mknod: return EPERM
+
+# mmap2: flags in {MAP_SHARED|MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK|MAP_NORESERVE|MAP_FIXED|MAP_DENYWRITE}
+mmap2: arg3 in 0x24833
+mmap: arg3 in 0x24833
+
+_newselect: 1
+oldlstat: return EPERM
+oldstat: return EPERM
+open: 1
+pause: 1
+pipe: 1
+poll: 1
+readdir: return EPERM
+readlink: return EPERM
+rename: return EPERM
+rmdir: return EPERM
+select: 1
+set_thread_area: 1
+setfsgid32: return EPERM
+setfsuid32: return EPERM
+setgid32: return EPERM
+setgroups32: return EPERM
+setregid32: return EPERM
+setresgid32: return EPERM
+setresuid32: return EPERM
+setreuid32: return EPERM
+setuid32: return EPERM
+sigaction: 1
+sigprocmask: 1
+sigreturn: 1
+
+# socketcall: call=={SYS_CONNECT,SYS_SOCKET,SYS_GETSOCKOPT}
+socketcall: arg0 == 1 || arg0 == 3 || arg0 == 15; return EPERM
+
+stat64: return EPERM
+statfs64: return EPERM
+stat: return EPERM
+symlink: return EPERM
+time: 1
+truncate64: return EPERM
+ugetrlimit: 1
+unlink: return EPERM
+uselib: return EPERM
+ustat: return EPERM
+utime: return EPERM
+utimes: return EPERM
+waitpid: 1
diff --git a/tests/tests/os/assets/minijail/isolated-x86-64.policy b/tests/tests/os/assets/minijail/isolated-x86-64.policy
new file mode 100644
index 0000000..45ea743
--- /dev/null
+++ b/tests/tests/os/assets/minijail/isolated-x86-64.policy
@@ -0,0 +1,46 @@
+# Minijail Seccomp Policy for isolated_app processes on X86-64.
+
+access: return EPERM
+
+# arch_prctl: arg0 == ARCH_SET_GS
+arch_prctl: arg0 == 0x1001; return EPERM
+
+chmod: return EPERM
+chown: return EPERM
+creat: return EPERM
+dup2: 1
+epoll_create: 1
+epoll_wait: 1
+fork: return EPERM
+futimesat: return EPERM
+getdents64: 1
+getdents: return EPERM
+getrlimit: 1
+ioperm: return EPERM
+iopl: return EPERM
+lchown: return EPERM
+link: return EPERM
+lstat: return EPERM
+mkdir: return EPERM
+mknod: return EPERM
+
+# mmap: flags in {MAP_SHARED|MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK|MAP_NORESERVE|MAP_FIXED|MAP_DENYWRITE}
+mmap: arg3 in 0x24833
+
+newfstatat: 1
+open: 1
+pause: 1
+pipe: 1
+poll: 1
+readlink: return EPERM
+rename: return EPERM
+rmdir: return EPERM
+select: 1
+stat: return EPERM
+symlink: return EPERM
+time: 1
+unlink: return EPERM
+uselib: return EPERM
+ustat: return EPERM
+utime: return EPERM
+utimes: return EPERM
diff --git a/tests/tests/os/jni/Android.mk b/tests/tests/os/jni/Android.mk
index 425b6c1..1e4eb25 100644
--- a/tests/tests/os/jni/Android.mk
+++ b/tests/tests/os/jni/Android.mk
@@ -42,8 +42,7 @@
endif
ifeq ($(ARCH_SUPPORTS_SECCOMP),1)
- LOCAL_SRC_FILES += seccomp-tests/tests/seccomp_bpf_tests.c \
- seccomp_sample_program.cpp
+ LOCAL_SRC_FILES += seccomp-tests/tests/seccomp_bpf_tests.c
# This define controls the behavior of OSFeatures.needsSeccompSupport().
LOCAL_CFLAGS += -DARCH_SUPPORTS_SECCOMP
@@ -56,6 +55,6 @@
LOCAL_SRC_FILES += android_os_cts_CpuFeatures.cpp
LOCAL_C_INCLUDES += ndk/sources/cpufeatures
-LOCAL_STATIC_LIBRARIES := cpufeatures libc++_static
+LOCAL_STATIC_LIBRARIES := cpufeatures libc++_static libminijail
include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/os/jni/android_os_cts_SeccompTest.cpp b/tests/tests/os/jni/android_os_cts_SeccompTest.cpp
index 1ba8550..44cfc7e 100644
--- a/tests/tests/os/jni/android_os_cts_SeccompTest.cpp
+++ b/tests/tests/os/jni/android_os_cts_SeccompTest.cpp
@@ -20,12 +20,9 @@
#include <time.h>
#if defined(ARCH_SUPPORTS_SECCOMP)
-#include <linux/filter.h>
-#include <linux/seccomp.h>
-#include <sys/syscall.h>
+#include <libminijail.h>
#endif
-#include "seccomp_sample_program.h"
#include "seccomp-tests/tests/test_harness.h"
// Forward declare from seccomp_bpf_tests.c.
@@ -54,31 +51,52 @@
return false;
}
-jboolean android_security_cts_SeccompBpfTest_installTestFilter(JNIEnv*, jclass) {
+jboolean android_security_cts_SeccompBpfTest_nativeInstallTestFilter(
+ JNIEnv*, jclass, jint policyFd) {
#if !defined(ARCH_SUPPORTS_SECCOMP)
- return false;
-#else
- struct sock_fprog prog = GetTestSeccompFilterProgram();
-
- if (prog.len == 0)
return false;
+#else
+ minijail* j = minijail_new();
+ minijail_use_seccomp_filter(j);
+ minijail_set_seccomp_filter_tsync(j);
+ minijail_parse_seccomp_filters_from_fd(j, policyFd);
+ minijail_enter(j);
+ minijail_destroy(j);
- int rv = syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, SECCOMP_FILTER_FLAG_TSYNC, &prog);
- return rv == 0;
+ close(policyFd);
+ return true;
#endif
}
+jstring android_security_cts_SeccompBpfTest_getPolicyAbiString(JNIEnv* env, jclass) {
+ const char* string;
+#if defined(__arm__)
+ string = "arm";
+#elif defined(__aarch64__)
+ string = "arm64";
+#elif defined(__i386__)
+ string = "i386";
+#elif defined(__x86_64__)
+ string = "x86-64";
+#else
+ return nullptr;
+#endif
+ return env->NewStringUTF(string);
+}
+
jint android_security_cts_SeccompBpfTest_getClockBootTime(JNIEnv*, jclass) {
- struct timespec ts;
- int rv = clock_gettime(CLOCK_BOOTTIME, &ts);
- return rv;
+ struct timespec ts;
+ int rv = clock_gettime(CLOCK_BOOTTIME_ALARM, &ts);
+ return rv;
}
static JNINativeMethod methods[] = {
{ "runKernelUnitTest", "(Ljava/lang/String;)Z",
(void*)android_security_cts_SeccompBpfTest_runKernelUnitTest },
- { "installTestFilter", "()Z",
- (void*)android_security_cts_SeccompBpfTest_installTestFilter },
+ { "nativeInstallTestFilter", "(I)Z",
+ (void*)android_security_cts_SeccompBpfTest_nativeInstallTestFilter },
+ { "getPolicyAbiString", "()Ljava/lang/String;",
+ (void*)android_security_cts_SeccompBpfTest_getPolicyAbiString },
{ "getClockBootTime", "()I",
(void*)android_security_cts_SeccompBpfTest_getClockBootTime },
};
diff --git a/tests/tests/os/jni/seccomp-tests/README.android b/tests/tests/os/jni/seccomp-tests/README.android
index a819ee5..cad678a 100644
--- a/tests/tests/os/jni/seccomp-tests/README.android
+++ b/tests/tests/os/jni/seccomp-tests/README.android
@@ -10,6 +10,8 @@
- Rename main() to seccomp_test_main()
- Add get_seccomp_test_list()
- Backport TEST(syscall_restart) from upstream
+- Add parentheses in macro IS_SECCOMP_EVENT(status),
+ __TEST_IMPL, __TEST_F_IMPL, __EXPECT_STR, and _CONSTRUCTOR_ORDER_BACKWARD.
The diff of modifications can be found in local-modifications-android.diff
and local-modifications-android-2.diff. Note, the TEST(syscall_restart)
diff --git a/tests/tests/os/jni/seccomp-tests/tests/seccomp_bpf_tests.c b/tests/tests/os/jni/seccomp-tests/tests/seccomp_bpf_tests.c
index 7481dd2..a813361 100644
--- a/tests/tests/os/jni/seccomp-tests/tests/seccomp_bpf_tests.c
+++ b/tests/tests/os/jni/seccomp-tests/tests/seccomp_bpf_tests.c
@@ -878,7 +878,7 @@
#define PTRACE_EVENT_SECCOMP 7
#endif
-#define IS_SECCOMP_EVENT(status) ((status >> 16) == PTRACE_EVENT_SECCOMP)
+#define IS_SECCOMP_EVENT(status) (((status) >> 16) == PTRACE_EVENT_SECCOMP)
bool tracer_running;
void tracer_stop(int sig)
{
diff --git a/tests/tests/os/jni/seccomp-tests/tests/test_harness.h b/tests/tests/os/jni/seccomp-tests/tests/test_harness.h
index 597e40c..b7d44f1 100644
--- a/tests/tests/os/jni/seccomp-tests/tests/test_harness.h
+++ b/tests/tests/os/jni/seccomp-tests/tests/test_harness.h
@@ -222,7 +222,7 @@
#define __TEST_IMPL(test_name, _signal) \
static void test_name(struct __test_metadata *_metadata); \
static struct __test_metadata _##test_name##_object = \
- { name: "global." #test_name, fn: &test_name, termsig: _signal }; \
+ { name: "global." #test_name, fn: &(test_name), termsig: (_signal) }; \
static void __attribute__((constructor)) _register_##test_name(void) { \
__register_test(&_##test_name##_object); \
} \
@@ -280,7 +280,7 @@
static struct __test_metadata _##fixture_name##_##test_name##_object = { \
name: #fixture_name "." #test_name, \
fn: &wrapper_##fixture_name##_##test_name, \
- termsig: signal, \
+ termsig: (signal), \
}; \
static void __attribute__((constructor)) \
_register_##fixture_name##_##test_name(void) { \
@@ -378,7 +378,7 @@
#define __EXPECT_STR(_expected, _seen, _t, _assert) do { \
const char *__exp = (_expected); \
const char *__seen = (_seen); \
- if (!(strcmp(__exp, __seen) _t 0)) { \
+ if (!(strcmp(__exp, __seen) _t (0))) { \
__TH_LOG("Expected '%s' %s '%s'.", __exp, #_t, __seen); \
_metadata->passed = 0; \
_metadata->trigger = 1; \
@@ -402,7 +402,7 @@
static int __constructor_order = 0;
#define _CONSTRUCTOR_ORDER_FORWARD 1
-#define _CONSTRUCTOR_ORDER_BACKWARD -1
+#define _CONSTRUCTOR_ORDER_BACKWARD (-1)
/*
* Since constructors are called in reverse order, reverse the test
diff --git a/tests/tests/os/jni/seccomp_sample_program.cpp b/tests/tests/os/jni/seccomp_sample_program.cpp
deleted file mode 100644
index eb1e9a6..0000000
--- a/tests/tests/os/jni/seccomp_sample_program.cpp
+++ /dev/null
@@ -1,1532 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <linux/filter.h>
-
-// This file defines a sample seccomp-bpf policy. It is taken from the
-// Chromium renderer process policy applied to isolatedProcess services.
-//
-// In the future, this policy should be further restricted to just the set
-// of system calls that an isolatedProcess should be allowed to make.
-
-#if defined(__arm__)
-struct sock_filter kTestSeccompFilter[] = {
- {0x20, 0, 0, 0x4},
- {0x15, 1, 0, 0x40000028},
- {0x6, 0, 0, 0x30006},
- {0x20, 0, 0, 0x0},
- {0x35, 0, 90, 0xab},
- {0x35, 0, 43, 0x108},
- {0x35, 0, 21, 0x14f},
- {0x35, 0, 10, 0x168},
- {0x35, 0, 5, 0x181},
- {0x35, 0, 2, 0xf0006},
- {0x35, 0, 72, 0xffff0},
- {0x35, 71, 67, 0xffff1},
- {0x35, 0, 67, 0x182},
- {0x35, 65, 69, 0xf0001},
- {0x35, 0, 2, 0x16f},
- {0x35, 0, 67, 0x17e},
- {0x35, 66, 63, 0x180},
- {0x35, 62, 65, 0x16e},
- {0x35, 0, 5, 0x15b},
- {0x35, 0, 2, 0x160},
- {0x35, 0, 59, 0x161},
- {0x35, 57, 61, 0x165},
- {0x35, 0, 60, 0x15c},
- {0x35, 59, 56, 0x15d},
- {0x35, 0, 2, 0x152},
- {0x35, 0, 54, 0x153},
- {0x35, 52, 56, 0x15a},
- {0x35, 55, 51, 0x151},
- {0x35, 0, 10, 0x121},
- {0x35, 0, 5, 0x138},
- {0x35, 0, 2, 0x143},
- {0x35, 0, 48, 0x147},
- {0x35, 47, 46, 0x148},
- {0x35, 0, 46, 0x139},
- {0x35, 44, 48, 0x142},
- {0x35, 0, 2, 0x127},
- {0x35, 0, 42, 0x12a},
- {0x35, 45, 42, 0x135},
- {0x35, 44, 40, 0x126},
- {0x35, 0, 4, 0x10e},
- {0x35, 0, 2, 0x119},
- {0x35, 0, 38, 0x11e},
- {0x35, 137, 40, 0x120},
- {0x35, 35, 39, 0x118},
- {0x35, 0, 3, 0x10b},
- {0x35, 0, 37, 0x10c},
- {0x35, 33, 0, 0x10d},
- {0x5, 0, 0, 0x11c},
- {0x35, 31, 34, 0x10a},
- {0x35, 0, 22, 0xce},
- {0x35, 0, 11, 0xee},
- {0x35, 0, 5, 0xf9},
- {0x35, 0, 2, 0x100},
- {0x35, 0, 25, 0x101},
- {0x35, 129, 28, 0x107},
- {0x35, 0, 24, 0xfa},
- {0x35, 26, 22, 0xfd},
- {0x35, 0, 2, 0xf0},
- {0x35, 0, 149, 0xf1},
- {0x35, 19, 23, 0xf8},
- {0x35, 22, 0, 0xef},
- {0x5, 0, 0, 0x113},
- {0x35, 0, 5, 0xda},
- {0x35, 0, 2, 0xde},
- {0x35, 0, 18, 0xe0},
- {0x35, 17, 13, 0xe1},
- {0x35, 0, 16, 0xdc},
- {0x35, 224, 175, 0xdd},
- {0x35, 0, 2, 0xd2},
- {0x35, 0, 10, 0xd3},
- {0x35, 9, 8, 0xd4},
- {0x35, 7, 8, 0xd1},
- {0x35, 0, 13, 0xb9},
- {0x35, 0, 7, 0xc1},
- {0x35, 0, 2, 0xc7},
- {0x35, 0, 3, 0xcb},
- {0x35, 2, 3, 0xcd},
- {0x35, 0, 2, 0xc5},
- {0x35, 1, 0, 0xc6},
- {0x5, 0, 0, 0x103},
- {0x5, 0, 0, 0x101},
- {0x35, 0, 3, 0xbb},
- {0x35, 1, 0, 0xbf},
- {0x5, 0, 0, 0x100},
- {0x35, 162, 254, 0xc0},
- {0x35, 253, 252, 0xba},
- {0x35, 0, 4, 0xb2},
- {0x35, 0, 2, 0xb5},
- {0x35, 0, 251, 0xb6},
- {0x35, 249, 248, 0xb8},
- {0x35, 248, 249, 0xb4},
- {0x35, 0, 2, 0xad},
- {0x35, 0, 246, 0xb0},
- {0x35, 245, 246, 0xb1},
- {0x35, 156, 244, 0xac},
- {0x35, 0, 42, 0x52},
- {0x35, 0, 21, 0x7e},
- {0x35, 0, 10, 0x96},
- {0x35, 0, 5, 0xa4},
- {0x35, 0, 2, 0xa8},
- {0x35, 0, 238, 0xa9},
- {0x35, 236, 238, 0xaa},
- {0x35, 0, 235, 0xa5},
- {0x35, 236, 235, 0xa6},
- {0x35, 0, 2, 0x9e},
- {0x35, 0, 233, 0x9f},
- {0x35, 232, 233, 0xa2},
- {0x35, 232, 231, 0x98},
- {0x35, 0, 5, 0x8c},
- {0x35, 0, 2, 0x90},
- {0x35, 0, 229, 0x91},
- {0x35, 228, 227, 0x94},
- {0x35, 0, 226, 0x8d},
- {0x35, 225, 224, 0x8e},
- {0x35, 0, 2, 0x85},
- {0x35, 0, 222, 0x86},
- {0x35, 221, 223, 0x8a},
- {0x35, 222, 221, 0x7f},
- {0x35, 0, 10, 0x64},
- {0x35, 0, 5, 0x73},
- {0x35, 0, 2, 0x7a},
- {0x35, 0, 217, 0x7b},
- {0x35, 165, 217, 0x7d},
- {0x35, 0, 216, 0x77},
- {0x35, 215, 214, 0x79},
- {0x35, 0, 2, 0x6c},
- {0x35, 0, 212, 0x6d},
- {0x35, 211, 212, 0x72},
- {0x35, 209, 211, 0x6a},
- {0x35, 0, 4, 0x5b},
- {0x35, 0, 2, 0x60},
- {0x35, 0, 207, 0x62},
- {0x35, 205, 207, 0x63},
- {0x35, 204, 205, 0x5c},
- {0x35, 0, 2, 0x54},
- {0x35, 0, 204, 0x55},
- {0x35, 203, 201, 0x57},
- {0x35, 200, 202, 0x53},
- {0x35, 0, 21, 0x2d},
- {0x35, 0, 10, 0x3e},
- {0x35, 0, 5, 0x46},
- {0x35, 0, 2, 0x4f},
- {0x35, 0, 197, 0x50},
- {0x35, 194, 195, 0x51},
- {0x35, 0, 193, 0x48},
- {0x35, 193, 194, 0x4e},
- {0x35, 0, 2, 0x41},
- {0x35, 0, 192, 0x43},
- {0x35, 191, 190, 0x44},
- {0x35, 189, 188, 0x3f},
- {0x35, 0, 5, 0x33},
- {0x35, 0, 2, 0x38},
- {0x35, 0, 187, 0x3c},
- {0x35, 186, 184, 0x3d},
- {0x35, 0, 185, 0x36},
- {0x35, 136, 183, 0x37},
- {0x35, 0, 2, 0x2f},
- {0x35, 0, 181, 0x30},
- {0x35, 180, 181, 0x31},
- {0x35, 178, 179, 0x2e},
- {0x35, 0, 10, 0x17},
- {0x35, 0, 5, 0x21},
- {0x35, 0, 2, 0x26},
- {0x35, 0, 174, 0x29},
- {0x35, 175, 174, 0x2b},
- {0x35, 0, 172, 0x22},
- {0x35, 165, 173, 0x25},
- {0x35, 0, 2, 0x19},
- {0x35, 0, 171, 0x1d},
- {0x35, 170, 169, 0x1e},
- {0x35, 168, 167, 0x18},
- {0x35, 0, 4, 0xd},
- {0x35, 0, 2, 0x11},
- {0x35, 0, 166, 0x13},
- {0x35, 165, 164, 0x15},
- {0x35, 162, 164, 0xe},
- {0x35, 0, 2, 0x3},
- {0x35, 0, 161, 0x7},
- {0x35, 159, 161, 0x8},
- {0x35, 158, 159, 0x2},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 152, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 155, 156, 0x1},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 148, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 151, 0, 0x1},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 144, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 147, 0, 0x6},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 140, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 143, 0, 0x2},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 136, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 139, 0, 0x0},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 132, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 135, 0, 0x5},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 128, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 131, 132, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 124, 0x0},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 127, 0xfffffe7f},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 120, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 122, 0, 0x1},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 115, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 117, 0, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 110, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 112, 0, 0x4},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 105, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 107, 0, 0x5},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 100, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 102, 0, 0x9},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 95, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 97, 0, 0xa},
- {0x6, 0, 0, 0x30005},
- {0x20, 0, 0, 0x24},
- {0x15, 0, 89, 0x0},
- {0x20, 0, 0, 0x20},
- {0x15, 92, 91, 0x4},
- {0x20, 0, 0, 0x2c},
- {0x15, 0, 85, 0x0},
- {0x20, 0, 0, 0x28},
- {0x45, 89, 88, 0xfffdb7cc},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 81, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 84, 0, 0x10},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 77, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 80, 0, 0xf},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 73, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 76, 0, 0x3},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 69, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 72, 0, 0x4},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 65, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 68, 0, 0x53564d41},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 61, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 64, 0, 0x59616d61},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 57, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 60, 0, 0x29},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 53, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 56, 0, 0x2b},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 49, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 52, 0, 0x7f},
- {0x6, 0, 0, 0x30004},
- {0x20, 0, 0, 0x24},
- {0x15, 0, 44, 0x0},
- {0x20, 0, 0, 0x20},
- {0x45, 48, 47, 0xfffffff8},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 40, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 43, 0, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 36, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 39, 0, 0x1},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 32, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 35, 0, 0x2},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 28, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 31, 0, 0x6},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 24, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 27, 0, 0x7},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 20, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 23, 0, 0x5},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 16, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 19, 0, 0x0},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 12, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 15, 0, 0x406},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 8, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 0, 12, 0x4},
- {0x20, 0, 0, 0x24},
- {0x15, 0, 4, 0x0},
- {0x20, 0, 0, 0x20},
- {0x45, 8, 7, 0xfff1e3fc},
- {0x20, 0, 0, 0x14},
- {0x15, 1, 0, 0x0},
- {0x6, 0, 0, 0x30003},
- {0x20, 0, 0, 0x10},
- {0x15, 2, 0, 0xfc1},
- {0x6, 0, 0, 0x30002},
- {0x6, 0, 0, 0x50001},
- {0x6, 0, 0, 0x7fff0000},
- {0x6, 0, 0, 0x30001},
-};
-#elif defined(__aarch64__)
-struct sock_filter kTestSeccompFilter[] = {
- {0x20, 0, 0, 0x4},
- {0x15, 1, 0, 0xc00000b7},
- {0x6, 0, 0, 0x30006},
- {0x20, 0, 0, 0x0},
- {0x35, 0, 51, 0x88},
- {0x35, 0, 25, 0xba},
- {0x35, 0, 12, 0xdf},
- {0x35, 0, 6, 0xea},
- {0x35, 0, 3, 0x104},
- {0x35, 0, 1, 0x114},
- {0x35, 95, 104, 0x116},
- {0x35, 94, 104, 0x105},
- {0x35, 0, 93, 0xf2},
- {0x35, 92, 101, 0xf3},
- {0x35, 0, 2, 0xe4},
- {0x35, 0, 100, 0xe6},
- {0x35, 90, 89, 0xe9},
- {0x35, 0, 88, 0xe2},
- {0x35, 87, 98, 0xe3},
- {0x35, 0, 6, 0xd1},
- {0x35, 0, 3, 0xd9},
- {0x35, 0, 1, 0xdd},
- {0x35, 101, 92, 0xde},
- {0x35, 92, 82, 0xdc},
- {0x35, 0, 91, 0xd5},
- {0x35, 90, 80, 0xd6},
- {0x35, 0, 2, 0xcc},
- {0x35, 0, 78, 0xce},
- {0x35, 77, 87, 0xd0},
- {0x35, 0, 85, 0xc7},
- {0x35, 84, 100, 0xc8},
- {0x35, 0, 12, 0x9e},
- {0x35, 0, 6, 0xa6},
- {0x35, 0, 3, 0xa9},
- {0x35, 0, 1, 0xac},
- {0x35, 70, 80, 0xb3},
- {0x35, 69, 79, 0xaa},
- {0x35, 0, 77, 0xa7},
- {0x35, 67, 99, 0xa8},
- {0x35, 0, 2, 0xa1},
- {0x35, 0, 65, 0xa3},
- {0x35, 64, 74, 0xa4},
- {0x35, 0, 73, 0x9f},
- {0x35, 72, 71, 0xa0},
- {0x35, 0, 6, 0x94},
- {0x35, 0, 3, 0x97},
- {0x35, 0, 1, 0x9c},
- {0x35, 58, 68, 0x9d},
- {0x35, 57, 66, 0x99},
- {0x35, 0, 66, 0x95},
- {0x35, 65, 64, 0x96},
- {0x35, 0, 2, 0x8b},
- {0x35, 0, 63, 0x8e},
- {0x35, 61, 52, 0x8f},
- {0x35, 0, 51, 0x89},
- {0x35, 50, 60, 0x8a},
- {0x35, 0, 25, 0x4e},
- {0x35, 0, 12, 0x65},
- {0x35, 0, 6, 0x80},
- {0x35, 0, 3, 0x83},
- {0x35, 0, 1, 0x85},
- {0x35, 54, 44, 0x86},
- {0x35, 53, 139, 0x84},
- {0x35, 0, 52, 0x81},
- {0x35, 144, 137, 0x82},
- {0x35, 0, 2, 0x72},
- {0x35, 0, 39, 0x7c},
- {0x35, 38, 48, 0x7d},
- {0x35, 0, 47, 0x66},
- {0x35, 140, 36, 0x71},
- {0x35, 0, 6, 0x5b},
- {0x35, 0, 3, 0x61},
- {0x35, 0, 1, 0x63},
- {0x35, 32, 41, 0x64},
- {0x35, 177, 31, 0x62},
- {0x35, 0, 39, 0x5c},
- {0x35, 39, 29, 0x5d},
- {0x35, 0, 2, 0x58},
- {0x35, 0, 36, 0x59},
- {0x35, 36, 26, 0x5a},
- {0x35, 0, 34, 0x4f},
- {0x35, 24, 34, 0x51},
- {0x35, 0, 12, 0x2c},
- {0x35, 0, 6, 0x3b},
- {0x35, 0, 3, 0x3e},
- {0x35, 0, 1, 0x48},
- {0x35, 19, 29, 0x4a},
- {0x35, 18, 28, 0x44},
- {0x35, 0, 27, 0x3c},
- {0x35, 25, 16, 0x3d},
- {0x35, 0, 2, 0x34},
- {0x35, 0, 23, 0x38},
- {0x35, 13, 23, 0x3a},
- {0x35, 0, 12, 0x2d},
- {0x35, 11, 20, 0x33},
- {0x35, 0, 5, 0x1d},
- {0x35, 0, 2, 0x21},
- {0x35, 0, 17, 0x27},
- {0x35, 16, 7, 0x2b},
- {0x35, 0, 16, 0x1e},
- {0x35, 15, 5, 0x20},
- {0x35, 0, 2, 0x14},
- {0x35, 0, 13, 0x19},
- {0x35, 2, 204, 0x1a},
- {0x35, 0, 1, 0x11},
- {0x35, 0, 9, 0x13},
- {0x5, 0, 0, 0x10f},
- {0x20, 0, 0, 0x24},
- {0x15, 4, 0, 0x0},
- {0x15, 0, 2, 0xffffffff},
- {0x20, 0, 0, 0x20},
- {0x45, 1, 0, 0x80000000},
- {0x5, 0, 0, 0x100},
- {0x20, 0, 0, 0x20},
- {0x15, 1, 0, 0x4},
- {0x5, 0, 0, 0x105},
- {0x5, 0, 0, 0x103},
- {0x20, 0, 0, 0x24},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 249, 0xffffffff},
- {0x20, 0, 0, 0x20},
- {0x45, 0, 247, 0x80000000},
- {0x20, 0, 0, 0x20},
- {0x45, 254, 252, 0xfffffff8},
- {0x20, 0, 0, 0x2c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 242, 0xffffffff},
- {0x20, 0, 0, 0x28},
- {0x45, 0, 240, 0x80000000},
- {0x20, 0, 0, 0x28},
- {0x45, 247, 245, 0xfffdb7cc},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 235, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 233, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 238, 240, 0x1},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 228, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 226, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 231, 0, 0x10},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 221, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 219, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 224, 0, 0xf},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 214, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 212, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 217, 0, 0x3},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 207, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 205, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 210, 0, 0x4},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 200, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 198, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 203, 0, 0x53564d41},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 193, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 191, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 196, 0, 0x59616d61},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 186, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 184, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 189, 0, 0x29},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 179, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 177, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 182, 0, 0x2b},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 172, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 170, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 175, 0, 0x7f},
- {0x6, 0, 0, 0x30005},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 164, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 162, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 167, 0, 0x111a},
- {0x6, 0, 0, 0x30004},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 156, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 154, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 159, 0, 0x1},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 149, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 147, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 152, 0, 0x6},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 142, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 140, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 145, 0, 0x2},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 135, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 133, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 138, 0, 0x0},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 128, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 126, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 131, 0, 0x5},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 121, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 119, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 124, 126, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 114, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 112, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 117, 0xfffffe7f},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 107, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 105, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 109, 0, 0x1},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 99, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 97, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 101, 0, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 91, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 89, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 93, 0, 0x4},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 83, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 81, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 85, 0, 0x5},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 75, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 73, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 77, 0, 0x9},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 67, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 65, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 69, 0, 0xa},
- {0x6, 0, 0, 0x30003},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 58, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 56, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 61, 0, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 51, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 49, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 54, 0, 0x1},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 44, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 42, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 47, 0, 0x2},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 37, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 35, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 40, 0, 0x6},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 30, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 28, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 33, 0, 0x7},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 23, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 21, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 26, 0, 0x5},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 16, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 14, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 19, 0, 0x0},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 9, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 7, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 12, 0, 0x406},
- {0x20, 0, 0, 0x1c},
- {0x15, 4, 0, 0x0},
- {0x15, 0, 2, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 1, 0, 0x80000000},
- {0x6, 0, 0, 0x30002},
- {0x20, 0, 0, 0x18},
- {0x15, 0, 6, 0x4},
- {0x20, 0, 0, 0x24},
- {0x15, 0, 4, 0x0},
- {0x20, 0, 0, 0x20},
- {0x45, 2, 0, 0xffe1e3fc},
- {0x6, 0, 0, 0x7fff0000},
- {0x6, 0, 0, 0x50001},
- {0x6, 0, 0, 0x30001},
-};
-#elif defined(__i386__)
-struct sock_filter kTestSeccompFilter[] = {
- {0x20, 0, 0, 0x4},
- {0x15, 1, 0, 0x40000003},
- {0x6, 0, 0, 0x30007},
- {0x20, 0, 0, 0x0},
- {0x45, 0, 1, 0x40000000},
- {0x6, 0, 0, 0x30006},
- {0x35, 0, 86, 0x96},
- {0x35, 0, 43, 0xe0},
- {0x35, 0, 20, 0x11c},
- {0x35, 0, 10, 0x13f},
- {0x35, 0, 5, 0x149},
- {0x35, 0, 2, 0x163},
- {0x35, 0, 95, 0x164},
- {0x35, 94, 91, 0x165},
- {0x35, 0, 92, 0x14c},
- {0x35, 89, 92, 0x161},
- {0x35, 0, 2, 0x141},
- {0x35, 0, 90, 0x144},
- {0x35, 89, 86, 0x145},
- {0x35, 85, 87, 0x140},
- {0x35, 0, 4, 0x12d},
- {0x35, 0, 2, 0x136},
- {0x35, 0, 85, 0x137},
- {0x35, 84, 81, 0x138},
- {0x35, 82, 80, 0x134},
- {0x35, 0, 2, 0x127},
- {0x35, 0, 80, 0x128},
- {0x35, 79, 77, 0x12c},
- {0x35, 79, 78, 0x11d},
- {0x35, 0, 11, 0xfe},
- {0x35, 0, 6, 0x10a},
- {0x35, 0, 3, 0x10e},
- {0x35, 1, 0, 0x10f},
- {0x5, 0, 0, 0x144},
- {0x35, 73, 70, 0x110},
- {0x35, 0, 72, 0x10c},
- {0x35, 71, 68, 0x10d},
- {0x35, 0, 2, 0x102},
- {0x35, 0, 68, 0x103},
- {0x35, 138, 68, 0x109},
- {0x35, 67, 66, 0x101},
- {0x35, 0, 4, 0xf1},
- {0x35, 0, 2, 0xf4},
- {0x35, 0, 64, 0xfc},
- {0x35, 60, 62, 0xfd},
- {0x35, 61, 62, 0xf3},
- {0x35, 0, 3, 0xee},
- {0x35, 1, 0, 0xef},
- {0x5, 0, 0, 0x13a},
- {0x35, 152, 58, 0xf0},
- {0x35, 57, 56, 0xe1},
- {0x35, 0, 21, 0xb9},
- {0x35, 0, 11, 0xcd},
- {0x35, 0, 6, 0xd4},
- {0x35, 0, 3, 0xdc},
- {0x35, 0, 49, 0xdd},
- {0x35, 51, 0, 0xde},
- {0x5, 0, 0, 0x104},
- {0x35, 0, 46, 0xd9},
- {0x35, 177, 48, 0xdb},
- {0x35, 0, 2, 0xd1},
- {0x35, 0, 45, 0xd2},
- {0x35, 44, 42, 0xd3},
- {0x35, 41, 43, 0xce},
- {0x35, 0, 4, 0xc1},
- {0x35, 0, 2, 0xc6},
- {0x35, 0, 38, 0xc7},
- {0x35, 37, 39, 0xcb},
- {0x35, 38, 36, 0xc5},
- {0x35, 0, 2, 0xbb},
- {0x35, 0, 37, 0xbf},
- {0x35, 242, 35, 0xc0},
- {0x35, 34, 32, 0xba},
- {0x35, 0, 10, 0xaa},
- {0x35, 0, 5, 0xb1},
- {0x35, 0, 2, 0xb5},
- {0x35, 0, 31, 0xb6},
- {0x35, 29, 27, 0xb8},
- {0x35, 0, 28, 0xb2},
- {0x35, 27, 28, 0xb4},
- {0x35, 0, 2, 0xac},
- {0x35, 0, 159, 0xad},
- {0x35, 25, 24, 0xb0},
- {0x35, 23, 21, 0xab},
- {0x35, 0, 4, 0xa4},
- {0x35, 0, 2, 0xa6},
- {0x35, 0, 21, 0xa8},
- {0x35, 20, 19, 0xa9},
- {0x35, 18, 16, 0xa5},
- {0x35, 0, 2, 0x9e},
- {0x35, 0, 16, 0x9f},
- {0x35, 15, 16, 0xa2},
- {0x35, 15, 14, 0x98},
- {0x35, 0, 44, 0x4f},
- {0x35, 0, 23, 0x6f},
- {0x35, 0, 13, 0x7e},
- {0x35, 0, 5, 0x8c},
- {0x35, 0, 2, 0x90},
- {0x35, 0, 9, 0x91},
- {0x35, 8, 7, 0x94},
- {0x35, 0, 6, 0x8d},
- {0x35, 5, 3, 0x8e},
- {0x35, 0, 3, 0x85},
- {0x35, 0, 1, 0x86},
- {0x35, 0, 3, 0x8a},
- {0x5, 0, 0, 0x102},
- {0x35, 1, 0, 0x7f},
- {0x5, 0, 0, 0x101},
- {0x5, 0, 0, 0x101},
- {0x35, 0, 4, 0x77},
- {0x35, 0, 2, 0x7a},
- {0x35, 0, 253, 0x7c},
- {0x35, 165, 253, 0x7d},
- {0x35, 252, 251, 0x79},
- {0x35, 0, 2, 0x73},
- {0x35, 0, 250, 0x75},
- {0x35, 249, 247, 0x76},
- {0x35, 247, 248, 0x72},
- {0x35, 0, 10, 0x60},
- {0x35, 0, 5, 0x66},
- {0x35, 0, 2, 0x6c},
- {0x35, 0, 243, 0x6d},
- {0x35, 241, 243, 0x6e},
- {0x35, 0, 158, 0x67},
- {0x35, 239, 241, 0x6a},
- {0x35, 0, 2, 0x63},
- {0x35, 0, 237, 0x64},
- {0x35, 236, 238, 0x65},
- {0x35, 237, 236, 0x62},
- {0x35, 0, 4, 0x57},
- {0x35, 0, 2, 0x5a},
- {0x35, 0, 182, 0x5b},
- {0x35, 231, 232, 0x5c},
- {0x35, 230, 232, 0x59},
- {0x35, 0, 2, 0x51},
- {0x35, 0, 228, 0x52},
- {0x35, 227, 228, 0x53},
- {0x35, 227, 228, 0x50},
- {0x35, 0, 20, 0x29},
- {0x35, 0, 10, 0x38},
- {0x35, 0, 5, 0x41},
- {0x35, 0, 2, 0x46},
- {0x35, 0, 221, 0x48},
- {0x35, 221, 222, 0x4e},
- {0x35, 0, 221, 0x43},
- {0x35, 220, 219, 0x44},
- {0x35, 0, 2, 0x3d},
- {0x35, 0, 218, 0x3e},
- {0x35, 216, 215, 0x3f},
- {0x35, 214, 216, 0x3c},
- {0x35, 0, 4, 0x30},
- {0x35, 0, 2, 0x33},
- {0x35, 0, 213, 0x36},
- {0x35, 164, 211, 0x37},
- {0x35, 210, 211, 0x31},
- {0x35, 0, 2, 0x2d},
- {0x35, 0, 208, 0x2e},
- {0x35, 207, 206, 0x2f},
- {0x35, 207, 206, 0x2b},
- {0x35, 0, 9, 0x17},
- {0x35, 0, 4, 0x1f},
- {0x35, 0, 2, 0x22},
- {0x35, 0, 203, 0x25},
- {0x35, 200, 194, 0x26},
- {0x35, 199, 201, 0x21},
- {0x35, 0, 2, 0x19},
- {0x35, 0, 199, 0x1d},
- {0x35, 196, 197, 0x1e},
- {0x35, 196, 195, 0x18},
- {0x35, 0, 4, 0xe},
- {0x35, 0, 2, 0x12},
- {0x35, 0, 192, 0x13},
- {0x35, 193, 192, 0x15},
- {0x35, 192, 190, 0x11},
- {0x35, 0, 2, 0x3},
- {0x35, 0, 189, 0x8},
- {0x35, 188, 187, 0xd},
- {0x35, 186, 187, 0x2},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 180, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 183, 0, 0x1},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 176, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 179, 0, 0x6},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 172, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 175, 0, 0x2},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 168, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 171, 0, 0x0},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 164, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 167, 0, 0x5},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 160, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 163, 164, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 156, 0x0},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 159, 0xfffffe7f},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 152, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 154, 0, 0x1},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 147, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 149, 0, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 142, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 144, 0, 0x4},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 137, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 139, 0, 0x5},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 132, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 134, 0, 0x9},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 127, 0x0},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 129, 0, 0xa},
- {0x6, 0, 0, 0x30005},
- {0x20, 0, 0, 0x24},
- {0x15, 0, 121, 0x0},
- {0x20, 0, 0, 0x20},
- {0x15, 124, 123, 0x4},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 117, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 120, 0, 0x10},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 113, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 116, 0, 0xf},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 109, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 112, 0, 0x3},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 105, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 108, 0, 0x4},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 101, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 104, 0, 0x53564d41},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 97, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 100, 0, 0x59616d61},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 93, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 96, 0, 0x29},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 89, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 92, 0, 0x2b},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 85, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 88, 0, 0x7f},
- {0x6, 0, 0, 0x30004},
- {0x20, 0, 0, 0x24},
- {0x15, 0, 80, 0x0},
- {0x20, 0, 0, 0x20},
- {0x45, 84, 83, 0xfffffff8},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 76, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 79, 0, 0x8},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 72, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 75, 0, 0xd},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 68, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 71, 0, 0xa},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 64, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 67, 0, 0x9},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 60, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 63, 0, 0xc},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 56, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 59, 0, 0xb},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 52, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 55, 0, 0x11},
- {0x20, 0, 0, 0x14},
- {0x15, 0, 48, 0x0},
- {0x20, 0, 0, 0x10},
- {0x15, 51, 50, 0x10},
- {0x20, 0, 0, 0x2c},
- {0x15, 0, 44, 0x0},
- {0x20, 0, 0, 0x28},
- {0x45, 48, 47, 0xfffdb7cc},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 40, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 43, 0, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 36, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 39, 0, 0x1},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 32, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 35, 0, 0x2},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 28, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 31, 0, 0x6},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 24, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 27, 0, 0x7},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 20, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 23, 0, 0x5},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 16, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 19, 0, 0x0},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 12, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 15, 0, 0x406},
- {0x20, 0, 0, 0x1c},
- {0x15, 0, 8, 0x0},
- {0x20, 0, 0, 0x18},
- {0x15, 0, 12, 0x4},
- {0x20, 0, 0, 0x24},
- {0x15, 0, 4, 0x0},
- {0x20, 0, 0, 0x20},
- {0x45, 8, 7, 0xfff363fc},
- {0x20, 0, 0, 0x14},
- {0x15, 1, 0, 0x0},
- {0x6, 0, 0, 0x30003},
- {0x20, 0, 0, 0x10},
- {0x15, 2, 0, 0x12b3},
- {0x6, 0, 0, 0x30002},
- {0x6, 0, 0, 0x50001},
- {0x6, 0, 0, 0x7fff0000},
- {0x6, 0, 0, 0x30001},
-};
-#elif defined(__x86_64__)
-struct sock_filter kTestSeccompFilter[] = {
- {0x20, 0, 0, 0x4},
- {0x15, 1, 0, 0xc000003e},
- {0x6, 0, 0, 0x30007},
- {0x20, 0, 0, 0x0},
- {0x45, 0, 1, 0x40000000},
- {0x6, 0, 0, 0x30006},
- {0x35, 0, 58, 0x80},
- {0x35, 0, 28, 0xe4},
- {0x35, 0, 14, 0x111},
- {0x35, 0, 7, 0x120},
- {0x35, 0, 3, 0x13c},
- {0x35, 0, 1, 0x13f},
- {0x35, 106, 115, 0x140},
- {0x35, 105, 114, 0x13e},
- {0x35, 0, 1, 0x123},
- {0x35, 103, 121, 0x126},
- {0x35, 102, 111, 0x121},
- {0x35, 0, 3, 0x119},
- {0x35, 0, 1, 0x11d},
- {0x35, 99, 108, 0x11e},
- {0x35, 98, 116, 0x11a},
- {0x35, 0, 106, 0x112},
- {0x35, 105, 96, 0x118},
- {0x35, 0, 6, 0xf8},
- {0x35, 0, 3, 0x106},
- {0x35, 0, 1, 0x10e},
- {0x35, 92, 110, 0x110},
- {0x35, 100, 109, 0x107},
- {0x35, 0, 90, 0x101},
- {0x35, 98, 107, 0x102},
- {0x35, 0, 3, 0xea},
- {0x35, 0, 1, 0xec},
- {0x35, 104, 86, 0xf7},
- {0x35, 94, 60, 0xeb},
- {0x35, 0, 94, 0xe5},
- {0x35, 101, 83, 0xe7},
- {0x35, 0, 15, 0xac},
- {0x35, 0, 7, 0xcb},
- {0x35, 0, 3, 0xd9},
- {0x35, 0, 1, 0xdc},
- {0x35, 78, 87, 0xdd},
- {0x35, 95, 86, 0xda},
- {0x35, 0, 1, 0xd5},
- {0x35, 75, 93, 0xd6},
- {0x35, 83, 74, 0xd4},
- {0x35, 0, 4, 0xbb},
- {0x35, 0, 1, 0xc9},
- {0x35, 125, 89, 0xca},
- {0x35, 0, 70, 0xc8},
- {0x5, 0, 0, 0x13d},
- {0x35, 0, 77, 0xae},
- {0x35, 85, 67, 0xba},
- {0x35, 0, 6, 0x8c},
- {0x35, 0, 3, 0x97},
- {0x35, 0, 1, 0x9e},
- {0x35, 63, 81, 0x9f},
- {0x35, 172, 62, 0x9d},
- {0x35, 0, 79, 0x8e},
- {0x35, 78, 60, 0x95},
- {0x35, 0, 3, 0x84},
- {0x35, 0, 1, 0x88},
- {0x35, 57, 66, 0x8a},
- {0x35, 56, 65, 0x87},
- {0x35, 0, 73, 0x81},
- {0x35, 72, 54, 0x83},
- {0x35, 0, 29, 0x3c},
- {0x35, 0, 14, 0x6b},
- {0x35, 0, 7, 0x76},
- {0x35, 0, 3, 0x7a},
- {0x35, 0, 1, 0x7e},
- {0x35, 48, 57, 0x7f},
- {0x35, 65, 56, 0x7c},
- {0x35, 0, 1, 0x78},
- {0x35, 45, 63, 0x79},
- {0x35, 53, 62, 0x77},
- {0x35, 0, 3, 0x6f},
- {0x35, 0, 1, 0x73},
- {0x35, 50, 59, 0x74},
- {0x35, 49, 40, 0x71},
- {0x35, 0, 57, 0x6d},
- {0x35, 56, 38, 0x6e},
- {0x35, 0, 6, 0x4c},
- {0x35, 0, 3, 0x66},
- {0x35, 0, 1, 0x68},
- {0x35, 43, 52, 0x69},
- {0x35, 33, 51, 0x67},
- {0x35, 0, 41, 0x60},
- {0x35, 31, 49, 0x62},
- {0x35, 0, 3, 0x40},
- {0x35, 0, 1, 0x49},
- {0x35, 28, 46, 0x4a},
- {0x35, 201, 36, 0x48},
- {0x35, 0, 44, 0x3e},
- {0x35, 43, 0, 0x3f},
- {0x5, 0, 0, 0x109},
- {0x35, 0, 15, 0x1d},
- {0x35, 0, 8, 0x31},
- {0x35, 0, 3, 0x37},
- {0x35, 0, 1, 0x3a},
- {0x35, 28, 19, 0x3b},
- {0x35, 27, 36, 0x39},
- {0x35, 0, 2, 0x35},
- {0x35, 16, 0, 0x36},
- {0x5, 0, 0, 0x108},
- {0x35, 14, 23, 0x33},
- {0x35, 0, 3, 0x27},
- {0x35, 0, 1, 0x29},
- {0x35, 29, 20, 0x2c},
- {0x35, 10, 28, 0x28},
- {0x35, 0, 18, 0x20},
- {0x35, 8, 26, 0x24},
- {0x35, 0, 8, 0xb},
- {0x35, 0, 4, 0x15},
- {0x35, 0, 2, 0x1a},
- {0x35, 0, 4, 0x1c},
- {0x5, 0, 0, 0x103},
- {0x35, 20, 11, 0x16},
- {0x35, 0, 19, 0x12},
- {0x35, 18, 0, 0x13},
- {0x5, 0, 0, 0x117},
- {0x35, 0, 5, 0x6},
- {0x35, 0, 3, 0x9},
- {0x35, 1, 0, 0xa},
- {0x5, 0, 0, 0x109},
- {0x5, 0, 0, 0x101},
- {0x35, 11, 2, 0x7},
- {0x35, 0, 10, 0x4},
- {0x35, 9, 0, 0x5},
- {0x5, 0, 0, 0x10c},
- {0x20, 0, 0, 0x14},
- {0x15, 4, 0, 0x0},
- {0x15, 0, 2, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 1, 0, 0x80000000},
- {0x5, 0, 0, 0x103},
- {0x20, 0, 0, 0x10},
- {0x15, 0, 1, 0x1},
- {0x5, 0, 0, 0x104},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 253, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 251, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 253, 0, 0x6},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 246, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 244, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 246, 0, 0x2},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 239, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 237, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 239, 0, 0x0},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 232, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 230, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 232, 0, 0x5},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 225, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 223, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 225, 226, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 218, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 216, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 218, 0xfffffe7f},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 211, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 209, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 210, 0, 0x1},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 203, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 201, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 202, 0, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 195, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 193, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 194, 0, 0x4},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 187, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 185, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 186, 0, 0x5},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 179, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 177, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 178, 0, 0x9},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 171, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 169, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x54, 0, 0, 0xfffffe7f},
- {0x15, 170, 0, 0xa},
- {0x6, 0, 0, 0x30005},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 162, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 160, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 162, 0, 0x10},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 155, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 153, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 155, 0, 0xf},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 148, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 146, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 148, 0, 0x3},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 141, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 139, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 141, 0, 0x4},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 134, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 132, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 134, 0, 0x53564d41},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 127, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 125, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 127, 0, 0x59616d61},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 120, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 118, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 120, 0, 0x29},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 113, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 111, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 113, 0, 0x2b},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 106, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 104, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 106, 0, 0x7f},
- {0x6, 0, 0, 0x30004},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 98, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 96, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 98, 0, 0x3},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 91, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 89, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 91, 0, 0x1},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 84, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 82, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 84, 0, 0x2},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 77, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 75, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 77, 0, 0x6},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 70, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 68, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 70, 0, 0x7},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 63, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 61, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 63, 0, 0x5},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 56, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 54, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 56, 0, 0x0},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 49, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 47, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 49, 0, 0x406},
- {0x20, 0, 0, 0x1c},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 42, 0xffffffff},
- {0x20, 0, 0, 0x18},
- {0x45, 0, 40, 0x80000000},
- {0x20, 0, 0, 0x18},
- {0x15, 0, 43, 0x4},
- {0x20, 0, 0, 0x24},
- {0x15, 0, 41, 0x0},
- {0x20, 0, 0, 0x20},
- {0x45, 39, 38, 0xffe363fc},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 31, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 29, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 31, 0, 0x12b1},
- {0x6, 0, 0, 0x30003},
- {0x20, 0, 0, 0x14},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 23, 0xffffffff},
- {0x20, 0, 0, 0x10},
- {0x45, 0, 21, 0x80000000},
- {0x20, 0, 0, 0x10},
- {0x15, 23, 24, 0x1},
- {0x20, 0, 0, 0x24},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 16, 0xffffffff},
- {0x20, 0, 0, 0x20},
- {0x45, 0, 14, 0x80000000},
- {0x20, 0, 0, 0x20},
- {0x15, 16, 15, 0x4},
- {0x20, 0, 0, 0x24},
- {0x15, 3, 0, 0x0},
- {0x15, 0, 9, 0xffffffff},
- {0x20, 0, 0, 0x20},
- {0x45, 0, 7, 0x80000000},
- {0x20, 0, 0, 0x20},
- {0x45, 10, 9, 0xfffffff8},
- {0x20, 0, 0, 0x2c},
- {0x15, 4, 0, 0x0},
- {0x15, 0, 2, 0xffffffff},
- {0x20, 0, 0, 0x28},
- {0x45, 1, 0, 0x80000000},
- {0x6, 0, 0, 0x30002},
- {0x20, 0, 0, 0x28},
- {0x45, 2, 1, 0xfffdb7cc},
- {0x6, 0, 0, 0x50001},
- {0x6, 0, 0, 0x7fff0000},
- {0x6, 0, 0, 0x30001},
-};
-#endif
-
-struct sock_fprog GetTestSeccompFilterProgram() {
- struct sock_fprog prog = {
- .len = sizeof(kTestSeccompFilter) / sizeof(struct sock_filter),
- .filter = kTestSeccompFilter
- };
- return prog;
-}
diff --git a/tests/tests/os/src/android/os/cts/SeccompTest.java b/tests/tests/os/src/android/os/cts/SeccompTest.java
index 7376079..d70a647 100644
--- a/tests/tests/os/src/android/os/cts/SeccompTest.java
+++ b/tests/tests/os/src/android/os/cts/SeccompTest.java
@@ -17,13 +17,16 @@
package android.os.cts;
import android.app.Service;
-import android.content.Context;
import android.content.ComponentName;
+import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.content.res.AssetFileDescriptor;
+import android.content.res.AssetManager;
import android.os.Environment;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
+import android.os.Process;
import android.os.RemoteException;
import android.os.MemoryFile;
import android.os.SystemClock;
@@ -300,7 +303,7 @@
public static class IsolatedService extends Service {
private final ISeccompIsolatedService.Stub mService = new ISeccompIsolatedService.Stub() {
public boolean installFilter() {
- return installTestFilter();
+ return installTestFilter(getAssets());
}
public boolean createThread() {
@@ -395,14 +398,78 @@
}
/**
+ * Loads an architecture-specific policy file from the AssetManager and
+ * installs it using Minijail.
+ */
+ private static boolean installTestFilter(final AssetManager assets) {
+ final String arch = getPolicyAbiString();
+ if (arch == null) {
+ throw new RuntimeException("Unsupported architecture/ABI");
+ }
+
+ try {
+ // Create a pipe onto which we will write the composite Seccomp policy.
+ ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe();
+ final ParcelFileDescriptor.AutoCloseOutputStream outputStream =
+ new ParcelFileDescriptor.AutoCloseOutputStream(pipe[1]);
+
+ // The policy files to concat together.
+ final AssetFileDescriptor[] policyFiles = {
+ assets.openFd("minijail/isolated-" + arch + ".policy"),
+ assets.openFd("minijail/isolated-common.policy"),
+ arch.equals("i386") ? null : assets.openFd("minijail/isolated-common-not-i386.policy"),
+ };
+
+ // Convert our PID to ASCII byte string.
+ final byte[] myPidBytes = Integer.toString(Process.myPid()).getBytes();
+
+ // Concatenate all the policyFiles together on the pipe.
+ final byte[] buffer = new byte[2048];
+ for (AssetFileDescriptor policyFile : policyFiles) {
+ if (policyFile == null)
+ continue;
+
+ final FileInputStream policyStream = policyFile.createInputStream();
+ while (true) {
+ int bytesRead = policyStream.read(buffer);
+ if (bytesRead == -1)
+ break;
+
+ // Replace the literal '$' with our PID. This allows us to lock down
+ // certain syscalls that take a pid/tgid.
+ for (int i = 0; i < bytesRead; i++) {
+ if (buffer[i] == '$') {
+ outputStream.write(myPidBytes);
+ } else {
+ outputStream.write(buffer[i]);
+ }
+ }
+ }
+ policyStream.close();
+ }
+ outputStream.close();
+
+ return nativeInstallTestFilter(pipe[0].detachFd());
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to load policy file", e);
+ }
+ }
+
+ /**
+ * Returns the architecture name policy file substring.
+ */
+ private static native String getPolicyAbiString();
+
+ /**
* Runs the seccomp_bpf_unittest of the given name.
*/
private native boolean runKernelUnitTest(final String name);
/**
- * Installs a test seccomp-bpf filter program that.
+ * Installs a Minijail seccomp policy from a FD. This takes ownership of
+ * the FD and closes it.
*/
- private native static boolean installTestFilter();
+ private native static boolean nativeInstallTestFilter(int policyFd);
/**
* Attempts to get the CLOCK_BOOTTIME, which is a violation of the
diff --git a/tests/tests/os/src/android/os/cts/SecurityPatchTest.java b/tests/tests/os/src/android/os/cts/SecurityPatchTest.java
index a857670..68609e1 100644
--- a/tests/tests/os/src/android/os/cts/SecurityPatchTest.java
+++ b/tests/tests/os/src/android/os/cts/SecurityPatchTest.java
@@ -31,8 +31,8 @@
"ro.build.version.security_patch should be in the format \"YYYY-MM-DD\". Found \"%s\"";
private static final String SECURITY_PATCH_DATE_ERROR =
"ro.build.version.security_patch should be \"%d-%02d\" or later. Found \"%s\"";
- private static final int SECURITY_PATCH_YEAR = 2017;
- private static final int SECURITY_PATCH_MONTH = 01;
+ private static final int SECURITY_PATCH_YEAR = 2016;
+ private static final int SECURITY_PATCH_MONTH = 06;
private boolean mSkipTests = false;
diff --git a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
index 698896b..912bf8f 100644
--- a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
@@ -542,6 +542,7 @@
"/data/mdl",
"/data/misc",
"/data/misc/bluetooth",
+ "/data/misc/bluetooth/logs",
"/data/misc/dhcp",
"/data/misc/lockscreen",
"/data/misc/sensor",
@@ -786,92 +787,6 @@
assertTrue("/data is not mounted NODEV", (vfs.f_flag & OsConstants.ST_NODEV) != 0);
}
- public void testAllBlockDevicesAreSecure() throws Exception {
- Set<File> insecure = getAllInsecureDevicesInDirAndSubdir(new File("/dev"), FileUtils.S_IFBLK);
- assertTrue("Found insecure block devices: " + insecure.toString(),
- insecure.isEmpty());
- }
-
- private static final Set<File> CHAR_DEV_EXCEPTIONS = new HashSet<File>(
- Arrays.asList(
- // All exceptions should be alphabetical and associated with a bug number.
- new File("/dev/adsprpc-smd"), // b/11710243
- new File("/dev/alarm"), // b/9035217
- new File("/dev/ashmem"),
- new File("/dev/binder"),
- new File("/dev/card0"), // b/13159510
- new File("/dev/renderD128"),
- new File("/dev/renderD129"), // b/23798677
- new File("/dev/dri/card0"), // b/13159510
- new File("/dev/dri/renderD128"),
- new File("/dev/dri/renderD129"), // b/23798677
- new File("/dev/felica"), // b/11142586
- new File("/dev/felica_ant"), // b/11142586
- new File("/dev/felica_cen"), // b/11142586
- new File("/dev/felica_pon"), // b/11142586
- new File("/dev/felica_rfs"), // b/11142586
- new File("/dev/felica_rws"), // b/11142586
- new File("/dev/felica_uicc"), // b/11142586
- new File("/dev/full"),
- new File("/dev/galcore"),
- new File("/dev/genlock"), // b/9035217
- new File("/dev/graphics/galcore"),
- new File("/dev/ion"),
- new File("/dev/kgsl-2d0"), // b/11271533
- new File("/dev/kgsl-2d1"), // b/11271533
- new File("/dev/kgsl-3d0"), // b/9035217
- new File("/dev/log/events"), // b/9035217
- new File("/dev/log/main"), // b/9035217
- new File("/dev/log/radio"), // b/9035217
- new File("/dev/log/system"), // b/9035217
- new File("/dev/mali0"), // b/9106968
- new File("/dev/mali"), // b/11142586
- new File("/dev/mm_interlock"), // b/12955573
- new File("/dev/mm_isp"), // b/12955573
- new File("/dev/mm_v3d"), // b/12955573
- new File("/dev/msm_rotator"), // b/9035217
- new File("/dev/null"),
- new File("/dev/nvhost-as-gpu"),
- new File("/dev/nvhost-ctrl"), // b/9088251
- new File("/dev/nvhost-ctrl-gpu"),
- new File("/dev/nvhost-dbg-gpu"),
- new File("/dev/nvhost-gpu"),
- new File("/dev/nvhost-gr2d"), // b/9088251
- new File("/dev/nvhost-gr3d"), // b/9088251
- new File("/dev/nvhost-tsec"),
- new File("/dev/nvhost-prof-gpu"),
- new File("/dev/nvhost-vic"),
- new File("/dev/nvmap"), // b/9088251
- new File("/dev/pmsg0"), // b/31857082
- new File("/dev/ptmx"), // b/9088251
- new File("/dev/pvrsrvkm"), // b/9108170
- new File("/dev/pvr_sync"),
- new File("/dev/quadd"),
- new File("/dev/random"),
- new File("/dev/snfc_cen"), // b/11142586
- new File("/dev/snfc_hsel"), // b/11142586
- new File("/dev/snfc_intu_poll"), // b/11142586
- new File("/dev/snfc_rfs"), // b/11142586
- new File("/dev/tegra-throughput"),
- new File("/dev/tiler"), // b/9108170
- new File("/dev/tty"),
- new File("/dev/urandom"),
- new File("/dev/ump"), // b/11142586
- new File("/dev/xt_qtaguid"), // b/9088251
- new File("/dev/zero"),
- new File("/dev/fimg2d"), // b/10428016
- new File("/dev/mobicore-user") // b/10428016
- ));
-
- public void testAllCharacterDevicesAreSecure() throws Exception {
- Set<File> insecure = getAllInsecureDevicesInDirAndSubdir(new File("/dev"), FileUtils.S_IFCHR);
- Set<File> insecurePts = getAllInsecureDevicesInDirAndSubdir(new File("/dev/pts"), FileUtils.S_IFCHR);
- insecure.removeAll(CHAR_DEV_EXCEPTIONS);
- insecure.removeAll(insecurePts);
- assertTrue("Found insecure character devices: " + insecure.toString(),
- insecure.isEmpty());
- }
-
public void testDevRandomWorldReadableAndWritable() throws Exception {
File f = new File("/dev/random");
@@ -985,67 +900,6 @@
.fileHasOnly("/system/bin/run-as"));
}
- private static Set<File>
- getAllInsecureDevicesInDirAndSubdir(File dir, int type) throws Exception {
- assertTrue(dir.isDirectory());
- Set<File> retval = new HashSet<File>();
-
- if (isSymbolicLink(dir)) {
- // don't examine symbolic links.
- return retval;
- }
-
- File[] subDirectories = dir.listFiles(new FileFilter() {
- @Override public boolean accept(File pathname) {
- return pathname.isDirectory();
- }
- });
-
-
- /* recurse into subdirectories */
- if (subDirectories != null) {
- for (File f : subDirectories) {
- retval.addAll(getAllInsecureDevicesInDirAndSubdir(f, type));
- }
- }
-
- File[] filesInThisDirectory = dir.listFiles();
- if (filesInThisDirectory == null) {
- return retval;
- }
-
- for (File f: filesInThisDirectory) {
- FileUtils.FileStatus status = new FileUtils.FileStatus();
- FileUtils.getFileStatus(f.getAbsolutePath(), status, false);
- if (status.isOfType(type)) {
- if (f.canRead() || f.canWrite() || f.canExecute()) {
- retval.add(f);
- }
- if (status.uid == 2000) {
- // The shell user should not own any devices
- retval.add(f);
- }
-
- // Don't allow devices owned by GIDs
- // accessible to non-privileged applications.
- if ((status.gid == 1007) // AID_LOG
- || (status.gid == 1015) // AID_SDCARD_RW
- || (status.gid == 1023) // AID_MEDIA_RW
- || (status.gid == 1028) // AID_SDCARD_R
- || (status.gid == 2000)) // AID_SHELL
- {
- if (status.hasModeFlag(FileUtils.S_IRGRP)
- || status.hasModeFlag(FileUtils.S_IWGRP)
- || status.hasModeFlag(FileUtils.S_IXGRP))
- {
- retval.add(f);
- }
- }
- }
- }
- return retval;
- }
-
private Set<File> getWritableDirectoriesAndSubdirectoriesOf(File dir) throws Exception {
Set<File> retval = new HashSet<File>();
if (!dir.isDirectory()) {
diff --git a/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java b/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java
index f93aacf..2a4b6da 100644
--- a/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java
@@ -16,31 +16,40 @@
package android.permission.cts;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.media.AudioManager;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
import android.telephony.TelephonyManager;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Test the non-location-related functionality of TelephonyManager.
*/
-public class TelephonyManagerPermissionTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class TelephonyManagerPermissionTest {
private boolean mHasTelephony;
TelephonyManager mTelephonyManager = null;
private AudioManager mAudioManager;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
mHasTelephony = getContext().getPackageManager().hasSystemFeature(
PackageManager.FEATURE_TELEPHONY);
- mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ mTelephonyManager =
+ (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
assertNotNull(mTelephonyManager);
- mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+ mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
assertNotNull(mAudioManager);
}
@@ -50,7 +59,7 @@
* Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE}.
*/
- @SmallTest
+ @Test
public void testGetDeviceId() {
if (!mHasTelephony) {
return;
@@ -76,7 +85,7 @@
* Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE}.
*/
- @SmallTest
+ @Test
public void testGetLine1Number() {
if (!mHasTelephony) {
return;
@@ -96,7 +105,7 @@
* Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE}.
*/
- @SmallTest
+ @Test
public void testGetSimSerialNumber() {
if (!mHasTelephony) {
return;
@@ -116,7 +125,7 @@
* Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE}.
*/
- @SmallTest
+ @Test
public void testGetSubscriberId() {
if (!mHasTelephony) {
return;
@@ -136,7 +145,7 @@
* Requires Permission:
* {@link android.Manifest.permission#READ_PHONE_STATE}.
*/
- @SmallTest
+ @Test
public void testVoiceMailNumber() {
if (!mHasTelephony) {
return;
@@ -157,7 +166,7 @@
* {@link android.Manifest.permission#MODIFY_PHONE_STATE} for
* {@link AudioManager#MODE_IN_CALL}.
*/
- @SmallTest
+ @Test
public void testSetMode() {
if (!mHasTelephony) {
return;
@@ -168,9 +177,28 @@
}
/**
+ * Verify that TelephonyManager.setDataEnabled requires Permission.
+ * <p>
+ * Requires Permission:
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE}.
+ */
+ @Test
+ public void testSetDataEnabled() {
+ if (!mHasTelephony) {
+ return;
+ }
+ try {
+ mTelephonyManager.setDataEnabled(false);
+ fail("Able to set data enabled");
+ } catch (SecurityException e) {
+ // expected
+ }
+ }
+
+ /**
* Verify that Telephony related broadcasts are protected.
*/
- @SmallTest
+ @Test
public void testProtectedBroadcasts() {
if (!mHasTelephony) {
return;
@@ -215,4 +243,8 @@
} catch (SecurityException e) {}
}
+
+ private static Context getContext() {
+ return InstrumentationRegistry.getContext();
+ }
}
diff --git a/tests/tests/provider/Android.mk b/tests/tests/provider/Android.mk
index 30d3e71..ee51fea 100644
--- a/tests/tests/provider/Android.mk
+++ b/tests/tests/provider/Android.mk
@@ -28,8 +28,6 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
LOCAL_STATIC_JAVA_LIBRARIES := \
diff --git a/tests/tests/provider/OldAndroidTest.xml b/tests/tests/provider/OldAndroidTest.xml
deleted file mode 100644
index bd22d8f..0000000
--- a/tests/tests/provider/OldAndroidTest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 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="Test module config for provider">
- <include name="common-config" />
- <option name="run-command:run-command"
- value="ime enable android.provider.cts/.MockInputMethodService" />
-</configuration>
diff --git a/tests/tests/renderscript/libcoremathtestcpp/Android.mk b/tests/tests/renderscript/libcoremathtestcpp/Android.mk
index c62f20e..ad528571 100644
--- a/tests/tests/renderscript/libcoremathtestcpp/Android.mk
+++ b/tests/tests/renderscript/libcoremathtestcpp/Android.mk
@@ -32,5 +32,5 @@
LOCAL_C_INCLUDES += frameworks/rs
LOCAL_LDFLAGS := -llog -ldl
-LOCAL_STATIC_LIBRARIES := libRScpp_static libcutils
+LOCAL_STATIC_LIBRARIES := libRScpp_static
include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/DebugContext.java b/tests/tests/renderscript/src/android/renderscript/cts/DebugContext.java
index 5c71155..f1ca6ed 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/DebugContext.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/DebugContext.java
@@ -23,6 +23,8 @@
import android.renderscript.RSRuntimeException;
import android.renderscript.Type;
import android.util.Log;
+import java.util.Random;
+import java.util.function.*;
public class DebugContext extends RSBaseCompute {
Allocation AUnused;
@@ -91,4 +93,381 @@
// The context is dead at this point so make sure it's not reused
RenderScript.releaseAllContexts();
}
+
+ /**
+ * Helper for rsAllocationCopy tests
+ */
+
+ protected class SetupAllocationCopyTests {
+ int Width;
+ int Height;
+ int ArrLen;
+ Allocation aIn;
+ Allocation aOut;
+ Random RN;
+
+ SetupAllocationCopyTests(int dimension,
+ int size, Function<RenderScript, Type.Builder> TB, long seed) {
+ // Type.Builder constructor needs a RenderScript instance,
+ // and that's created by setupDebugContext(). Hence a
+ // Function<RenderScript, Type.Builder> is needed here
+
+ assertTrue(dimension == 1 || dimension == 2);
+
+ setupDebugContext();
+ RN = new Random(seed);
+ // So that we can have offsets that will be invalid in another
+ // dimension
+ Width = RN.nextInt(size/2)+size/2;
+ Height = RN.nextInt(size/2);
+ if (dimension == 1) {
+ ArrLen = Width;
+ } else {
+ ArrLen = Width * Height;
+ }
+
+ Type.Builder typeBuilder = TB.apply(mRS);
+
+ if (dimension == 1)
+ typeBuilder.setX(Width);
+ else
+ typeBuilder.setX(Width).setY(Height);
+
+ aIn = Allocation.createTyped(mRS, typeBuilder.create());
+ aOut = Allocation.createTyped(mRS, typeBuilder.create());
+
+ // Initialize test Allocations
+ if (aIn.getElement().getDataType() == Element.DataType.SIGNED_8) {
+ byte[] inArray = new byte[ArrLen];
+ RN.nextBytes(inArray);
+ byte[] outArray = new byte[ArrLen];
+ aIn.copyFrom(inArray);
+ aOut.copyFrom(outArray);
+ } else {
+ assertTrue(aIn.getElement().getDataType() ==
+ Element.DataType.SIGNED_16);
+ short[] inArray = new short[ArrLen];
+ for (int i = 0; i < ArrLen; i++)
+ inArray[i] = (short)RN.nextInt();
+ short[] outArray = new short[ArrLen];
+ aIn.copyFrom(inArray);
+ aOut.copyFrom(outArray);
+ }
+
+ // Setup script environment
+ if (dimension == 1) {
+ Soob.set_aIn1D(aIn);
+ Soob.set_aOut1D(aOut);
+ } else {
+ Soob.set_aIn2D(aIn);
+ Soob.set_aOut2D(aOut);
+ }
+ }
+
+ protected void finishAllocationCopyTests() {
+ mRS.finish();
+
+ // Flush messages through the pipeline.
+ mRS.sendMessage(RS_MSG_TEST_FLUSH, null);
+ waitForMessage();
+ Soob.destroy();
+ }
+ }
+
+ /**
+ * 1D copy - things should work under DebugContext if given
+ * legitimate arguments
+ */
+ public void testDebugContextRsAllocationCopy1D_Byte_Normal() {
+ SetupAllocationCopyTests AC =
+ new SetupAllocationCopyTests(1, 512,
+ (RenderScript rs)-> new Type.Builder(rs, Element.I8(rs)),
+ 0x172d8ab9);
+ int Offset = AC.RN.nextInt(AC.Width);
+ int Count = AC.RN.nextInt(AC.Width - Offset);
+ Soob.set_dstXOff(Offset);
+ Soob.set_srcXOff(Offset);
+ Soob.set_xCount(Count);
+ Soob.set_srcMip(0);
+ Soob.set_dstMip(0);
+ Soob.invoke_test1D();
+
+ AC.finishAllocationCopyTests();
+
+ // Validate results
+ boolean result = true;
+ byte[] inArray = new byte[AC.ArrLen];
+ byte[] outArray = new byte[AC.ArrLen];
+ AC.aIn.copyTo(inArray);
+ AC.aOut.copyTo(outArray);
+ for (int i = 0; i < AC.Width; i++) {
+ if (Offset <= i && i < Offset + Count) {
+ if (inArray[i] != outArray[i]) {
+ result = false;
+ break;
+ }
+ } else {
+ if (outArray[i] != 0) {
+ result = false;
+ break;
+ }
+ }
+ }
+ assertTrue(result);
+
+ RenderScript.releaseAllContexts();
+ }
+
+ /**
+ * 2D copy - with legitimate arguments
+ */
+ public void testDebugContextRsAllocationCopy2D_Short_Normal() {
+ SetupAllocationCopyTests AC =
+ new SetupAllocationCopyTests(2, 128,
+ (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs)),
+ 0x172d8aba);
+ // to make sure xOff is not a valid yOff.
+ int xOff = AC.RN.nextInt(AC.Width-AC.Height) + AC.Height;
+ int yOff = AC.RN.nextInt(AC.Height);
+ int xCount = AC.RN.nextInt(AC.Width - xOff);
+ int yCount = AC.RN.nextInt(AC.Height - yOff);
+
+ Soob.set_dstXOff(xOff);
+ Soob.set_srcXOff(xOff);
+ Soob.set_yOff(yOff);
+ Soob.set_xCount(xCount);
+ Soob.set_yCount(yCount);
+ Soob.set_srcMip(0);
+ Soob.set_dstMip(0);
+ Soob.invoke_test2D();
+
+ AC.finishAllocationCopyTests();
+
+ // Validate results
+ boolean result = true;
+ short[] inArray = new short[AC.ArrLen];
+ short[] outArray = new short[AC.ArrLen];
+ AC.aIn.copyTo(inArray);
+ AC.aOut.copyTo(outArray);
+ for (int i = 0; i < AC.Height; i++) {
+ for (int j = 0; j < AC.Width; j++) {
+ int pos = i * AC.Width + j;
+ if (yOff <= i && i < yOff + yCount &&
+ xOff <= j && j < xOff + xCount) {
+ if (inArray[pos] != outArray[pos]) {
+ result = false;
+ break;
+ }
+ } else {
+ if (outArray[pos] != 0) {
+ result = false;
+ break;
+ }
+ }
+ }
+ }
+ assertTrue(result);
+
+ // The context is dead at this point so make sure it's not reused
+ RenderScript.releaseAllContexts();
+ }
+
+ /**
+ * Test invalid arguments to rsAllocationCopy1D - bad source LOD
+ */
+ public void testDebugContextRsAllocationCopy1D_Byte_BadSrcLOD() {
+ SetupAllocationCopyTests AC =
+ new SetupAllocationCopyTests(1, 512,
+ (RenderScript rs)-> new Type.Builder(rs, Element.I8(rs)),
+ 0x172d8abb);
+ int Offset = AC.RN.nextInt(AC.Width);
+ int Count = AC.RN.nextInt(AC.Width - Offset);
+ Soob.set_dstXOff(Offset);
+ Soob.set_srcXOff(Offset);
+ Soob.set_xCount(Count);
+ Soob.set_srcMip(1); // bad source LOD
+ Soob.set_dstMip(0);
+ Soob.invoke_test1D();
+
+ AC.finishAllocationCopyTests();
+ assertTrue(mRanErrorHandler);
+
+ // The context is dead at this point so make sure it's not reused
+ RenderScript.releaseAllContexts();
+ }
+
+ /**
+ * Test invalid arguments to rsAllocationCopy1D - bad destination LOD
+ */
+ public void testDebugContextRsAllocationCopy1D_Byte_BadDstLOD() {
+ SetupAllocationCopyTests AC =
+ new SetupAllocationCopyTests(1, 512,
+ (RenderScript rs)-> new Type.Builder(rs, Element.I8(rs)),
+ 0x172d8abc);
+ int Offset = AC.RN.nextInt(AC.Width);
+ int Count = AC.RN.nextInt(AC.Width - Offset);
+ Soob.set_dstXOff(Offset);
+ Soob.set_srcXOff(Offset);
+ Soob.set_xCount(Count);
+ Soob.set_srcMip(0);
+ Soob.set_dstMip(1); // bad destination LOD
+ Soob.invoke_test1D();
+
+ AC.finishAllocationCopyTests();
+ assertTrue(mRanErrorHandler);
+
+ // The context is dead at this point so make sure it's not reused
+ RenderScript.releaseAllContexts();
+ }
+
+
+ /**
+ * Test invalid arguments to rsAllocationCopy1D - invalid count
+ */
+ public void testDebugContextRsAllocationCopy1D_Byte_BadCount() {
+ SetupAllocationCopyTests AC =
+ new SetupAllocationCopyTests(1, 512,
+ (RenderScript rs)-> new Type.Builder(rs, Element.I8(rs)),
+ 0x172d8abd);
+ int Offset = AC.RN.nextInt(AC.Width);
+ Soob.set_dstXOff(Offset);
+ Soob.set_srcXOff(Offset);
+ Soob.set_xCount(AC.Width - Offset + 1); // Invalid count by 1
+ Soob.set_srcMip(0);
+ Soob.set_dstMip(0);
+ Soob.invoke_test1D();
+
+ AC.finishAllocationCopyTests();
+ assertTrue(mRanErrorHandler);
+
+ // The context is dead at this point so make sure it's not reused
+ RenderScript.releaseAllContexts();
+ }
+
+ /**
+ * Test invalid arguments to rsAllocationCopy1D - invalid source offset
+ */
+ public void testDebugContextRsAllocationCopy1D_Byte_BadSrcOffset() {
+ SetupAllocationCopyTests AC =
+ new SetupAllocationCopyTests(1, 512,
+ (RenderScript rs)-> new Type.Builder(rs, Element.I8(rs)),
+ 0x172d8abe);
+
+ int Offset = AC.RN.nextInt(AC.Width);
+ Soob.set_dstXOff(Offset);
+ Soob.set_srcXOff(AC.Width); // Invalid src offset
+ Soob.set_xCount(1);
+ Soob.set_srcMip(0);
+ Soob.set_dstMip(0);
+ Soob.invoke_test1D();
+
+ AC.finishAllocationCopyTests();
+ assertTrue(mRanErrorHandler);
+
+ // The context is dead at this point so make sure it's not reused
+ RenderScript.releaseAllContexts();
+ }
+
+ /**
+ * Test invalid arguments to rsAllocationCopy1D - invalid destination offset
+ */
+ public void testDebugContextRsAllocationCopy1D_Byte_BadDstOffset() {
+ SetupAllocationCopyTests AC =
+ new SetupAllocationCopyTests(1, 512,
+ (RenderScript rs)-> new Type.Builder(rs, Element.I8(rs)),
+ 0x172d8abf);
+
+ int Offset = AC.RN.nextInt(AC.Width);
+ Soob.set_dstXOff(AC.ArrLen); // Invalid dst offset
+ Soob.set_srcXOff(Offset); // Invalid src offset
+ Soob.set_xCount(1);
+ Soob.set_srcMip(0);
+ Soob.set_dstMip(0);
+ Soob.invoke_test1D();
+
+ AC.finishAllocationCopyTests();
+ assertTrue(mRanErrorHandler);
+
+ // The context is dead at this point so make sure it's not reused
+ RenderScript.releaseAllContexts();
+ }
+
+
+ /**
+ * Test invalid arguments to rsAllocationCopy2D - invalid y count
+ */
+ public void testDebugContextRsAllocationCopy2D_Short_BadYCount() {
+ SetupAllocationCopyTests AC =
+ new SetupAllocationCopyTests(2, 128,
+ (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs)),
+ 0x172d8ac0);
+ int xOff = AC.RN.nextInt(AC.Width);
+ int yOff = AC.RN.nextInt(AC.Height);
+ int xCount = AC.RN.nextInt(AC.Width - xOff);
+
+ Soob.set_dstXOff(xOff);
+ Soob.set_srcXOff(xOff);
+ Soob.set_yOff(yOff);
+ Soob.set_xCount(xCount); // Legitimate X count
+ Soob.set_yCount(AC.Height - yOff + 1); // Invalid Y count by 1
+ Soob.set_srcMip(0);
+ Soob.set_dstMip(0);
+ Soob.invoke_test2D();
+
+ AC.finishAllocationCopyTests();
+ assertTrue(mRanErrorHandler);
+
+ // The context is dead at this point so make sure it's not reused
+ RenderScript.releaseAllContexts();
+ }
+
+ /**
+ * Test invalid arguments to rsAllocationCopy2D - 2D operation on
+ * an 1D Allocation
+ */
+ public void testDebugContextRsAllocationCopy2D_Short_WrongD() {
+ setupDebugContext();
+
+ Random random = new Random(0x172d8ac1);
+ int width = random.nextInt(128);
+ int height = random.nextInt(128);
+ int xOff = random.nextInt(width);
+ int yOff = random.nextInt(height);
+ int xCount = random.nextInt(width - xOff);
+ int yCount = random.nextInt(height - yOff);
+ int arr_len = width * height;
+
+
+ Type.Builder typeBuilder1 = new Type.Builder(mRS, Element.I16(mRS));
+ typeBuilder1.setX(width);
+ // aIn is one-dimensional
+ Allocation aIn = Allocation.createTyped(mRS, typeBuilder1.create());
+ Type.Builder typeBuilder2 = new Type.Builder(mRS, Element.I16(mRS));
+ typeBuilder2.setX(width).setY(height);
+ Allocation aOut = Allocation.createTyped(mRS, typeBuilder2.create());
+
+ Soob.set_aIn2D(aIn);
+ Soob.set_aOut2D(aOut);
+ Soob.set_srcXOff(xOff);
+ Soob.set_dstXOff(xOff);
+ Soob.set_yOff(yOff);
+ Soob.set_xCount(xCount); // Legitimate X count
+ Soob.set_yCount(yCount); // Legitimate Y count (w.r.t aOut)
+ Soob.set_srcMip(0);
+ Soob.set_dstMip(0);
+ Soob.invoke_test2D();
+ mRS.finish();
+
+ // Flush messages through the pipeline.
+ mRS.sendMessage(RS_MSG_TEST_FLUSH, null);
+ waitForMessage();
+
+ Soob.destroy();
+ assertTrue(mRanErrorHandler);
+
+ // The context is dead at this point so make sure it's not reused
+ RenderScript.releaseAllContexts();
+ }
+
+
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/StructFieldTest.java b/tests/tests/renderscript/src/android/renderscript/cts/StructFieldTest.java
new file mode 100644
index 0000000..f98cd05
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/StructFieldTest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2016 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 android.renderscript.cts;
+
+import android.content.Context;
+import android.renderscript.RenderScript;
+import java.util.Random;
+
+public class StructFieldTest extends RSBaseCompute {
+ private Random r;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ r = new Random(0);
+ }
+
+ private ScriptField_InnerOne.Item makeInnerOne() {
+ ScriptField_InnerOne.Item innerOne = new ScriptField_InnerOne.Item();
+ innerOne.x = r.nextInt();
+ innerOne.y = r.nextInt();
+ innerOne.f = r.nextFloat();
+ return innerOne;
+ }
+
+ private ScriptField_InnerTwo.Item makeInnerTwo() {
+ ScriptField_InnerTwo.Item innerTwo = new ScriptField_InnerTwo.Item();
+ innerTwo.z = (byte)r.nextInt();
+ innerTwo.innerOne = makeInnerOne();
+ return innerTwo;
+ }
+
+ public void testStructField() {
+ ScriptC_struct_field s = new ScriptC_struct_field(mRS);
+
+ ScriptField_Outer.Item outer = new ScriptField_Outer.Item();
+ outer.innerOneA = makeInnerOne();
+ outer.l = r.nextLong();
+ outer.innerOneB = makeInnerOne();
+ for (int i = 0; i < 3; ++i)
+ outer.innerTwo3[i] = makeInnerTwo();
+ for (int i = 0; i < 2; ++i)
+ outer.innerTwo2[i] = makeInnerTwo();
+ for (int i = 0; i < 4; ++i)
+ outer.innerOne4[i] = makeInnerOne();
+ outer.innerOneC = makeInnerOne();
+ s.set_outer(outer);
+
+ s.invoke_checkOuter(
+ outer.innerOneA.x, outer.innerOneA.y, outer.innerOneA.f,
+ outer.l,
+ outer.innerOneB.x, outer.innerOneB.y, outer.innerOneB.f,
+ outer.innerTwo3[0].z,
+ outer.innerTwo3[0].innerOne.x, outer.innerTwo3[0].innerOne.y, outer.innerTwo3[0].innerOne.f,
+ outer.innerTwo3[1].z,
+ outer.innerTwo3[1].innerOne.x, outer.innerTwo3[1].innerOne.y, outer.innerTwo3[1].innerOne.f,
+ outer.innerTwo3[2].z,
+ outer.innerTwo3[2].innerOne.x, outer.innerTwo3[2].innerOne.y, outer.innerTwo3[2].innerOne.f,
+ outer.innerTwo2[0].z,
+ outer.innerTwo2[0].innerOne.x, outer.innerTwo2[0].innerOne.y, outer.innerTwo2[0].innerOne.f,
+ outer.innerTwo2[1].z,
+ outer.innerTwo2[1].innerOne.x, outer.innerTwo2[1].innerOne.y, outer.innerTwo2[1].innerOne.f,
+ outer.innerOne4[0].x, outer.innerOne4[0].y, outer.innerOne4[0].f,
+ outer.innerOne4[1].x, outer.innerOne4[1].y, outer.innerOne4[1].f,
+ outer.innerOne4[2].x, outer.innerOne4[2].y, outer.innerOne4[2].f,
+ outer.innerOne4[3].x, outer.innerOne4[3].y, outer.innerOne4[3].f,
+ outer.innerOneC.x, outer.innerOneC.y, outer.innerOneC.f);
+
+ mRS.finish();
+ waitForMessage();
+ checkForErrors();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/oob.rs b/tests/tests/renderscript/src/android/renderscript/cts/oob.rs
index d27a8ca..404473f 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/oob.rs
+++ b/tests/tests/renderscript/src/android/renderscript/cts/oob.rs
@@ -10,3 +10,26 @@
rsSetElementAt_int(aInt, 1, 1);
}
+// OOB tests on rsAllocationCopy[12]DRange
+rs_allocation aIn1D;
+rs_allocation aOut1D;
+rs_allocation aIn2D;
+rs_allocation aOut2D;
+
+int dstXOff = 0;
+int srcXOff = 0;
+int yOff = 0;
+int xCount = 0;
+int yCount = 0;
+int srcMip = 0; // Only used in 1D tests
+int dstMip = 0; // Ditto.
+
+void test1D() {
+ rsAllocationCopy1DRange(aOut1D, dstXOff, dstMip, xCount,
+ aIn1D, srcXOff, srcMip);
+}
+
+void test2D() {
+ rsAllocationCopy2DRange(aOut2D, dstXOff, yOff, 0, 0, xCount, yCount,
+ aIn2D, srcXOff, yOff, 0, 0);
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/struct_field.rs b/tests/tests/renderscript/src/android/renderscript/cts/struct_field.rs
new file mode 100644
index 0000000..0ad639c
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/struct_field.rs
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "shared.rsh"
+
+// Ensure that we can reflect correct Java code for a struct with
+// multiple fields of type struct. Java sets the script global
+// variable "outer", and then calls a verification invokable
+// "checkOuter()", passing the expected field values as scalar
+// arguments.
+
+struct InnerOne {
+ int x;
+ int y;
+ float f;
+};
+
+typedef struct InnerOne s_innerOne;
+
+struct InnerTwo {
+ int8_t z;
+ struct InnerOne innerOne;
+};
+
+struct Outer {
+ struct InnerOne innerOneA;
+ long l; // to induce padding
+ struct InnerOne innerOneB;
+ struct InnerTwo innerTwo3[3];
+ struct InnerTwo innerTwo2[2];
+ struct InnerOne innerOne4[4];
+ s_innerOne innerOneC; // does a typedef confuse reflection?
+};
+
+struct Outer outer;
+
+// Fragment of incoming argument list: Fields for struct InnerOne.
+// Arguments are named argPrefix"_x", argPrefix"_y", argPrefix"_f".
+#define ARGS_INNERONE_(argPrefix) \
+ int argPrefix ## _x, int argPrefix ## _y, float argPrefix ## _f
+
+// Fragment of incoming argument list: Fields for struct InnerOne
+// within struct Outer.
+// Arguments are named outerFieldName"_x", outerFieldName"_y", outerFieldName"_f".
+#define ARGS_INNERONE_SCALAR(outerFieldName) \
+ ARGS_INNERONE_(outerFieldName)
+
+// Fragment of incoming argument list: Fields for element of array of
+// struct InnerOne within struct Outer.
+// Arguments are named outerFieldName"_"index"_x", outerFieldName"_"index"_y",
+// and outerFieldName"_"index"_f".
+#define ARGS_INNERONE_ARRAY(outerFieldName, index) \
+ ARGS_INNERONE_(outerFieldName ## _ ## index)
+
+// Fragment of incoming argument list: Fields for element of array of
+// struct InnerTwo (with nested InnerOne flattened out) within struct Outer.
+// Arguments are named outerFieldName"_"index"_z", outerFieldName"_"index"_innerOne_x", etc.
+#define ARGS_INNERTWO_ARRAY(outerFieldName, index) \
+ int8_t outerFieldName ## _ ## index ## _z, ARGS_INNERONE_(outerFieldName ## _ ## index ## _innerOne)
+
+// #define TRACE(...) rsDebug(__VA_ARGS__)
+#define TRACE(...) (void)0
+
+void checkOuter(ARGS_INNERONE_SCALAR(innerOneA),
+ long l,
+ ARGS_INNERONE_SCALAR(innerOneB),
+ ARGS_INNERTWO_ARRAY(innerTwo3, 0),
+ ARGS_INNERTWO_ARRAY(innerTwo3, 1),
+ ARGS_INNERTWO_ARRAY(innerTwo3, 2),
+ ARGS_INNERTWO_ARRAY(innerTwo2, 0),
+ ARGS_INNERTWO_ARRAY(innerTwo2, 1),
+ ARGS_INNERONE_ARRAY(innerOne4, 0),
+ ARGS_INNERONE_ARRAY(innerOne4, 1),
+ ARGS_INNERONE_ARRAY(innerOne4, 2),
+ ARGS_INNERONE_ARRAY(innerOne4, 3),
+ ARGS_INNERONE_SCALAR(innerOneC)) {
+ bool failed = false;
+
+ // Compare contents of a struct InnerOne instance against incoming argument values.
+ // Compares instanceName".x" to argPrefix"_x", etc.
+#define CHECK_INNERONE_(instanceName, argPrefix) \
+ do { \
+ TRACE(# instanceName, instanceName.x); \
+ _RS_ASSERT(instanceName.x == argPrefix ## _x); \
+ TRACE(# instanceName, instanceName.y); \
+ _RS_ASSERT(instanceName.y == argPrefix ## _y); \
+ TRACE(# instanceName, instanceName.f); \
+ _RS_ASSERT(instanceName.f == argPrefix ## _f); \
+ } while(false)
+
+ // Compare contents of a struct InnerOne instance within global
+ // variable "outer" against incoming argument values.
+ // Compares "outer."outerFieldName".x" to outerFieldName"_x", etc.
+#define CHECK_INNERONE_SCALAR(outerFieldName) \
+ CHECK_INNERONE_(outer.outerFieldName, outerFieldName)
+
+ // Compare contents of element of array of struct InnerOne
+ // instance within global variable "outer" against incoming argument values.
+ // Compares "outer"outerFieldName"["index"].x" to outerFieldName"_"index"_x", etc.
+#define CHECK_INNERONE_ARRAY(outerFieldName, index) \
+ CHECK_INNERONE_(outer.outerFieldName[index], outerFieldName ## _ ## index)
+
+ // Compare contents of element of array of struct InnerTwo
+ // instance within global variable "outer" against incoming argument values.
+ // Compares "outer."outerFieldName"["index"].z" to outerFieldName"_"index"_z",
+ // "outer."outerFieldName"["index"].innerOne.x" to outerFieldName""index"_innerOne_x",
+ // etc.
+#define CHECK_INNERTWO_ARRAY(outerFieldName, index) \
+ do { \
+ TRACE(# index, outer.outerFieldName[index].z); \
+ _RS_ASSERT(outer.outerFieldName[index].z == outerFieldName ## _ ## index ## _z); \
+ CHECK_INNERONE_(outer.outerFieldName[index].innerOne, outerFieldName ## _ ## index ## _innerOne); \
+ } while (false);
+
+ CHECK_INNERONE_SCALAR(innerOneA);
+ TRACE("l", outer.l);
+ _RS_ASSERT(outer.l == l);
+ CHECK_INNERONE_SCALAR(innerOneB);
+ CHECK_INNERTWO_ARRAY(innerTwo3, 0);
+ CHECK_INNERTWO_ARRAY(innerTwo3, 1);
+ CHECK_INNERTWO_ARRAY(innerTwo3, 2);
+ CHECK_INNERTWO_ARRAY(innerTwo2, 0);
+ CHECK_INNERTWO_ARRAY(innerTwo2, 1);
+ CHECK_INNERONE_ARRAY(innerOne4, 0);
+ CHECK_INNERONE_ARRAY(innerOne4, 1);
+ CHECK_INNERONE_ARRAY(innerOne4, 2);
+ CHECK_INNERONE_ARRAY(innerOne4, 3);
+ CHECK_INNERONE_SCALAR(innerOneC);
+
+ if (failed) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ }
+ else {
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+ }
+}
diff --git a/tests/tests/rscpp/librscpptest/Android.mk b/tests/tests/rscpp/librscpptest/Android.mk
index 73d2234..36eafe2 100644
--- a/tests/tests/rscpp/librscpptest/Android.mk
+++ b/tests/tests/rscpp/librscpptest/Android.mk
@@ -48,7 +48,7 @@
LOCAL_CPPFLAGS := -std=c++11
LOCAL_SHARED_LIBRARIES := libdl liblog
-LOCAL_STATIC_LIBRARIES := libRScpp_static libcutils
+LOCAL_STATIC_LIBRARIES := libRScpp_static
LOCAL_SDK_VERSION := 21
diff --git a/tests/tests/rscpp/librscpptest/rs_jni.cpp b/tests/tests/rscpp/librscpptest/rs_jni.cpp
index 920d95d..9401c0a 100644
--- a/tests/tests/rscpp/librscpptest/rs_jni.cpp
+++ b/tests/tests/rscpp/librscpptest/rs_jni.cpp
@@ -50,7 +50,7 @@
}
}
-sp<const Element> makeElement(sp<RS> rs, RsDataType dt, int vecSize) {
+sp<const Element> makeElement(const sp<RS> &rs, RsDataType dt, int vecSize) {
if (vecSize > 1) {
return Element::createVector(rs, dt, vecSize);
} else {
diff --git a/tests/tests/rscpp/librscpptest/rs_jni_allocation.cpp b/tests/tests/rscpp/librscpptest/rs_jni_allocation.cpp
index 4b8b8a8..f2d1a0b 100644
--- a/tests/tests/rscpp/librscpptest/rs_jni_allocation.cpp
+++ b/tests/tests/rscpp/librscpptest/rs_jni_allocation.cpp
@@ -31,7 +31,7 @@
using namespace android::RSC;
-static void createTypedHelper (sp<RS> rs, sp<const Element> e) {
+static void createTypedHelper (const sp<RS> &rs, sp<const Element> e) {
Type::Builder typeBuilder(rs, e);
for (int mips = 0; mips <= 1; mips ++) {
bool useMips = (mips == 1);
@@ -122,7 +122,7 @@
return true;
}
-static sp<const Element> makeElement(sp<RS> rs, RsDataType dt, int vecSize) {
+static sp<const Element> makeElement(const sp<RS> &rs, RsDataType dt, int vecSize) {
if (vecSize > 1) {
return Element::createVector(rs, dt, vecSize);
} else {
@@ -142,7 +142,7 @@
* @param autoPadding Enable autoPadding or not.
*/
template <class T>
-static bool helperCopy1D(sp<RS> rs, int cellCount, int offset, int count, bool copyRange,
+static bool helperCopy1D(const sp<RS> &rs, int cellCount, int offset, int count, bool copyRange,
RsDataType dt, bool autoPadding = false) {
bool passed = true;
int arrLen = cellCount;
@@ -188,7 +188,7 @@
}
//Corresponding 1D allocation to allocation copy.
-static bool helperFloatAllocationCopy1D(sp<RS> rs, int cellCount, int offset, int count) {
+static bool helperFloatAllocationCopy1D(const sp<RS> &rs, int cellCount, int offset, int count) {
bool passed = true;
sp<Allocation> srcA = Allocation::createSized(rs, Element::F32(rs), cellCount);
@@ -234,7 +234,7 @@
* @param autoPadding Enable autoPadding or not.
*/
template <class T>
-static bool helperCopy2D(sp<RS> rs, int xElems, int yElems,
+static bool helperCopy2D(const sp<RS> &rs, int xElems, int yElems,
int xOffset, int yOffset, int xCount, int yCount,
RsDataType dt, bool autoPadding = false) {
bool passed = true;
@@ -275,7 +275,7 @@
}
//Corresponding 2D allocation to allocation copy.
-static bool helperFloatAllocationCopy2D(sp<RS> rs, int xElems, int yElems,
+static bool helperFloatAllocationCopy2D(const sp<RS> &rs, int xElems, int yElems,
int xOffset, int yOffset, int xCount, int yCount) {
bool passed = true;
@@ -325,7 +325,7 @@
* @param autoPadding Enable autoPadding or not.
*/
template <class T>
-static bool helperCopy3D(sp<RS> rs, int xElems, int yElems, int zElems,
+static bool helperCopy3D(const sp<RS> &rs, int xElems, int yElems, int zElems,
int xOffset, int yOffset, int zOffset,
int xCount, int yCount, int zCount,
RsDataType dt, bool autoPadding = false) {
@@ -378,7 +378,7 @@
}
//Corresponding 3D allocation to allocation copy.
-static bool helperFloatAllocationCopy3D(sp<RS> rs, int xElems, int yElems, int zElems,
+static bool helperFloatAllocationCopy3D(const sp<RS> &rs, int xElems, int yElems, int zElems,
int xOffset, int yOffset, int zOffset,
int xCount, int yCount, int zCount) {
diff --git a/tests/tests/rscpp/librscpptest/rs_jni_type.cpp b/tests/tests/rscpp/librscpptest/rs_jni_type.cpp
index 5458a25..b6e4078 100644
--- a/tests/tests/rscpp/librscpptest/rs_jni_type.cpp
+++ b/tests/tests/rscpp/librscpptest/rs_jni_type.cpp
@@ -32,7 +32,7 @@
using namespace android::RSC;
-static bool testTypeBuilderHelper(sp<RS> mRS, sp<const Element> e) {
+static bool testTypeBuilderHelper(const sp<RS> &mRS, sp<const Element> e) {
const int min = 1;
const int max = 8;
diff --git a/tests/tests/security/Android.mk b/tests/tests/security/Android.mk
index f2b4470..a8593e1 100644
--- a/tests/tests/security/Android.mk
+++ b/tests/tests/security/Android.mk
@@ -42,7 +42,7 @@
libgui \
libaudioutils \
libnbaio \
- libpcre \
+ libpcre2 \
libpackagelistparser \
libpowermanager \
libbase \
diff --git a/tests/tests/security/jni/Android.mk b/tests/tests/security/jni/Android.mk
index d39ac7e..22420f8 100644
--- a/tests/tests/security/jni/Android.mk
+++ b/tests/tests/security/jni/Android.mk
@@ -51,7 +51,7 @@
libgui \
libaudioutils \
libnbaio \
- libpcre \
+ libpcre2 \
libpackagelistparser \
libpowermanager \
libbase \
diff --git a/tests/tests/security/jni/android_security_cts_SELinuxTest.cpp b/tests/tests/security/jni/android_security_cts_SELinuxTest.cpp
index 8f164bc..1cfde0a 100644
--- a/tests/tests/security/jni/android_security_cts_SELinuxTest.cpp
+++ b/tests/tests/security/jni/android_security_cts_SELinuxTest.cpp
@@ -19,14 +19,15 @@
#include <JNIHelp.h>
#include <ScopedLocalRef.h>
#include <ScopedUtfChars.h>
-#include <UniquePtr.h>
+
+#include <memory>
struct SecurityContext_Delete {
void operator()(security_context_t p) const {
freecon(p);
}
};
-typedef UniquePtr<char[], SecurityContext_Delete> Unique_SecurityContext;
+typedef std::unique_ptr<char[], SecurityContext_Delete> Unique_SecurityContext;
/*
* Function: getFileContext
diff --git a/tests/tests/security/src/android/security/cts/CryptoProviderWorkaroundTest.java b/tests/tests/security/src/android/security/cts/CryptoProviderWorkaroundTest.java
new file mode 100644
index 0000000..861c443
--- /dev/null
+++ b/tests/tests/security/src/android/security/cts/CryptoProviderWorkaroundTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2016 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 android.security.cts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import dalvik.system.VMRuntime;
+import java.security.NoSuchProviderException;
+import java.security.SecureRandom;
+import java.security.Security;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * http://b/28550092 : Removal of "Crypto" provider in N caused application compatibility
+ * issues for callers of SecureRandom. To improve compatibility the provider is not registered
+ * as a JCA Provider obtainable via Security.getProvider() but is made available for
+ * SecureRandom.getInstance() iff the application targets API <= 23.
+ */
+@RunWith(JUnit4.class)
+public class CryptoProviderWorkaroundTest {
+ @Test
+ public void cryptoProvider_withWorkaround_Success() throws Exception {
+ // Assert that SecureRandom is still using the default value. Sanity check.
+ assertEquals(SecureRandom.DEFAULT_SDK_TARGET_FOR_CRYPTO_PROVIDER_WORKAROUND,
+ SecureRandom.getSdkTargetForCryptoProviderWorkaround());
+
+ try {
+ // Modify the maximum target SDK to apply the workaround, thereby enabling the
+ // workaround for the current SDK and enabling it to be tested.
+ SecureRandom.setSdkTargetForCryptoProviderWorkaround(
+ VMRuntime.getRuntime().getTargetSdkVersion());
+
+ // Assert that the crypto provider is not installed...
+ assertNull(Security.getProvider("Crypto"));
+ SecureRandom sr = SecureRandom.getInstance("SHA1PRNG", "Crypto");
+ assertNotNull(sr);
+ // ...but we can get a SecureRandom from it...
+ assertEquals("org.apache.harmony.security.provider.crypto.CryptoProvider",
+ sr.getProvider().getClass().getName());
+ // ...yet it's not installed. So the workaround worked.
+ assertNull(Security.getProvider("Crypto"));
+ } finally {
+ // Reset the target SDK for the workaround to the default / real value.
+ SecureRandom.setSdkTargetForCryptoProviderWorkaround(
+ SecureRandom.DEFAULT_SDK_TARGET_FOR_CRYPTO_PROVIDER_WORKAROUND);
+ }
+ }
+
+ @Test
+ public void cryptoProvider_withoutWorkaround_Failure() throws Exception {
+ // Assert that SecureRandom is still using the default value. Sanity check.
+ assertEquals(SecureRandom.DEFAULT_SDK_TARGET_FOR_CRYPTO_PROVIDER_WORKAROUND,
+ SecureRandom.getSdkTargetForCryptoProviderWorkaround());
+
+ try {
+ // We set the limit SDK for the workaround at the previous one, indicating that the
+ // workaround shouldn't be in place.
+ SecureRandom.setSdkTargetForCryptoProviderWorkaround(
+ VMRuntime.getRuntime().getTargetSdkVersion() - 1);
+
+ SecureRandom sr = SecureRandom.getInstance("SHA1PRNG", "Crypto");
+ fail("Should throw " + NoSuchProviderException.class.getName());
+ } catch(NoSuchProviderException expected) {
+ // The workaround doesn't work. As expected.
+ } finally {
+ // Reset the target SDK for the workaround to the default / real value.
+ SecureRandom.setSdkTargetForCryptoProviderWorkaround(
+ SecureRandom.DEFAULT_SDK_TARGET_FOR_CRYPTO_PROVIDER_WORKAROUND);
+ }
+ }
+}
diff --git a/tests/tests/simpleperf/Android.mk b/tests/tests/simpleperf/Android.mk
index 040e153..342752e 100644
--- a/tests/tests/simpleperf/Android.mk
+++ b/tests/tests/simpleperf/Android.mk
@@ -1,36 +1,42 @@
LOCAL_PATH := $(call my-dir)
-test_executable := CtsSimpleperfTestCases
-list_executable := $(test_executable)_list
simpleperf_src_path := system/extras/simpleperf
LLVM_ROOT_PATH := external/llvm
include $(LLVM_ROOT_PATH)/llvm.mk
include $(CLEAR_VARS)
-LOCAL_MODULE := $(test_executable)
+LOCAL_MODULE := CtsSimpleperfTestCases
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
LOCAL_MULTILIB := both
LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-LOCAL_SHARED_LIBRARIES += \
- libbacktrace \
- libunwind \
- libbase \
- liblog \
- libutils \
- libLLVM \
-
LOCAL_WHOLE_STATIC_LIBRARIES = \
libsimpleperf_cts_test \
LOCAL_STATIC_LIBRARIES += \
- libgtest \
libbacktrace_offline \
+ libbacktrace \
+ libunwind \
libziparchive \
libz \
+ libgtest \
+ libbase \
+ libcutils \
+ liblog \
+ libprocinfo \
+ libutils \
liblzma \
+ libLLVMObject \
+ libLLVMBitReader \
+ libLLVMMC \
+ libLLVMMCParser \
+ libLLVMCore \
+ libLLVMSupport \
+ libprotobuf-cpp-lite \
+ libevent \
+ libc \
LOCAL_POST_LINK_CMD = \
TMP_FILE=`mktemp $(OUT_DIR)/simpleperf-post-link-XXXXXXXXXX` && \
@@ -41,35 +47,6 @@
LOCAL_COMPATIBILITY_SUITE := cts
LOCAL_CTS_TEST_PACKAGE := android.simpleperf
+LOCAL_FORCE_STATIC_EXECUTABLE := true
+include $(LLVM_DEVICE_BUILD_MK)
include $(BUILD_CTS_EXECUTABLE)
-
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(list_executable)
-LOCAL_MODULE_HOST_OS := linux
-LOCAL_MULTILIB := first
-LOCAL_LDLIBS = -lrt
-
-LOCAL_WHOLE_STATIC_LIBRARIES += \
- libsimpleperf_cts_test \
-
-LOCAL_STATIC_LIBRARIES += \
- libbacktrace_offline \
- libbacktrace \
- libunwind \
- libziparchive-host \
- libz \
- liblzma \
- libbase \
- liblog \
- libcutils \
- libutils \
- libLLVMObject \
- libLLVMBitReader \
- libLLVMMC \
- libLLVMMCParser \
- libLLVMCore \
- libLLVMSupport \
-
-include $(LLVM_HOST_BUILD_MK)
-include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
index 3f3a5a2..a6e92c0 100644
--- a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
+++ b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
@@ -130,7 +130,7 @@
// Generate a vanilla mock connection service, if not provided.
this.connectionService = new MockConnectionService();
}
- CtsConnectionService.setUp(TEST_PHONE_ACCOUNT_HANDLE, this.connectionService);
+ CtsConnectionService.setUp(this.connectionService);
if ((flags & FLAG_REGISTER) != 0) {
mTelecomManager.registerPhoneAccount(TEST_PHONE_ACCOUNT);
diff --git a/tests/tests/telecom/src/android/telecom/cts/CallScreeningServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/CallScreeningServiceTest.java
index 0704a8d..6985641 100644
--- a/tests/tests/telecom/src/android/telecom/cts/CallScreeningServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/CallScreeningServiceTest.java
@@ -136,7 +136,7 @@
private void setupConnectionService() throws Exception {
mConnectionService = new MockConnectionService();
- CtsConnectionService.setUp(TEST_PHONE_ACCOUNT_HANDLE, mConnectionService);
+ CtsConnectionService.setUp(mConnectionService);
mTelecomManager.registerPhoneAccount(TEST_PHONE_ACCOUNT);
TestUtils.enablePhoneAccount(getInstrumentation(), TEST_PHONE_ACCOUNT_HANDLE);
diff --git a/tests/tests/telecom/src/android/telecom/cts/CtsConnectionService.java b/tests/tests/telecom/src/android/telecom/cts/CtsConnectionService.java
index e820e10..2220263 100644
--- a/tests/tests/telecom/src/android/telecom/cts/CtsConnectionService.java
+++ b/tests/tests/telecom/src/android/telecom/cts/CtsConnectionService.java
@@ -44,8 +44,9 @@
* Telecom framework to the test connection service.
* sTelecomConnectionService: Contains the connection service object registered to the Telecom
* framework. We use this object to forward any communication from the
- * test connection service to the Telecom framework.
- *
+ * test connection service to the Telecom framework. After Telecom
+ * binds to CtsConnectionService, this is set to be the instance of
+ * CtsConnectionService created by the framework after Telecom binds.
*/
public class CtsConnectionService extends ConnectionService {
private static String LOG_TAG = "CtsConnectionService";
@@ -62,19 +63,9 @@
mIsServiceBound = true;
}
- // ConnectionService used by default as a fallback if no connection service is specified
- // during test setup.
- private static ConnectionService mMockConnectionService = new MockConnectionService();
-
- /**
- * Used to control whether the {@link MockVideoProvider} will be created when connections are
- * created. Used by {@link VideoCallTest#testVideoCallDelayProvider()} to test scenario where
- * the {@link MockVideoProvider} is not created immediately when the Connection is created.
- */
private static Object sLock = new Object();
- public static void setUp(PhoneAccountHandle phoneAccountHandle,
- ConnectionService connectionService) throws Exception {
+ public static void setUp(ConnectionService connectionService) throws Exception {
synchronized(sLock) {
if (sConnectionService != null) {
throw new Exception("Mock ConnectionService exists. Failed to call tearDown().");
@@ -98,8 +89,7 @@
return sConnectionService.onCreateOutgoingConnection(
connectionManagerPhoneAccount, request);
} else {
- return mMockConnectionService.onCreateOutgoingConnection(
- connectionManagerPhoneAccount, request);
+ return null;
}
}
}
@@ -112,8 +102,7 @@
return sConnectionService.onCreateIncomingConnection(
connectionManagerPhoneAccount, request);
} else {
- return mMockConnectionService.onCreateIncomingConnection(
- connectionManagerPhoneAccount, request);
+ return null;
}
}
}
@@ -123,8 +112,6 @@
synchronized(sLock) {
if (sConnectionService != null) {
sConnectionService.onConference(connection1, connection2);
- } else {
- mMockConnectionService.onConference(connection1, connection2);
}
}
}
@@ -134,8 +121,6 @@
synchronized(sLock) {
if (sConnectionService != null) {
sConnectionService.onRemoteExistingConnectionAdded(connection);
- } else {
- mMockConnectionService.onRemoteExistingConnectionAdded(connection);
}
}
}
@@ -185,8 +170,6 @@
synchronized(sLock) {
if (sConnectionService != null) {
sConnectionService.onRemoteConferenceAdded(conference);
- } else {
- mMockConnectionService.onRemoteConferenceAdded(conference);
}
}
}
diff --git a/tests/tests/telephony/src/android/telephony/cts/CellInfoTest.java b/tests/tests/telephony/src/android/telephony/cts/CellInfoTest.java
index 2a198b6..66ce1f1 100644
--- a/tests/tests/telephony/src/android/telephony/cts/CellInfoTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/CellInfoTest.java
@@ -43,6 +43,18 @@
// Maximum and minimum possible RSSI values(in dbm).
private static final int MAX_RSSI = -10;
private static final int MIN_RSSI = -150;
+ // Maximum and minimum possible RSSP values(in dbm).
+ private static final int MAX_RSRP = -44;
+ private static final int MIN_RSRP = -140;
+ // Maximum and minimum possible RSSQ values.
+ private static final int MAX_RSRQ = -3;
+ private static final int MIN_RSRQ = -35;
+ // Maximum and minimum possible RSSNR values.
+ private static final int MAX_RSSNR = 50;
+ private static final int MIN_RSSNR = 0;
+ // Maximum and minimum possible CQI values.
+ private static final int MAX_CQI = 30;
+ private static final int MIN_CQI = 0;
private PackageManager mPm;
@Override
@@ -101,15 +113,29 @@
// Only physical cell id is available for LTE neighbor.
int pci = lte.getCellIdentity().getPci();
// Physical cell id should be within [0, 503].
- assertTrue("getPci() out of range [0, 503]", pci >= 0 && pci <= 503);
+ assertTrue("getPci() out of range [0, 503], pci=" + pci, pci >= 0 && pci <= 503);
int earfcn = lte.getCellIdentity().getEarfcn();
// Reference 3GPP 36.101 Table 5.7.3-1
- assertTrue("getEarfcn() out of range [0,47000]", earfcn >= 0 && earfcn <= 47000);
-
- int ta = ((CellSignalStrengthLte)lte.getCellSignalStrength()).getTimingAdvance();
+ assertTrue("getEarfcn() out of range [0,47000], earfcn=" + earfcn,
+ earfcn >= 0 && earfcn <= 47000);
+ CellSignalStrengthLte cellSignalStrengthLte = lte.getCellSignalStrength();
//Integer.MAX_VALUE indicates an unavailable field
- assertTrue("getTimingAdvance() invalid [0-1282] | Integer.MAX_VALUE",
+ int rsrp = cellSignalStrengthLte.getRsrp();
+ // RSRP is being treated as RSSI in LTE (they are similar but not quite right)
+ // so reusing the constants here.
+ assertTrue("getRsrp() out of range, rsrp=" + rsrp, rsrp >= MIN_RSRP && rsrp <= MAX_RSRP);
+ int rsrq = cellSignalStrengthLte.getRsrq();
+ assertTrue("getRsrq() out of range | Integer.MAX_VALUE, rsrq=" + rsrq,
+ rsrq == Integer.MAX_VALUE || (rsrq >= MIN_RSRQ && rsrq <= MAX_RSRQ));
+ int rssnr = cellSignalStrengthLte.getRssnr();
+ assertTrue("getRssnr() out of range | Integer.MAX_VALUE, rssnr=" + rssnr,
+ rssnr == Integer.MAX_VALUE || (rssnr >= MIN_RSSNR && rssnr <= MAX_RSSNR));
+ int cqi = cellSignalStrengthLte.getCqi();
+ assertTrue("getCqi() out of range | Integer.MAX_VALUE, cqi=" + cqi,
+ cqi == Integer.MAX_VALUE || (cqi >= MIN_CQI && cqi <= MAX_CQI));
+ int ta = cellSignalStrengthLte.getTimingAdvance();
+ assertTrue("getTimingAdvance() invalid [0-1282] | Integer.MAX_VALUE, ta=" + ta,
ta == Integer.MAX_VALUE || (ta >= 0 && ta <=1282));
}
@@ -119,11 +145,12 @@
// Verify wcdma primary scrambling code information.
// Primary scrambling code should be within [0, 511].
int psc = wcdma.getCellIdentity().getPsc();
- assertTrue("getPsc() out of range [0, 511]", psc >= 0 && psc <= 511);
+ assertTrue("getPsc() out of range [0, 511], psc=" + psc, psc >= 0 && psc <= 511);
int uarfcn = wcdma.getCellIdentity().getUarfcn();
// Reference 3GPP 25.101 Table 5.2
- assertTrue("getUarfcn() out of range [400,11000]", uarfcn >= 400 && uarfcn <= 11000);
+ assertTrue("getUarfcn() out of range [400,11000], uarfcn=" + uarfcn,
+ uarfcn >= 400 && uarfcn <= 11000);
}
// Verify gsm cell information is within correct range.
@@ -132,21 +159,25 @@
// Verify gsm local area code and cellid.
// Local area code and cellid should be with [0, 65535].
int lac = gsm.getCellIdentity().getLac();
- assertTrue("getLac() out of range [0, 65535]", lac >= 0 && lac <= 65535);
+ assertTrue("getLac() out of range [0, 65535], lac=" + lac, !gsm.isRegistered() ||
+ lac >= 0 && lac <= 65535);
int cid = gsm.getCellIdentity().getCid();
- assertTrue("getCid() out range [0, 65535]", cid >= 0 && cid <= 65535);
+ assertTrue("getCid() out range [0, 65535], cid=" + cid, !gsm.isRegistered() ||
+ cid >= 0 && cid <= 65535);
int arfcn = gsm.getCellIdentity().getArfcn();
// Reference 3GPP 45.005 Table 2-2
- assertTrue("getArfcn() out of range [0,1024]", arfcn >= 0 && arfcn <= 1024);
+ assertTrue("getArfcn() out of range [0,1024], arfcn=" + arfcn,
+ arfcn >= 0 && arfcn <= 1024);
int bsic = gsm.getCellIdentity().getBsic();
- assertTrue("getBsic() out of range [0,63]", bsic >=0 && bsic <=63);
+ // TODO(b/32774471) - Bsic should always be valid
+ //assertTrue("getBsic() out of range [0,63]", bsic >=0 && bsic <=63);
}
// Rssi(in dbm) should be within [MIN_RSSI, MAX_RSSI].
private void verifyRssiDbm(int dbm) {
- assertTrue("getCellSignalStrength().getDbm() out of range",
+ assertTrue("getCellSignalStrength().getDbm() out of range, dbm=" + dbm,
dbm >= MIN_RSSI && dbm <= MAX_RSSI);
}
}
diff --git a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
index ae9dda1..50820b2 100644
--- a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
@@ -16,7 +16,15 @@
package android.telephony.cts;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import android.bluetooth.BluetoothAdapter;
+import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.cts.util.TestThread;
@@ -25,45 +33,53 @@
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Looper;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.CellLocation;
import android.telephony.PhoneStateListener;
+import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
-import android.test.AndroidTestCase;
import android.util.Log;
import com.android.internal.telephony.PhoneConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.regex.Pattern;
-public class TelephonyManagerTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class TelephonyManagerTest {
private TelephonyManager mTelephonyManager;
private boolean mOnCellLocationChangedCalled = false;
+ private ServiceState mServiceState;
private final Object mLock = new Object();
private static final int TOLERANCE = 1000;
private PhoneStateListener mListener;
private static ConnectivityManager mCm;
- private static final String TAG = "android.telephony.cts.TelephonyManagerTest";
+ private static final String TAG = "TelephonyManagerTest";
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
mTelephonyManager =
(TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
mCm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
if (mListener != null) {
// unregister the listener
mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_NONE);
}
- super.tearDown();
}
+ @Test
public void testListen() throws Throwable {
if (mCm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) == null) {
Log.d(TAG, "Skipping test that requires ConnectivityManager.TYPE_MOBILE");
@@ -129,6 +145,7 @@
* it's no need to get details of these information, just make sure they are in right
* condition(>0 or not null).
*/
+ @Test
public void testTelephonyManager() {
assertTrue(mTelephonyManager.getNetworkType() >= TelephonyManager.NETWORK_TYPE_UNKNOWN);
assertTrue(mTelephonyManager.getPhoneType() >= TelephonyManager.PHONE_TYPE_NONE);
@@ -143,8 +160,8 @@
assertFalse(mTelephonyManager.getMmsUAProfUrl().isEmpty());
}
- // The following methods may return null. Simply call them to make sure they do not
- // throw any exceptions.
+ // The following methods may return any value depending on the state of the device. Simply
+ // call them to make sure they do not throw any exceptions.
mTelephonyManager.getVoiceMailNumber();
mTelephonyManager.getSimOperatorName();
mTelephonyManager.getNetworkCountryIso();
@@ -163,6 +180,7 @@
mTelephonyManager.getDeviceId(mTelephonyManager.getDefaultSim());
mTelephonyManager.getDeviceSoftwareVersion();
mTelephonyManager.getPhoneCount();
+ mTelephonyManager.getDataEnabled();
TelecomManager telecomManager = (TelecomManager) getContext()
.getSystemService(Context.TELECOM_SERVICE);
@@ -172,9 +190,26 @@
mTelephonyManager.isVoicemailVibrationEnabled(defaultAccount);
}
+ @Test
+ public void testCreateForPhoneAccountHandle(){
+ TelecomManager telecomManager = getContext().getSystemService(TelecomManager.class);
+ PhoneAccountHandle handle =
+ telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL);
+ TelephonyManager telephonyManager = mTelephonyManager.createForPhoneAccountHandle(handle);
+ assertEquals(mTelephonyManager.getSubscriberId(), telephonyManager.getSubscriberId());
+ }
+
+ @Test
+ public void testCreateForPhoneAccountHandle_InvalidHandle(){
+ PhoneAccountHandle handle =
+ new PhoneAccountHandle(new ComponentName("com.example.foo", "bar"), "baz");
+ assertNull(mTelephonyManager.createForPhoneAccountHandle(handle));
+ }
+
/**
* Tests that the phone count returned is valid.
*/
+ @Test
public void testGetPhoneCount() {
int phoneCount = mTelephonyManager.getPhoneCount();
int phoneType = mTelephonyManager.getPhoneType();
@@ -196,6 +231,7 @@
* GSM, a valid MEID or ESN if CDMA, or a valid MAC address if
* only a WiFi device.
*/
+ @Test
public void testGetDeviceId() {
String deviceId = mTelephonyManager.getDeviceId();
verifyDeviceId(deviceId);
@@ -206,6 +242,7 @@
* GSM, a valid MEID or ESN if CDMA, or a valid MAC address if
* only a WiFi device.
*/
+ @Test
public void testGetDeviceIdForSlotId() {
String deviceId = mTelephonyManager.getDeviceId(mTelephonyManager.getDefaultSim());
verifyDeviceId(deviceId);
@@ -375,6 +412,7 @@
private static final String ISO_COUNTRY_CODE_PATTERN = "[a-z]{2}";
+ @Test
public void testGetNetworkCountryIso() {
PackageManager packageManager = getContext().getPackageManager();
String countryCode = mTelephonyManager.getNetworkCountryIso();
@@ -387,6 +425,7 @@
}
}
+ @Test
public void testGetSimCountryIso() {
PackageManager packageManager = getContext().getPackageManager();
String countryCode = mTelephonyManager.getSimCountryIso();
@@ -398,4 +437,40 @@
// Non-telephony may still have the property defined if it has a SIM.
}
}
+
+ @Test
+ public void testGetServiceState() throws InterruptedException {
+ if (mCm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) == null) {
+ Log.d(TAG, "Skipping test that requires ConnectivityManager.TYPE_MOBILE");
+ return;
+ }
+
+ TestThread t = new TestThread(new Runnable() {
+ public void run() {
+ Looper.prepare();
+
+ mListener = new PhoneStateListener() {
+ @Override
+ public void onServiceStateChanged(ServiceState serviceState) {
+ synchronized (mLock) {
+ mServiceState = serviceState;
+ mLock.notify();
+ }
+ }
+ };
+ mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_SERVICE_STATE);
+ Looper.loop();
+ }
+ });
+ t.start();
+ synchronized (mLock) {
+ mLock.wait(TOLERANCE);
+ }
+
+ assertEquals(mServiceState, mTelephonyManager.getServiceState());
+ }
+
+ private static Context getContext() {
+ return InstrumentationRegistry.getContext();
+ }
}
diff --git a/tests/tests/text/src/android/text/format/cts/DateFormatTest.java b/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
index 756e4eb..f72111b 100644
--- a/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
+++ b/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
@@ -264,10 +264,6 @@
public void test_bug_82144() {
for (Locale locale : Locale.getAvailableLocales()) {
- if (locale.toString().startsWith("haw")) {
- // http://b/26397197 - remove this when fixed.
- continue;
- }
Locale.setDefault(locale);
char[] order = DateFormat.getDateFormatOrder(mContext);
boolean seenDay = false, seenMonth = false, seenYear = false;
diff --git a/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java b/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
index f0a4d09..a05ba7a 100644
--- a/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
+++ b/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
@@ -19,6 +19,8 @@
import android.content.Context;
import android.test.AndroidTestCase;
import android.text.format.DateUtils;
+
+import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Formatter;
@@ -145,6 +147,8 @@
return;
}
+ // This test assumes a default DateFormat.is24Hour setting.
+ DateFormat.is24Hour = null;
Date date = new Date(109, 0, 19, 3, 30, 15);
long fixedTime = date.getTime();
diff --git a/tests/tests/util/src/android/util/cts/TimeUtilsTest.java b/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
index 1c3a303..3176316 100644
--- a/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
+++ b/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
@@ -38,11 +38,11 @@
Calendar c = Calendar.getInstance(tz);
TimeZone guess;
- c.set(2008, Calendar.OCTOBER, 20, 12, 00, 00);
+ c.set(2016, Calendar.OCTOBER, 20, 12, 0, 0);
guess = guessTimeZone(c, "us");
assertEquals(name, guess.getID());
- c.set(2009, Calendar.JANUARY, 20, 12, 00, 00);
+ c.set(2017, Calendar.JANUARY, 20, 12, 0, 0);
guess = guessTimeZone(c, "us");
assertEquals(name, guess.getID());
}
@@ -59,7 +59,7 @@
Calendar c = Calendar.getInstance(tz);
TimeZone guess;
- c.set(2008, Calendar.OCTOBER, 20, 12, 00, 00);
+ c.set(2016, Calendar.OCTOBER, 20, 12, 0, 0);
guess = guessTimeZone(c, "us");
assertEquals(name, guess.getID());
}
@@ -75,7 +75,7 @@
Calendar c = Calendar.getInstance(tz);
TimeZone guess;
- c.set(2005, Calendar.OCTOBER, 20, 12, 00, 00);
+ c.set(2005, Calendar.OCTOBER, 20, 12, 0, 0);
guess = guessTimeZone(c, "us");
assertEquals(name, guess.getID());
}
@@ -95,7 +95,7 @@
Calendar c = Calendar.getInstance(tz);
TimeZone guess;
- c.set(2009, Calendar.JULY, 20, 12, 00, 00);
+ c.set(2016, Calendar.JULY, 20, 12, 0, 0);
guess = guessTimeZone(c, country);
assertEquals(name, guess.getID());
}
@@ -107,4 +107,31 @@
c.getTimeInMillis(),
country);
}
+
+ public void testFormatDuration() {
+ assertFormatDuration("0", 0);
+ assertFormatDuration("-1ms", -1);
+ assertFormatDuration("+1ms", 1);
+ assertFormatDuration("+10ms", 10);
+ assertFormatDuration("+100ms", 100);
+ assertFormatDuration("+101ms", 101);
+ assertFormatDuration("+330ms", 330);
+ assertFormatDuration("+1s0ms", 1000);
+ assertFormatDuration("+1s330ms", 1330);
+ assertFormatDuration("+10s24ms", 10024);
+ assertFormatDuration("+1m0s30ms", 60030);
+ assertFormatDuration("+1h0m0s30ms", 3600030);
+ assertFormatDuration("+1d0h0m0s30ms", 86400030);
+ }
+
+ public void testFormatHugeDuration() {
+ assertFormatDuration("+15542d1h11m11s555ms", 1342833071555L);
+ assertFormatDuration("-15542d1h11m11s555ms", -1342833071555L);
+ }
+
+ private void assertFormatDuration(String expected, long duration) {
+ StringBuilder sb = new StringBuilder();
+ TimeUtils.formatDuration(duration, sb);
+ assertEquals("formatDuration(" + duration + ")", expected, sb.toString());
+ }
}
diff --git a/tests/tests/view/jni/CtsViewJniOnLoad.cpp b/tests/tests/view/jni/CtsViewJniOnLoad.cpp
index 2c1e643..1a7ef3c 100644
--- a/tests/tests/view/jni/CtsViewJniOnLoad.cpp
+++ b/tests/tests/view/jni/CtsViewJniOnLoad.cpp
@@ -16,8 +16,8 @@
*/
#include <jni.h>
-#include <utils/Log.h>
#define LOG_TAG "CtsViewJniOnLoad"
+#include <utils/Log.h>
extern int register_android_view_cts_ChoreographerNativeTest(JNIEnv* env);
diff --git a/tests/tests/voiceinteraction/Android.mk b/tests/tests/voiceinteraction/Android.mk
index e470f86..d64574a 100644
--- a/tests/tests/voiceinteraction/Android.mk
+++ b/tests/tests/voiceinteraction/Android.mk
@@ -30,7 +30,6 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/voiceinteraction/OldAndroidTest.xml b/tests/tests/voiceinteraction/OldAndroidTest.xml
deleted file mode 100644
index fa1ab70..0000000
--- a/tests/tests/voiceinteraction/OldAndroidTest.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="Test module config for VoiceInteraction">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsVoiceInteractionService.apk" />
- <option name="cts-apk-installer:test-file-name" value="CtsVoiceInteractionApp.apk" />
- <option name="run-command:run-command"
- value="settings put secure voice_interaction_service android.voiceinteraction.service/.MainInteractionService" />
- <option name="cts-apk-installer:test-file-name" value="CtsVoiceInteractionTestCases.apk" />
-</configuration>
diff --git a/tests/tests/voicesettings/Android.mk b/tests/tests/voicesettings/Android.mk
index 4f53362..cbc97a2 100644
--- a/tests/tests/voicesettings/Android.mk
+++ b/tests/tests/voicesettings/Android.mk
@@ -30,8 +30,6 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_CTS_MODULE_CONFIG := $(LOCAL_PATH)/Old$(CTS_MODULE_TEST_CONFIG)
-
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/voicesettings/OldAndroidTest.xml b/tests/tests/voicesettings/OldAndroidTest.xml
deleted file mode 100644
index 246bf06..0000000
--- a/tests/tests/voicesettings/OldAndroidTest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<!-- Copyright (C) 2015 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="Test module config for VoiceSettings">
- <include name="common-config" />
- <option name="cts-apk-installer:test-file-name" value="CtsVoiceSettingsService.apk" />
- <option name="run-command:run-command"
- value="settings put secure voice_interaction_service android.voicesettings.service/.MainInteractionService" />
-</configuration>
diff --git a/tools/Android.mk b/tools/Android.mk
index 169accf..0a05aed 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -12,31 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Build the CTS harness
-
-JUNIT_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar
-HOSTTESTLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar
-TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar
-CTS_TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/old-cts-tradefed.jar
-CTS_TF_EXEC_PATH ?= $(HOST_OUT_EXECUTABLES)/old-cts-tradefed
-
-cts_prebuilt_jar := $(HOST_OUT)/old-cts/old-android-cts/tools/cts-prebuilt.jar
-$(cts_prebuilt_jar): PRIVATE_TESTS_DIR := $(HOST_OUT)/old-cts/old-android-cts/repository/testcases
-$(cts_prebuilt_jar): PRIVATE_PLANS_DIR := $(HOST_OUT)/old-cts/old-android-cts/repository/plans
-$(cts_prebuilt_jar): PRIVATE_TOOLS_DIR := $(HOST_OUT)/old-cts/old-android-cts/tools
-$(cts_prebuilt_jar): $(JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(ADDITIONAL_TF_JARS) | $(ACP) $(HOST_OUT_EXECUTABLES)/adb
- mkdir -p $(PRIVATE_TESTS_DIR)
- mkdir -p $(PRIVATE_PLANS_DIR)
- mkdir -p $(PRIVATE_TOOLS_DIR)
- $(ACP) -fp $(JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(ADDITIONAL_TF_JARS) $(PRIVATE_TOOLS_DIR)
-
-.PHONY: cts-harness
-cts-harness : $(cts_prebuilt_jar)
-
-# Put the test coverage report in the dist dir if "old-cts" is among the build goals.
-ifneq ($(filter old-cts, $(MAKECMDGOALS)),)
- $(call dist-for-goals,old-cts,$(CTS_TF_JAR))
- $(call dist-for-goals,old-cts,$(HOSTTESTLIB_JAR))
-endif
-
include $(call all-subdir-makefiles)
diff --git a/tools/cfassembler/Android.mk b/tools/cfassembler/Android.mk
index 8e0f351..df736ed 100644
--- a/tools/cfassembler/Android.mk
+++ b/tools/cfassembler/Android.mk
@@ -22,14 +22,9 @@
LOCAL_IS_HOST_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE := cfassembler
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/cfassembler$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/cfassembler | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
+LOCAL_SRC_FILES := etc/cfassembler
+LOCAL_ADDITIONAL_DEPENDENCIES := $(HOST_OUT_JAVA_LIBRARIES)/cfassembler$(COMMON_JAVA_PACKAGE_SUFFIX)
+include $(BUILD_PREBUILT)
INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
diff --git a/tools/cts-api-coverage/Android.mk b/tools/cts-api-coverage/Android.mk
index 2382d61..3f66961 100644
--- a/tools/cts-api-coverage/Android.mk
+++ b/tools/cts-api-coverage/Android.mk
@@ -14,25 +14,15 @@
LOCAL_PATH := $(call my-dir)
-# We use copy-file-to-new-target so that the installed
-# script file's timestamp is at least as new as the
-# .jar file it wraps.
-
# the hat script
# ============================================================
include $(CLEAR_VARS)
LOCAL_IS_HOST_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE := cts-api-coverage
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_MODULE)$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/$(LOCAL_MODULE) | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_MODULE)$(COMMON_JAVA_PACKAGE_SUFFIX)
+include $(BUILD_PREBUILT)
# the other stuff
# ============================================================
diff --git a/tools/cts-device-info/jni/Android.mk b/tools/cts-device-info/jni/Android.mk
index eda845c..30bde53 100644
--- a/tools/cts-device-info/jni/Android.mk
+++ b/tools/cts-device-info/jni/Android.mk
@@ -24,11 +24,7 @@
CtsDeviceInfoJniOnLoad.cpp \
com_android_cts_deviceinfo_VulkanDeviceInfo.cpp
-LOCAL_C_INCLUDES := \
- $(JNI_H_INCLUDE) \
- external/vulkan-validation-layers/libs/vkjson
-
-LOCAL_STATIC_LIBRARIES := libvkjson
+LOCAL_STATIC_LIBRARIES := libvkjson_ndk
LOCAL_SHARED_LIBRARIES := libvulkan liblog libdl
LOCAL_NDK_STL_VARIANT := c++_static
diff --git a/tools/cts-java-scanner-doclet/Android.mk b/tools/cts-java-scanner-doclet/Android.mk
index d647537..dbd760d 100644
--- a/tools/cts-java-scanner-doclet/Android.mk
+++ b/tools/cts-java-scanner-doclet/Android.mk
@@ -22,6 +22,6 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
-LOCAL_JAVA_LIBRARIES := junit
+LOCAL_JAVA_LIBRARIES := junit-host
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tools/cts-java-scanner/Android.mk b/tools/cts-java-scanner/Android.mk
index 8b6c906..644f1c0 100644
--- a/tools/cts-java-scanner/Android.mk
+++ b/tools/cts-java-scanner/Android.mk
@@ -14,25 +14,15 @@
LOCAL_PATH := $(call my-dir)
-# We use copy-file-to-new-target so that the installed
-# script file's timestamp is at least as new as the
-# .jar file it wraps.
-
# the hat script
# ============================================================
include $(CLEAR_VARS)
LOCAL_IS_HOST_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE := cts-java-scanner
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_MODULE)$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/$(LOCAL_MODULE) | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_MODULE)$(COMMON_JAVA_PACKAGE_SUFFIX)
+include $(BUILD_PREBUILT)
# the other stuff
# ============================================================
diff --git a/tools/cts-native-scanner/Android.mk b/tools/cts-native-scanner/Android.mk
index 8bcff1c..203b482 100644
--- a/tools/cts-native-scanner/Android.mk
+++ b/tools/cts-native-scanner/Android.mk
@@ -14,25 +14,15 @@
LOCAL_PATH := $(call my-dir)
-# We use copy-file-to-new-target so that the installed
-# script file's timestamp is at least as new as the
-# .jar file it wraps.
-
# the hat script
# ============================================================
include $(CLEAR_VARS)
LOCAL_IS_HOST_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE := cts-native-scanner
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_MODULE)$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/$(LOCAL_MODULE) | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_MODULE)$(COMMON_JAVA_PACKAGE_SUFFIX)
+include $(BUILD_PREBUILT)
# Build all sub-directories
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tools/cts-tradefed/res/config/collect-tests-only.xml b/tools/cts-tradefed/res/config/collect-tests-only.xml
index 9ee7d51..fea3f3d 100644
--- a/tools/cts-tradefed/res/config/collect-tests-only.xml
+++ b/tools/cts-tradefed/res/config/collect-tests-only.xml
@@ -47,4 +47,7 @@
<!-- Tell all DalvikTests to only list the tests -->
<option name="compatibility:test-arg" value="com.android.compatibility.testtype.DalvikTest:collect-tests-only:true" />
+ <!-- Tell all LibcoreTests to only list the tests -->
+ <option name="compatibility:test-arg" value="com.android.compatibility.testtype.LibcoreTest:collect-tests-only:true" />
+
</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index d0a318e..4c3ce6f 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -195,9 +195,6 @@
<option name="compatibility:exclude-filter" value="CtsTelecomTestCases android.telecom.cts.ExtendedInCallServiceTest#testAddNewOutgoingCallAndThenDisconnect" />
<option name="compatibility:exclude-filter" value="CtsTelecomTestCases android.telecom.cts.RemoteConferenceTest#testRemoteConferenceCallbacks_ConferenceableConnections" />
- <!-- b/23979591 -->
- <option name="compatibility:exclude-filter" value="CtsTelephonyTestCases android.telephony.cts.CellInfoTest#testCellInfo" />
-
<!-- b/23779020 -->
<option name="compatibility:exclude-filter" value="CtsTransitionTestCases android.transition.cts.ChangeScrollTest#testChangeScroll" />
diff --git a/tools/cts-xml-generator/Android.mk b/tools/cts-xml-generator/Android.mk
index 5842dd8..23256f3 100644
--- a/tools/cts-xml-generator/Android.mk
+++ b/tools/cts-xml-generator/Android.mk
@@ -14,25 +14,15 @@
LOCAL_PATH := $(call my-dir)
-# We use copy-file-to-new-target so that the installed
-# script file's timestamp is at least as new as the
-# .jar file it wraps.
-
# the hat script
# ============================================================
include $(CLEAR_VARS)
LOCAL_IS_HOST_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE := cts-xml-generator
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_MODULE)$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/$(LOCAL_MODULE) | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_MODULE)$(COMMON_JAVA_PACKAGE_SUFFIX)
+include $(BUILD_PREBUILT)
# the other stuff
# ============================================================
diff --git a/tools/dasm/Android.mk b/tools/dasm/Android.mk
index c18e677..1b1f328 100644
--- a/tools/dasm/Android.mk
+++ b/tools/dasm/Android.mk
@@ -22,14 +22,9 @@
LOCAL_IS_HOST_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE := dasm
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/dasm$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/dasm | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
+LOCAL_SRC_FILES := etc/dasm
+LOCAL_ADDITIONAL_DEPENDENCIES := $(HOST_OUT_JAVA_LIBRARIES)/dasm$(COMMON_JAVA_PACKAGE_SUFFIX)
+include $(BUILD_PREBUILT)
INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
diff --git a/tools/junit/Android.mk b/tools/junit/Android.mk
index 90e6924..b581149 100644
--- a/tools/junit/Android.mk
+++ b/tools/junit/Android.mk
@@ -21,7 +21,3 @@
LOCAL_STATIC_JAVA_LIBRARIES := junit4-target
LOCAL_DEX_PREOPT := false
include $(BUILD_JAVA_LIBRARY)
-
-cts_library_jar := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).jar
-$(cts_library_jar): $(LOCAL_BUILT_MODULE)
- $(copy-file-to-target)
diff --git a/tools/testng/Android.mk b/tools/testng/Android.mk
index 2abb7f9..af1593d 100644
--- a/tools/testng/Android.mk
+++ b/tools/testng/Android.mk
@@ -21,7 +21,3 @@
LOCAL_STATIC_JAVA_LIBRARIES := testng
LOCAL_DEX_PREOPT := false
include $(BUILD_JAVA_LIBRARY)
-
-cts_library_jar := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).jar
-$(cts_library_jar): $(LOCAL_BUILT_MODULE)
- $(copy-file-to-target)
diff --git a/tools/tradefed-host/.classpath b/tools/tradefed-host/.classpath
deleted file mode 100644
index e716219..0000000
--- a/tools/tradefed-host/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="res"/>
- <classpathentry kind="src" path="commonutil-src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry exported="true" kind="var" path="CTS_SRC_ROOT/out/host/common/obj/JAVA_LIBRARIES/ctsdeviceinfolib_intermediates/javalib.jar"/>
- <classpathentry kind="var" path="CTS_SRC_ROOT/out/host/common/obj/JAVA_LIBRARIES/hosttestlib_intermediates/javalib.jar"/>
- <classpathentry kind="var" path="CTS_SRC_ROOT/prebuilts/misc/common/tradefed/tradefed-prebuilt.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tools/tradefed-host/.gitignore b/tools/tradefed-host/.gitignore
deleted file mode 100644
index ba077a4..0000000
--- a/tools/tradefed-host/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/tools/tradefed-host/.project b/tools/tradefed-host/.project
deleted file mode 100644
index ffd16af..0000000
--- a/tools/tradefed-host/.project
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>cts-tradefed-host</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
- <linkedResources>
- <link>
- <name>commonutil-src</name>
- <type>2</type>
- <locationURI>CTS_SRC_ROOT/cts/libs/commonutil/src</locationURI>
- </link>
- </linkedResources>
-</projectDescription>
diff --git a/tools/tradefed-host/Android.mk b/tools/tradefed-host/Android.mk
deleted file mode 100644
index e7954a6..0000000
--- a/tools/tradefed-host/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src) \
- $(call all-java-files-under, ../../libs/commonutil/src)
-
-LOCAL_JAVA_RESOURCE_DIRS := res
-
-LOCAL_MODULE := old-cts-tradefed
-LOCAL_MODULE_TAGS := optional
-LOCAL_JAVA_LIBRARIES := tradefed-prebuilt hosttestlib
-LOCAL_STATIC_JAVA_LIBRARIES := ctsdeviceinfolib compatibility-host-util
-
-LOCAL_JAR_MANIFEST := MANIFEST.mf
-
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-# Build all sub-directories
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tools/tradefed-host/MANIFEST.mf b/tools/tradefed-host/MANIFEST.mf
deleted file mode 100644
index 5528c06..0000000
--- a/tools/tradefed-host/MANIFEST.mf
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: com.android.cts.tradefed.testtype
-Implementation-Version: %BUILD_NUMBER%
diff --git a/tools/tradefed-host/README b/tools/tradefed-host/README
deleted file mode 100644
index 545d4b4..0000000
--- a/tools/tradefed-host/README
+++ /dev/null
@@ -1,83 +0,0 @@
-CTS Trade Federation
----------------------
-
-CTS Trade Federation, cts-tradefed for short, is the next
-generation test harness for CTS.
-
-cts-tradefed is built on top of the Android Trade Federation test harness.
-
-It works in a similar manner to the prior CTS harness, but supports some
-advanced features such as:
-
- - modular, flexible extensible design. cts-tradefed can be extended to
-support running CTS in a continuous test environment.
- - supports sharding a CTS test run across multiple devices in parallel
- - automatically continue a CTS test run on another device if connection
-is lost
-
-Configuring cts-tradefed
-------------------------
-
-1. Ensure 'adb' is in your current PATH. adb can be found in the
-Android SDK available from http://developer.android.com
-
-Example:
- PATH=$PATH:/home/myuser/android-sdk-linux_x86/platform-tools
-
-2. Follow the 'Setting up your device' steps documented in the
-CTS User Manual. The CTS User Manual can be downloaded at
-http://source.android.com/compatibility/downloads.html
-
-3. Connect the device to the host machine.
-
-4. Ensure device is visible via 'adb devices'
-
-Using cts-tradefed
--------------------
-
-To run a test plan on a single device:
-
-1. Make sure you have at least one device connected
-2. Launch the cts-tradefed console by running the 'cts-tradefed'. If you've
-downloaded and extracted the CTS zip, the script can be found at
- android-cts/tools/cts-tradefed
-Or else if you are working from the Android source tree and have run make cts,
-the script can be found at
- out/host/linux-x86/cts/android-cts/tools/cts-tradefed
-3. Type:
-'run cts --plan CTS' to run the default CTS plan
-
-Some other useful commands are
-
-To run a test package:
-'run cts --package <packagename>'
-
-To run a test class:
-'run cts --class <full test class name>'
-
-To shard a plan test run on multiple devices
-'run cts --plan CTS --shards <number of shards>
-note: all connected devices must be running the same build
-
-For more options:
-'run cts --help'
-
-CTS Tradefed Development
-------------------------
-See http://source.android.com for instructions on obtaining the Android
-platform source code and setting up a build environment.
-
-The source for the CTS extensions for tradefed can be found at
-<android source root>/cts/tools/tradefed-host
-
-The source for the tradefed framework can be found on the 'tradefed' branch.
-
-Perform these steps to build and run cts-tradefed from the development
-environment:
-cd <path to android source root>
-make cts
-cts-tradefed
-
-More documentation and details on using and extending trade federation will
-be forthcoming in the near future.
-
diff --git a/tools/tradefed-host/etc/Android.mk b/tools/tradefed-host/etc/Android.mk
deleted file mode 100644
index 3c2a3cf..0000000
--- a/tools/tradefed-host/etc/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2011 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PREBUILT_EXECUTABLES := old-cts-tradefed
-include $(BUILD_HOST_PREBUILT)
-
diff --git a/tools/tradefed-host/etc/old-cts-tradefed b/tools/tradefed-host/etc/old-cts-tradefed
deleted file mode 100755
index 1dc7638..0000000
--- a/tools/tradefed-host/etc/old-cts-tradefed
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2011 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.
-
-# launcher script for old-cts-tradefed harness
-# can be used from an Android build environment, or a standalone cts zip
-
-checkFile() {
- if [ ! -f "$1" ]; then
- echo "Unable to locate $1"
- exit
- fi;
-}
-
-checkPath() {
- if ! type -P $1 &> /dev/null; then
- echo "Unable to find $1 in path."
- exit
- fi;
-}
-
-checkPath adb
-checkPath java
-
-# check java version
-JAVA_VERSION=$(java -version 2>&1 | head -n 2 | grep '[ "]1\.[678][\. "$$]')
-if [ "${JAVA_VERSION}" == "" ]; then
- echo "Wrong java version. 1.6, 1.7 or 1.8 is required."
- exit
-fi
-
-# check debug flag and set up remote debugging
-if [ -n "${TF_DEBUG}" ]; then
- if [ -z "${TF_DEBUG_PORT}" ]; then
- TF_DEBUG_PORT=10088
- fi
- RDBG_FLAG=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=${TF_DEBUG_PORT}
-fi
-
-# get OS
-HOST=`uname`
-if [ "$HOST" == "Linux" ]; then
- OS="linux-x86"
-elif [ "$HOST" == "Darwin" ]; then
- OS="darwin-x86"
-else
- echo "Unrecognized OS"
- exit
-fi
-
-# check if in Android build env
-if [ ! -z "${ANDROID_BUILD_TOP}" ]; then
- if [ ! -z "${ANDROID_HOST_OUT}" ]; then
- OLD_CTS_ROOT=${ANDROID_HOST_OUT}/old-cts
- else
- OLD_CTS_ROOT=${ANDROID_BUILD_TOP}/${OUT_DIR:-out}/host/${OS}/old-cts
- fi
- if [ ! -d ${OLD_CTS_ROOT} ]; then
- echo "Could not find $OLD_CTS_ROOT in Android build environment. Try 'make old-cts'"
- exit
- fi;
-fi;
-
-if [ -z ${OLD_CTS_ROOT} ]; then
- # assume we're in an extracted cts install
- OLD_CTS_ROOT="$(dirname $0)/../.."
-fi;
-
-JAR_DIR=${OLD_CTS_ROOT}/old-android-cts/tools
-JARS="tradefed-prebuilt.jar hosttestlib.jar old-cts-tradefed.jar"
-
-for JAR in $JARS; do
- checkFile ${JAR_DIR}/${JAR}
- JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
-done
-
-# load any shared libraries for host-side executables
-LIB_DIR=${OLD_CTS_ROOT}/old-android-cts/lib
-if [ "$HOST" == "Linux" ]; then
- LD_LIBRARY_PATH=${LIB_DIR}:${LIB_DIR}64:${LD_LIBRARY_PATH}
- export LD_LIBRARY_PATH
-elif [ "$HOST" == "Darwin" ]; then
- DYLD_LIBRARY_PATH=${LIB_DIR}:${LIB_DIR}64:${DYLD_LIBRARY_PATH}
- export DYLD_LIBRARY_PATH
-fi
-
-java $RDBG_FLAG \
- -cp ${JAR_PATH} -DCTS_ROOT=${OLD_CTS_ROOT} com.android.cts.tradefed.command.CtsConsole "$@"
-
diff --git a/tools/tradefed-host/res/config/basic-reporters.xml b/tools/tradefed-host/res/config/basic-reporters.xml
deleted file mode 100644
index d52a85b..0000000
--- a/tools/tradefed-host/res/config/basic-reporters.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="Configuration with basic cts reporters" >
- <result_reporter class="com.android.cts.tradefed.result.CtsTestLogReporter" />
- <result_reporter class="com.android.cts.tradefed.result.IssueReporter" />
-</configuration>
diff --git a/tools/tradefed-host/res/config/common-config.xml b/tools/tradefed-host/res/config/common-config.xml
deleted file mode 100644
index e1ac66d..0000000
--- a/tools/tradefed-host/res/config/common-config.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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="Common base configuration for CTS module">
- <!--
- This common base configuration contains some commonly used preparers
- -->
- <target_preparer class="com.android.cts.tradefed.targetprep.CtsFilePusher">
- <option name="cleanup" value="true" />
- </target_preparer>
- <target_preparer class="com.android.cts.tradefed.targetprep.CtsApkInstaller">
- <option name="cleanup-apks" value="true" />
- </target_preparer>
- <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer" />
-</configuration>
diff --git a/tools/tradefed-host/res/config/cts.xml b/tools/tradefed-host/res/config/cts.xml
deleted file mode 100644
index e08ad81..0000000
--- a/tools/tradefed-host/res/config/cts.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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="Runs a CTS plan from a pre-existing CTS installation">
-
- <option name="enable-root" value="false" />
- <build_provider class="com.android.cts.tradefed.build.CtsBuildProvider" />
- <device_recovery class="com.android.tradefed.device.WaitDeviceRecovery" />
- <test class="com.android.cts.tradefed.testtype.CtsTest" />
- <logger class="com.android.tradefed.log.FileLogger">
- <option name="log-level-display" value="WARN" />
- </logger>
- <result_reporter class="com.android.cts.tradefed.result.CtsXmlResultReporter" />
- <template-include name="reporters" default="basic-reporters" />
-</configuration>
diff --git a/tools/tradefed-host/res/report/cts_result.css b/tools/tradefed-host/res/report/cts_result.css
deleted file mode 100644
index f825d7a..0000000
--- a/tools/tradefed-host/res/report/cts_result.css
+++ /dev/null
@@ -1,186 +0,0 @@
-/* Copyright (C) 2008 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.
-*/
-
-body {
- font-family:arial,sans-serif;
- color:#000;
- font-size:13px;
- color:#333;
- padding:10;
- margin:10;
-}
-
-/* Report logo and device name */
-table.title {
- padding:5px;
- border-width: 0px;
- margin-left:auto;
- margin-right:auto;
- vertical-align:middle;
-}
-
-table.summary {
- background-color: rgb(212, 233, 169);
- border-collapse:collapse;
- border: 0px solid #A5C639;
- margin-left:auto;
- margin-right:auto;
-}
-
-table.summary th {
- background-color: #A5C639;
- font-size: 1.2em;
- padding: 0.5em;
-}
-
-table.summary td {
- border-width: 0px 0px 0px 0px;
- border-color: gray;
- border-style: inset;
- font-size: 1em;
- padding: 0.5em;
- vertical-align: top;
-}
-
-table.testsummary {
- background-color: rgb(212, 233, 169);
- border-collapse:collapse;
- margin-left:auto;
- margin-right:auto;
-}
-
-table.testsummary th {
- background-color: #A5C639;
- border: 1px outset gray;
- padding: 0.5em;
-}
-
-table.testsummary td {
- border: 1px outset #A5C639;
- padding: 0.5em;
- text-align: center;
-}
-
-table.testdetails {
- background-color: rgb(212, 233, 169);
- border-collapse:collapse;
- border-width:1;
- border-color: #A5C639;
- margin-left:auto;
- margin-right:auto;
- margin-bottom: 2em;
- vertical-align: top;
- width: 95%;
-}
-
-table.testdetails th {
- background-color: #A5C639;
- border-width: 1px;
- border-color: gray;
- border-style: outset;
- height: 2em;
- padding: 0.2em;
-}
-
-table.testdetails td {
- border-width: 1px;
- border-color: #A5C639;
- border-style: outset;
- text-align: left;
- vertical-align: top;
- padding: 0.2em;
-}
-
-table.testdetails td.package {
- background-color: white;
- border: 0px;
- font-weight: bold;
-}
-
-/* Test cell details */
-td.failed {
- background-color: #FA5858;
- font-weight:bold;
- vertical-align: top;
- text-align: center;
-}
-
-td.failuredetails {
- text-align: left;
-}
-
-td.pass {
- text-align: center;
- margin-left:auto;
- margin-right:auto;
-}
-
-td.timeout, td.omitted, td.notExecuted {
- background-color: #A5C639;
- vertical-align: top;
- text-align: center;
-}
-
-td.testname {
- border-width: 1px;
- border-color: #A5C639;
- border-style: outset;
- text-align: left;
- vertical-align: top;
- padding:1;
- overflow:hidden;
-}
-
-td.testcase {
- border-width: 1px;
- border-color: #A5C639;
- border-style: outset;
- text-align: left;
- vertical-align: top;
- padding:1;
- overflow:hidden;
- font-weight:bold;
-}
-
-td.testcasespacer {
- border-width: 1px;
- border-color: #A5C639;
- border-style: outset;
- text-align: left;
- vertical-align: top;
- padding:1;
- overflow:hidden;
- font-weight:bold;
-}
-
-td.testsuite {
- border-width: 1px;
- border-color: #A5C639;
- border-style: outset;
- text-align: left;
- vertical-align: top;
- padding:1;
- overflow:hidden;
- font-weight:bold;
-}
-
-div.details {
- white-space: pre-wrap; /* css-3 */
- white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
- white-space: -pre-wrap; /* Opera 4-6 */
- white-space: -o-pre-wrap; /* Opera 7 */
- word-wrap: break-word; /* Internet Explorer 5.5+ */
- overflow:auto;
-}
diff --git a/tools/tradefed-host/res/report/cts_result.xsd b/tools/tradefed-host/res/report/cts_result.xsd
deleted file mode 100644
index ce606e9..0000000
--- a/tools/tradefed-host/res/report/cts_result.xsd
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2009 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.
- -->
-
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://compatibility.android.com/cts_result/1.15"
- xmlns="http://compatibility.android.com/cts_result/1.15"
- elementFormDefault="qualified">
-
-<xs:element name="TestResult">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="DeviceInfo" type="deviceInfoType"/>
- <xs:element name="HostInfo" type="hostInfoType"/>
- <xs:element name="Summary" type="summaryType"/>
- <xs:element name="TestPackage" type="testPackageType" maxOccurs="unbounded" minOccurs="1"/>
- </xs:sequence>
- <xs:attribute name="starttime" type="xs:string"/>
- <xs:attribute name="endtime" type="xs:string"/>
- <xs:attribute name="testPlan" type="xs:string"/>
- <xs:attribute name="version" type="xs:string"/>
- <xs:attribute name="suite" type="xs:string"/>
- </xs:complexType>
-</xs:element>
-
-<xs:complexType name="deviceInfoType">
- <xs:sequence>
- <xs:element name="Screen">
- <xs:complexType>
- <xs:attribute name="screen_size" type="xs:string"/>
- <xs:attribute name="resolution" type="xs:string"/>
- <xs:attribute name="screen_density" type="xs:decimal"/>
- <xs:attribute name="screen_density_bucket" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="PhoneSubInfo">
- <xs:complexType>
- <xs:attribute name="subscriberId" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="BuildInfo">
- <xs:complexType>
- <xs:attribute name="Xdpi" type="xs:decimal"/>
- <xs:attribute name="Ydpi" type="xs:decimal"/>
- <xs:attribute name="androidPlatformVersion" type="xs:integer"/>
- <xs:attribute name="buildID" type="xs:string"/>
- <xs:attribute name="buildName" type="xs:string"/>
- <xs:attribute name="buildVersion" type="xs:string"/>
- <xs:attribute name="build_board" type="xs:string"/>
- <xs:attribute name="build_manufacturer" type="xs:string"/>
- <xs:attribute name="build_brand" type="xs:string"/>
- <xs:attribute name="build_device" type="xs:string"/>
- <xs:attribute name="build_fingerprint" type="xs:string"/>
- <xs:attribute name="build_model" type="xs:string"/>
- <xs:attribute name="build_type" type="xs:string"/>
- <xs:attribute name="deviceID" type="xs:string"/>
- <xs:attribute name="imei" type="xs:integer"/>
- <xs:attribute name="imsi" type="xs:integer"/>
- <xs:attribute name="keypad" type="xs:string"/>
- <xs:attribute name="locales" type="xs:string"/>
- <xs:attribute name="navigation" type="xs:string"/>
- <xs:attribute name="network" type="xs:string"/>
- <xs:attribute name="touch" type="xs:string"/>
- <xs:attribute name="openGlEsVersion" type="xs:string"/>
- <xs:attribute name="partitions" type="xs:string"/>
- <xs:attribute name="build_abi" type="xs:string"/>
- <xs:attribute name="build_abi2" type="xs:string"/>
- <xs:attribute name="storage_devices" type="xs:string"/>
- <xs:attribute name="multi_user" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="FeatureInfo" type="featureInfoType"/>
- <xs:element name="ProcessInfo" type="processInfoType"/>
- <xs:element name="SystemLibrariesInfo" type="systemLibrariesInfoType"/>
- <xs:element name="OpenGLCompressedTextureFormatsInfo" type="openGLCompressedTextureFormatsInfoType"/>
- </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="hostInfoType">
- <xs:sequence>
- <xs:element name="Os">
- <xs:complexType>
- <xs:attribute name="arch" type="xs:string"/>
- <xs:attribute name="name" type="xs:string"/>
- <xs:attribute name="version" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Java">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string"/>
- <xs:attribute name="version" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Cts">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="IntValue" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string"/>
- <xs:attribute name="value" type="xs:integer"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="version" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string"/>
-</xs:complexType>
-
-<xs:complexType name="featureInfoType">
- <xs:sequence>
- <xs:element name="Feature" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="type" type="xs:string" />
- <xs:attribute name="available" type="xs:string" />
- </xs:complexType>
- </xs:element>
- </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="processInfoType">
- <xs:sequence>
- <xs:element name="Process" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="uid" type="xs:integer" />
- </xs:complexType>
- </xs:element>
- </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="systemLibrariesInfoType">
- <xs:sequence>
- <xs:element name="Library" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string" />
- </xs:complexType>
- </xs:element>
- </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="openGLCompressedTextureFormatsInfoType">
- <xs:sequence>
- <xs:element name="TextureFormat" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string" />
- </xs:complexType>
- </xs:element>
- </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="summaryType">
- <xs:attribute name="failed" type="xs:integer"/>
- <xs:attribute name="notExecuted" type="xs:integer"/>
- <xs:attribute name="pass" type="xs:integer"/>
- <xs:attribute name="timeout" type="xs:integer"/>
- <xs:attribute name="omitted" type="xs:integer"/>
-</xs:complexType>
-
-<xs:complexType name="testPackageType">
- <xs:sequence>
- <xs:element name="TestSuite" type="testSuiteType" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="appPackageName" type="xs:string"/>
- <xs:attribute name="digest" type="xs:hexBinary"/>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="signatureCheck" type="xs:boolean" />
-</xs:complexType>
-
-<xs:complexType name="testSuiteType">
- <xs:sequence>
- <xs:element name="TestCase" type="testCaseType" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="TestSuite" type="testSuiteType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required"/>
-</xs:complexType>
-
-<xs:complexType name="testCaseType">
- <xs:sequence>
- <xs:element name="Test" type="testType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="priority" type="xs:string"/>
-</xs:complexType>
-
-<xs:simpleType name="unitType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="none"/>
- <xs:enumeration value="ms"/>
- <xs:enumeration value="fps"/>
- <xs:enumeration value="ops"/>
- <xs:enumeration value="kbps"/>
- <xs:enumeration value="mbps"/>
- <xs:enumeration value="byte"/>
- <xs:enumeration value="count"/>
- <xs:enumeration value="score"/>
- </xs:restriction>
-</xs:simpleType>
-
-<xs:simpleType name="scoreTypeType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="higherBetter"/>
- <xs:enumeration value="lowerBetter"/>
- <xs:enumeration value="neutral"/>
- <xs:enumeration value="warning"/>
- </xs:restriction>
-</xs:simpleType>
-
-<xs:complexType name="testType">
- <xs:sequence>
- <xs:element name="FailedScene" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="StackTrace" type="xs:string" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- <xs:attribute name="message" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Summary" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:decimal">
- <xs:attribute name="message" type="xs:string" use="required" />
- <xs:attribute name="scoreType" type="scoreTypeType" use="required" />
- <xs:attribute name="unit" type="unitType" use="required" />
- <xs:attribute name="target" type="xs:decimal" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="Details" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="ValueArray" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="Value" type="xs:decimal" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="source" type="xs:string" use="required" />
- <xs:attribute name="message" type="xs:string" use="required" />
- <xs:attribute name="scoreType" type="scoreTypeType" use="required" />
- <xs:attribute name="unit" type="unitType" use="required" />
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="result" type="resultType" use="required"/>
- <xs:attribute name="starttime" type="xs:string"/>
- <xs:attribute name="endtime" type="xs:string"/>
-</xs:complexType>
-
-<xs:simpleType name="resultType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="pass"/>
- <xs:enumeration value="fail"/>
- <xs:enumeration value="timeout"/>
- <xs:enumeration value="notExecuted"/>
- <xs:enumeration value="omitted"/>
- </xs:restriction>
-</xs:simpleType>
-</xs:schema>
diff --git a/tools/tradefed-host/res/report/cts_result.xsl b/tools/tradefed-host/res/report/cts_result.xsl
deleted file mode 100644
index 3b92527..0000000
--- a/tools/tradefed-host/res/report/cts_result.xsl
+++ /dev/null
@@ -1,636 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
-
- <xsl:template match="/">
-
- <html>
- <head>
- <title>Test Report for <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_model" /> - <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@deviceID"/></title>
- <script>
- function toggle(id) {
- e = document.getElementById(id)
- e.style.display = e.style.display == "none" ? "block" : "none"
- }
- </script>
- <STYLE type="text/css">
- @import "cts_result.css";
- </STYLE>
- </head>
- <body>
- <DIV>
- <TABLE class="title">
- <TR>
- <TD width="40%" align="left"><img src="logo.gif"></img></TD>
- <TD width="60%" align="left">
- <h1>Test Report for <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_model"/> -
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@deviceID"/>
- </h1>
- </TD>
- </TR>
- </TABLE>
- </DIV>
- <img src="newrule-green.png" align="left"></img>
-
- <br></br>
-
- <center>
- <a href="#" onclick="toggle('summary');">Show Device Information</a>
- </center>
-
- <br></br>
-
- <DIV id="summary" style="display: none">
- <TABLE class="summary">
- <TR>
- <TH colspan="2">Device Information</TH>
- </TR>
- <TR>
- <TD width="50%">
- <!-- Device information -->
- <TABLE>
- <TR>
- <TD class="rowtitle">Build Model</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_model"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Build Product</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@buildName"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Build Brand</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_brand"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Build Manufacturer</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_manufacturer"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Device ID</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@deviceID"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Android Version</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@buildVersion"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Build ID</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@buildID"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Build Fingerprint</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_fingerprint"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Build ABI</TD>
- <TD>
- <xsl:value-of
- select="TestResult/DeviceInfo/BuildInfo/@build_abi"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Build ABI2</TD>
- <TD>
- <xsl:value-of
- select="TestResult/DeviceInfo/BuildInfo/@build_abi2"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Android API Level</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@androidPlatformVersion"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Supported Locales</TD>
- <TD>
- <xsl:call-template name="formatDelimitedString">
- <xsl:with-param name="string" select="TestResult/DeviceInfo/BuildInfo/@locales"/>
- </xsl:call-template>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Low RAM Device</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/MemoryInfo/@is_low_ram_device"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Memory Class</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/MemoryInfo/@memory_class"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Large Memory Class</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/MemoryInfo/@large_memory_class"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Total Memory</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/MemoryInfo/@total_memory"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Screen Size</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/Screen/@screen_size"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Resolution</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/Screen/@resolution"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Density</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/Screen/@screen_density"/>
- (<xsl:value-of select="TestResult/DeviceInfo/Screen/@screen_density_bucket"/>)
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Phone number</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/PhoneSubInfo/@subscriberId"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">X dpi</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@Xdpi"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Y dpi</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@Ydpi"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Touch</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@touch"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Navigation</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@navigation"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Keypad</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@keypad"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Network</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@network"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">IMEI</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@imei"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">IMSI</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@imsi"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Open GL ES Version</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@openGlEsVersion"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Open GL Compressed Texture Formats</TD>
- <TD>
- <UL>
- <xsl:for-each select="TestResult/DeviceInfo/OpenGLCompressedTextureFormatsInfo/TextureFormat">
- <LI><xsl:value-of select="@name" /></LI>
- </xsl:for-each>
- </UL>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Root Processes</TD>
- <TD>
- <UL>
- <xsl:for-each select="TestResult/DeviceInfo/ProcessInfo/Process[@uid='0']">
- <LI><xsl:value-of select="@name" /></LI>
- </xsl:for-each>
- </UL>
- </TD>
- </TR>
-
- </TABLE>
- </TD>
-
- <TD width="50%">
- <TABLE>
-
- <TR>
- <TD class="rowtitle">Features</TD>
- <TD>
- <xsl:for-each select="TestResult/DeviceInfo/FeatureInfo/Feature[@type='sdk']">
- <xsl:text>[</xsl:text>
- <xsl:choose>
- <xsl:when test="@available = 'true'">
- <xsl:text>X</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>_</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>] </xsl:text>
-
- <xsl:value-of select="@name" />
- <br />
- </xsl:for-each>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Other Features</TD>
- <TD>
- <UL>
- <xsl:for-each select="TestResult/DeviceInfo/FeatureInfo/Feature[@type='other']">
- <LI><xsl:value-of select="@name" /></LI>
- </xsl:for-each>
- </UL>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">System Libraries</TD>
- <TD>
- <UL>
- <xsl:for-each select="TestResult/DeviceInfo/SystemLibrariesInfo/Library">
- <LI><xsl:value-of select="@name" /></LI>
- </xsl:for-each>
- </UL>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Partitions</TD>
- <TD>
- <pre>
- <xsl:call-template name="formatDelimitedString">
- <xsl:with-param name="string" select="TestResult/DeviceInfo/BuildInfo/@partitions" />
- <xsl:with-param name="numTokensPerRow" select="1" />
- </xsl:call-template>
- </pre>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Storage devices</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@storage_devices"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Multi-user support</TD>
- <TD>
- <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@multi_user"/>
- </TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
- </TABLE>
- <br />
- <br />
- </DIV>
-
- <DIV>
- <TABLE class="summary">
- <TR>
- <TH colspan="2">Test Summary</TH>
- </TR>
- <TR>
- <TD class="rowtitle">CTS version</TD>
- <TD>
- <xsl:value-of select="TestResult/HostInfo/Cts/@version"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Test timeout</TD>
- <TD>
- <xsl:value-of select="TestResult/HostInfo/Cts/IntValue[@name='testStatusTimeoutMs']/@value" /> ms
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Host Info</TD>
- <TD>
- <xsl:value-of select="TestResult/HostInfo/@name"/>
- (<xsl:value-of select="TestResult/HostInfo/Os/@name"/> - <xsl:value-of select="TestResult/HostInfo/Os/@version"/>)
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Plan name</TD>
- <TD>
- <xsl:value-of select="TestResult/@testPlan"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Start time</TD>
- <TD>
- <xsl:value-of select="TestResult/@starttime"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">End time</TD>
- <TD>
- <xsl:value-of select="TestResult/@endtime"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Tests Passed</TD>
- <TD>
- <xsl:value-of select="TestResult/Summary/@pass"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Tests Failed</TD>
- <TD>
- <xsl:value-of select="TestResult/Summary/@failed"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Tests Timed out</TD>
- <TD>
- <xsl:value-of select="TestResult/Summary/@timeout"/>
- </TD>
- </TR>
- <TR>
- <TD class="rowtitle">Tests Not Executed</TD>
- <TD>
- <xsl:value-of select="TestResult/Summary/@notExecuted"/>
- </TD>
- </TR>
- </TABLE>
- </DIV>
-
- <!-- High level summary of test execution -->
- <h2 align="center">Test Summary by Package</h2>
- <DIV>
- <TABLE class="testsummary">
- <TR>
- <TH>Test Package</TH>
- <TH>Passed</TH>
- <TH>Failed</TH>
- <TH>Timed Out</TH>
- <TH>Not Executed</TH>
- <TH>Total Tests</TH>
- </TR>
- <xsl:for-each select="TestResult/TestPackage">
- <TR>
- <TD>
- <xsl:variable name="href"><xsl:value-of select="@appPackageName"/></xsl:variable>
- <a href="#{$href}"><xsl:value-of select="@appPackageName"/></a>
- </TD>
- <TD>
- <xsl:value-of select="count(TestSuite//Test[@result = 'pass'])"/>
- </TD>
- <TD>
- <xsl:value-of select="count(TestSuite//Test[@result = 'fail'])"/>
- </TD>
- <TD>
- <xsl:value-of select="count(TestSuite//Test[@result = 'timeout'])"/>
- </TD>
- <TD>
- <xsl:value-of select="count(TestSuite//Test[@result = 'notExecuted'])"/>
- </TD>
- <TD>
- <xsl:value-of select="count(TestSuite//Test)"/>
- </TD>
- </TR>
- </xsl:for-each> <!-- end package -->
- </TABLE>
- </DIV>
-
- <xsl:call-template name="filteredResultTestReport">
- <xsl:with-param name="header" select="'Test Failures'" />
- <xsl:with-param name="resultFilter" select="'fail'" />
- </xsl:call-template>
-
- <xsl:call-template name="filteredResultTestReport">
- <xsl:with-param name="header" select="'Test Timeouts'" />
- <xsl:with-param name="resultFilter" select="'timeout'" />
- </xsl:call-template>
-
- <h2 align="center">Detailed Test Report</h2>
- <xsl:call-template name="detailedTestReport" />
-
- </body>
- </html>
- </xsl:template>
-
- <xsl:template name="filteredResultTestReport">
- <xsl:param name="header" />
- <xsl:param name="resultFilter" />
- <xsl:variable name="numMatching" select="count(TestResult/TestPackage/TestSuite//TestCase/Test[@result=$resultFilter])" />
- <xsl:if test="$numMatching > 0">
- <h2 align="center"><xsl:value-of select="$header" /> (<xsl:value-of select="$numMatching"/>)</h2>
- <xsl:call-template name="detailedTestReport">
- <xsl:with-param name="resultFilter" select="$resultFilter"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="detailedTestReport">
- <xsl:param name="resultFilter" />
- <DIV>
- <xsl:for-each select="TestResult/TestPackage">
- <xsl:if test="$resultFilter=''
- or count(TestSuite//TestCase/Test[@result=$resultFilter]) > 0">
-
- <TABLE class="testdetails">
- <TR>
- <TD class="package" colspan="3">
- <xsl:variable name="href"><xsl:value-of select="@appPackageName"/></xsl:variable>
- <a name="{$href}">Compatibility Test Package: <xsl:value-of select="@appPackageName"/>
- <xsl:if test="@abi">
- ABI: <xsl:value-of select="@abi"/>
- </xsl:if>
- </a>
- </TD>
- </TR>
-
- <TR>
- <TH width="30%">Test</TH>
- <TH width="5%">Result</TH>
- <TH>Details</TH>
- </TR>
-
- <!-- test case -->
- <xsl:for-each select="TestSuite//TestCase">
-
- <xsl:if test="$resultFilter='' or count(Test[@result=$resultFilter]) > 0">
- <!-- emit a blank row before every test suite name -->
- <xsl:if test="position()!=1">
- <TR><TD class="testcasespacer" colspan="3"></TD></TR>
- </xsl:if>
-
- <TR>
- <TD class="testcase" colspan="3">
- <xsl:for-each select="ancestor::TestSuite">
- <xsl:if test="position()!=1">.</xsl:if>
- <xsl:value-of select="@name"/>
- </xsl:for-each>
- <xsl:text>.</xsl:text>
- <xsl:value-of select="@name"/>
- </TD>
- </TR>
- </xsl:if>
-
- <!-- test -->
- <xsl:for-each select="Test">
- <xsl:if test="$resultFilter='' or $resultFilter=@result">
- <TR>
- <TD class="testname"> -- <xsl:value-of select="@name"/></TD>
-
- <!-- test results -->
- <xsl:choose>
- <xsl:when test="string(@KnownFailure)">
- <!-- "pass" indicates the that test actually passed (results have been inverted already) -->
- <xsl:if test="@result='pass'">
- <TD class="pass">
- <div style="text-align: center; margin-left:auto; margin-right:auto;">
- Known problem
- </div>
- </TD>
- <TD class="failuredetails"></TD>
- </xsl:if>
-
- <!-- "fail" indicates that a known failure actually passed (results have been inverted already) -->
- <xsl:if test="@result='fail'">
- <TD class="failed">
- <div style="text-align: center; margin-left:auto; margin-right:auto;">
- <xsl:value-of select="@result"/>
- </div>
- </TD>
- <TD class="failuredetails">
- <div class="details">
- A test that was a known failure actually passed. Please check.
- </div>
- </TD>
- </xsl:if>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:if test="@result='pass'">
- <TD class="pass">
- <div style="text-align: center; margin-left:auto; margin-right:auto;">
- <xsl:value-of select="@result"/>
- </div>
- </TD>
- <TD class="failuredetails"/>
- </xsl:if>
-
- <xsl:if test="@result='fail'">
- <TD class="failed">
- <div style="text-align: center; margin-left:auto; margin-right:auto;">
- <xsl:value-of select="@result"/>
- </div>
- </TD>
- <TD class="failuredetails">
- <div class="details">
- <xsl:value-of select="FailedScene/@message"/>
- </div>
- </TD>
- </xsl:if>
-
- <xsl:if test="@result='timeout'">
- <TD class="timeout">
- <div style="text-align: center; margin-left:auto; margin-right:auto;">
- <xsl:value-of select="@result"/>
- </div>
- <TD class="failuredetails"></TD>
- </TD>
- </xsl:if>
-
- <xsl:if test="@result='notExecuted'">
- <TD class="notExecuted">
- <div style="text-align: center; margin-left:auto; margin-right:auto;">
- <xsl:value-of select="@result"/>
- </div>
- </TD>
- <TD class="failuredetails"></TD>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </TR> <!-- finished with a row -->
- </xsl:if>
- </xsl:for-each> <!-- end test -->
- </xsl:for-each> <!-- end test case -->
- </TABLE>
- </xsl:if>
- </xsl:for-each> <!-- end test package -->
- </DIV>
- </xsl:template>
-
- <!-- Take a delimited string and insert line breaks after a some number of elements. -->
- <xsl:template name="formatDelimitedString">
- <xsl:param name="string" />
- <xsl:param name="numTokensPerRow" select="10" />
- <xsl:param name="tokenIndex" select="1" />
- <xsl:if test="$string">
- <!-- Requires the last element to also have a delimiter after it. -->
- <xsl:variable name="token" select="substring-before($string, ';')" />
- <xsl:value-of select="$token" />
- <xsl:text> </xsl:text>
-
- <xsl:if test="$tokenIndex mod $numTokensPerRow = 0">
- <br />
- </xsl:if>
-
- <xsl:call-template name="formatDelimitedString">
- <xsl:with-param name="string" select="substring-after($string, ';')" />
- <xsl:with-param name="numTokensPerRow" select="$numTokensPerRow" />
- <xsl:with-param name="tokenIndex" select="$tokenIndex + 1" />
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/tools/tradefed-host/res/report/logo.gif b/tools/tradefed-host/res/report/logo.gif
deleted file mode 100644
index 61970b3..0000000
--- a/tools/tradefed-host/res/report/logo.gif
+++ /dev/null
Binary files differ
diff --git a/tools/tradefed-host/res/report/newrule-green.png b/tools/tradefed-host/res/report/newrule-green.png
deleted file mode 100644
index 10a4194..0000000
--- a/tools/tradefed-host/res/report/newrule-green.png
+++ /dev/null
Binary files differ
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildHelper.java b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildHelper.java
deleted file mode 100644
index 1a9f04b..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildHelper.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.build;
-
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IFolderBuildInfo;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-
-/**
- * Helper class for retrieving files from the CTS install.
- * <p/>
- * Encapsulates the filesystem layout of the CTS installation.
- */
-public class CtsBuildHelper {
-
- static final String CTS_DIR_NAME = "old-android-cts";
- private final String mSuiteName = "OLD-CTS";
- /** The root location of the extracted CTS package */
- private final File mRootDir;
- /** the {@link #CTS_DIR_NAME} directory */
- private final File mCtsDir;
-
- /**
- * Creates a {@link CtsBuildHelper}.
- *
- * @param rootDir the parent folder that contains the "android-cts" directory and all its
- * contents.
- */
- public CtsBuildHelper(File rootDir) {
- mRootDir = rootDir;
- mCtsDir = new File(mRootDir, CTS_DIR_NAME);
- }
-
- /**
- * Alternate {@link CtsBuildHelper} constructor that takes the {@link IFolderBuildInfo}
- * representation of a CTS build.
- *
- * @param build the {@link IFolderBuildInfo}
- * @throws FileNotFoundException
- */
- public CtsBuildHelper(IFolderBuildInfo build) throws FileNotFoundException {
- this(build.getRootDir());
- }
-
- /**
- * A helper factory method that creates and validates a {@link CtsBuildHelper} given an
- * {@link IBuildInfo}.
- *
- * @param build the {@link IBuildInfo}
- * @return the {@link CtsBuildHelper}
- * @throws IllegalArgumentException if provided <var>build</var> is not a valid CTS build
- */
- public static CtsBuildHelper createBuildHelper(IBuildInfo build) {
- if (!(build instanceof IFolderBuildInfo)) {
- throw new IllegalArgumentException(String.format(
- "Wrong build type. Expected %s, received %s", IFolderBuildInfo.class.getName(),
- build.getClass().getName()));
- }
- try {
- CtsBuildHelper ctsBuild = new CtsBuildHelper((IFolderBuildInfo)build);
- ctsBuild.validateStructure();
- return ctsBuild;
- } catch (FileNotFoundException e) {
- throw new IllegalArgumentException("Invalid CTS build provided.", e);
- }
- }
-
- public String getSuiteName() {
- return mSuiteName;
- }
-
- /**
- * @return a {@link File} representing the parent folder of the CTS installation
- */
- public File getRootDir() {
- return mRootDir;
- }
-
- /**
- * @return a {@link File} representing the "android-cts" folder of the CTS installation
- */
- public File getCtsDir() {
- return mCtsDir;
- }
-
- /**
- * @return a {@link File} representing the test application file with given name
- * @throws FileNotFoundException if file does not exist
- */
- public File getTestApp(String appFileName) throws FileNotFoundException {
- File apkFile = new File(getTestCasesDir(), appFileName);
- if (!apkFile.exists()) {
- throw new FileNotFoundException(String.format("CTS test app file %s does not exist",
- apkFile.getAbsolutePath()));
- }
- return apkFile;
- }
-
- private File getRepositoryDir() {
- return new File(getCtsDir(), "repository");
- }
-
- /**
- * @return a {@link File} representing the results directory.
- */
- public File getResultsDir() {
- return new File(getRepositoryDir(), "results");
- }
-
- /**
- * @return a {@link File} representing the directory to store result logs.
- */
- public File getLogsDir() {
- return new File(getRepositoryDir(), "logs");
- }
-
- /**
- * @return a {@link File} representing the test cases directory
- */
- public File getTestCasesDir() {
- return new File(getRepositoryDir(), "testcases");
- }
-
- /**
- * @return a {@link File} representing the test plan directory
- */
- public File getTestPlansDir() {
- return new File(getRepositoryDir(), "plans");
- }
-
- /**
- * @return a {@link File} representing the test plan with given name. note: no attempt will be
- * made to ensure the plan actually exists
- * @throws FileNotFoundException if plans directory does not exist
- */
- public File getTestPlanFile(String planName) throws FileNotFoundException {
- String ctsPlanRelativePath = String.format("%s.xml", planName);
- return new File(getTestPlansDir(), ctsPlanRelativePath);
- }
-
- /**
- * Check the validity of the CTS build file system structure.
- * @throws FileNotFoundException if any major directories are missing
- */
- public void validateStructure() throws FileNotFoundException {
- if (!getCtsDir().exists()) {
- throw new FileNotFoundException(String.format(
- "CTS install folder %s does not exist", getCtsDir().getAbsolutePath()));
- }
- if (!getTestCasesDir().exists()) {
- throw new FileNotFoundException(String.format(
- "CTS test cases folder %s does not exist",
- getTestCasesDir().getAbsolutePath()));
- }
- if (!getTestPlansDir().exists()) {
- throw new FileNotFoundException(String.format(
- "CTS test plans folder %s does not exist",
- getTestPlansDir().getAbsolutePath()));
- }
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
deleted file mode 100644
index 7cdbedb..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.build;
-
-import com.android.tradefed.build.BuildRetrievalError;
-import com.android.tradefed.build.DeviceBuildInfo;
-import com.android.tradefed.build.FolderBuildInfo;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IBuildProvider;
-import com.android.tradefed.build.IDeviceBuildProvider;
-import com.android.tradefed.build.IFolderBuildInfo;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-
-import java.io.File;
-import java.util.regex.Pattern;
-
-/**
- * A simple {@link IBuildProvider} that uses a pre-existing CTS install.
- */
-public class CtsBuildProvider implements IDeviceBuildProvider {
-
- private static final Pattern RELEASE_BUILD = Pattern.compile("^[A-Z]{3}\\d{2}[A-Z]{0,1}$");
-
- @Option(name="cts-install-path", description="the path to the cts installation to use")
- private String mCtsRootDirPath = System.getProperty("CTS_ROOT");
-
- @Option(name="use-device-build-info", description="Bootstrap build info from device")
- private boolean mUseDeviceBuildInfo = false;
-
- @Option(name="test-tag", description="test tag name to supply.")
- private String mTestTag = "cts";
-
- @Option(name="branch", description="build branch name to supply.")
- private String mBranch = null;
-
- public static final String CTS_BUILD_VERSION = "7.0_r0";
- public static final String CTS_PACKAGE = "com.android.cts.tradefed.testtype";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBuildInfo getBuild() {
- if (mCtsRootDirPath == null) {
- throw new IllegalArgumentException("Missing --cts-install-path");
- }
- IFolderBuildInfo ctsBuild = new FolderBuildInfo(
- Package.getPackage(CTS_PACKAGE).getImplementationVersion(),
- mTestTag, mTestTag);
- ctsBuild.setRootDir(new File(mCtsRootDirPath));
- if (mBranch != null) {
- ctsBuild.setBuildBranch(mBranch);
- }
- return ctsBuild;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBuildInfo getBuild(ITestDevice device)
- throws BuildRetrievalError, DeviceNotAvailableException {
- if (!mUseDeviceBuildInfo) {
- // return a regular build info without extracting device attributes into standard
- // build info fields
- return getBuild();
- } else {
- String buildId = device.getBuildId();
- String buildFlavor = device.getBuildFlavor();
- IBuildInfo info = new DeviceBuildInfo(buildId, mTestTag, buildFlavor);
- if (mBranch == null) {
- // if branch is not specified via param, make a pseudo branch name based on platform
- // version and product info from device
- mBranch = String.format("%s-%s-%s-%s",
- device.getProperty("ro.product.brand"),
- device.getProperty("ro.product.name"),
- device.getProductVariant(),
- device.getProperty("ro.build.version.release"));
- }
- info.setBuildBranch(mBranch);
- info.setBuildFlavor(buildFlavor);
- String buildAlias = device.getBuildAlias();
- if (RELEASE_BUILD.matcher(buildAlias).matches()) {
- info.addBuildAttribute("build_alias", buildAlias);
- }
- return info;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void buildNotTested(IBuildInfo info) {
- // ignore
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void cleanUp(IBuildInfo info) {
- // ignore
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/command/CtsConsole.java b/tools/tradefed-host/src/com/android/cts/tradefed/command/CtsConsole.java
deleted file mode 100644
index 4cb9e16..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/command/CtsConsole.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.command;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.cts.tradefed.build.CtsBuildProvider;
-import com.android.cts.tradefed.result.ITestResultRepo;
-import com.android.cts.tradefed.result.ITestSummary;
-import com.android.cts.tradefed.result.PlanCreator;
-import com.android.cts.tradefed.result.TestResultRepo;
-import com.android.cts.tradefed.testtype.ITestPackageRepo;
-import com.android.cts.tradefed.testtype.TestPackageRepo;
-import com.android.tradefed.build.IFolderBuildInfo;
-import com.android.tradefed.command.Console;
-import com.android.tradefed.config.ArgsOptionParser;
-import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.util.FileUtil;
-import com.android.tradefed.util.RegexTrie;
-import com.android.tradefed.util.TableFormatter;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Specialization of trade federation console that adds CTS commands to list plans and packages.
- */
-public class CtsConsole extends Console {
-
- protected static final String ADD_PATTERN = "a(?:dd)?";
-
- private IFolderBuildInfo mBuildInfo = null;
- private CtsBuildHelper mBuildHelper = null;
-
- CtsConsole() {
- super();
- }
-
- @Override
- public void run() {
- printLine(String.format("Android CTS %s build:%s",
- CtsBuildProvider.CTS_BUILD_VERSION, getCtsBuildInfo().getBuildId()));
- super.run();
- }
-
- /**
- * Adds the 'list packages' and 'list plans' commands
- */
- @Override
- protected void setCustomCommands(RegexTrie<Runnable> trie, List<String> genericHelp,
- Map<String, String> commandHelp) {
- trie.put(new Runnable() {
- @Override
- public void run() {
- CtsBuildHelper ctsBuild = getCtsBuildHelper();
- if (ctsBuild != null) {
- listPlans(ctsBuild);
- }
- }
- }, LIST_PATTERN, "p(?:lans)?");
- trie.put(new Runnable() {
- @Override
- public void run() {
- CtsBuildHelper ctsBuild = getCtsBuildHelper();
- if (ctsBuild != null) {
- listPackages(ctsBuild);
- }
- }
- }, LIST_PATTERN, "packages");
- trie.put(new Runnable() {
- @Override
- public void run() {
- CtsBuildHelper ctsBuild = getCtsBuildHelper();
- if (ctsBuild != null) {
- listResults(ctsBuild);
- }
- }
- }, LIST_PATTERN, "r(?:esults)?");
-
- // find existing help for 'LIST_PATTERN' commands, and append these commands help
- String listHelp = commandHelp.get(LIST_PATTERN);
- if (listHelp == null) {
- // no help? Unexpected, but soldier on
- listHelp = new String();
- }
- String combinedHelp = listHelp +
- "\tp[lans]\t\tList all CTS test plans" + LINE_SEPARATOR +
- "\tpackages\tList all CTS packages" + LINE_SEPARATOR +
- "\tr[esults]\tList all CTS results" + LINE_SEPARATOR;
- commandHelp.put(LIST_PATTERN, combinedHelp);
-
- ArgRunnable<CaptureList> addDerivedCommand = new ArgRunnable<CaptureList>() {
- @Override
- public void run(CaptureList args) {
- // Skip 2 tokens to get past addPattern and "derivedplan"
- String[] flatArgs = new String[args.size() - 2];
- for (int i = 2; i < args.size(); i++) {
- flatArgs[i - 2] = args.get(i).get(0);
- }
- CtsBuildHelper ctsBuild = getCtsBuildHelper();
- if (ctsBuild != null) {
- // FIXME may want to only add certain ABIs
- addDerivedPlan(ctsBuild, AbiUtils.getAbisSupportedByCompatibility(), flatArgs);
- }
- }
- };
- trie.put(addDerivedCommand, ADD_PATTERN, "d(?:erivedplan?)", null);
- commandHelp.put(ADD_PATTERN, String.format(
- "%s help:" + LINE_SEPARATOR +
- "\tderivedplan Add a derived plan" + LINE_SEPARATOR,
- ADD_PATTERN));
- }
-
- @Override
- protected String getConsolePrompt() {
- return "cts-tf > ";
- }
-
- @Override
- protected String getGenericHelpString(List<String> genericHelp) {
- StringBuilder helpBuilder = new StringBuilder();
- helpBuilder.append("CTS-tradefed host version ");
- helpBuilder.append(CtsBuildProvider.CTS_BUILD_VERSION);
- helpBuilder.append("\n\n");
- helpBuilder.append("CTS-tradefed is the test harness for running the Android ");
- helpBuilder.append("Compatibility Suite, built on top of the tradefed framework.\n\n");
- helpBuilder.append("Available commands and options\n");
- helpBuilder.append("Host:\n");
- helpBuilder.append(" help: show this message\n");
- helpBuilder.append(" help all: show the complete tradefed help\n");
- helpBuilder.append(" exit: gracefully exit the cts console, waiting till all ");
- helpBuilder.append("invocations are complete\n");
- helpBuilder.append("Run:\n");
- helpBuilder.append(" run cts --plan test_plan_name: run a test plan\n");
- helpBuilder.append(" run cts --package/-p : run a CTS test package\n");
- helpBuilder.append(" run cts --class/-c [--method/-m] : run a specific test class and/or");
- helpBuilder.append("method\n");
- helpBuilder.append(" run cts --continue-session session_ID: run all not executed ");
- helpBuilder.append("tests from a previous CTS session\n");
- helpBuilder.append(" run cts [options] --serial/-s device_ID: run CTS on specified ");
- helpBuilder.append("device\n");
- helpBuilder.append(" run cts [options] --shards number_of_shards: shard a CTS run into ");
- helpBuilder.append("given number of independent chunks, to run on multiple devices in");
- helpBuilder.append("parallel\n");
- helpBuilder.append(" run cts --help/--help-all: get more help on running CTS\n");
- helpBuilder.append("List:\n");
- helpBuilder.append(" l/list d/devices: list connected devices and their state\n");
- helpBuilder.append(" l/list packages: list CTS test packages\n");
- helpBuilder.append(" l/list p/plans: list CTS test plans\n");
- helpBuilder.append(" l/list i/invocations: list invocations aka CTS test runs currently");
- helpBuilder.append("in progress\n");
- helpBuilder.append(" l/list c/commands: list commands: aka CTS test run commands ");
- helpBuilder.append("currently in the queue waiting to be allocated devices\n");
- helpBuilder.append(" l/list r/results: list CTS results currently present in the ");
- helpBuilder.append("repository\n");
- helpBuilder.append("Add:\n");
- helpBuilder.append(" add derivedplan --plan plane_name --session/-s session_id -r ");
- helpBuilder.append("[pass/fail/notExecuted/timeout]: derive a plan from the given ");
- helpBuilder.append("session\n");
- helpBuilder.append("Dump:\n");
- helpBuilder.append(" d/dump l/logs: dump the tradefed logs for all running invocations\n");
- helpBuilder.append("Options:\n");
- helpBuilder.append(" --disable-reboot : Do not reboot device after running some amount of tests.\n");
- return helpBuilder.toString();
- }
-
- private void listPlans(CtsBuildHelper ctsBuild) {
- FilenameFilter xmlFilter = new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return name.endsWith(".xml");
- }
- };
- for (File planFile : ctsBuild.getTestPlansDir().listFiles(xmlFilter)) {
- printLine(FileUtil.getBaseName(planFile.getName()));
- }
- }
-
- private void listPackages(CtsBuildHelper ctsBuild) {
- ITestPackageRepo testCaseRepo = new TestPackageRepo(ctsBuild.getTestCasesDir(), false);
- for (String packageName : testCaseRepo.getPackageNames()) {
- printLine(packageName);
- }
- }
-
- private void listResults(CtsBuildHelper ctsBuild) {
- TableFormatter tableFormatter = new TableFormatter();
- List<List<String>> table = new ArrayList<List<String>>();
- table.add(Arrays.asList("Session","Pass", "Fail","Not Executed","Start time","Plan name",
- "Device serial(s)"));
- ITestResultRepo testResultRepo = new TestResultRepo(ctsBuild.getResultsDir());
- for (ITestSummary result : testResultRepo.getSummaries()) {
- table.add(Arrays.asList(Integer.toString(result.getId()),
- Integer.toString(result.getNumPassed()),
- Integer.toString(result.getNumFailed()),
- Integer.toString(result.getNumIncomplete()),
- result.getTimestamp(),
- result.getTestPlan(),
- result.getDeviceSerials()));
- }
- tableFormatter.displayTable(table, new PrintWriter(System.out, true));
- }
-
- private void addDerivedPlan(CtsBuildHelper ctsBuild, Set<String> abis, String[] flatArgs) {
- PlanCreator creator = new PlanCreator();
- try {
- ArgsOptionParser optionParser = new ArgsOptionParser(creator);
- optionParser.parse(Arrays.asList(flatArgs));
- creator.createAndSerializeDerivedPlan(ctsBuild, abis);
- } catch (ConfigurationException e) {
- printLine("Error: " + e.getMessage());
- printLine(ArgsOptionParser.getOptionHelp(false, creator));
- }
- }
-
- private IFolderBuildInfo getCtsBuildInfo() {
- if (mBuildInfo == null) {
- try {
- mBuildInfo = (IFolderBuildInfo) new CtsBuildProvider().getBuild();
- } catch (IllegalArgumentException e) {
- printLine("Could not find CTS install location: CTS_ROOT env variable not set");
- }
- }
- return mBuildInfo;
- }
-
- private CtsBuildHelper getCtsBuildHelper() {
- if (mBuildHelper == null) {
- try {
- mBuildHelper = new CtsBuildHelper(getCtsBuildInfo());
- mBuildHelper.validateStructure();
- } catch (FileNotFoundException e) {
- printLine(String.format("Invalid cts install: %s", e.getMessage()));
- mBuildHelper = null;
- }
- }
- return mBuildHelper;
- }
-
- public static void main(String[] args) throws InterruptedException, ConfigurationException {
- Console console = new CtsConsole();
- Console.startConsole(console, args);
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/device/DeviceInfoCollector.java b/tools/tradefed-host/src/com/android/cts/tradefed/device/DeviceInfoCollector.java
deleted file mode 100644
index 0ab70a7..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/device/DeviceInfoCollector.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.device;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.result.CtsXmlResultReporter;
-import com.android.ddmlib.IDevice;
-import com.android.ddmlib.Log;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IFolderBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.testtype.InstrumentationTest;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Collects info from device under test.
- * <p/>
- * This class simply serves as a conduit for grabbing info from device using the device info
- * collector apk, and forwarding that data directly to the {@link ITestInvocationListener} as run
- * metrics.
- */
-public class DeviceInfoCollector {
-
- private static final String LOG_TAG = "DeviceInfoCollector";
- private static final String APK_NAME = "TestDeviceSetup";
- public static final String APP_PACKAGE_NAME = "android.tests.devicesetup";
- private static final String INSTRUMENTATION_NAME = "android.tests.getinfo.DeviceInfoInstrument";
-
- private static final String EXTENDED_APK_NAME = "CtsDeviceInfo";
- public static final String EXTENDED_APP_PACKAGE_NAME =
- "com.android.compatibility.common.deviceinfo";
- private static final String EXTENDED_INSTRUMENTATION_NAME =
- "android.support.test.runner.AndroidJUnitRunner";
- private static final String DEVICE_INFO_FILES = "device-info-files";
-
- public static final Set<String> IDS = new HashSet<String>();
- public static final Set<String> EXTENDED_IDS = new HashSet<String>();
-
- static {
- for (String abi : AbiUtils.getAbisSupportedByCompatibility()) {
- IDS.add(AbiUtils.createId(abi, APP_PACKAGE_NAME));
- EXTENDED_IDS.add(AbiUtils.createId(abi, EXTENDED_APP_PACKAGE_NAME));
- }
- }
-
- /**
- * Installs and runs the device info collector instrumentation, and forwards results
- * to the listener.
- *
- * @param device
- * @param listener
- * @throws DeviceNotAvailableException
- */
- public static void collectDeviceInfo(ITestDevice device, String abi, File testApkDir,
- ITestInvocationListener listener) throws DeviceNotAvailableException {
- runInstrumentation(device, abi, testApkDir, listener, APK_NAME, APP_PACKAGE_NAME,
- INSTRUMENTATION_NAME);
- }
-
- /**
- * Installs and runs the extended device info collector instrumentation, and forwards results
- * to the listener.
- *
- * @param device
- * @param listener
- * @throws DeviceNotAvailableException
- */
- public static void collectExtendedDeviceInfo(ITestDevice device, String abi, File testApkDir,
- ITestInvocationListener listener, IBuildInfo buildInfo)
- throws DeviceNotAvailableException {
- // Clear files in device test result directory
- String deviceResultDir = getDeviceResultDir(device);
- device.executeShellCommand(String.format("rm -rf %s", deviceResultDir));
- runInstrumentation(device, abi, testApkDir, listener, EXTENDED_APK_NAME,
- EXTENDED_APP_PACKAGE_NAME, EXTENDED_INSTRUMENTATION_NAME);
- // Copy files in remote result directory to local directory
- pullExtendedDeviceInfoResults(device, buildInfo);
- }
-
- private static void runInstrumentation(ITestDevice device, String abi, File testApkDir,
- ITestInvocationListener listener, String apkName, String packageName,
- String instrumentName) throws DeviceNotAvailableException {
- File apkFile = new File(testApkDir, String.format("%s.apk", apkName));
- if (!apkFile.exists()) {
- Log.e(LOG_TAG, String.format("Could not find %s", apkFile.getAbsolutePath()));
- return;
- }
- // collect the instrumentation bundle results using instrumentation test
- // should work even though no tests will actually be run
- InstrumentationTest instrTest = new InstrumentationTest();
- instrTest.setDevice(device);
- instrTest.setInstallFile(apkFile);
- // no need to collect tests and re-run
- instrTest.setRerunMode(false);
- instrTest.setPackageName(packageName);
- instrTest.setRunName(AbiUtils.createId(abi, packageName));
- instrTest.setRunnerName(instrumentName);
- instrTest.run(listener);
- }
-
- private static void pullExtendedDeviceInfoResults(ITestDevice device, IBuildInfo buildInfo)
- throws DeviceNotAvailableException {
- if (!(buildInfo instanceof IFolderBuildInfo)) {
- Log.e(LOG_TAG, "Invalid instance of buildInfo");
- return;
- }
- File localResultDir = new File(buildInfo.getBuildAttributes().get(
- CtsXmlResultReporter.CTS_RESULT_DIR));
- if (localResultDir == null || !localResultDir.isDirectory()) {
- Log.e(LOG_TAG, "Local result directory is null or is not a directory");
- return;
- }
-
- localResultDir = new File(localResultDir, DEVICE_INFO_FILES);
- localResultDir.mkdirs();
-
-
- String deviceResultDir = getDeviceResultDir(device);
-
- // Pull files from device result directory to local result directory
- String command = String.format("adb -s %s pull %s %s", device.getSerialNumber(),
- deviceResultDir, localResultDir.getAbsolutePath());
- if (!execute(command)) {
- Log.e(LOG_TAG, String.format("Failed to run %s", command));
- }
- }
-
- private static boolean execute(String command) {
- try {
- Process p = Runtime.getRuntime().exec(new String[] {"/bin/bash", "-c", command});
- return (p.waitFor() == 0);
- } catch (Exception e) {
- Log.e(LOG_TAG, e);
- return false;
- }
- }
-
- private static String getDeviceResultDir(ITestDevice device) {
- String externalStorePath = device.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE);
- if (externalStorePath == null) {
- Log.e(LOG_TAG, String.format(
- "Failed to get external storage path on device %s", device.getSerialNumber()));
- return null;
- }
- return String.format("%s/%s", externalStorePath, DEVICE_INFO_FILES);
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/AbstractXmlPullParser.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/AbstractXmlPullParser.java
deleted file mode 100644
index c5f1e2d..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/AbstractXmlPullParser.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
-
-import java.io.IOException;
-import java.io.Reader;
-
-/**
- * Helper abstract class for XmlPullParser
- *
- * TODO: move to com.android.tradefed.util.xml
- */
-public abstract class AbstractXmlPullParser {
-
- /**
- * Parse the summary data from the given input data.
- *
- * @param xmlReader the input XML
- * @throws ParseException if failed to parse the summary data.
- */
- public void parse(Reader xmlReader) throws ParseException {
- try {
- XmlPullParserFactory fact = org.xmlpull.v1.XmlPullParserFactory.newInstance();
- XmlPullParser parser = fact.newPullParser();
- parser.setInput (xmlReader);
- parse(parser);
- } catch (XmlPullParserException e) {
- throw new ParseException(e);
- } catch (IOException e) {
- throw new ParseException(e);
- }
- }
-
- abstract void parse(XmlPullParser parser) throws XmlPullParserException, IOException;
-
- /**
- * Parse an integer value from an XML attribute
- *
- * @param parser the {@link XmlPullParser}
- * @param name the attribute name
- * @return the parsed value or 0 if it could not be parsed
- */
- protected int parseIntAttr(XmlPullParser parser, String name) {
- try {
- String value = parser.getAttributeValue(null, name);
- if (value != null) {
- return Integer.parseInt(value);
- }
- } catch (NumberFormatException e) {
- // ignore
- }
- return 0;
- }
-
- /**
- * Parse a boolean attribute value
- */
- protected boolean parseBooleanAttr(XmlPullParser parser, String name) {
- String stringValue = parser.getAttributeValue(null, name);
- return stringValue != null &&
- Boolean.parseBoolean(stringValue);
- }
-
- /**
- * Helper method for retrieving attribute value with given name
- *
- * @param parser the XmlPullParser
- * @param name the attribute name
- * @return the attribute value
- */
- protected String getAttribute(XmlPullParser parser, String name) {
- return parser.getAttributeValue(null, name);
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsTestLogReporter.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsTestLogReporter.java
deleted file mode 100644
index 8500d01..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsTestLogReporter.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.cts.tradefed.result;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.device.DeviceInfoCollector;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.Log.LogLevel;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.OptionCopier;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.IShardableListener;
-import com.android.tradefed.result.StubTestInvocationListener;
-
-import java.util.Map;
-
-/**
- * Dumps tests in progress to stdout
- */
-public class CtsTestLogReporter extends StubTestInvocationListener implements IShardableListener {
-
- private static final String DEVICE_INFO_ERROR = "DEVICE_INFO_ERROR_";
-
- @Option(name = "quiet-output", description = "Mute display of test results.")
- private boolean mQuietOutput = false;
-
- protected IBuildInfo mBuildInfo;
- private String mDeviceSerial;
- private TestResults mResults = new TestResults();
- private TestPackageResult mCurrentPkgResult = null;
- private boolean mIsDeviceInfoRun = false;
- private boolean mIsExtendedDeviceInfoRun = false;
-
- @Override
- public void invocationStarted(IBuildInfo buildInfo) {
- mDeviceSerial = buildInfo.getDeviceSerial() == null ? "unknown_device" : buildInfo.getDeviceSerial();
- }
-
- /**
- * Reports the start of a test run.
- *
- * @param id the unique identifier of this test run, generated by
- * {@link AbiUtils#createId(String, String)}.
- * @param numTests total number of tests in test run
- */
- @Override
- public void testRunStarted(String id, int numTests) {
- if (mCurrentPkgResult != null && !id.equals(mCurrentPkgResult.getId())) {
- // display results from previous run
- logCompleteRun(mCurrentPkgResult);
- }
- mIsDeviceInfoRun = DeviceInfoCollector.IDS.contains(id);
- mIsExtendedDeviceInfoRun = DeviceInfoCollector.EXTENDED_IDS.contains(id);
- if (mIsDeviceInfoRun) {
- logResult("Collecting device info");
- } else if (mIsExtendedDeviceInfoRun) {
- logResult("Collecting extended device info");
- } else {
- if (mCurrentPkgResult == null || !id.equals(mCurrentPkgResult.getId())) {
- logResult("-----------------------------------------");
- logResult("Test package %s started", id);
- logResult("-----------------------------------------");
- }
- mCurrentPkgResult = mResults.getOrCreatePackage(id);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testStarted(TestIdentifier test) {
- if (mIsExtendedDeviceInfoRun) {
- return;
- }
- mCurrentPkgResult.insertTest(test);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testFailed(TestIdentifier test, String trace) {
- if (mIsExtendedDeviceInfoRun) {
- return;
- }
- mCurrentPkgResult.reportTestFailure(test, CtsTestStatus.FAIL, trace);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testAssumptionFailure(TestIdentifier test, String trace) {
- if (mIsExtendedDeviceInfoRun) {
- return;
- }
- // TODO: do something different here?
- mCurrentPkgResult.reportTestFailure(test, CtsTestStatus.FAIL, trace);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testEnded(TestIdentifier test, Map<String, String> testMetrics) {
- if (mIsExtendedDeviceInfoRun) {
- for (Map.Entry<String, String> metricsEntry : testMetrics.entrySet()) {
- String key = metricsEntry.getKey();
- String value = metricsEntry.getValue();
- if (key.startsWith(DEVICE_INFO_ERROR)) {
- throw new RuntimeException(String.format(
- "Error collecting extended device info: %s=%s", key, value));
- }
- }
- return;
- }
- mCurrentPkgResult.reportTestEnded(test, testMetrics);
- Test result = mCurrentPkgResult.findTest(test);
- String stack = result.getStackTrace() == null ? "" : "\n" + result.getStackTrace();
- logResult("%s#%s %s %s", test.getClassName(), test.getTestName(), result.getResult(),
- stack);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void invocationEnded(long elapsedTime) {
- if (mIsExtendedDeviceInfoRun) {
- return;
- }
- // display the results of the last completed run
- if (mCurrentPkgResult != null) {
- logCompleteRun(mCurrentPkgResult);
- }
- }
-
- private void logResult(String format, Object... args) {
- if (mQuietOutput) {
- CLog.i(format, args);
- } else {
- Log.logAndDisplay(LogLevel.INFO, mDeviceSerial, String.format(format, args));
- }
- }
-
- private void logCompleteRun(TestPackageResult pkgResult) {
- String appPackageName = pkgResult.getAppPackageName();
- if (appPackageName.equals(DeviceInfoCollector.APP_PACKAGE_NAME)) {
- logResult("Device info collection complete");
- return;
- } else if (appPackageName.equals(DeviceInfoCollector.EXTENDED_APP_PACKAGE_NAME)) {
- logResult("Extended device info collection complete");
- return;
- }
- logResult("%s package complete: Passed %d, Failed %d, Not Executed %d",
- pkgResult.getId(), pkgResult.countTests(CtsTestStatus.PASS),
- pkgResult.countTests(CtsTestStatus.FAIL),
- pkgResult.countTests(CtsTestStatus.NOT_EXECUTED));
- }
-
- @Override
- public IShardableListener clone() {
- CtsTestLogReporter clone = new CtsTestLogReporter();
- OptionCopier.copyOptionsNoThrow(this, clone);
- return clone;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsTestStatus.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsTestStatus.java
deleted file mode 100644
index 76c3770..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsTestStatus.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-/**
- * An enum of possible test statuses.
- */
-public enum CtsTestStatus {
- PASS("pass"),
- FAIL("fail"),
- NOT_EXECUTED("notExecuted");
-
- private String mValue;
-
- CtsTestStatus(String storedValue) {
- mValue = storedValue;
- }
-
- /**
- * Get the String representation of this test status that should be stored in
- * xml
- * @return
- */
- String getValue() {
- return mValue;
- }
-
- /**
- * Find the {@link CtsTestStatus} corresponding to given string value
- * <p/>
- * Performs a case insensitive search
- *
- * @param value
- * @return the CtsTestStatus or <code>null</code> if it could not be found
- */
- static CtsTestStatus getStatus(String value) {
- for (CtsTestStatus status : CtsTestStatus.values()) {
- if (value.compareToIgnoreCase(status.getValue()) == 0) {
- return status;
- }
- }
- return null;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java
deleted file mode 100644
index 07caaef..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java
+++ /dev/null
@@ -1,550 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.result;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.cts.tradefed.device.DeviceInfoCollector;
-import com.android.cts.tradefed.testtype.CtsTest;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.Log.LogLevel;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IFolderBuildInfo;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ILogSaver;
-import com.android.tradefed.result.ILogSaverListener;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.ITestSummaryListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.LogFile;
-import com.android.tradefed.result.LogFileSaver;
-import com.android.tradefed.result.TestSummary;
-import com.android.tradefed.util.FileUtil;
-import com.android.tradefed.util.StreamUtil;
-
-import org.kxml2.io.KXmlSerializer;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Writes results to an XML files in the CTS format.
- * <p/>
- * Collects all test info in memory, then dumps to file when invocation is complete.
- * <p/>
- * Outputs xml in format governed by the cts_result.xsd
- */
-public class CtsXmlResultReporter
- implements ITestInvocationListener, ITestSummaryListener, ILogSaverListener {
-
- private static final String LOG_TAG = "CtsXmlResultReporter";
- private static final String DEVICE_INFO = "DEVICE_INFO_";
- private static final String DEVICE_INFO_EXT = ".deviceinfo.json";
-
- public static final String CTS_RESULT_DIR = "cts-result-dir";
- static final String TEST_RESULT_FILE_NAME = "testResult.xml";
- static final String CTS_RESULT_FILE_VERSION = "4.4";
- private static final String[] CTS_RESULT_RESOURCES = {"cts_result.xsl", "cts_result.css",
- "logo.gif", "newrule-green.png"};
-
- /** the XML namespace */
- static final String ns = null;
-
- static final String RESULT_TAG = "TestResult";
- static final String PLAN_ATTR = "testPlan";
- static final String STARTTIME_ATTR = "starttime";
-
- @Option(name = "quiet-output", description = "Mute display of test results.")
- private boolean mQuietOutput = false;
-
- private static final String REPORT_DIR_NAME = "output-file-path";
- @Option(name=REPORT_DIR_NAME, description="root file system path to directory to store xml " +
- "test results and associated logs. If not specified, results will be stored at " +
- "<cts root>/repository/results")
- protected File mReportDir = null;
-
- // listen in on the plan option provided to CtsTest
- @Option(name = CtsTest.PLAN_OPTION, description = "the test plan to run.")
- private String mPlanName = "NA";
-
- // listen in on the continue-session option provided to CtsTest
- @Option(name = CtsTest.CONTINUE_OPTION, description = "the test result session to continue.")
- private Integer mContinueSessionId = null;
-
- @Option(name = "result-server", description = "Server to publish test results.")
- private String mResultServer;
-
- @Option(name = "include-test-log-tags", description = "Include test log tags in XML report.")
- private boolean mIncludeTestLogTags = false;
-
- @Option(name = "use-log-saver", description = "Also saves generated result XML with log saver")
- private boolean mUseLogSaver = false;
-
- protected IBuildInfo mBuildInfo;
- private String mStartTime;
- private String mDeviceSerial;
- private TestResults mResults = new TestResults();
- private TestPackageResult mCurrentPkgResult = null;
- private Test mCurrentTest = null;
- private boolean mIsDeviceInfoRun = false;
- private boolean mIsExtendedDeviceInfoRun = false;
- private ResultReporter mReporter;
- private File mLogDir;
- private String mSuiteName;
- private String mReferenceUrl;
- private ILogSaver mLogSaver;
-
- public void setReportDir(File reportDir) {
- mReportDir = reportDir;
- }
-
- /** Set whether to include TestLog tags in the XML reports. */
- public void setIncludeTestLogTags(boolean include) {
- mIncludeTestLogTags = include;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void invocationStarted(IBuildInfo buildInfo) {
- mBuildInfo = buildInfo;
- if (!(buildInfo instanceof IFolderBuildInfo)) {
- throw new IllegalArgumentException("build info is not a IFolderBuildInfo");
- }
- IFolderBuildInfo ctsBuild = (IFolderBuildInfo)buildInfo;
- CtsBuildHelper ctsBuildHelper = getBuildHelper(ctsBuild);
- mDeviceSerial = buildInfo.getDeviceSerial() == null ? "unknown_device" :
- buildInfo.getDeviceSerial();
- if (mContinueSessionId != null) {
- CLog.d("Continuing session %d", mContinueSessionId);
- // reuse existing directory
- TestResultRepo resultRepo = new TestResultRepo(ctsBuildHelper.getResultsDir());
- mResults = resultRepo.getResult(mContinueSessionId);
- if (mResults == null) {
- throw new IllegalArgumentException(String.format("Could not find session %d",
- mContinueSessionId));
- }
- mPlanName = resultRepo.getSummaries().get(mContinueSessionId).getTestPlan();
- mStartTime = resultRepo.getSummaries().get(mContinueSessionId).getStartTime();
- mReportDir = resultRepo.getReportDir(mContinueSessionId);
- } else {
- if (mReportDir == null) {
- mReportDir = ctsBuildHelper.getResultsDir();
- }
- mReportDir = createUniqueReportDir(mReportDir);
-
- mStartTime = getTimestamp();
- logResult("Created result dir %s", mReportDir.getName());
- }
- mSuiteName = ctsBuildHelper.getSuiteName();
- mReporter = new ResultReporter(mResultServer, mSuiteName);
-
- ctsBuild.addBuildAttribute(CTS_RESULT_DIR, mReportDir.getAbsolutePath());
-
- // TODO: allow customization of log dir
- // create a unique directory for saving logs, with same name as result dir
- File rootLogDir = getBuildHelper(ctsBuild).getLogsDir();
- mLogDir = new File(rootLogDir, mReportDir.getName());
- mLogDir.mkdirs();
- }
-
- /**
- * Create a unique directory for saving results.
- * <p/>
- * Currently using legacy CTS host convention of timestamp directory names. In case of
- * collisions, will use {@link FileUtil} to generate unique file name.
- * <p/>
- * TODO: in future, consider using LogFileSaver to create build-specific directories
- *
- * @param parentDir the parent folder to create dir in
- * @return the created directory
- */
- private static synchronized File createUniqueReportDir(File parentDir) {
- // TODO: in future, consider using LogFileSaver to create build-specific directories
-
- File reportDir = new File(parentDir, TimeUtil.getResultTimestamp());
- if (reportDir.exists()) {
- // directory with this timestamp exists already! Choose a unique, although uglier, name
- try {
- reportDir = FileUtil.createTempDir(TimeUtil.getResultTimestamp() + "_", parentDir);
- } catch (IOException e) {
- CLog.e(e);
- CLog.e("Failed to create result directory %s", reportDir.getAbsolutePath());
- }
- } else {
- if (!reportDir.mkdirs()) {
- // TODO: consider throwing an exception
- CLog.e("mkdirs failed when attempting to create result directory %s",
- reportDir.getAbsolutePath());
- }
- }
- return reportDir;
- }
-
- /**
- * Helper method to retrieve the {@link CtsBuildHelper}.
- * @param ctsBuild
- */
- CtsBuildHelper getBuildHelper(IFolderBuildInfo ctsBuild) {
- CtsBuildHelper buildHelper = new CtsBuildHelper(ctsBuild.getRootDir());
- try {
- buildHelper.validateStructure();
- } catch (FileNotFoundException e) {
- // just log an error - it might be expected if we failed to retrieve a build
- CLog.e("Invalid CTS build %s", ctsBuild.getRootDir());
- }
- return buildHelper;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream) {
- try {
- File logFile = getLogFileSaver().saveAndZipLogData(dataName, dataType,
- dataStream.createInputStream());
- logResult(String.format("Saved log %s", logFile.getName()));
- } catch (IOException e) {
- CLog.e("Failed to write log for %s", dataName);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream,
- LogFile logFile) {
- CLog.i("Got log for %s %s %s", dataName, dataType, logFile.getUrl());
- if (mIncludeTestLogTags && mCurrentTest != null) {
- TestLog log = TestLog.fromDataName(dataName, logFile.getUrl());
- if (log != null) {
- mCurrentTest.addTestLog(log);
- }
- }
- }
-
- /**
- * Return the {@link LogFileSaver} to use.
- * <p/>
- * Exposed for unit testing.
- */
- LogFileSaver getLogFileSaver() {
- return new LogFileSaver(mLogDir);
- }
-
- @Override
- public void setLogSaver(ILogSaver logSaver) {
- mLogSaver = logSaver;
- }
-
- @Override
- public void testRunStarted(String id, int numTests) {
- mIsDeviceInfoRun = DeviceInfoCollector.IDS.contains(id);
- mIsExtendedDeviceInfoRun = DeviceInfoCollector.EXTENDED_IDS.contains(id);
- if (!mIsDeviceInfoRun && !mIsExtendedDeviceInfoRun) {
- mCurrentPkgResult = mResults.getOrCreatePackage(id);
- mCurrentPkgResult.setDeviceSerial(mDeviceSerial);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testStarted(TestIdentifier test) {
- if (!mIsDeviceInfoRun && !mIsExtendedDeviceInfoRun) {
- mCurrentTest = mCurrentPkgResult.insertTest(test);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testFailed(TestIdentifier test, String trace) {
- if (!mIsDeviceInfoRun && !mIsExtendedDeviceInfoRun) {
- mCurrentPkgResult.reportTestFailure(test, CtsTestStatus.FAIL, trace);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testAssumptionFailure(TestIdentifier test, String trace) {
- // TODO: do something different here?
- if (!mIsDeviceInfoRun && !mIsExtendedDeviceInfoRun) {
- mCurrentPkgResult.reportTestFailure(test, CtsTestStatus.FAIL, trace);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testIgnored(TestIdentifier test) {
- // TODO: ??
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testEnded(TestIdentifier test, Map<String, String> testMetrics) {
- if (!mIsDeviceInfoRun && !mIsExtendedDeviceInfoRun) {
- mCurrentPkgResult.reportTestEnded(test, testMetrics);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testRunEnded(long elapsedTime, Map<String, String> runMetrics) {
- if (mIsDeviceInfoRun) {
- mResults.populateDeviceInfoMetrics(runMetrics);
- } else if (mIsExtendedDeviceInfoRun) {
- checkExtendedDeviceInfoMetrics(runMetrics);
- } else {
- mCurrentPkgResult.populateMetrics(runMetrics);
- }
- }
-
- private void checkExtendedDeviceInfoMetrics(Map<String, String> runMetrics) {
- for (Map.Entry<String, String> metricEntry : runMetrics.entrySet()) {
- String key = metricEntry.getKey();
- String value = metricEntry.getValue();
- if (!key.startsWith(DEVICE_INFO) && !value.endsWith(DEVICE_INFO_EXT)) {
- CLog.e(String.format("%s failed: %s", key, value));
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void invocationEnded(long elapsedTime) {
- if (mReportDir == null || mStartTime == null) {
- // invocationStarted must have failed, abort
- CLog.w("Unable to create XML report");
- return;
- }
-
- File reportFile = getResultFile(mReportDir);
- createXmlResult(reportFile, mStartTime, elapsedTime);
- if (mUseLogSaver) {
- FileInputStream fis = null;
- try {
- fis = new FileInputStream(reportFile);
- mLogSaver.saveLogData("cts-result", LogDataType.XML, fis);
- } catch (IOException ioe) {
- CLog.e("error saving XML with log saver");
- CLog.e(ioe);
- } finally {
- StreamUtil.close(fis);
- }
- }
- copyFormattingFiles(mReportDir);
- zipResults(mReportDir);
-
- try {
- mReporter.reportResult(reportFile, mReferenceUrl);
- } catch (IOException e) {
- CLog.e(e);
- }
- }
-
- private void logResult(String format, Object... args) {
- if (mQuietOutput) {
- CLog.i(format, args);
- } else {
- Log.logAndDisplay(LogLevel.INFO, mDeviceSerial, String.format(format, args));
- }
- }
-
- /**
- * Creates a report file and populates it with the report data from the completed tests.
- */
- private void createXmlResult(File reportFile, String startTimestamp, long elapsedTime) {
- String endTime = getTimestamp();
- OutputStream stream = null;
- try {
- stream = createOutputResultStream(reportFile);
- KXmlSerializer serializer = new KXmlSerializer();
- serializer.setOutput(stream, "UTF-8");
- serializer.startDocument("UTF-8", false);
- serializer.setFeature(
- "http://xmlpull.org/v1/doc/features.html#indent-output", true);
- serializer.processingInstruction("xml-stylesheet type=\"text/xsl\" " +
- "href=\"cts_result.xsl\"");
- serializeResultsDoc(serializer, startTimestamp, endTime);
- serializer.endDocument();
- String msg = String.format("XML test result file generated at %s. Passed %d, " +
- "Failed %d, Not Executed %d", mReportDir.getName(),
- mResults.countTests(CtsTestStatus.PASS),
- mResults.countTests(CtsTestStatus.FAIL),
- mResults.countTests(CtsTestStatus.NOT_EXECUTED));
- logResult(msg);
- logResult("Time: %s", TimeUtil.formatElapsedTime(elapsedTime));
- } catch (IOException e) {
- Log.e(LOG_TAG, "Failed to generate report data");
- } finally {
- StreamUtil.close(stream);
- }
- }
-
- /**
- * Output the results XML.
- *
- * @param serializer the {@link KXmlSerializer} to use
- * @param startTime the user-friendly starting time of the test invocation
- * @param endTime the user-friendly ending time of the test invocation
- * @throws IOException
- */
- private void serializeResultsDoc(KXmlSerializer serializer, String startTime, String endTime)
- throws IOException {
- serializer.startTag(ns, RESULT_TAG);
- serializer.attribute(ns, PLAN_ATTR, mPlanName);
- serializer.attribute(ns, STARTTIME_ATTR, startTime);
- serializer.attribute(ns, "endtime", endTime);
- serializer.attribute(ns, "version", CTS_RESULT_FILE_VERSION);
- serializer.attribute(ns, "suite", mSuiteName);
- if (mReferenceUrl != null) {
- serializer.attribute(ns, "referenceUrl", mReferenceUrl);
- }
- mResults.serialize(serializer, mBuildInfo.getBuildId());
- // TODO: not sure why, but the serializer doesn't like this statement
- //serializer.endTag(ns, RESULT_TAG);
- }
-
- private File getResultFile(File reportDir) {
- return new File(reportDir, TEST_RESULT_FILE_NAME);
- }
-
- /**
- * Creates the output stream to use for test results. Exposed for mocking.
- */
- OutputStream createOutputResultStream(File reportFile) throws IOException {
- logResult("Created xml report file at file://%s", reportFile.getAbsolutePath());
- return new FileOutputStream(reportFile);
- }
-
- /**
- * Copy the xml formatting files stored in this jar to the results directory
- *
- * @param resultsDir
- */
- private void copyFormattingFiles(File resultsDir) {
- for (String resultFileName : CTS_RESULT_RESOURCES) {
- InputStream configStream = getClass().getResourceAsStream(String.format("/report/%s",
- resultFileName));
- if (configStream != null) {
- File resultFile = new File(resultsDir, resultFileName);
- try {
- FileUtil.writeToFile(configStream, resultFile);
- } catch (IOException e) {
- Log.w(LOG_TAG, String.format("Failed to write %s to file", resultFileName));
- }
- } else {
- Log.w(LOG_TAG, String.format("Failed to load %s from jar", resultFileName));
- }
- }
- }
-
- /**
- * Zip the contents of the given results directory.
- *
- * @param resultsDir
- */
- private void zipResults(File resultsDir) {
- try {
- // create a file in parent directory, with same name as resultsDir
- File zipResultFile = new File(resultsDir.getParent(), String.format("%s.zip",
- resultsDir.getName()));
- FileUtil.createZip(resultsDir, zipResultFile);
- } catch (IOException e) {
- Log.w(LOG_TAG, String.format("Failed to create zip for %s", resultsDir.getName()));
- }
- }
-
- /**
- * Get a String version of the current time.
- * <p/>
- * Exposed so unit tests can mock.
- */
- String getTimestamp() {
- return TimeUtil.getTimestamp();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testRunFailed(String errorMessage) {
- // ignore
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testRunStopped(long elapsedTime) {
- // ignore
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void invocationFailed(Throwable cause) {
- // ignore
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public TestSummary getSummary() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void putSummary(List<TestSummary> summaries) {
- // By convention, only store the first summary that we see as the summary URL.
- if (summaries.isEmpty()) {
- return;
- }
-
- mReferenceUrl = summaries.get(0).getSummary().getString();
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/DeviceInfoResult.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/DeviceInfoResult.java
deleted file mode 100644
index fb253e6..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/DeviceInfoResult.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import android.tests.getinfo.DeviceInfoConstants;
-
-import com.android.tradefed.log.LogUtil.CLog;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Data structure for the device info collected by CTS.
- * <p/>
- * Provides methods to serialize and deserialize from XML, as well as checks for consistency
- * when multiple devices are used to generate the report.
- */
-class DeviceInfoResult extends AbstractXmlPullParser {
- static final String TAG = "DeviceInfo";
- private static final String ns = CtsXmlResultReporter.ns;
- static final String BUILD_TAG = "BuildInfo";
- private static final String PHONE_TAG = "PhoneSubInfo";
- private static final String SCREEN_TAG = "Screen";
- private static final String MEMORY_TAG = "MemoryInfo";
-
- private static final String FEATURE_INFO_TAG = "FeatureInfo";
- private static final String FEATURE_TAG = "Feature";
- private static final String FEATURE_ATTR_DELIM = ":";
- private static final String FEATURE_DELIM = ";";
-
- private static final String OPENGL_TEXTURE_FORMATS_INFO_TAG =
- "OpenGLCompressedTextureFormatsInfo";
- private static final String OPENGL_TEXTURE_FORMAT_TAG = "TextureFormat";
- private static final String OPENGL_TEXTURE_FORMAT_DELIM = ";";
-
- private static final String OPENGL_EXTENSIONS_TAG = "OpenGlExtensions";
- private static final String OPENGL_EXTENSION_TAG = "OpenGlExtension";
- private static final String OPENGL_EXTENSION_DELIM = ";";
-
- private static final String SYSLIB_INFO_TAG = "SystemLibrariesInfo";
- private static final String SYSLIB_TAG = "Library";
- private static final String SYSLIB_DELIM = ";";
-
- private static final String PROCESS_INFO_TAG = "ProcessInfo";
- private static final String PROCESS_TAG = "Process";
- private static final String PROCESS_DELIM = ";";
- private static final String PROCESS_ATTR_DELIM = ":";
-
- private Map<String, String> mMetrics = new HashMap<String, String>();
-
- /**
- * Serialize this object and all its contents to XML.
- *
- * @param serializer
- * @throws IOException
- */
- public void serialize(KXmlSerializer serializer) throws IOException {
- serializer.startTag(ns, TAG);
-
- if (mMetrics.isEmpty()) {
- // this might be expected, if device info collection was turned off
- CLog.d("Could not find device info");
- serializer.endTag(ns, TAG);
- return;
- }
-
- // Extract metrics that need extra handling, and then dump the remainder into BuildInfo
- Map<String, String> metricsCopy = new HashMap<String, String>(mMetrics);
- serializer.startTag(ns, SCREEN_TAG);
- serializer.attribute(ns, DeviceInfoConstants.RESOLUTION,
- getMetric(metricsCopy, DeviceInfoConstants.RESOLUTION));
- serializer.attribute(ns, DeviceInfoConstants.SCREEN_DENSITY,
- getMetric(metricsCopy, DeviceInfoConstants.SCREEN_DENSITY));
- serializer.attribute(ns, DeviceInfoConstants.SCREEN_DENSITY_BUCKET,
- getMetric(metricsCopy, DeviceInfoConstants.SCREEN_DENSITY_BUCKET));
- serializer.attribute(ns, DeviceInfoConstants.SCREEN_SIZE,
- getMetric(metricsCopy, DeviceInfoConstants.SCREEN_SIZE));
- serializer.attribute(ns, DeviceInfoConstants.SMALLEST_SCREEN_WIDTH_DP,
- getMetric(metricsCopy, DeviceInfoConstants.SMALLEST_SCREEN_WIDTH_DP));
- serializer.endTag(ns, SCREEN_TAG);
-
- serializer.startTag(ns, PHONE_TAG);
- serializer.attribute(ns, DeviceInfoConstants.PHONE_NUMBER,
- getMetric(metricsCopy, DeviceInfoConstants.PHONE_NUMBER));
- serializer.endTag(ns, PHONE_TAG);
-
- serializer.startTag(ns, MEMORY_TAG);
- serializer.attribute(ns, DeviceInfoConstants.IS_LOW_RAM_DEVICE,
- getMetric(metricsCopy, DeviceInfoConstants.IS_LOW_RAM_DEVICE));
- serializer.attribute(ns, DeviceInfoConstants.MEMORY_CLASS,
- getMetric(metricsCopy, DeviceInfoConstants.MEMORY_CLASS));
- serializer.attribute(ns, DeviceInfoConstants.LARGE_MEMORY_CLASS,
- getMetric(metricsCopy, DeviceInfoConstants.LARGE_MEMORY_CLASS));
- serializer.attribute(ns, DeviceInfoConstants.TOTAL_MEMORY,
- getMetric(metricsCopy, DeviceInfoConstants.TOTAL_MEMORY));
- serializer.endTag(ns, MEMORY_TAG);
-
- String featureData = getMetric(metricsCopy, DeviceInfoConstants.FEATURES);
- String processData = getMetric(metricsCopy, DeviceInfoConstants.PROCESSES);
- String sysLibData = getMetric(metricsCopy, DeviceInfoConstants.SYS_LIBRARIES);
- String textureData = getMetric(metricsCopy,
- DeviceInfoConstants.OPEN_GL_COMPRESSED_TEXTURE_FORMATS);
- String openGlExtensionData = getMetric(metricsCopy,
- DeviceInfoConstants.OPEN_GL_EXTENSIONS);
-
- // dump the remaining metrics without translation
- serializer.startTag(ns, BUILD_TAG);
- for (Map.Entry<String, String> metricEntry : metricsCopy.entrySet()) {
- serializer.attribute(ns, metricEntry.getKey(), metricEntry.getValue());
- }
- serializer.endTag(ns, BUILD_TAG);
-
- serializeFeatureInfo(serializer, featureData);
- serializeProcessInfo(serializer, processData);
- serializeSystemLibrariesInfo(serializer, sysLibData);
- serializeOpenGLCompressedTextureFormatsInfo(serializer, textureData);
- serializeOpenGLExtensions(serializer, openGlExtensionData);
- // End
- serializer.endTag(ns, TAG);
- }
-
- /**
- * Fetch and remove given metric from hashmap.
- *
- * @return the metric value or empty string if it was not present in map.
- */
- private String getMetric(Map<String, String> metrics, String metricName ) {
- String value = metrics.remove(metricName);
- if (value == null) {
- value = "";
- }
- return value;
- }
-
- private void serializeFeatureInfo(KXmlSerializer serializer, String featureData)
- throws IOException {
- serialize(serializer, FEATURE_INFO_TAG, FEATURE_TAG, FEATURE_DELIM, FEATURE_ATTR_DELIM,
- featureData, "name", "type", "available");
- }
-
- private void serializeProcessInfo(KXmlSerializer serializer, String rootProcesses)
- throws IOException {
- serialize(serializer, PROCESS_INFO_TAG, PROCESS_TAG, PROCESS_DELIM, PROCESS_ATTR_DELIM,
- rootProcesses, "name", "uid");
- }
-
- private void serializeOpenGLCompressedTextureFormatsInfo(KXmlSerializer serializer,
- String formats) throws IOException {
- serialize(serializer, OPENGL_TEXTURE_FORMATS_INFO_TAG, OPENGL_TEXTURE_FORMAT_TAG,
- OPENGL_TEXTURE_FORMAT_DELIM, null, formats, "name");
- }
-
- private void serializeOpenGLExtensions(KXmlSerializer serializer, String extensions)
- throws IOException {
- serialize(serializer, OPENGL_EXTENSIONS_TAG, OPENGL_EXTENSION_TAG,
- OPENGL_EXTENSION_DELIM, null, extensions, "name");
- }
-
- private void serializeSystemLibrariesInfo(KXmlSerializer serializer, String libs)
- throws IOException {
- serialize(serializer, SYSLIB_INFO_TAG, SYSLIB_TAG, SYSLIB_DELIM, null, libs, "name");
- }
-
- /**
- * Serializes a XML structure where there is an outer tag with tags inside it.
- *
- * <pre>
- * Input: value1:value2;value3:value4
- *
- * Output:
- * <OuterTag>
- * <SubTag attr1="value1" attr2="value2" />
- * <SubTag attr1="value3" attr2="value4" />
- * </OuterTag>
- * </pre>
- *
- * @param serializer to do it
- * @param tag would be "OuterTag"
- * @param subTag would be "SubTag"
- * @param delim would be ";"
- * @param attrDelim would be ":" in the example but can be null if only one attrName given
- * @param data would be "value1:value2;value3:value4"
- * @param attrNames would be an array with "attr1", "attr2"
- * @throws IOException if there is a problem
- */
- private void serialize(KXmlSerializer serializer, String tag, String subTag,
- String delim, String attrDelim, String data, String... attrNames) throws IOException {
- serializer.startTag(ns, tag);
-
- if (data == null) {
- data = "";
- }
-
- String[] values = data.split(delim);
- for (String value : values) {
- if (!value.isEmpty()) {
- String[] attrValues = attrDelim != null ? value.split(attrDelim) : new String[] {value};
- if (attrValues.length == attrNames.length) {
- serializer.startTag(ns, subTag);
- for (int i = 0; i < attrNames.length; i++) {
- serializer.attribute(ns, attrNames[i], attrValues[i]);
- }
- serializer.endTag(ns, subTag);
- }
- }
- }
-
- serializer.endTag(ns, tag);
- }
-
- /**
- * Populates this class with package result data parsed from XML.
- *
- * @param parser the {@link XmlPullParser}. Expected to be pointing at start
- * of a {@link #TAG}
- */
- @Override
- void parse(XmlPullParser parser) throws XmlPullParserException, IOException {
- if (!parser.getName().equals(TAG)) {
- throw new XmlPullParserException(String.format(
- "invalid XML: Expected %s tag but received %s", TAG, parser.getName()));
- }
- int eventType = parser.getEventType();
- while (eventType != XmlPullParser.END_DOCUMENT) {
- if (eventType == XmlPullParser.START_TAG) {
- if (parser.getName().equals(SCREEN_TAG) ||
- parser.getName().equals(PHONE_TAG) ||
- parser.getName().equals(BUILD_TAG)) {
- addMetricsFromAttributes(parser);
- } else if (parser.getName().equals(FEATURE_INFO_TAG)) {
- mMetrics.put(DeviceInfoConstants.FEATURES, parseFeatures(parser));
- } else if (parser.getName().equals(PROCESS_INFO_TAG)) {
- mMetrics.put(DeviceInfoConstants.PROCESSES, parseProcess(parser));
- } else if (parser.getName().equals(SYSLIB_INFO_TAG)) {
- mMetrics.put(DeviceInfoConstants.SYS_LIBRARIES, parseSystemLibraries(parser));
- } else if (parser.getName().equals(OPENGL_TEXTURE_FORMATS_INFO_TAG)) {
- mMetrics.put(DeviceInfoConstants.OPEN_GL_COMPRESSED_TEXTURE_FORMATS,
- parseOpenGLCompressedTextureFormats(parser));
- }
- } else if (eventType == XmlPullParser.END_TAG && parser.getName().equals(TAG)) {
- return;
- }
- eventType = parser.next();
- }
- }
-
- private String parseFeatures(XmlPullParser parser) throws XmlPullParserException, IOException {
- return parseTag(parser, FEATURE_INFO_TAG, FEATURE_TAG, FEATURE_DELIM, FEATURE_ATTR_DELIM,
- "name", "type", "available");
- }
-
- private String parseProcess(XmlPullParser parser) throws XmlPullParserException, IOException {
- return parseTag(parser, PROCESS_INFO_TAG, PROCESS_TAG, PROCESS_DELIM,
- PROCESS_ATTR_DELIM, "name", "uid");
- }
-
- private String parseOpenGLCompressedTextureFormats(XmlPullParser parser)
- throws XmlPullParserException, IOException {
- return parseTag(parser, OPENGL_TEXTURE_FORMATS_INFO_TAG, OPENGL_TEXTURE_FORMAT_TAG,
- OPENGL_TEXTURE_FORMAT_DELIM, null, "name");
- }
-
- private String parseSystemLibraries(XmlPullParser parser)
- throws XmlPullParserException, IOException {
- return parseTag(parser, SYSLIB_INFO_TAG, SYSLIB_TAG, SYSLIB_DELIM, null, "name");
- }
-
- /**
- * Converts XML into a flattened string.
- *
- * <pre>
- * Input:
- * <OuterTag>
- * <SubTag attr1="value1" attr2="value2" />
- * <SubTag attr1="value3" attr2="value4" />
- * </OuterTag>
- *
- * Output: value1:value2;value3:value4
- * </pre>
- *
- * @param parser that parses the xml
- * @param tag like "OuterTag"
- * @param subTag like "SubTag"
- * @param delim like ";"
- * @param attrDelim like ":" or null if tehre is only one attribute
- * @param attrNames like "attr1", "attr2"
- * @return flattened string like "value1:value2;value3:value4"
- * @throws XmlPullParserException
- * @throws IOException
- */
- private String parseTag(XmlPullParser parser, String tag, String subTag, String delim,
- String attrDelim, String... attrNames) throws XmlPullParserException, IOException {
- if (!parser.getName().equals(tag)) {
- throw new XmlPullParserException(String.format(
- "invalid XML: Expected %s tag but received %s", tag,
- parser.getName()));
- }
- StringBuilder flattened = new StringBuilder();
-
- for (int eventType = parser.getEventType();
- eventType != XmlPullParser.END_DOCUMENT;
- eventType = parser.next()) {
-
- if (eventType == XmlPullParser.START_TAG && parser.getName().equals(subTag)) {
- for (int i = 0; i < attrNames.length; i++) {
- flattened.append(getAttribute(parser, attrNames[i]));
- if (i + 1 < attrNames.length) {
- flattened.append(attrDelim);
- }
- }
- flattened.append(delim);
- } else if (eventType == XmlPullParser.END_TAG && parser.getName().equals(tag)) {
- break;
- }
- }
-
- return flattened.toString();
- }
-
- /**
- * Adds all attributes from the current XML tag to metrics as name-value pairs
- */
- private void addMetricsFromAttributes(XmlPullParser parser) {
- int attrCount = parser.getAttributeCount();
- for (int i = 0; i < attrCount; i++) {
- mMetrics.put(parser.getAttributeName(i), parser.getAttributeValue(i));
- }
- }
-
- /**
- * Populate the device info metrics with values collected from device.
- * <p/>
- * Check that the provided device info metrics are consistent with the currently stored metrics.
- * If any inconsistencies occur, logs errors and stores error messages in the metrics map
- */
- public void populateMetrics(Map<String, String> metrics) {
- if (mMetrics.isEmpty()) {
- // no special processing needed, no existing metrics
- mMetrics.putAll(metrics);
- return;
- }
- Map<String, String> metricsCopy = new HashMap<String, String>(
- metrics);
- // add values for metrics that might be different across runs
- combineMetrics(metricsCopy, DeviceInfoConstants.PHONE_NUMBER, DeviceInfoConstants.IMSI,
- DeviceInfoConstants.IMSI, DeviceInfoConstants.SERIAL_NUMBER);
-
- // ensure all the metrics we expect to be identical actually are
- checkMetrics(metricsCopy, DeviceInfoConstants.BUILD_FINGERPRINT,
- DeviceInfoConstants.BUILD_MODEL, DeviceInfoConstants.BUILD_BRAND,
- DeviceInfoConstants.BUILD_MANUFACTURER, DeviceInfoConstants.BUILD_BOARD,
- DeviceInfoConstants.BUILD_DEVICE, DeviceInfoConstants.PRODUCT_NAME,
- DeviceInfoConstants.BUILD_ABI, DeviceInfoConstants.BUILD_ABI2,
- DeviceInfoConstants.BUILD_ABIS, DeviceInfoConstants.BUILD_ABIS_32,
- DeviceInfoConstants.BUILD_ABIS_64, DeviceInfoConstants.SCREEN_SIZE);
- }
-
- private void combineMetrics(Map<String, String> metrics, String... keysToCombine) {
- for (String combineKey : keysToCombine) {
- String currentKeyValue = mMetrics.get(combineKey);
- String valueToAdd = metrics.remove(combineKey);
- if (valueToAdd != null) {
- if (currentKeyValue == null) {
- // strange - no existing value. Can occur during unit testing
- mMetrics.put(combineKey, valueToAdd);
- } else if (!currentKeyValue.equals(valueToAdd)) {
- // new value! store a comma separated list
- valueToAdd = String.format("%s,%s", currentKeyValue, valueToAdd);
- mMetrics.put(combineKey, valueToAdd);
- } else {
- // ignore, current value is same as existing
- }
-
- } else {
- CLog.d("Missing metric %s", combineKey);
- }
- }
- }
-
- private void checkMetrics(Map<String, String> metrics, String... keysToCheck) {
- Set<String> keyCheckSet = new HashSet<String>();
- Collections.addAll(keyCheckSet, keysToCheck);
- for (Map.Entry<String, String> metricEntry : metrics.entrySet()) {
- String currentValue = mMetrics.get(metricEntry.getKey());
- if (keyCheckSet.contains(metricEntry.getKey()) && currentValue != null
- && !metricEntry.getValue().equals(currentValue)) {
- CLog.e("Inconsistent info collected from devices. "
- + "Current result has %s='%s', Received '%s'. Are you sharding or " +
- "resuming a test run across different devices and/or builds?",
- metricEntry.getKey(), currentValue, metricEntry.getValue());
- mMetrics.put(metricEntry.getKey(),
- String.format("ERROR: Inconsistent results: %s, %s",
- metricEntry.getValue(), currentValue));
- } else {
- mMetrics.put(metricEntry.getKey(), metricEntry.getValue());
- }
- }
- }
-
- /**
- * Return the currently stored metrics.
- * <p/>
- * Exposed for unit testing.
- */
- Map<String, String> getMetrics() {
- return mMetrics;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/ITestResultRepo.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/ITestResultRepo.java
deleted file mode 100644
index 19b0540..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/ITestResultRepo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * Repository for CTS results.
- */
-public interface ITestResultRepo {
-
- /**
- * @return the list of {@link ITestSummary}s. The index of the {@link ITestSummary} in the
- * list is its session id
- */
- public List<ITestSummary> getSummaries();
-
- /**
- * Get the {@link TestResults} for given session id.
- *
- * @param sessionId the session id
- * @return the {@link TestResults} or <code>null</null> if the result with that session id
- * cannot be retrieved
- */
- public TestResults getResult(int sessionId);
-
- /**
- * Get the report directory for given result
- * @param sessionId
- * @return A {@link File} representing the report directory for the given sessionId
- */
- public File getReportDir(int sessionId);
-
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/ITestSummary.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/ITestSummary.java
deleted file mode 100644
index e7041ec..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/ITestSummary.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-/**
- * Interface for a single CTS result summary.
- */
-public interface ITestSummary {
-
- /**
- * @return the session id
- */
- public int getId();
-
- /**
- * @return the starting timestamp, also known as result directory name
- */
- public String getTimestamp();
-
- /**
- * @return the num of not executed tests
- */
- public int getNumIncomplete();
-
- /**
- * @return the number of failed tests
- */
- public int getNumFailed();
-
- /**
- * @return the number of passed tests
- */
- public int getNumPassed();
-
- /**
- * @return the test plan associated with result
- */
- public String getTestPlan();
-
- /**
- * Return the user-friendly displayed start time stored in result XML.
- * <p/>
- * Expected format: {@link TimeUtil#getTimestamp()}
- */
- public String getStartTime();
-
- /**
- * @return a comma separated list of device serials associated with result
- */
- public String getDeviceSerials();
-
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/IssueReporter.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/IssueReporter.java
deleted file mode 100644
index ed5f238..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/IssueReporter.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.TestSummary;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.zip.GZIPOutputStream;
-
-/**
- * Class that sends a HTTP POST multipart/form-data request containing details
- * about a test failure.
- */
-public class IssueReporter implements ITestInvocationListener {
-
- private static final int BUGREPORT_SIZE = 500 * 1024;
-
- private static final String PRODUCT_NAME_KEY = "buildName";
- private static final String BUILD_TYPE_KEY = "build_type";
- private static final String BUILD_ID_KEY = "buildID";
-
- @Option(name = "issue-server", description = "Server url to post test failures to.")
- private String mServerUrl;
-
- private final ExecutorService mReporterService = Executors.newCachedThreadPool();
-
- private Issue mCurrentIssue;
- private String mBuildId;
- private String mBuildType;
- private String mProductName;
-
- @Override
- public void testFailed(TestIdentifier test, String trace) {
- mCurrentIssue = new Issue();
- mCurrentIssue.mTestName = test.toString();
- mCurrentIssue.mStackTrace = trace;
- }
-
- @Override
- public void testAssumptionFailure(TestIdentifier test, String trace) {
- mCurrentIssue = new Issue();
- mCurrentIssue.mTestName = test.toString();
- mCurrentIssue.mStackTrace = trace;
- }
-
- @Override
- public void testIgnored(TestIdentifier test) {
- // TODO: ??
- }
-
- @Override
- public void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream) {
- if (dataName.startsWith("bug-")) {
- try {
- setBugReport(dataStream);
- } catch (IOException e) {
- CLog.e(e);
- }
- }
- }
-
- /**
- * Set the bug report for the current test failure. GZip it to save space.
- * This is only called when the --bugreport option is enabled.
- */
- private void setBugReport(InputStreamSource dataStream) throws IOException {
- if (mCurrentIssue != null) {
- // Only one bug report can be stored at a time and they are gzipped to
- // about 0.5 MB so there shoudn't be any memory leak bringing down CTS.
- InputStream input = null;
- try {
- input = dataStream.createInputStream();
- mCurrentIssue.mBugReport = getBytes(input, BUGREPORT_SIZE);
- } finally {
- if (input != null) {
- input.close();
- }
- }
- } else {
- CLog.e("setBugReport is getting called on an empty issue...");
- }
- }
-
- /**
- * @param input that will be gzipped and returne as a byte array
- * @param size of the output expected
- * @return the byte array with the input's data
- * @throws IOException
- */
- static byte[] getBytes(InputStream input, int size) throws IOException {
- ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(size);
- GZIPOutputStream gzipOutput = new GZIPOutputStream(byteOutput);
- for (byte[] buffer = new byte[1024]; ; ) {
- int numRead = input.read(buffer);
- if (numRead < 0) {
- break;
- }
- gzipOutput.write(buffer, 0, numRead);
- }
- gzipOutput.close();
- return byteOutput.toByteArray();
- }
-
- @Override
- public void testEnded(TestIdentifier test, Map<String, String> testMetrics) {
- if (mCurrentIssue != null) {
- mReporterService.submit(mCurrentIssue);
- mCurrentIssue = null;
- }
- }
-
- @Override
- public void testRunEnded(long elapsedTime, Map<String, String> runMetrics) {
- setDeviceMetrics(runMetrics);
- }
-
- /** Set device information. Populated once when the device info app runs. */
- private void setDeviceMetrics(Map<String, String> metrics) {
- if (metrics.containsKey(BUILD_ID_KEY)) {
- mBuildId = metrics.get(BUILD_ID_KEY);
- }
- if (metrics.containsKey(BUILD_TYPE_KEY)) {
- mBuildType = metrics.get(BUILD_TYPE_KEY);
- }
- if (metrics.containsKey(PRODUCT_NAME_KEY)) {
- mProductName = metrics.get(PRODUCT_NAME_KEY);
- }
- }
-
- @Override
- public void invocationEnded(long elapsedTime) {
- try {
- mReporterService.shutdown();
- if (!mReporterService.awaitTermination(1, TimeUnit.MINUTES)) {
- CLog.i("Some issues could not be reported...");
- }
- } catch (InterruptedException e) {
- CLog.e(e);
- }
- }
-
- class Issue implements Callable<Void> {
-
- private String mTestName;
- private String mStackTrace;
- private byte[] mBugReport;
-
- @Override
- public Void call() throws Exception {
- if (isEmpty(mServerUrl)
- || isEmpty(mBuildId)
- || isEmpty(mBuildType)
- || isEmpty(mProductName)
- || isEmpty(mTestName)
- || isEmpty(mStackTrace)) {
- return null;
- }
-
- new MultipartForm(mServerUrl)
- .addFormValue("productName", mProductName)
- .addFormValue("buildType", mBuildType)
- .addFormValue("buildId", mBuildId)
- .addFormValue("testName", mTestName)
- .addFormValue("stackTrace", mStackTrace)
- .addFormFile("bugReport", "bugreport.txt.gz", mBugReport)
- .submit();
-
- return null;
- }
-
- private boolean isEmpty(String value) {
- return value == null || value.trim().isEmpty();
- }
- }
-
- @Override
- public void invocationStarted(IBuildInfo buildInfo) {
- }
-
- @Override
- public void testRunStarted(String id, int numTests) {
- }
-
- @Override
- public void testStarted(TestIdentifier test) {
- }
-
- @Override
- public void testRunFailed(String arg0) {
- }
-
- @Override
- public void testRunStopped(long elapsedTime) {
- }
-
- @Override
- public void invocationFailed(Throwable cause) {
- }
-
- @Override
- public TestSummary getSummary() {
- return null;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/MultipartForm.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/MultipartForm.java
deleted file mode 100644
index f3ef0bb..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/MultipartForm.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-/** MultipartForm builds a multipart form and submits it. */
-class MultipartForm {
-
- private static final String FORM_DATA_BOUNDARY = "C75I55u3R3p0r73r";
-
- private final String mServerUrl;
-
- private final Map<String, String> mFormValues = new HashMap<String, String>();
-
- private String mName;
- private String mFileName;
- private byte[] mData;
-
- public MultipartForm(String serverUrl) {
- mServerUrl = serverUrl;
- }
-
- public MultipartForm addFormValue(String name, String value) {
- mFormValues.put(name, value);
- return this;
- }
-
- public MultipartForm addFormFile(String name, String fileName, byte[] data) {
- mName = name;
- mFileName = fileName;
- mData = data;
- return this;
- }
-
- public void submit() throws IOException {
- String redirectUrl = submitForm(mServerUrl);
- if (redirectUrl != null) {
- submitForm(redirectUrl);
- }
- }
-
- /**
- * @param serverUrl to post the data to
- * @return a url if the server redirected to another url
- * @throws IOException
- */
- private String submitForm(String serverUrl) throws IOException {
- HttpURLConnection connection = null;
- try {
- URL url = new URL(serverUrl);
- connection = (HttpURLConnection) url.openConnection();
- connection.setInstanceFollowRedirects(false);
- connection.setRequestMethod("POST");
- connection.setDoOutput(true);
- connection.setRequestProperty("Content-Type",
- "multipart/form-data; boundary=" + FORM_DATA_BOUNDARY);
-
- byte[] body = getContentBody();
- connection.setRequestProperty("Content-Length", Integer.toString(body.length));
-
- OutputStream output = connection.getOutputStream();
- try {
- output.write(body);
- } finally {
- output.close();
- }
-
- // Open the stream to get a response. Otherwise request will be cancelled.
- InputStream input = connection.getInputStream();
- input.close();
-
- if (connection.getResponseCode() == 302) {
- return connection.getHeaderField("Location");
- }
- } finally {
- if (connection != null) {
- connection.disconnect();
- }
- }
-
- return null;
- }
-
- private byte[] getContentBody() throws IOException {
- ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
- PrintWriter writer = new PrintWriter(new OutputStreamWriter(byteOutput));
- writer.println();
-
- for (Map.Entry<String, String> formValue : mFormValues.entrySet()) {
- writeFormField(writer, formValue.getKey(), formValue.getValue());
- }
-
- if (mData != null) {
- writeFormFileHeader(writer, mName, mFileName);
- writer.flush(); // Must flush here before writing to the byte stream!
- byteOutput.write(mData);
- writer.println();
- }
- writer.append("--").append(FORM_DATA_BOUNDARY).println("--");
- writer.flush();
- writer.close();
- return byteOutput.toByteArray();
- }
-
- private void writeFormField(PrintWriter writer, String name, String value) {
- writer.append("--").println(FORM_DATA_BOUNDARY);
- writer.append("Content-Disposition: form-data; name=\"").append(name).println("\"");
- writer.println();
- writer.println(value);
- }
-
- private void writeFormFileHeader(PrintWriter writer, String name, String fileName) {
- writer.append("--").println(FORM_DATA_BOUNDARY);
- writer.append("Content-Disposition: form-data; name=\"").append(name);
- writer.append("\"; filename=\"").append(fileName).println("\"");
- writer.println("Content-Type: application/x-gzip");
- writer.println("Content-Transfer-Encoding: binary");
- writer.println();
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/PlanCreator.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/PlanCreator.java
deleted file mode 100644
index 0926635..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/PlanCreator.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.cts.tradefed.testtype.CtsTest;
-import com.android.cts.tradefed.testtype.ITestPackageDef;
-import com.android.cts.tradefed.testtype.ITestPackageRepo;
-import com.android.cts.tradefed.testtype.ITestPlan;
-import com.android.cts.tradefed.testtype.TestPackageRepo;
-import com.android.cts.tradefed.testtype.TestPlan;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.Log.LogLevel;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.log.LogUtil.CLog;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * Class for creating test plans from CTS result XML.
- */
-public class PlanCreator {
-
- @Option (name = "plan", shortName = 'p', description = "the name of the plan to create",
- importance=Importance.IF_UNSET)
- private String mPlanName = null;
-
- @Option (name = "session", shortName = 's', description = "the session id to derive from",
- importance=Importance.IF_UNSET)
- private Integer mSessionId = null;
-
- @Option (name = "result", shortName = 'r',
- description = "the result type to filter. One of pass, fail, notExecuted.",
- importance=Importance.IF_UNSET)
- private String mResultFilterString = null;
-
- @Option(name = CtsTest.RUN_KNOWN_FAILURES_OPTION)
- private boolean mIncludeKnownFailures = false;
-
- private CtsTestStatus mResultFilter = null;
- private TestResults mResult = null;
-
- private File mPlanFile;
-
- /**
- * Create an empty {@link PlanCreator}.
- * <p/>
- * All {@link Option} fields must be populated via
- * {@link com.android.tradefed.config.ArgsOptionParser}
- */
- public PlanCreator() {
- }
-
- /**
- * Create a {@link PlanCreator} using the specified option values.
- */
- public PlanCreator(String planName, int session, CtsTestStatus result) {
- mPlanName = planName;
- mSessionId = session;
- mResultFilterString = result.getValue();
- }
-
- /**
- * Create and serialize a test plan derived from a result.
- * <p/>
- * {@link Option} values must all be set before this is called.
- * @throws ConfigurationException
- */
- public void createAndSerializeDerivedPlan(CtsBuildHelper build, Set<String> abis)
- throws ConfigurationException {
- ITestPlan derivedPlan = createDerivedPlan(build, abis);
- if (derivedPlan != null) {
- try {
- derivedPlan.serialize(new BufferedOutputStream(new FileOutputStream(mPlanFile)));
- } catch (IOException e) {
- Log.logAndDisplay(LogLevel.ERROR, "", String.format("Failed to create plan file %s",
- mPlanName));
- CLog.e(e);
- }
- }
- }
-
- /**
- * Create a test plan derived from a result.
- * <p/>
- * {@link Option} values must all be set before this is called.
- *
- * @param build
- * @return test plan
- * @throws ConfigurationException
- */
- public ITestPlan createDerivedPlan(CtsBuildHelper build, Set<String> abis)
- throws ConfigurationException {
- checkFields(build);
- ITestPackageRepo pkgDefRepo =
- new TestPackageRepo(build.getTestCasesDir(), mIncludeKnownFailures);
- ITestPlan derivedPlan = new TestPlan(mPlanName, abis);
- for (TestPackageResult pkg : mResult.getPackages()) {
- Collection<TestIdentifier> filteredTests = pkg.getTestsWithStatus(mResultFilter);
- String pkgId = pkg.getId();
- ITestPackageDef pkgDef = pkgDefRepo.getTestPackage(pkgId);
- if (pkgDef != null) {
- Collection<TestIdentifier> excludedTests =
- new LinkedHashSet<TestIdentifier>(pkgDef.getTests());
- excludedTests.removeAll(filteredTests);
- derivedPlan.addPackage(pkgId);
- derivedPlan.addExcludedTests(pkgId, excludedTests);
- } else {
- CLog.e("Could not find package %s in repository", pkgId);
- }
- }
- return derivedPlan;
- }
-
- /**
- * Check that all {@Option}s have been populated with valid values.
- * @param build
- * @throws ConfigurationException if any option has an invalid value
- */
- private void checkFields(CtsBuildHelper build) throws ConfigurationException {
- if (mSessionId == null) {
- throw new ConfigurationException("Missing --session argument");
- }
- ITestResultRepo repo = new TestResultRepo(build.getResultsDir());
- mResult = repo.getResult(mSessionId);
- if (mResult == null) {
- throw new ConfigurationException(String.format("Could not find session with id %d",
- mSessionId));
- }
- if (mResultFilterString == null) {
- throw new ConfigurationException("Missing --result argument");
- }
- mResultFilter = CtsTestStatus.getStatus(mResultFilterString);
- if (mResultFilter == null) {
- throw new ConfigurationException(
- "Invalid result argument. Expected one of pass,fail,notExecuted");
- }
- if (mPlanName == null) {
- throw new ConfigurationException("Missing --plan argument");
- }
- try {
- mPlanFile = build.getTestPlanFile(mPlanName);
- if (mPlanFile.exists()) {
- throw new ConfigurationException(String.format("Test plan %s already exists",
- mPlanName));
- }
- } catch (FileNotFoundException e) {
- throw new ConfigurationException("Could not find plans directory");
- }
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/ResultReporter.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/ResultReporter.java
deleted file mode 100644
index 39969d3..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/ResultReporter.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.annotation.Nullable;
-
-/**
- * Class that sends a HTTP POST multipart/form-data request containing
- * the test result XML.
- */
-class ResultReporter {
-
- private static final int RESULT_XML_BYTES = 500 * 1024;
-
- private final String mServerUrl;
- private final String mSuiteName;
-
- ResultReporter(String serverUrl, String suiteName) {
- mServerUrl = serverUrl;
- mSuiteName = suiteName;
- }
-
- public void reportResult(File reportFile, @Nullable String referenceUrl) throws IOException {
- if (isEmpty(mServerUrl)) {
- return;
- }
-
- InputStream input = new FileInputStream(reportFile);
- try {
- byte[] data = IssueReporter.getBytes(input, RESULT_XML_BYTES);
- MultipartForm multipartForm = new MultipartForm(mServerUrl)
- .addFormValue("suite", mSuiteName)
- .addFormFile("resultXml", "testResult.xml.gz", data);
- if (!isEmpty(referenceUrl)) {
- multipartForm.addFormValue("referenceUrl", referenceUrl);
- }
- multipartForm.submit();
- } finally {
- input.close();
- }
- }
-
- private static boolean isEmpty(String value) {
- return value == null || value.trim().isEmpty();
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/Test.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/Test.java
deleted file mode 100644
index e25ea5a..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/Test.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.compatibility.common.util.MetricsXmlSerializer;
-import com.android.compatibility.common.util.ReportLog;
-import com.android.cts.tradefed.result.TestLog.TestLogType;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Data structure that represents a "Test" result XML element.
- */
-class Test extends AbstractXmlPullParser {
- static final String TAG = "Test";
- private static final String NAME_ATTR = "name";
- private static final String MESSAGE_ATTR = "message";
- private static final String ENDTIME_ATTR = "endtime";
- private static final String STARTTIME_ATTR = "starttime";
- private static final String RESULT_ATTR = "result";
- private static final String SCENE_TAG = "FailedScene";
- private static final String STACK_TAG = "StackTrace";
- private String mName;
- private CtsTestStatus mResult;
- private String mStartTime;
- private String mEndTime;
- private String mMessage;
- private String mStackTrace;
- private ReportLog mReport;
-
- /**
- * Log info for this test like a logcat dump or bugreport.
- * Use *Locked methods instead of mutating this directly.
- */
- private List<TestLog> mTestLogs;
-
- /**
- * Create an empty {@link Test}
- */
- public Test() {
- }
-
- /**
- * Create a {@link Test}.
- *
- * @param name
- */
- public Test(String name) {
- mName = name;
- mResult = CtsTestStatus.NOT_EXECUTED;
- mStartTime = TimeUtil.getTimestamp();
- updateEndTime();
- }
-
- /**
- * Add a test log to this Test.
- */
- public void addTestLog(TestLog testLog) {
- addTestLogLocked(testLog);
- }
-
- /**
- * Set the name of this {@link Test}
- */
- public void setName(String name) {
- mName = name;
- }
-
- /**
- * Get the name of this {@link Test}
- */
- public String getName() {
- return mName;
- }
-
- public CtsTestStatus getResult() {
- return mResult;
- }
-
- public String getMessage() {
- return mMessage;
- }
-
- public void setMessage(String message) {
- mMessage = message;
- }
-
- public String getStartTime() {
- return mStartTime;
- }
-
- public String getEndTime() {
- return mEndTime;
- }
-
- public String getStackTrace() {
- return mStackTrace;
- }
-
- public void setStackTrace(String stackTrace) {
-
- mStackTrace = sanitizeStackTrace(stackTrace);
- mMessage = getFailureMessageFromStackTrace(mStackTrace);
- }
-
- public ReportLog getReportLog() {
- return mReport;
- }
-
- public void setReportLog(ReportLog report) {
- mReport = report;
- }
-
- public void updateEndTime() {
- mEndTime = TimeUtil.getTimestamp();
- }
-
- public void setResultStatus(CtsTestStatus status) {
- mResult = status;
- }
-
- /**
- * Serialize this object and all its contents to XML.
- *
- * @param serializer
- * @throws IOException
- */
- public void serialize(KXmlSerializer serializer)
- throws IOException {
- serializer.startTag(CtsXmlResultReporter.ns, TAG);
- serializer.attribute(CtsXmlResultReporter.ns, NAME_ATTR, getName());
- serializer.attribute(CtsXmlResultReporter.ns, RESULT_ATTR, mResult.getValue());
- serializer.attribute(CtsXmlResultReporter.ns, STARTTIME_ATTR, mStartTime);
- serializer.attribute(CtsXmlResultReporter.ns, ENDTIME_ATTR, mEndTime);
-
- serializeTestLogsLocked(serializer);
-
- if (mMessage != null) {
- serializer.startTag(CtsXmlResultReporter.ns, SCENE_TAG);
- serializer.attribute(CtsXmlResultReporter.ns, MESSAGE_ATTR, mMessage);
- if (mStackTrace != null) {
- serializer.startTag(CtsXmlResultReporter.ns, STACK_TAG);
- serializer.text(mStackTrace);
- serializer.endTag(CtsXmlResultReporter.ns, STACK_TAG);
- }
- serializer.endTag(CtsXmlResultReporter.ns, SCENE_TAG);
- }
- MetricsXmlSerializer metricsXmlSerializer = new MetricsXmlSerializer(serializer);
- metricsXmlSerializer.serialize(mReport);
- serializer.endTag(CtsXmlResultReporter.ns, TAG);
- }
-
- /**
- * Strip out any invalid XML characters that might cause the report to be unviewable.
- * http://www.w3.org/TR/REC-xml/#dt-character
- */
- private static String sanitizeStackTrace(String trace) {
- if (trace != null) {
- return trace.replaceAll("[^\\u0009\\u000A\\u000D\\u0020-\\uD7FF\\uE000-\\uFFFD]", "");
- } else {
- return null;
- }
- }
-
- /**
- * Gets the failure message to show from the stack trace.
- * <p/>
- * Exposed for unit testing
- *
- * @param stack the full stack trace
- * @return the failure message
- */
- static String getFailureMessageFromStackTrace(String stack) {
- // return the first two lines of stack as failure message
- int endPoint = stack.indexOf('\n');
- if (endPoint != -1) {
- int nextLine = stack.indexOf('\n', endPoint + 1);
- if (nextLine != -1) {
- return stack.substring(0, nextLine);
- }
- }
- return stack;
- }
-
- /**
- * Populates this class with test result data parsed from XML.
- *
- * @param parser the {@link XmlPullParser}. Expected to be pointing at start
- * of a Test tag
- */
- @Override
- void parse(XmlPullParser parser) throws XmlPullParserException, IOException {
- if (!parser.getName().equals(TAG)) {
- throw new XmlPullParserException(String.format(
- "invalid XML: Expected %s tag but received %s", TAG, parser.getName()));
- }
- setName(getAttribute(parser, NAME_ATTR));
- mResult = CtsTestStatus.getStatus(getAttribute(parser, RESULT_ATTR));
- mStartTime = getAttribute(parser, STARTTIME_ATTR);
- mEndTime = getAttribute(parser, ENDTIME_ATTR);
-
- int eventType = parser.next();
- while (eventType != XmlPullParser.END_DOCUMENT) {
- if (eventType == XmlPullParser.START_TAG && parser.getName().equals(SCENE_TAG)) {
- mMessage = getAttribute(parser, MESSAGE_ATTR);
- } else if (eventType == XmlPullParser.START_TAG && parser.getName().equals(STACK_TAG)) {
- mStackTrace = parser.nextText();
- } else if (eventType == XmlPullParser.START_TAG && TestLog.isTag(parser.getName())) {
- parseTestLog(parser);
- } else if (eventType == XmlPullParser.END_TAG && parser.getName().equals(TAG)) {
- return;
- }
- eventType = parser.next();
- }
- }
-
- /** Parse a TestLog entry from the parser positioned at a TestLog tag. */
- private void parseTestLog(XmlPullParser parser) throws XmlPullParserException{
- TestLog log = TestLog.fromXml(parser);
- if (log == null) {
- throw new XmlPullParserException("invalid XML: bad test log tag");
- }
- addTestLog(log);
- }
-
- /** Add a TestLog to the test in a thread safe manner. */
- private synchronized void addTestLogLocked(TestLog testLog) {
- if (mTestLogs == null) {
- mTestLogs = new ArrayList<>(TestLogType.values().length);
- }
- mTestLogs.add(testLog);
- }
-
- /** Serialize the TestLogs of this test in a thread safe manner. */
- private synchronized void serializeTestLogsLocked(KXmlSerializer serializer) throws IOException {
- if (mTestLogs != null) {
- for (TestLog log : mTestLogs) {
- log.serialize(serializer);
- }
- }
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestCase.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/TestCase.java
deleted file mode 100644
index fdb8b3b..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestCase.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.util.ArrayUtil;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Deque;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Data structure that represents a "TestCase" XML element and its children.
- */
-class TestCase extends AbstractXmlPullParser {
-
- static final String TAG = "TestCase";
-
- private String mName;
-
- Map<String, Test> mChildTestMap = new LinkedHashMap<String, Test>();
-
- /**
- * Create a {@link TestCase}
- * @param testCaseName
- */
- public TestCase(String testCaseName) {
- setName(testCaseName);
- }
-
- public TestCase() {
- }
-
- public void setName(String name) {
- mName = name;
- }
-
- public String getName() {
- return mName;
- }
-
- /**
- * Gets the child tests
- */
- public Collection<Test> getTests() {
- return mChildTestMap.values();
- }
-
- /**
- * @param testName
- * @param insertIfMissing
- * @return
- */
- public Test findTest(String testName, boolean insertIfMissing) {
- Test t = mChildTestMap.get(testName);
- if (t == null && insertIfMissing) {
- t = new Test(testName);
- mChildTestMap.put(t.getName(), t);
- }
- return t;
- }
-
- /**
- * Serialize this object and all its contents to XML.
- *
- * @param serializer
- * @throws IOException
- */
- public void serialize(KXmlSerializer serializer) throws IOException {
- serializer.startTag(CtsXmlResultReporter.ns, TAG);
- serializer.attribute(CtsXmlResultReporter.ns, "name", getName());
- // unused
- serializer.attribute(CtsXmlResultReporter.ns, "priority", "");
- for (Test t : mChildTestMap.values()) {
- t.serialize(serializer);
- }
- serializer.endTag(CtsXmlResultReporter.ns, TAG);
- }
-
- /**
- * Populates this class with test case result data parsed from XML.
- *
- * @param parser the {@link XmlPullParser}. Expected to be pointing at start
- * of a TestCase tag
- */
- @Override
- void parse(XmlPullParser parser) throws XmlPullParserException, IOException {
- if (!parser.getName().equals(TAG)) {
- throw new XmlPullParserException(String.format(
- "invalid XML: Expected %s tag but received %s", TAG, parser.getName()));
- }
- setName(getAttribute(parser, "name"));
- int eventType = parser.next();
- while (eventType != XmlPullParser.END_DOCUMENT) {
- if (eventType == XmlPullParser.START_TAG && parser.getName().equals(Test.TAG)) {
- Test test = new Test();
- test.parse(parser);
- mChildTestMap.put(test.getName(), test);
- } else if (eventType == XmlPullParser.END_TAG && parser.getName().equals(TAG)) {
- return;
- }
- eventType = parser.next();
- }
- }
-
- /**
- * Adds tests contained in this result that have the given <var>resultFilter</var>.
- *
- * @param tests the {@link Collection} of {@link TestIdentifier}s to add to
- * @param parentSuiteNames a {@link Deque} of parent suite names. Used to
- * construct the full class name of the test
- * @param resultFilter the {@link CtsTestStatus} to filter by
- */
- void addTestsWithStatus(Collection<TestIdentifier> tests, Deque<String> parentSuiteNames,
- CtsTestStatus resultFilter) {
- if (getName() != null) {
- parentSuiteNames.addLast(getName());
- }
- String fullClassName = ArrayUtil.join(".", parentSuiteNames);
- for (Test test : mChildTestMap.values()) {
- if (resultFilter.equals(test.getResult())) {
- tests.add(new TestIdentifier(fullClassName, test.getName()));
- }
- }
- if (getName() != null) {
- parentSuiteNames.removeLast();
- }
- }
-
- /**
- * Count the number of tests in this {@link TestCase} with given status.
- *
- * @param status
- * @return the test count
- */
- public int countTests(CtsTestStatus status) {
- int total = 0;
- for (Test test : mChildTestMap.values()) {
- if (test.getResult().equals(status)) {
- total++;
- }
- }
- return total;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestLog.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/TestLog.java
deleted file mode 100644
index 1210432..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestLog.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.cts.tradefed.result;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xmlpull.v1.XmlPullParser;
-
-import java.io.IOException;
-
-import javax.annotation.Nullable;
-
-/**
- * TestLog describes a log for a test. It corresponds to the "TestLog" XML element.
- */
-class TestLog {
-
- private static final String TAG = "TestLog";
- private static final String TYPE_ATTR = "type";
- private static final String URL_ATTR = "url";
-
- /** Type of log. */
- public enum TestLogType {
- LOGCAT("logcat-"),
- BUGREPORT("bug-"),
-
- ;
-
- // This enum restricts the type of logs reported back to the server,
- // because we do not intend to support them all. Using an enum somewhat
- // assures that we will only see these expected types on the server side.
-
- /**
- * Returns the TestLogType from an ILogSaver data name or null
- * if the data name is not supported.
- */
- @Nullable
- static TestLogType fromDataName(String dataName) {
- if (dataName == null) {
- return null;
- }
-
- for (TestLogType type : values()) {
- if (dataName.startsWith(type.dataNamePrefix)) {
- return type;
- }
- }
- return null;
- }
-
- private final String dataNamePrefix;
-
- private TestLogType(String dataNamePrefix) {
- this.dataNamePrefix = dataNamePrefix;
- }
-
- String getAttrValue() {
- return name().toLowerCase();
- }
- }
-
- /** Type of the log like LOGCAT or BUGREPORT. */
- private final TestLogType mLogType;
-
- /** Url pointing to the log file. */
- private final String mUrl;
-
- /** Create a TestLog from an ILogSaver callback. */
- @Nullable
- static TestLog fromDataName(String dataName, String url) {
- TestLogType logType = TestLogType.fromDataName(dataName);
- if (logType == null) {
- return null;
- }
-
- if (url == null) {
- return null;
- }
-
- return new TestLog(logType, url);
- }
-
- /** Create a TestLog from XML given a XmlPullParser positioned at the TestLog tag. */
- @Nullable
- static TestLog fromXml(XmlPullParser parser) {
- String type = parser.getAttributeValue(null, TYPE_ATTR);
- if (type == null) {
- return null;
- }
-
- String url = parser.getAttributeValue(null, URL_ATTR);
- if (url == null) {
- return null;
- }
-
- try {
- TestLogType logType = TestLogType.valueOf(type.toUpperCase());
- return new TestLog(logType, url);
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
-
- /** Create a TestLog directly given a log type and url. */
- public static TestLog of(TestLogType logType, String url) {
- return new TestLog(logType, url);
- }
-
- private TestLog(TestLogType logType, String url) {
- this.mLogType = logType;
- this.mUrl = url;
- }
-
- /** Returns this TestLog's log type. */
- TestLogType getLogType() {
- return mLogType;
- }
-
- /** Returns this TestLog's URL. */
- String getUrl() {
- return mUrl;
- }
-
- /** Serialize the TestLog to XML. */
- public void serialize(KXmlSerializer serializer) throws IOException {
- serializer.startTag(CtsXmlResultReporter.ns, TAG);
- serializer.attribute(CtsXmlResultReporter.ns, TYPE_ATTR, mLogType.getAttrValue());
- serializer.attribute(CtsXmlResultReporter.ns, URL_ATTR, mUrl);
- serializer.endTag(CtsXmlResultReporter.ns, TAG);
- }
-
- /** Returns true if the tag is a TestLog tag. */
- public static boolean isTag(String tagName) {
- return TAG.equals(tagName);
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestPackageResult.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/TestPackageResult.java
deleted file mode 100644
index 60d8408..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestPackageResult.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.compatibility.common.util.MetricsStore;
-import com.android.compatibility.common.util.ReportLog;
-import com.android.cts.tradefed.testtype.CtsTest;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.log.LogUtil.CLog;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Data structure for a CTS test package result.
- * <p/>
- * Provides methods to serialize to XML.
- */
-class TestPackageResult extends AbstractXmlPullParser {
-
- static final String TAG = "TestPackage";
-
- public static final String RESULT_KEY = "COMPATIBILITY_TEST_RESULT";
-
- private static final String DIGEST_ATTR = "digest";
- private static final String APP_PACKAGE_NAME_ATTR = "appPackageName";
- private static final String NAME_ATTR = "name";
- private static final String ABI_ATTR = "abi";
- private static final String ns = CtsXmlResultReporter.ns;
- private static final String SIGNATURE_TEST_PKG = "android.tests.sigtest";
-
- private String mDeviceSerial;
- private String mAppPackageName;
- private String mName;
- private String mAbi;
- private String mDigest;
-
- private Map<String, String> mMetrics = new HashMap<String, String>();
- private Map<TestIdentifier, Map<String, String>> mTestMetrics = new HashMap<TestIdentifier, Map<String, String>>();
-
- private TestSuite mSuiteRoot = new TestSuite(null);
-
- public void setDeviceSerial(String deviceSerial) {
- mDeviceSerial = deviceSerial;
- }
-
- public String getDeviceSerial() {
- return mDeviceSerial;
- }
-
- public String getId() {
- return AbiUtils.createId(getAbi(), getAppPackageName());
- }
-
- public void setAppPackageName(String appPackageName) {
- mAppPackageName = appPackageName;
- }
-
- public String getAppPackageName() {
- return mAppPackageName;
- }
-
- public void setName(String name) {
- mName = name;
- }
-
- public String getName() {
- return mName;
- }
-
- public void setAbi(String abi) {
- mAbi = abi;
- }
-
- public String getAbi() {
- return mAbi;
- }
-
- public void setDigest(String digest) {
- mDigest = digest;
- }
-
- public String getDigest() {
- return mDigest;
- }
-
- /**
- * Return the {@link TestSuite}s
- */
- public Collection<TestSuite> getTestSuites() {
- return mSuiteRoot.getTestSuites();
- }
-
- /**
- * Adds a test result to this test package
- *
- * @param testId
- */
- public Test insertTest(TestIdentifier testId) {
- return findTest(testId, true);
- }
-
- private Test findTest(TestIdentifier testId, boolean insertIfMissing) {
- List<String> classNameSegments = new LinkedList<String>();
- Collections.addAll(classNameSegments, testId.getClassName().split("\\."));
- if (classNameSegments.size() <= 0) {
- CLog.e("Unrecognized package name format for test class '%s'",
- testId.getClassName());
- // should never happen
- classNameSegments.add("UnknownTestClass");
- }
- String testCaseName = classNameSegments.remove(classNameSegments.size() - 1);
- return mSuiteRoot.findTest(classNameSegments, testCaseName, testId.getTestName(), insertIfMissing);
- }
-
-
- /**
- * Find the test result for given {@link TestIdentifier}.
- * @param testId
- * @return the {@link Test} or <code>null</code>
- */
- public Test findTest(TestIdentifier testId) {
- return findTest(testId, false);
- }
-
- /**
- * Serialize this object and all its contents to XML.
- *
- * @param serializer
- * @throws IOException
- */
- public void serialize(KXmlSerializer serializer) throws IOException {
- serializer.startTag(ns, TAG);
- serializeAttribute(serializer, NAME_ATTR, mName);
- serializeAttribute(serializer, APP_PACKAGE_NAME_ATTR, mAppPackageName);
- serializeAttribute(serializer, ABI_ATTR, mAbi);
- serializeAttribute(serializer, DIGEST_ATTR, getDigest());
- if (SIGNATURE_TEST_PKG.equals(mName)) {
- serializer.attribute(ns, "signatureCheck", "true");
- }
- mSuiteRoot.serialize(serializer);
- serializer.endTag(ns, TAG);
- }
-
- /**
- * Helper method to serialize attributes.
- * Can handle null values. Useful for cases where test package has not been fully populated
- * such as when unit testing.
- *
- * @param attrName
- * @param attrValue
- * @throws IOException
- */
- private void serializeAttribute(KXmlSerializer serializer, String attrName, String attrValue)
- throws IOException {
- attrValue = attrValue == null ? "" : attrValue;
- serializer.attribute(ns, attrName, attrValue);
- }
-
- /**
- * Populates this class with package result data parsed from XML.
- *
- * @param parser the {@link XmlPullParser}. Expected to be pointing at start
- * of TestPackage tag
- */
- @Override
- void parse(XmlPullParser parser) throws XmlPullParserException, IOException {
- if (!parser.getName().equals(TAG)) {
- throw new XmlPullParserException(String.format(
- "invalid XML: Expected %s tag but received %s", TAG, parser.getName()));
- }
- setAppPackageName(getAttribute(parser, APP_PACKAGE_NAME_ATTR));
- setName(getAttribute(parser, NAME_ATTR));
- setAbi(getAttribute(parser, ABI_ATTR));
- setDigest(getAttribute(parser, DIGEST_ATTR));
- int eventType = parser.getEventType();
- while (eventType != XmlPullParser.END_DOCUMENT) {
- if (eventType == XmlPullParser.START_TAG && parser.getName().equals(TestSuite.TAG)) {
- TestSuite suite = new TestSuite();
- suite.parse(parser);
- mSuiteRoot.insertSuite(suite);
- }
- if (eventType == XmlPullParser.END_TAG && parser.getName().equals(TAG)) {
- return;
- }
- eventType = parser.next();
- }
- }
-
- /**
- * Return a list of {@link TestIdentifier}s contained in this result with the given status
- *
- * @param resultFilter the {@link CtsTestStatus} to filter by
- * @return a collection of {@link TestIdentifier}s
- */
- public Collection<TestIdentifier> getTestsWithStatus(CtsTestStatus resultFilter) {
- Collection<TestIdentifier> tests = new LinkedList<TestIdentifier>();
- Deque<String> suiteNames = new LinkedList<String>();
- mSuiteRoot.addTestsWithStatus(tests, suiteNames, resultFilter);
- return tests;
- }
-
- /**
- * Populate values in this package result from run metrics
- * @param metrics A map of metrics from the completed test run.
- */
- public void populateMetrics(Map<String, String> metrics) {
- String name = metrics.get(CtsTest.PACKAGE_NAME_METRIC);
- if (name != null) {
- setName(name);
- }
- String abi = metrics.get(CtsTest.PACKAGE_ABI_METRIC);
- if (abi != null) {
- setAbi(abi);
- }
- String digest = metrics.get(CtsTest.PACKAGE_DIGEST_METRIC);
- if (digest != null) {
- setDigest(digest);
- }
- mMetrics.putAll(metrics);
-
- // Collect performance results
- for (TestIdentifier test : mTestMetrics.keySet()) {
- // device test can have performance results in test metrics
- String perfResult = mTestMetrics.get(test).get(RESULT_KEY);
- ReportLog report = null;
- if (perfResult != null) {
- try {
- report = ReportLog.parse(perfResult);
- } catch (XmlPullParserException | IOException e) {
- e.printStackTrace();
- }
- }
- Test result = findTest(test);
- if (report != null && !result.getResult().equals(CtsTestStatus.FAIL)) {
- result.setResultStatus(CtsTestStatus.PASS);
- result.setReportLog(report);
- }
- }
- }
-
- /**
- * Report the given test as a failure.
- *
- * @param test
- * @param status
- * @param trace
- */
- public void reportTestFailure(TestIdentifier test, CtsTestStatus status, String trace) {
- Test result = findTest(test);
- result.setResultStatus(status);
- result.setStackTrace(trace);
- }
-
- /**
- * Report that the given test has completed.
- *
- * @param test The {@link TestIdentifier} of the completed test.
- * @param testMetrics A map holding metrics about the completed test, if any.
- */
- public void reportTestEnded(TestIdentifier test, Map<String, String> testMetrics) {
- Test result = findTest(test);
- if (!result.getResult().equals(CtsTestStatus.FAIL)) {
- result.setResultStatus(CtsTestStatus.PASS);
- }
- result.updateEndTime();
- if (mTestMetrics.containsKey(test)) {
- CLog.e("Test metrics already contains key: " + test);
- }
- mTestMetrics.put(test, testMetrics);
- CLog.i("Test metrics:" + testMetrics);
- }
-
- /**
- * Return the number of tests with given status
- *
- * @param status
- * @return the total number of tests with given status
- */
- public int countTests(CtsTestStatus status) {
- return mSuiteRoot.countTests(status);
- }
-
- /**
- * @return A map holding the metrics from the test run.
- */
- public Map<String, String> getMetrics() {
- return mMetrics;
- }
-
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestResultRepo.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/TestResultRepo.java
deleted file mode 100644
index fd42892..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestResultRepo.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * An implementation of {@link ITestResultsRepo}.
- */
-public class TestResultRepo implements ITestResultRepo {
-
- /**
- * ordered list of result directories. the index of each file is its session id.
- */
- private List<File> mResultDirs;
-
- /**
- * Create a {@link TestResultRepo} from a directory of results
- *
- * @param testResultsDir the parent directory of results
- */
- public TestResultRepo(File testResultsDir) {
- mResultDirs = new ArrayList<File>();
- File[] resultArray = testResultsDir.listFiles(new ResultDirFilter());
- if (resultArray != null) {
- List<File> resultList = new ArrayList<File>();
- Collections.addAll(resultList, resultArray);
- Collections.sort(resultList, new FileComparator());
- for (int i=0; i < resultList.size(); i++) {
- File resultFile = new File(resultList.get(i),
- CtsXmlResultReporter.TEST_RESULT_FILE_NAME);
- if (resultFile.exists()) {
- mResultDirs.add(resultList.get(i));
- }
- }
- }
- }
-
- @Override
- public File getReportDir(int sessionId) {
- return mResultDirs.get(sessionId);
- }
-
- private ITestSummary parseSummary(int id, File resultDir) {
- TestSummaryXml result = new TestSummaryXml(id, resultDir.getName());
- try {
- result.parse(new BufferedReader(new FileReader(new File(resultDir,
- CtsXmlResultReporter.TEST_RESULT_FILE_NAME))));
- return result;
- } catch (ParseException e) {
- CLog.e(e);
- } catch (FileNotFoundException e) {
- // should never happen, since we check for file existence above. Barf the stack trace
- CLog.e(e);
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<ITestSummary> getSummaries() {
- // parsing the summary data should be relatively quick, so just parse it every time
- // rather than caching it
- List<ITestSummary> summaries = new ArrayList<ITestSummary>(mResultDirs.size());
- for (int i = 0; i < mResultDirs.size(); i++) {
- summaries.add(parseSummary(i, mResultDirs.get(i)));
- }
- return summaries;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public TestResults getResult(int sessionId) {
- // TODO: consider caching the results in future
- if (mResultDirs.size() <= sessionId) {
- CLog.e("Session id %d does not exist", sessionId);
- return null;
- }
- try {
- TestResults results = new TestResults();
- File resultFile = new File(mResultDirs.get(sessionId),
- CtsXmlResultReporter.TEST_RESULT_FILE_NAME);
- results.parse(new BufferedReader(new FileReader(resultFile)));
- return results;
- } catch (FileNotFoundException e) {
- CLog.e("Could not find result file for session %d", sessionId);
- } catch (ParseException e) {
- CLog.e("Failed to parse result file for session %d", sessionId);
- }
- return null;
- }
-
- private class ResultDirFilter implements FileFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean accept(File file) {
- return file.isDirectory();
- }
- }
-
- /**
- * A {@link Comparator} that compares {@link File}s by name.
- */
- private class FileComparator implements Comparator<File> {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int compare(File file0, File file1) {
- return file0.getName().compareTo(file1.getName());
- }
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestResults.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/TestResults.java
deleted file mode 100644
index a3f1591..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestResults.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.result;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.build.CtsBuildProvider;
-import com.android.tradefed.log.LogUtil.CLog;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Data structure for the detailed CTS test results.
- * <p/>
- * Can deserialize results for test packages from XML
- */
-class TestResults extends AbstractXmlPullParser {
-
- private static final String ns = CtsXmlResultReporter.ns;
-
- // XML constants
- static final String SUMMARY_TAG = "Summary";
- static final String PASS_ATTR = "pass";
- static final String TIMEOUT_ATTR = "timeout";
- static final String NOT_EXECUTED_ATTR = "notExecuted";
- static final String FAILED_ATTR = "failed";
-
- private Map<String, TestPackageResult> mPackageResults =
- new LinkedHashMap<String, TestPackageResult>();
- private DeviceInfoResult mDeviceInfo = new DeviceInfoResult();
-
- /**
- * {@inheritDoc}
- */
- @Override
- void parse(XmlPullParser parser) throws XmlPullParserException, IOException {
- int eventType = parser.getEventType();
- while (eventType != XmlPullParser.END_DOCUMENT) {
- if (eventType == XmlPullParser.START_TAG && parser.getName().equals(
- DeviceInfoResult.TAG)) {
- mDeviceInfo.parse(parser);
- }
- if (eventType == XmlPullParser.START_TAG && parser.getName().equals(
- TestPackageResult.TAG)) {
- TestPackageResult pkg = new TestPackageResult();
- pkg.parse(parser);
- if (pkg.getId() != null) {
- mPackageResults.put(pkg.getId(), pkg);
- } else {
- CLog.w("Found package with no id");
- }
- }
- eventType = parser.next();
- }
- }
-
- /**
- * @return the list of {@link TestPackageResult}.
- */
- public Collection<TestPackageResult> getPackages() {
- return mPackageResults.values();
- }
-
- /**
- * Count the number of tests with given status
- * @param status
- */
- public int countTests(CtsTestStatus status) {
- int total = 0;
- for (TestPackageResult result : mPackageResults.values()) {
- total += result.countTests(status);
- }
- return total;
- }
-
- /**
- * Serialize the test results to XML.
- *
- * @param serializer
- * @throws IOException
- */
- public void serialize(KXmlSerializer serializer, String buildId) throws IOException {
- mDeviceInfo.serialize(serializer);
- serializeHostInfo(serializer, buildId);
- serializeTestSummary(serializer);
- // sort before serializing
- List<TestPackageResult> pkgs = new ArrayList<TestPackageResult>(mPackageResults.values());
- Collections.sort(pkgs, new PkgComparator());
- for (TestPackageResult r : pkgs) {
- r.serialize(serializer);
- }
- }
-
- /**
- * Output the host info XML.
- *
- * @param serializer
- */
- private void serializeHostInfo(KXmlSerializer serializer, String buildId) throws IOException {
- serializer.startTag(ns, "HostInfo");
-
- String hostName = "";
- try {
- hostName = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException ignored) {}
- serializer.attribute(ns, "name", hostName);
-
- serializer.startTag(ns, "Os");
- serializer.attribute(ns, "name", System.getProperty("os.name"));
- serializer.attribute(ns, "version", System.getProperty("os.version"));
- serializer.attribute(ns, "arch", System.getProperty("os.arch"));
- serializer.endTag(ns, "Os");
-
- serializer.startTag(ns, "Java");
- serializer.attribute(ns, "name", System.getProperty("java.vendor"));
- serializer.attribute(ns, "version", System.getProperty("java.version"));
- serializer.endTag(ns, "Java");
-
- serializer.startTag(ns, "Cts");
- serializer.attribute(ns, "version", CtsBuildProvider.CTS_BUILD_VERSION);
- serializer.attribute(ns, "build", buildId);
- // TODO: consider outputting other tradefed options here
- serializer.startTag(ns, "IntValue");
- serializer.attribute(ns, "name", "testStatusTimeoutMs");
- // TODO: create a constant variable for testStatusTimeoutMs value. Currently it cannot be
- // changed
- serializer.attribute(ns, "value", "600000");
- serializer.endTag(ns, "IntValue");
- serializer.endTag(ns, "Cts");
-
- serializer.endTag(ns, "HostInfo");
- }
-
- /**
- * Output the test summary XML containing summary totals for all tests.
- *
- * @param serializer
- * @throws IOException
- */
- private void serializeTestSummary(KXmlSerializer serializer) throws IOException {
- serializer.startTag(ns, SUMMARY_TAG);
- serializer.attribute(ns, FAILED_ATTR, Integer.toString(countTests(CtsTestStatus.FAIL)));
- serializer.attribute(ns, NOT_EXECUTED_ATTR,
- Integer.toString(countTests(CtsTestStatus.NOT_EXECUTED)));
- // ignore timeouts - these are reported as errors
- serializer.attribute(ns, TIMEOUT_ATTR, "0");
- serializer.attribute(ns, PASS_ATTR, Integer.toString(countTests(CtsTestStatus.PASS)));
- serializer.endTag(ns, SUMMARY_TAG);
- }
-
- private static class PkgComparator implements Comparator<TestPackageResult> {
-
- @Override
- public int compare(TestPackageResult lhs, TestPackageResult rhs) {
- return lhs.getId().compareTo(rhs.getId());
- }
- }
-
- /**
- * Return existing package with given id. If not found, create a new one.
- * @param id
- * @return
- */
- public TestPackageResult getOrCreatePackage(String id) {
- TestPackageResult pkgResult = mPackageResults.get(id);
- if (pkgResult == null) {
- pkgResult = new TestPackageResult();
- String[] abiAndName = AbiUtils.parseId(id);
- pkgResult.setAbi(abiAndName[0]);
- pkgResult.setAppPackageName(abiAndName[1]);
- mPackageResults.put(id, pkgResult);
- }
- return pkgResult;
- }
-
- /**
- * Populate the results with collected device info metrics.
- * @param runMetrics
- */
- public void populateDeviceInfoMetrics(Map<String, String> runMetrics) {
- mDeviceInfo.populateMetrics(runMetrics);
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestSuite.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/TestSuite.java
deleted file mode 100644
index ca287ca..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestSuite.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.ddmlib.testrunner.TestIdentifier;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Deque;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Data structure that represents a "TestSuite" XML element and its children.
- */
-class TestSuite extends AbstractXmlPullParser {
-
- static final String TAG = "TestSuite";
-
- private String mName;
-
- // use linked hash map for predictable iteration order
- Map<String, TestSuite> mChildSuiteMap = new LinkedHashMap<String, TestSuite>();
- Map<String, TestCase> mChildTestCaseMap = new LinkedHashMap<String, TestCase>();
-
- /**
- * @param testSuite
- */
- public TestSuite(String suiteName) {
- mName = suiteName;
- }
-
- public TestSuite() {
- }
-
- /**
- * @return the name of this suite
- */
- public String getName() {
- return mName;
- }
-
- /**
- * Set the name of this suite
- */
- public void setName(String name) {
- mName = name;
- }
-
- /**
- * Insert the given test result into this suite.
- *
- * @param suiteNames list of remaining suite names for this test
- * @param testClassName the test class name
- * @param testName the test method name
- * @param testResult the {@link TestResult}
- */
- public Test findTest(List<String> suiteNames, String testClassName, String testName,
- boolean insertIfMissing) {
- if (suiteNames.size() <= 0) {
- // no more package segments
- TestCase testCase = getTestCase(testClassName);
- return testCase.findTest(testName, insertIfMissing);
- } else {
- String rootName = suiteNames.remove(0);
- TestSuite suite = getTestSuite(rootName);
- return suite.findTest(suiteNames, testClassName, testName, insertIfMissing);
- }
- }
-
- /**
- * Gets all the child {@link TestSuite}s
- */
- public Collection<TestSuite> getTestSuites() {
- return mChildSuiteMap.values();
- }
-
- /**
- * Gets all the child {@link TestCase}s
- */
- public Collection<TestCase> getTestCases() {
- return mChildTestCaseMap.values();
- }
-
- /**
- * Get the child {@link TestSuite} with given name, creating if necessary.
- *
- * @param suiteName
- * @return the {@link TestSuite}
- */
- private TestSuite getTestSuite(String suiteName) {
- TestSuite testSuite = mChildSuiteMap.get(suiteName);
- if (testSuite == null) {
- testSuite = new TestSuite(suiteName);
- mChildSuiteMap.put(suiteName, testSuite);
- }
- return testSuite;
- }
-
- /**
- * Get the child {@link TestCase} with given name, creating if necessary.
- * @param testCaseName
- * @return
- */
- private TestCase getTestCase(String testCaseName) {
- TestCase testCase = mChildTestCaseMap.get(testCaseName);
- if (testCase == null) {
- testCase = new TestCase(testCaseName);
- mChildTestCaseMap.put(testCaseName, testCase);
- }
- return testCase;
- }
-
- /**
- * Serialize this object and all its contents to XML.
- *
- * @param serializer
- * @throws IOException
- */
- public void serialize(KXmlSerializer serializer) throws IOException {
- if (mName != null) {
- serializer.startTag(CtsXmlResultReporter.ns, TAG);
- serializer.attribute(CtsXmlResultReporter.ns, "name", mName);
- }
- for (TestSuite childSuite : mChildSuiteMap.values()) {
- childSuite.serialize(serializer);
- }
- for (TestCase childCase : mChildTestCaseMap.values()) {
- childCase.serialize(serializer);
- }
- if (mName != null) {
- serializer.endTag(CtsXmlResultReporter.ns, TAG);
- }
- }
-
- /**
- * Populates this class with suite result data parsed from XML.
- *
- * @param parser the {@link XmlPullParser}. Expected to be pointing at start
- * of a TestSuite tag
- */
- @Override
- void parse(XmlPullParser parser) throws XmlPullParserException, IOException {
- if (!parser.getName().equals(TAG)) {
- throw new XmlPullParserException(String.format(
- "invalid XML: Expected %s tag but received %s", TAG, parser.getName()));
- }
- setName(getAttribute(parser, "name"));
- int eventType = parser.next();
- while (eventType != XmlPullParser.END_DOCUMENT) {
- if (eventType == XmlPullParser.START_TAG && parser.getName().equals(TestSuite.TAG)) {
- TestSuite suite = new TestSuite();
- suite.parse(parser);
- insertSuite(suite);
- } else if (eventType == XmlPullParser.START_TAG && parser.getName().equals(
- TestCase.TAG)) {
- TestCase testCase = new TestCase();
- testCase.parse(parser);
- insertTestCase(testCase);
- } else if (eventType == XmlPullParser.END_TAG && parser.getName().equals(TAG)) {
- return;
- }
- eventType = parser.next();
- }
- }
-
- /**
- * Adds a child {@link TestCase}.
- */
- public void insertTestCase(TestCase testCase) {
- mChildTestCaseMap.put(testCase.getName(), testCase);
- }
-
- /**
- * Adds a child {@link TestSuite}.
- */
- public void insertSuite(TestSuite suite) {
- mChildSuiteMap.put(suite.getName(), suite);
- }
-
-
- /**
- * Adds tests contained in this result that have the given <var>resultFilter</var>
- *
- * @param tests the {@link Collection} of {@link TestIdentifier}s to add to
- * @param parentSuiteNames a {@link Deque} of parent suite names. Used to construct the full
- * class name of the test
- * @param resultFilter the {@link CtsTestStatus} to filter by
- */
- void addTestsWithStatus(Collection<TestIdentifier> tests, Deque<String> parentSuiteNames,
- CtsTestStatus resultFilter) {
- if (getName() != null) {
- parentSuiteNames.addLast(getName());
- }
- for (TestSuite suite : mChildSuiteMap.values()) {
- suite.addTestsWithStatus(tests, parentSuiteNames, resultFilter);
- }
- for (TestCase testCase : mChildTestCaseMap.values()) {
- testCase.addTestsWithStatus(tests, parentSuiteNames, resultFilter);
- }
- if (getName() != null) {
- parentSuiteNames.removeLast();
- }
- }
-
- /**
- * Count the number of tests in this {@link TestSuite} with given status.
- *
- * @param status
- * @return the test count
- */
- public int countTests(CtsTestStatus status) {
- int total = 0;
- for (TestSuite suite : mChildSuiteMap.values()) {
- total += suite.countTests(status);
- }
- for (TestCase testCase : mChildTestCaseMap.values()) {
- total += testCase.countTests(status);
- }
- return total;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestSummaryXml.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/TestSummaryXml.java
deleted file mode 100644
index 36f3297..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/TestSummaryXml.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import android.tests.getinfo.DeviceInfoConstants;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-/**
- * A {@link ITestSummary} that parses summary data from the CTS result XML.
- */
-public class TestSummaryXml extends AbstractXmlPullParser implements ITestSummary {
-
- private final int mId;
- private final String mTimestamp;
- private int mNumFailed = 0;
- private int mNumNotExecuted = 0;
- private int mNumPassed = 0;
- private String mPlan = "NA";
- private String mStartTime = "unknown";
- private String mDeviceSerials = "unknown";
-
- /**
- * @param id
- * @param resultFile
- * @throws ParseException
- * @throws FileNotFoundException
- */
- public TestSummaryXml(int id, String timestamp) {
- mId = id;
- mTimestamp = timestamp;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getId() {
- return mId;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getTimestamp() {
- return mTimestamp;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getNumIncomplete() {
- return mNumNotExecuted;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getNumFailed() {
- return mNumFailed;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getNumPassed() {
- return mNumPassed;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getTestPlan() {
- return mPlan ;
- }
-
-
- @Override
- void parse(XmlPullParser parser) throws XmlPullParserException, IOException {
- int eventType = parser.getEventType();
- while (eventType != XmlPullParser.END_DOCUMENT) {
- if (eventType == XmlPullParser.START_TAG && parser.getName().equals(
- CtsXmlResultReporter.RESULT_TAG)) {
- mPlan = getAttribute(parser, CtsXmlResultReporter.PLAN_ATTR);
- mStartTime = getAttribute(parser, CtsXmlResultReporter.STARTTIME_ATTR);
- } else if (eventType == XmlPullParser.START_TAG && parser.getName().equals(
- DeviceInfoResult.BUILD_TAG)) {
- mDeviceSerials = getAttribute(parser, DeviceInfoConstants.SERIAL_NUMBER);
- } else if (eventType == XmlPullParser.START_TAG && parser.getName().equals(
- TestResults.SUMMARY_TAG)) {
- mNumFailed = parseIntAttr(parser, TestResults.FAILED_ATTR) +
- parseIntAttr(parser, TestResults.TIMEOUT_ATTR);
- mNumNotExecuted = parseIntAttr(parser, TestResults.NOT_EXECUTED_ATTR);
- mNumPassed = parseIntAttr(parser, TestResults.PASS_ATTR);
- // abort after parsing Summary, which should be the last tag
- return;
- }
- eventType = parser.next();
- }
- throw new XmlPullParserException("Could not find Summary tag");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getStartTime() {
- return mStartTime;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getDeviceSerials() {
- return mDeviceSerials;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/TimeUtil.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/TimeUtil.java
deleted file mode 100644
index fb737f9..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/TimeUtil.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Utility class for formatting times as strings.
- */
-class TimeUtil {
-
- /**
- * Return a prettified version of the given elapsed time
- * @return
- */
- static String formatElapsedTime(long elapsedTimeMs) {
- long seconds = TimeUnit.MILLISECONDS.toSeconds(elapsedTimeMs) % 60;
- long minutes = TimeUnit.MILLISECONDS.toMinutes(elapsedTimeMs) % 60;
- long hours = TimeUnit.MILLISECONDS.toHours(elapsedTimeMs);
- StringBuilder time = new StringBuilder();
- if (hours > 0) {
- time.append(hours);
- time.append("h ");
- }
- if (minutes > 0) {
- time.append(minutes);
- time.append("m ");
- }
- time.append(seconds);
- time.append("s");
-
- return time.toString();
- }
-
- /**
- * Return the current timestamp as a {@link String} suitable for displaying.
- * <p/>
- * Example: Fri Aug 20 15:13:03 PDT 2010
- */
- static String getTimestamp() {
- return getTimestamp(System.currentTimeMillis());
- }
-
- /**
- * Return the given time as a {@link String} suitable for displaying.
- * <p/>
- * Example: Fri Aug 20 15:13:03 PDT 2010
- *
- * @param time the epoch time in ms since midnight Jan 1, 1970
- */
- static String getTimestamp(long time) {
- SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
- return dateFormat.format(new Date(time));
- }
-
- /**
- * Return the current timestamp in a compressed format, used to uniquely identify results.
- * <p/>
- * Example: 2010.08.16_11.42.12
- */
- static String getResultTimestamp() {
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd_HH.mm.ss");
- return dateFormat.format(new Date());
- }
-
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsApkInstaller.java b/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsApkInstaller.java
deleted file mode 100644
index 08061b1..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsApkInstaller.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2015 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 com.android.cts.tradefed.targetprep;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.config.OptionClass;
-import com.android.tradefed.targetprep.TargetSetupError;
-import com.android.tradefed.targetprep.TestAppInstallSetup;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-
-/**
- * Installs specified apks from CTS test case repository
- */
-@OptionClass(alias="cts-apk-installer")
-public class CtsApkInstaller extends TestAppInstallSetup {
-
- private CtsBuildHelper mBuildHelper = null;
-
- protected CtsBuildHelper getCtsBuildHelper(IBuildInfo buildInfo) {
- if (mBuildHelper == null) {
- mBuildHelper = CtsBuildHelper.createBuildHelper(buildInfo);
- }
- return mBuildHelper;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected File getLocalPathForFilename(IBuildInfo buildInfo, String apkFileName)
- throws TargetSetupError {
- try {
- return getCtsBuildHelper(buildInfo).getTestApp(apkFileName);
- } catch (FileNotFoundException e) {
- throw new TargetSetupError(String.format("apk not found: %s", apkFileName), e);
- }
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsFilePusher.java b/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsFilePusher.java
deleted file mode 100644
index c6ae2e1..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsFilePusher.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2015 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 com.android.cts.tradefed.targetprep;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.config.OptionClass;
-import com.android.tradefed.targetprep.PushFilePreparer;
-
-import java.io.File;
-
-/**
- * Pushes specified testing artifacts from CTS test case repository
- */
-@OptionClass(alias="cts-file-pusher")
-public class CtsFilePusher extends PushFilePreparer {
-
- private CtsBuildHelper mBuildHelper;
-
- protected CtsBuildHelper getCtsBuildHelper(IBuildInfo buildInfo) {
- if (mBuildHelper == null) {
- mBuildHelper = CtsBuildHelper.createBuildHelper(buildInfo);
- }
- return mBuildHelper;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public File resolveRelativeFilePath(IBuildInfo buildInfo, String fileName) {
- return new File(getCtsBuildHelper(buildInfo).getTestCasesDir(), fileName);
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsRootDeviceSetup.java b/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsRootDeviceSetup.java
deleted file mode 100644
index f75a99e..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsRootDeviceSetup.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.targetprep;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IFolderBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.targetprep.DeviceSetup;
-import com.android.tradefed.targetprep.ITargetPreparer;
-import com.android.tradefed.targetprep.TargetSetupError;
-
-import java.io.FileNotFoundException;
-
-/**
- * A {@link ITargetPreparer} that attempts to automatically perform the CTS-specific manual steps
- * for setting up a device for CTS testing.
- * <p/>
- * This class is NOT intended for 'official' CTS runs against a production device as the steps
- * performed by this class require a debug build (aka 'adb root' must succeed).
- * <p/>
- * This class currently performs the 'Allow mock locations' and 'accessibililty setup' steps
- * documented in the CTS user manual. It is intended to be used in conjunction with
- * a {@link DeviceSetup} which will enable the 'Stay Awake' setting and verify that external
- * storage is present.
- */
-public class CtsRootDeviceSetup implements ITargetPreparer {
-
- private static final String DEVICE_ADMIN_APK_FILE_NAME = "CtsAdminApp.apk";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setUp(ITestDevice device, IBuildInfo buildInfo) throws TargetSetupError,
- DeviceNotAvailableException {
- if (!(buildInfo instanceof IFolderBuildInfo)) {
- throw new IllegalArgumentException("Provided buildInfo is not a IFolderBuildInfo");
- }
- CLog.i("Setting up %s to run CTS tests", device.getSerialNumber());
-
- IFolderBuildInfo ctsBuild = (IFolderBuildInfo)buildInfo;
- try {
- CtsBuildHelper buildHelper = new CtsBuildHelper(ctsBuild.getRootDir());
-
- if (!device.enableAdbRoot()) {
- throw new TargetSetupError(String.format(
- "Failed to set root on device %s.", device.getSerialNumber()));
- }
-
- // perform CTS setup steps that only work if adb is root
- SettingsToggler.setSecureInt(device, "mock_location", 1);
- enableDeviceAdmin(device, buildHelper);
- // This is chrome specific setting to disable the first screen.
- // For other browser, it will not do anything.
- device.executeShellCommand(
- "echo \"chrome --disable-fre\" > /data/local/chrome-command-line");
- // end root setup steps
- } catch (FileNotFoundException e) {
- throw new TargetSetupError("Invalid CTS installation", e);
- }
- }
-
- private void enableDeviceAdmin(ITestDevice device, CtsBuildHelper ctsBuild)
- throws DeviceNotAvailableException, TargetSetupError, FileNotFoundException {
- String errorCode = device.installPackage(ctsBuild.getTestApp(DEVICE_ADMIN_APK_FILE_NAME),
- true);
- if (errorCode != null) {
- // TODO: retry ?
- throw new TargetSetupError(String.format(
- "Failed to install %s on device %s. Reason: %s",
- DEVICE_ADMIN_APK_FILE_NAME, device.getSerialNumber(), errorCode));
- }
- // TODO: enable device admin Settings
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/SettingsToggler.java b/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/SettingsToggler.java
deleted file mode 100644
index ff6c4f4..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/SettingsToggler.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2012 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 com.android.cts.tradefed.targetprep;
-
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-
-/**
- * {@link SettingsToggler} sets settings by using the "adb shell content" command.
- */
-public class SettingsToggler {
- private static final String GROUP_SECURE = "secure";
- private static final String GROUP_GLOBAL = "global";
-
- /** Sets a setting by deleting and then inserting the string value. */
- public static void setString(ITestDevice device, String group, String name, String value)
- throws DeviceNotAvailableException {
- deleteSetting(device, group, name);
- device.executeShellCommand(
- "content insert"
- + " --uri content://settings/" + group
- + " --bind name:s:" + name
- + " --bind value:s:" + value);
- }
-
- /** Sets a secure setting by deleting and then inserting the string value. */
- public static void setSecureString(ITestDevice device, String name, String value)
- throws DeviceNotAvailableException {
- setString(device, GROUP_SECURE, name, value);
- }
-
- /** Sets a global setting by deleting and then inserting the string value. */
- public static void setGlobalString(ITestDevice device, String name, String value)
- throws DeviceNotAvailableException {
- setString(device, GROUP_GLOBAL, name, value);
- }
-
- /** Sets a setting by deleting and then inserting the int value. */
- public static void setInt(ITestDevice device, String group, String name, int value)
- throws DeviceNotAvailableException {
- deleteSetting(device, group, name);
- device.executeShellCommand(
- "content insert"
- + " --uri content://settings/" + group
- + " --bind name:s:" + name
- + " --bind value:i:" + value);
- }
-
- /** Sets a secure setting by deleting and then inserting the int value. */
- public static void setSecureInt(ITestDevice device, String name, int value)
- throws DeviceNotAvailableException {
- setInt(device, GROUP_SECURE, name, value);
- }
-
- /** Sets a global setting by deleting and then inserting the int value. */
- public static void setGlobalInt(ITestDevice device, String name, int value)
- throws DeviceNotAvailableException {
- setInt(device, GROUP_GLOBAL, name, value);
- }
-
- public static void updateString(ITestDevice device, String group, String name, String value)
- throws DeviceNotAvailableException {
- device.executeShellCommand(
- "content update"
- + " --uri content://settings/" + group
- + " --bind value:s:" + value
- + " --where \"name='" + name + "'\"");
- }
-
- public static void updateSecureString(ITestDevice device, String name, String value)
- throws DeviceNotAvailableException {
- updateString(device, GROUP_SECURE, name, value);
- }
-
- public static void updateGlobalString(ITestDevice device, String name, String value)
- throws DeviceNotAvailableException {
- updateString(device, GROUP_GLOBAL, name, value);
- }
-
- public static void updateInt(ITestDevice device, String group, String name, int value)
- throws DeviceNotAvailableException {
- device.executeShellCommand(
- "content update"
- + " --uri content://settings/" + group
- + " --bind value:i:" + value
- + " --where \"name='" + name + "'\"");
- }
-
- public static void updateSecureInt(ITestDevice device, String name, int value)
- throws DeviceNotAvailableException {
- updateInt(device, GROUP_SECURE, name, value);
- }
-
- public static void updateGlobalInt(ITestDevice device, String name, int value)
- throws DeviceNotAvailableException {
- updateInt(device, GROUP_GLOBAL, name, value);
- }
-
- private static void deleteSetting(ITestDevice device, String group, String name)
- throws DeviceNotAvailableException {
- device.executeShellCommand(
- "content delete"
- + " --uri content://settings/" + group
- + " --where \"name='" + name + "'\"");
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/Abi.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/Abi.java
deleted file mode 100644
index 926e14b..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/Abi.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.cts.tradefed.testtype;
-
-import com.android.tradefed.testtype.IAbi;
-/**
- * A class representing an ABI.
- */
-public class Abi implements IAbi {
-
- private String mName;
- private String mBitness;
-
- public Abi(String name, String bitness) {
- mName = name;
- mBitness = bitness;
- }
-
- @Override
- public String getName() {
- return mName;
- }
-
- @Override
- public String getBitness() {
- return mBitness;
- }
-
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsInstrumentationApkTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsInstrumentationApkTest.java
deleted file mode 100644
index 1fa4e7b..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsInstrumentationApkTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.ddmlib.Log;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.InstrumentationTest;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * An {@link InstrumentationTest} that will install CTS apks
- * before test execution, and uninstall on execution completion.
- */
-public class CtsInstrumentationApkTest extends InstrumentationTest implements IBuildReceiver {
-
- private static final String LOG_TAG = "CtsInstrumentationApkTest";
-
- /** the file names of the CTS apks to install */
- private Collection<String> mInstallFileNames = new ArrayList<String>();
- private Collection<String> mUninstallPackages = new ArrayList<String>();
- protected CtsBuildHelper mCtsBuild = null;
- protected IAbi mAbi = null;
-
- /**
- * @param abi the ABI to run the test on
- */
- public void setAbi(IAbi abi) {
- mAbi = abi;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setBuild(IBuildInfo build) {
- mCtsBuild = CtsBuildHelper.createBuildHelper(build);
- }
-
- /**
- * Add an apk to install.
- *
- * @param apkFileName the apk file name
- * @param packageName the apk's Android package name
- */
- public void addInstallApk(String apkFileName, String packageName) {
- mInstallFileNames.add(apkFileName);
- mUninstallPackages.add(packageName);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void run(final ITestInvocationListener listener)
- throws DeviceNotAvailableException {
- ITestDevice testDevice = getDevice();
-
- if (testDevice == null) {
- Log.e(LOG_TAG, "Missing device.");
- return;
- }
- if (mCtsBuild == null) {
- Log.e(LOG_TAG, "Missing build");
- return;
- }
- boolean success = true;
- for (String apkFileName : mInstallFileNames) {
- Log.d(LOG_TAG, String.format("Installing %s on %s", apkFileName,
- testDevice.getSerialNumber()));
- try {
- File apkFile = mCtsBuild.getTestApp(apkFileName);
- String errorCode = null;
- String[] options = {AbiUtils.createAbiFlag(mAbi.getName())};
- errorCode = testDevice.installPackage(apkFile, true, options);
- if (errorCode != null) {
- Log.e(LOG_TAG, String.format("Failed to install %s on %s. Reason: %s",
- apkFileName, testDevice.getSerialNumber(), errorCode));
- success = false;
- }
- } catch (FileNotFoundException e) {
- Log.e(LOG_TAG, String.format("Could not find file %s", apkFileName));
- success = false;
- }
- }
- if (success) {
- super.run(listener);
- }
- for (String packageName : mUninstallPackages) {
- Log.d(LOG_TAG, String.format("Uninstalling %s on %s", packageName,
- testDevice.getSerialNumber()));
- testDevice.uninstallPackage(packageName);
- }
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java
deleted file mode 100644
index 6eb36b6..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java
+++ /dev/null
@@ -1,1228 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.compatibility.common.util.MonitoringUtils;
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.cts.tradefed.device.DeviceInfoCollector;
-import com.android.cts.tradefed.result.CtsTestStatus;
-import com.android.cts.tradefed.result.PlanCreator;
-import com.android.cts.tradefed.util.ReportLogUtil;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.Log.LogLevel;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.config.OptionCopier;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.DeviceUnresponsiveException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.device.TestDeviceOptions;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.ResultForwarder;
-import com.android.tradefed.targetprep.BuildError;
-import com.android.tradefed.targetprep.ITargetCleaner;
-import com.android.tradefed.targetprep.ITargetPreparer;
-import com.android.tradefed.targetprep.TargetSetupError;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IAbiReceiver;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.testtype.IResumableTest;
-import com.android.tradefed.testtype.IShardableTest;
-import com.android.tradefed.testtype.InstrumentationTest;
-import com.android.tradefed.util.AbiFormatter;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import junit.framework.Test;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * A {@link Test} for running CTS tests.
- * <p/>
- * Supports running all the tests contained in a CTS plan, or individual test packages.
- */
-public class CtsTest implements IDeviceTest, IResumableTest, IShardableTest, IBuildReceiver {
- private static final String LOG_TAG = "CtsTest";
-
- public static final String PLAN_OPTION = "plan";
- private static final String PACKAGE_OPTION = "package";
- private static final String CLASS_OPTION = "class";
- private static final String METHOD_OPTION = "method";
- private static final String TEST_OPTION = "test";
- public static final String CONTINUE_OPTION = "continue-session";
- public static final String RUN_KNOWN_FAILURES_OPTION = "run-known-failures";
- private static final String INCLUDE_FILTERS_OPTION = "include";
- private static final String EXCLUDE_FILTERS_OPTION = "exclude";
-
- public static final String PACKAGE_NAME_METRIC = "packageName";
- public static final String PACKAGE_ABI_METRIC = "packageAbi";
- public static final String PACKAGE_DIGEST_METRIC = "packageDigest";
-
- @Option(name = PLAN_OPTION, description = "the test plan to run.",
- importance = Importance.IF_UNSET)
- private String mPlanName = null;
-
- @Option(name = PACKAGE_OPTION, shortName = 'p', description = "the test packages(s) to run.",
- importance = Importance.IF_UNSET)
- private Collection<String> mPackageNames = new ArrayList<String>();
-
- @Option(name = "exclude-package", description = "the test packages(s) to exclude from the run.")
- private Collection<String> mExcludedPackageNames = new ArrayList<String>();
-
- @Option(name = CLASS_OPTION, shortName = 'c', description = "run a specific test class.",
- importance = Importance.IF_UNSET)
- private String mClassName = null;
-
- @Option(name = METHOD_OPTION, shortName = 'm',
- description = "run a specific test method, from given --class.",
- importance = Importance.IF_UNSET)
- private String mMethodName = null;
-
- @Option(name = TEST_OPTION, shortName = 't', description = "run a specific test",
- importance = Importance.IF_UNSET)
- private String mTestName = null;
-
- @Option(name = CONTINUE_OPTION,
- description = "continue a previous test session.",
- importance = Importance.IF_UNSET)
- private Integer mContinueSessionId = null;
-
- @Option(name = "skip-device-info", shortName = 'd', description =
- "flag to control whether to collect info from device. Providing this flag will speed up " +
- "test execution for short test runs but will result in required data being omitted from " +
- "the test report.")
- private boolean mSkipDeviceInfo = false;
-
- @Option(name = "resume", description =
- "flag to attempt to automatically resume aborted test run on another connected device. ")
- private boolean mResume = false;
-
- @Option(name = "shards", description =
- "shard the tests to run into separately runnable chunks to execute on multiple devices " +
- "concurrently.")
- private int mShards = 1;
-
- @Option(name = "screenshot", description =
- "flag for taking a screenshot of the device when test execution is complete.")
- private boolean mScreenshot = false;
-
- @Option(name = "bugreport", shortName = 'b', description =
- "take a bugreport after each failed test. " +
- "Warning: can potentially use a lot of disk space.")
- private boolean mBugreport = false;
-
- @Option(name = RUN_KNOWN_FAILURES_OPTION, shortName = 'k', description =
- "run tests including known failures")
- private boolean mIncludeKnownFailures;
-
- @Option(name = "disable-reboot", description =
- "Do not reboot device after running some amount of tests. Default behavior is to reboot.")
- private boolean mDisableReboot = false;
-
- @Option(name = "reboot-wait-time", description =
- "Additional wait time in ms after boot complete.")
- private int mRebootWaitTimeMSec = 2 * 60 * 1000;
-
- @Option(name = "reboot-interval", description =
- "Interval between each reboot in min.")
- private int mRebootIntervalMin = 30;
-
- @Option(name = "screenshot-on-failure", description =
- "take a screenshot on every test failure.")
- private boolean mScreenshotOnFailures = false;
-
- @Option(name = "logcat-on-failure", description =
- "take a logcat snapshot on every test failure. Unlike --bugreport, this can capture" +
- "logs even if connection with device has been lost, as well as being much more " +
- "performant.")
- private boolean mLogcatOnFailures = false;
-
- @Option(name = AbiFormatter.FORCE_ABI_STRING,
- description = AbiFormatter.FORCE_ABI_DESCRIPTION,
- importance = Importance.IF_UNSET)
- private String mForceAbi = null;
-
- @Option(name = "logcat-on-failure-size", description =
- "The max number of logcat data in bytes to capture when --logcat-on-failure is on. " +
- "Should be an amount that can comfortably fit in memory.")
- private int mMaxLogcatBytes = 500 * 1024; // 500K
-
- @Option(name = "collect-deqp-logs", description =
- "Collect dEQP logs from the device.")
- private boolean mCollectDeqpLogs = false;
-
- @Option(name = INCLUDE_FILTERS_OPTION, description = "Positive filters to pass to tests.")
- private List<String> mPositiveFilters = new ArrayList<> ();
-
- @Option(name = EXCLUDE_FILTERS_OPTION, description = "Negative filters to pass to tests.")
- private List<String> mNegativeFilters = new ArrayList<> ();
-
- @Option(name = "min-pre-reboot-package-count", description =
- "The minimum number of packages to require a pre test reboot")
- private int mMinPreRebootPackageCount = 2;
-
- @Option(name = "skip-connectivity-check",
- description = "Don't verify device connectivity between module execution.")
- private boolean mSkipConnectivityCheck = false;
-
- private final int mShardAssignment;
- private final int mTotalShards;
- private ITestDevice mDevice = null;
- private CtsBuildHelper mCtsBuild = null;
- private IBuildInfo mBuildInfo = null;
- // last reboot time
- private long mPrevRebootTime;
- // The list of packages to run. populated in {@code setupTestPackageList}
- // This is a member variable so that run can be called more than once
- // and the test run is resumed.
- private List<TestPackage> mTestPackageList = new ArrayList<>();
- // The index in the pacakge list of the last test to complete
- private int mLastTestPackageIndex = 0;
-
- /** data structure for a {@link IRemoteTest} and its known tests */
- static class TestPackage {
- private final IRemoteTest mTestForPackage;
- private final ITestPackageDef mPackageDef;
- private final Collection<TestIdentifier> mKnownTests;
-
- TestPackage(ITestPackageDef packageDef, IRemoteTest testForPackage) {
- mPackageDef = packageDef;
- mTestForPackage = testForPackage;
- mKnownTests = packageDef.getTests();
- }
-
- IRemoteTest getTestForPackage() {
- return mTestForPackage;
- }
-
- Collection<TestIdentifier> getKnownTests() {
- return mKnownTests;
- }
-
- ITestPackageDef getPackageDef() {
- return mPackageDef;
- }
-
- /**
- * @return the test run name that should be used for the TestPackage.
- */
- String getTestRunName() {
- return mPackageDef.getId();
- }
-
- /**
- * @return the ABI on which the test will run.
- */
- IAbi getAbi() {
- return mPackageDef.getAbi();
- }
- }
-
- /**
- * A {@link ResultForwarder} that will forward a bugreport on each failed test.
- */
- private static class FailedTestBugreportGenerator extends ResultForwarder {
- private ITestDevice mDevice;
-
- public FailedTestBugreportGenerator(ITestInvocationListener listener, ITestDevice device) {
- super(listener);
- mDevice = device;
- }
-
- @Override
- public void testFailed(TestIdentifier test, String trace) {
- super.testFailed(test, trace);
- InputStreamSource bugSource = mDevice.getBugreport();
- super.testLog(String.format("bug-%s_%s", test.getClassName(), test.getTestName()),
- LogDataType.TEXT, bugSource);
- bugSource.cancel();
- }
- }
-
- /**
- * A {@link ResultForwarder} that will forward a logcat snapshot on each failed test.
- */
- private static class FailedTestLogcatGenerator extends ResultForwarder {
- private ITestDevice mDevice;
- private int mNumLogcatBytes;
-
- public FailedTestLogcatGenerator(ITestInvocationListener listener, ITestDevice device,
- int maxLogcatBytes) {
- super(listener);
- mDevice = device;
- mNumLogcatBytes = maxLogcatBytes;
- }
-
- @Override
- public void testFailed(TestIdentifier test, String trace) {
- super.testFailed(test, trace);
- // sleep 2s to ensure test failure stack trace makes it into logcat capture
- RunUtil.getDefault().sleep(2 * 1000);
- InputStreamSource logSource = mDevice.getLogcat(mNumLogcatBytes);
- super.testLog(String.format("logcat-%s_%s", test.getClassName(), test.getTestName()),
- LogDataType.TEXT, logSource);
- logSource.cancel();
- }
- }
-
- /**
- * A {@link ResultForwarder} that will forward a screenshot on test failures.
- */
- private static class FailedTestScreenshotGenerator extends ResultForwarder {
- private ITestDevice mDevice;
-
- public FailedTestScreenshotGenerator(ITestInvocationListener listener,
- ITestDevice device) {
- super(listener);
- mDevice = device;
- }
-
- @Override
- public void testFailed(TestIdentifier test, String trace) {
- super.testFailed(test, trace);
-
- try {
- InputStreamSource screenSource = mDevice.getScreenshot();
- super.testLog(String.format("screenshot-%s_%s", test.getClassName(),
- test.getTestName()), LogDataType.PNG, screenSource);
- screenSource.cancel();
- } catch (DeviceNotAvailableException e) {
- // TODO: rethrow this somehow
- CLog.e("Device %s became unavailable while capturing screenshot, %s",
- mDevice.getSerialNumber(), e.toString());
- }
- }
- }
-
- /**
- * Create a new {@link CtsTest} that will run the default list of {@link TestPackage}s.
- */
- public CtsTest() {
- this(0 /*shardAssignment*/, 1 /*totalShards*/);
- }
-
- /**
- * Create a new {@link CtsTest} that will run the given {@link List} of {@link TestPackage}s.
- */
- public CtsTest(int shardAssignment, int totalShards) {
- if (shardAssignment < 0) {
- throw new IllegalArgumentException(
- "shardAssignment cannot be negative. found:" + shardAssignment);
- }
- if (totalShards < 1) {
- throw new IllegalArgumentException(
- "shardAssignment must be at least 1. found:" + totalShards);
- }
- this.mShardAssignment = shardAssignment;
- this.mTotalShards = totalShards;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ITestDevice getDevice() {
- return mDevice;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setDevice(ITestDevice device) {
- mDevice = device;
- }
-
- /**
- * Set the plan name to run.
- * <p/>
- * Exposed for unit testing
- */
- void setPlanName(String planName) {
- mPlanName = planName;
- }
-
- /**
- * Set the skip collect device info flag.
- * <p/>
- * Exposed for unit testing
- */
- void setSkipDeviceInfo(boolean skipDeviceInfo) {
- mSkipDeviceInfo = skipDeviceInfo;
- }
-
- /**
- * Adds a package name to the list of test packages to run.
- * <p/>
- * Exposed for unit testing
- */
- void addPackageName(String packageName) {
- mPackageNames.add(packageName);
- }
-
- /**
- * Adds a package name to the list of test packages to exclude.
- * <p/>
- * Exposed for unit testing
- */
- void addExcludedPackageName(String packageName) {
- mExcludedPackageNames.add(packageName);
- }
-
- /**
- * Set the test class name to run.
- * <p/>
- * Exposed for unit testing
- */
- void setClassName(String className) {
- mClassName = className;
- }
-
- /**
- * Set the test method name to run.
- * <p/>
- * Exposed for unit testing
- */
- void setMethodName(String methodName) {
- mMethodName = methodName;
- }
-
- /**
- * Set the test name to run e.g. android.test.cts.SampleTest#testSample
- * <p/>
- * Exposed for unit testing
- */
- void setTestName(String testName) {
- mTestName = testName;
- }
-
- /**
- * Sets the test session id to continue.
- * <p/>
- * Exposed for unit testing
- */
- void setContinueSessionId(int sessionId) {
- mContinueSessionId = sessionId;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isResumable() {
- return mResume;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setBuild(IBuildInfo build) {
- mCtsBuild = CtsBuildHelper.createBuildHelper(build);
- mBuildInfo = build;
- }
-
- /**
- * Set the CTS build container.
- * <p/>
- * Exposed so unit tests can mock the provided build.
- */
- void setBuildHelper(CtsBuildHelper buildHelper) {
- mCtsBuild = buildHelper;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
- if (getDevice() == null) {
- throw new IllegalArgumentException("missing device");
- }
-
- Set<String> abiSet = getAbis();
- if (abiSet == null || abiSet.isEmpty()) {
- throw new IllegalArgumentException("could not get device's ABIs");
- }
- Log.logAndDisplay(LogLevel.INFO, LOG_TAG, "ABIs: " + abiSet);
-
- checkFields();
- setupTestPackageList(abiSet);
- if (mBugreport) {
- listener = new FailedTestBugreportGenerator(listener, getDevice());
- }
- if (mScreenshotOnFailures) {
- listener = new FailedTestScreenshotGenerator(listener, getDevice());
- }
- if (mLogcatOnFailures) {
- listener = new FailedTestLogcatGenerator(listener, getDevice(), mMaxLogcatBytes);
- }
-
- // Setup the a map of Test id to ResultFilter
- Map<String, ResultFilter> filterMap = new HashMap<>();
- int totalTestCount = 0;
- for (TestPackage testPackage : mTestPackageList) {
- ResultFilter resultFilter = new ResultFilter(listener, testPackage);
- totalTestCount += resultFilter.getKnownTestCount();
- filterMap.put(testPackage.getPackageDef().getId(), resultFilter);
- }
-
- // collect and install the prerequisiteApks first, to save time when multiple test
- // packages are using the same prerequisite apk
- Map<String, Set<String>> prerequisiteApks = getPrerequisiteApks(mTestPackageList, abiSet);
- Collection<String> uninstallPackages = getPrerequisitePackageNames(mTestPackageList);
-
- try {
- // always collect the device info, even for resumed runs, since test will likely be
- // running on a different device
- collectDeviceInfo(getDevice(), mCtsBuild, listener);
- // prepare containers to hold test metric report logs.
- prepareReportLogContainers(getDevice(), mBuildInfo);
- preRebootIfNecessary(mTestPackageList);
-
- mPrevRebootTime = System.currentTimeMillis();
- int remainingPackageCount = mTestPackageList.size();
- Log.logAndDisplay(LogLevel.INFO, LOG_TAG,
- String.format("Start test run of %,d packages, containing %,d tests",
- remainingPackageCount, totalTestCount));
- IAbi currentAbi = null;
-
- // check connectivity upfront
- if (!mSkipConnectivityCheck) {
- MonitoringUtils.checkDeviceConnectivity(getDevice(), listener, "start");
- }
- for (int i = mLastTestPackageIndex; i < mTestPackageList.size(); i++) {
- TestPackage testPackage = mTestPackageList.get(i);
-
- if (currentAbi == null ||
- !currentAbi.getName().equals(testPackage.getAbi().getName())) {
- currentAbi = testPackage.getAbi();
- installPrerequisiteApks(
- prerequisiteApks.get(currentAbi.getName()), currentAbi);
- }
-
- IRemoteTest test = testPackage.getTestForPackage();
- if (test instanceof IBuildReceiver) {
- ((IBuildReceiver) test).setBuild(mBuildInfo);
- }
- if (test instanceof IDeviceTest) {
- ((IDeviceTest) test).setDevice(getDevice());
- }
- if (test instanceof DeqpTestRunner) {
- ((DeqpTestRunner)test).setCollectLogs(mCollectDeqpLogs);
- }
- if (test instanceof GeeTest) {
- if (!mPositiveFilters.isEmpty()) {
- String positivePatterns = join(mPositiveFilters, ":");
- ((GeeTest)test).setPositiveFilters(positivePatterns);
- }
- if (!mNegativeFilters.isEmpty()) {
- String negativePatterns = join(mNegativeFilters, ":");
- ((GeeTest)test).setPositiveFilters(negativePatterns);
- }
- }
- if (test instanceof InstrumentationTest) {
- if (!mPositiveFilters.isEmpty()) {
- String annotation = join(mPositiveFilters, ",");
- ((InstrumentationTest)test).addInstrumentationArg(
- "annotation", annotation);
- }
- if (!mNegativeFilters.isEmpty()) {
- String notAnnotation = join(mNegativeFilters, ",");
- ((InstrumentationTest)test).addInstrumentationArg(
- "notAnnotation", notAnnotation);
- }
- }
-
- forwardPackageDetails(testPackage.getPackageDef(), listener);
- try {
- performPackagePrepareSetup(testPackage.getPackageDef());
- test.run(filterMap.get(testPackage.getPackageDef().getId()));
- performPackagePreparerTearDown(testPackage.getPackageDef());
- } catch (DeviceUnresponsiveException due) {
- // being able to catch a DeviceUnresponsiveException here implies that recovery
- // was successful, and test execution should proceed to next module
- ByteArrayOutputStream stack = new ByteArrayOutputStream();
- due.printStackTrace(new PrintWriter(stack, true));
- try {
- stack.close();
- } catch (IOException ioe) {
- // won't happen on BAOS
- }
- CLog.w("Ignored DeviceUnresponsiveException because recovery was successful, "
- + "proceeding with next test package. Stack trace: %s",
- stack.toString());
- CLog.w("This may be due to incorrect timeout setting on test package %s",
- testPackage.getPackageDef().getName());
- }
- if (!mSkipConnectivityCheck) {
- MonitoringUtils.checkDeviceConnectivity(getDevice(), listener,
- String.format("%s-%s", testPackage.getPackageDef().getName(),
- testPackage.getPackageDef().getAbi().getName()));
- }
- if (i < mTestPackageList.size() - 1) {
- TestPackage nextPackage = mTestPackageList.get(i + 1);
- rebootIfNecessary(testPackage, nextPackage);
- changeToHomeScreen();
- }
- // Track of the last complete test package index for resume
- mLastTestPackageIndex = i;
- }
-
- if (mScreenshot) {
- InputStreamSource screenshotSource = getDevice().getScreenshot();
- try {
- listener.testLog("screenshot", LogDataType.PNG, screenshotSource);
- } finally {
- screenshotSource.cancel();
- }
- }
-
- uninstallPrequisiteApks(uninstallPackages);
- // Collect test metric report logs.
- collectReportLogs(getDevice(), mBuildInfo);
- } catch (RuntimeException e) {
- CLog.e(e);
- throw e;
- } catch (Error e) {
- CLog.e(e);
- throw e;
- } finally {
- for (ResultFilter filter : filterMap.values()) {
- filter.reportUnexecutedTests();
- }
- }
- }
-
- /**
- * Invokes {@link ITargetPreparer}s configured for the test package. {@link TargetSetupError}s
- * thrown by any preparer will be rethrown as {@link RuntimeException} so that the entire test
- * package will be skipped for execution. Note that preparers will be invoked in the same order
- * as they are defined in the module test config.
- * @param packageDef definition for the test package
- * @throws DeviceNotAvailableException
- */
- private void performPackagePrepareSetup(ITestPackageDef packageDef)
- throws DeviceNotAvailableException {
- List<ITargetPreparer> preparers = packageDef.getPackagePreparers();
- if (preparers != null) {
- for (ITargetPreparer preparer : preparers) {
- if (preparer instanceof IAbiReceiver) {
- ((IAbiReceiver) preparer).setAbi(packageDef.getAbi());
- }
- try {
- preparer.setUp(getDevice(), mBuildInfo);
- } catch (BuildError e) {
- // This should only happen for flashing new build
- CLog.e("Unexpected BuildError from preparer: %s",
- preparer.getClass().getCanonicalName());
- } catch (TargetSetupError e) {
- // log preparer class then rethrow & let caller handle
- CLog.e("TargetSetupError in preparer: %s",
- preparer.getClass().getCanonicalName());
- throw new RuntimeException(e);
- }
- }
- }
- }
-
- /**
- * Invokes clean up step for {@link ITargetCleaner}s configured for the test package. Note that
- * the cleaners will be invoked in the reverse order as they are defined in module test config.
- * @param packageDef definition for the test package
- * @throws DeviceNotAvailableException
- */
- private void performPackagePreparerTearDown(ITestPackageDef packageDef)
- throws DeviceNotAvailableException {
- List<ITargetPreparer> preparers = packageDef.getPackagePreparers();
- if (preparers != null) {
- ListIterator<ITargetPreparer> itr = preparers.listIterator(preparers.size());
- // do teardown in reverse order
- while (itr.hasPrevious()) {
- ITargetPreparer preparer = itr.previous();
- if (preparer instanceof ITargetCleaner) {
- ((ITargetCleaner) preparer).tearDown(getDevice(), mBuildInfo, null);
- }
- }
- }
- }
-
- /**
- * Helper method to join strings. Exposed for unit tests
- * @param input
- * @param conjunction
- * @return string with elements of the input list with interleaved conjunction.
- */
- protected static String join(List<String> input, String conjunction) {
- StringBuilder sb = new StringBuilder();
- boolean first = true;
- for (String item : input) {
- if (first) {
- first = false;
- } else {
- sb.append(conjunction);
- }
- sb.append(item);
- }
- return sb.toString();
- }
-
- /**
- * @param allTestPackageDefList The package list to filter
- * @param deviceAbiSet The ABIs supported by the device being tested
- * @return A {@link List} of {@link ITestPackageDef}s that should be tested
- */
- private static List<ITestPackageDef> filterByAbi(
- List<ITestPackageDef> allTestPackageDefList, Set<String> deviceAbiSet) {
- List<ITestPackageDef> filteredTestPackageDefList = new LinkedList<>();
- for (ITestPackageDef testPackageDef : allTestPackageDefList) {
- if (deviceAbiSet.contains(testPackageDef.getAbi().getName())) {
- // We only need test packages that are not empty and of matching ABIs
- filteredTestPackageDefList.add(testPackageDef);
- }
- }
- return filteredTestPackageDefList;
- }
-
- /** Reboot then the device iff the list of packages exceeds the minimum */
- private void preRebootIfNecessary(List<TestPackage> testPackageList)
- throws DeviceNotAvailableException {
- if (mDisableReboot) {
- return;
- }
-
- Set<String> packageNameSet = new HashSet<>();
- for (TestPackage testPackage : testPackageList) {
- // Parse the package name
- packageNameSet.add(AbiUtils.parseTestName(testPackage.getPackageDef().getId()));
- }
- if (packageNameSet.size() < mMinPreRebootPackageCount) {
- // There is actually only one unique package name. No need to reboot.
- return;
- }
-
- // Reboot is needed
- Log.logAndDisplay(LogLevel.INFO, LOG_TAG,
- String.format("Pre-test reboot (%,d packages). Use --disable-reboot to skip",
- packageNameSet.size()));
-
- rebootDevice();
- }
-
- private void rebootIfNecessary(TestPackage testFinished, TestPackage testToRun)
- throws DeviceNotAvailableException {
- // If there comes spurious failure like INJECT_EVENTS for a package,
- // reboot it before running it.
- // Also reboot after package which is know to leave pop-up behind
- final List<String> rebootAfterList = Arrays.asList(
- "CtsMediaTestCases",
- "CtsAccessibilityTestCases",
- "CtsAccountManagerTestCases");
- final List<String> rebootBeforeList = Arrays.asList(
- "CtsAnimationTestCases",
- "CtsGraphicsTestCases",
- "CtsViewTestCases",
- "CtsWidgetTestCases" );
- long intervalInMSec = mRebootIntervalMin * 60 * 1000;
- if (mDisableReboot || mDevice.getSerialNumber().startsWith("emulator-")) {
- return;
- }
- long currentTime = System.currentTimeMillis();
- if (((currentTime - mPrevRebootTime) > intervalInMSec) ||
- rebootAfterList.contains(testFinished.getPackageDef().getName()) ||
- rebootBeforeList.contains(testToRun.getPackageDef().getName()) ) {
- Log.i(LOG_TAG,
- String.format("Rebooting after running package %s, before package %s",
- testFinished.getPackageDef().getName(),
- testToRun.getPackageDef().getName()));
- rebootDevice();
- mPrevRebootTime = System.currentTimeMillis();
- }
- }
-
- private void rebootDevice() throws DeviceNotAvailableException {
- final int TIMEOUT_MS = 10 * 60 * 1000;
- TestDeviceOptions options = mDevice.getOptions();
- // store default value and increase time-out for reboot
- int rebootTimeout = options.getRebootTimeout();
- long onlineTimeout = options.getOnlineTimeout();
- options.setRebootTimeout(TIMEOUT_MS);
- options.setOnlineTimeout(TIMEOUT_MS);
- mDevice.setOptions(options);
-
- mDevice.reboot();
-
- // restore default values
- options.setRebootTimeout(rebootTimeout);
- options.setOnlineTimeout(onlineTimeout);
- mDevice.setOptions(options);
- Log.i(LOG_TAG, "Rebooting done");
- try {
- Thread.sleep(mRebootWaitTimeMSec);
- } catch (InterruptedException e) {
- Log.i(LOG_TAG, "Boot wait interrupted");
- }
- }
-
- /**
- * Remove artifacts like status bar from the previous test.
- * But this cannot dismiss dialog popped-up.
- */
- private void changeToHomeScreen() throws DeviceNotAvailableException {
- final String homeCmd = "input keyevent 3";
-
- mDevice.executeShellCommand(homeCmd);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- //ignore
- }
- }
-
- /**
- * Set {@code mTestPackageList} to the list of test packages to run filtered by ABI.
- */
- private void setupTestPackageList(Set<String> abis) throws DeviceNotAvailableException {
- if (!mTestPackageList.isEmpty()) {
- Log.logAndDisplay(LogLevel.INFO, LOG_TAG, "Resume tests using existing package list");
- return;
- }
- try {
- // Collect ALL tests
- ITestPackageRepo testRepo = createTestCaseRepo();
- List<ITestPackageDef> testPkgDefs = new ArrayList<>(getAvailableTestPackages(testRepo));
- testPkgDefs = filterByAbi(testPkgDefs, abis);
- // Note: run() relies on the fact that the list is reliably sorted for sharding purposes
- Collections.sort(testPkgDefs);
- // Create test package list.
- List<TestPackage> testPackageList = new ArrayList<>();
- for (ITestPackageDef testPackageDef : testPkgDefs) {
- // Note: createTest filters the test list inside of testPackageDef by exclusion list
- IRemoteTest testForPackage = testPackageDef.createTest(mCtsBuild.getTestCasesDir());
- if (testPackageDef.getTests().size() > 0) {
- testPackageList.add(new TestPackage(testPackageDef, testForPackage));
- }
- }
-
- // Filter by shard
- int numTestPackages = testPackageList.size();
- int totalShards = Math.min(mTotalShards, numTestPackages);
-
- List<TestPackage> shardTestPackageList = new ArrayList<>();
- for (int i = mShardAssignment; i < numTestPackages; i += totalShards) {
- shardTestPackageList.add(testPackageList.get(i));
- }
- mTestPackageList.addAll(shardTestPackageList);
- } catch (FileNotFoundException e) {
- throw new IllegalArgumentException("failed to find test plan file", e);
- } catch (ParseException e) {
- throw new IllegalArgumentException("failed to parse test plan file", e);
- } catch (ConfigurationException e) {
- throw new IllegalArgumentException("failed to process arguments", e);
- }
- }
-
- /**
- * Return the {@link Set} of {@link ITestPackageDef}s to run unfiltered by ABI
- *
- * @return the {@link Set} of {@link ITestPackageDef}s to run
- * @throws ParseException
- * @throws FileNotFoundException
- * @throws ConfigurationException
- */
- private Set<ITestPackageDef> getAvailableTestPackages(ITestPackageRepo testRepo)
- throws ParseException, FileNotFoundException, ConfigurationException {
- // use LinkedHashSet to have predictable iteration order
- Set<ITestPackageDef> testPkgDefs = new LinkedHashSet<>();
- if (mPlanName != null) {
- Log.i(LOG_TAG, String.format("Executing CTS test plan %s", mPlanName));
- File ctsPlanFile = mCtsBuild.getTestPlanFile(mPlanName);
- ITestPlan plan = createPlan(mPlanName);
- plan.parse(createXmlStream(ctsPlanFile));
-
- for (String testId : plan.getTestIds()) {
- if (mExcludedPackageNames.contains(AbiUtils.parseTestName(testId))) {
- continue;
- }
- ITestPackageDef testPackageDef = testRepo.getTestPackage(testId);
- if (testPackageDef == null) {
- CLog.e("Could not find test id %s referenced in plan %s", testId, mPlanName);
- continue;
- }
-
- testPackageDef.setTestFilter(plan.getTestFilter(testId));
- testPkgDefs.add(testPackageDef);
- }
- } else if (mPackageNames.size() > 0){
- Log.i(LOG_TAG, String.format("Executing test packages %s", mPackageNames));
-
- Map<String, List<ITestPackageDef>> testPackageDefMap =
- testRepo.getTestPackageDefsByName();
-
- for (String name : mPackageNames) {
- if (!testPackageDefMap.containsKey(name)) {
- throw new IllegalArgumentException(String.format(
- "Could not find test package %s. " +
- "Use 'list packages' to see available packages.", name));
- }
- testPkgDefs.addAll(testPackageDefMap.get(name));
- }
- } else if (mClassName != null) {
- Log.i(LOG_TAG, String.format("Executing CTS test class %s", mClassName));
- testPkgDefs.addAll(buildTestPackageDefSet(testRepo, mClassName, mMethodName));
- } else if (mTestName != null) {
- Log.i(LOG_TAG, String.format("Executing CTS test %s", mTestName));
- String [] split = mTestName.split("#");
- if (split.length != 2) {
- Log.logAndDisplay(LogLevel.WARN, LOG_TAG, String.format(
- "Could not parse class and method from test %s", mTestName));
- } else {
- String className = split[0];
- String methodName = split[1];
- testPkgDefs.addAll(buildTestPackageDefSet(testRepo, className, methodName));
- }
- } else if (mContinueSessionId != null) {
- // create an in-memory derived plan that contains the notExecuted tests from previous
- // session use timestamp as plan name so it will hopefully be unique
- String uniquePlanName = Long.toString(System.currentTimeMillis());
- PlanCreator planCreator = new PlanCreator(uniquePlanName, mContinueSessionId,
- CtsTestStatus.NOT_EXECUTED);
- ITestPlan plan = createPlan(planCreator);
- for (String testId : plan.getTestIds()) {
- if (mExcludedPackageNames.contains(AbiUtils.parseTestName(testId))) {
- continue;
- }
- ITestPackageDef testPackageDef = testRepo.getTestPackage(testId);
- if (testPackageDef == null) {
- CLog.e("Could not find test id %s referenced in plan %s", testId, mPlanName);
- continue;
- }
-
- testPackageDef.setTestFilter(plan.getTestFilter(testId));
- testPkgDefs.add(testPackageDef);
- }
- } else {
- // should never get here - was checkFields() not called?
- throw new IllegalStateException("nothing to run?");
- }
- return testPkgDefs;
- }
-
- /**
- * Return the list of unique prerequisite Android package names
- *
- * @param testPackages The {@link TestPackage}s that contain prerequisites
- */
- private Collection<String> getPrerequisitePackageNames(List<TestPackage> testPackages) {
- Set<String> pkgNames = new HashSet<>();
- for (TestPackage testPkg : testPackages) {
- String pkgName = testPkg.mPackageDef.getTargetPackageName();
- if (pkgName != null) {
- pkgNames.add(pkgName);
- }
- }
- return pkgNames;
- }
-
- /**
- * @return a {@link Set} containing {@link ITestPackageDef}s pertaining to the given
- * {@code className} and {@code methodName}.
- */
- private static Set<ITestPackageDef> buildTestPackageDefSet(
- ITestPackageRepo testRepo, String className, String methodName) {
- Set<ITestPackageDef> testPkgDefs = new LinkedHashSet<>();
- // try to find packages to run from class name
- List<String> packageIds = testRepo.findPackageIdsForTest(className);
- if (packageIds.isEmpty()) {
- Log.logAndDisplay(LogLevel.WARN, LOG_TAG, String.format(
- "Could not find package for test class %s", className));
- }
- for (String packageId: packageIds) {
- ITestPackageDef testPackageDef = testRepo.getTestPackage(packageId);
- if (testPackageDef != null) {
- testPackageDef.setClassName(className, methodName);
- testPkgDefs.add(testPackageDef);
- }
- }
- return testPkgDefs;
- }
-
- /**
- * Return the list (by abi) of unique prerequisite apks to install
- *
- * @param testPackages The {@link List} of {@link TestPackage} that contain prerequisite APKs
- */
- private Map<String, Set<String>> getPrerequisiteApks(
- List<TestPackage> testPackages, Set<String> abiSet) {
- Map<String, Set<String>> abiToApkMap = new HashMap<>();
- for (TestPackage testPkg : testPackages) {
- if (testPkg.getKnownTests().size() == 0) {
- // No tests, no point in installing pre-reqs
- continue;
- }
- String apkName = testPkg.mPackageDef.getTargetApkName();
- if (apkName == null) {
- continue;
- }
- String abiName = testPkg.getAbi().getName();
- if (!abiSet.contains(abiName)) {
- continue;
- }
-
- if (!abiToApkMap.containsKey(abiName)) {
- abiToApkMap.put(abiName, new HashSet<String>());
- }
- abiToApkMap.get(abiName).add(apkName);
- }
- return abiToApkMap;
- }
-
- /**
- * FIXME eventually this should be removed once we get rid of CtsTestStubs, any other
- * prerequisite apks should be installed by the test runner
- *
- * Install the collection of test apk file names
- *
- * @param prerequisiteApks The APKs that must be installed
- * @throws DeviceNotAvailableException
- */
- private void installPrerequisiteApks(Collection<String> prerequisiteApks, IAbi abi)
- throws DeviceNotAvailableException {
- if (prerequisiteApks == null) {
- return;
- }
- Log.logAndDisplay(LogLevel.INFO, LOG_TAG, "Installing prerequisites");
- for (String apkName : prerequisiteApks) {
- try {
- File apkFile = mCtsBuild.getTestApp(apkName);
- String[] options = {AbiUtils.createAbiFlag(abi.getName())};
- String errorCode = getDevice().installPackage(apkFile, true, options);
- if (errorCode != null) {
- CLog.e("Failed to install %s. Reason: %s", apkName, errorCode);
- }
- } catch (FileNotFoundException e) {
- CLog.e("Could not find test apk %s", apkName);
- }
- }
- }
-
- /**
- * Uninstalls the collection of android package names from device.
- *
- * @param uninstallPackages The packages that must be uninstalled
- */
- private void uninstallPrequisiteApks(Collection<String> uninstallPackages)
- throws DeviceNotAvailableException {
- for (String pkgName : uninstallPackages) {
- getDevice().uninstallPackage(pkgName);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<IRemoteTest> split() {
- if (mShards <= 1) {
- return null;
- }
- checkFields();
-
- List<IRemoteTest> shardQueue = new LinkedList<>();
- for (int shardAssignment = 0; shardAssignment < mShards; shardAssignment++) {
- CtsTest ctsTest = new CtsTest(shardAssignment, mShards /* totalShards */);
- OptionCopier.copyOptionsNoThrow(this, ctsTest);
- // Set the shard count because the copy option on the previous line copies
- // over the mShard value
- ctsTest.mShards = 0;
- shardQueue.add(ctsTest);
- }
-
- return shardQueue;
- }
-
- /**
- * Runs the device info collector instrumentation on device, and forwards it to test listeners
- * as run metrics.
- * <p/>
- * Exposed so unit tests can mock.
- *
- * @throws DeviceNotAvailableException
- */
- void collectDeviceInfo(ITestDevice device, CtsBuildHelper ctsBuild,
- ITestInvocationListener listener) throws DeviceNotAvailableException {
- if (!mSkipDeviceInfo) {
- String abi = AbiFormatter.getDefaultAbi(device, "");
- DeviceInfoCollector.collectDeviceInfo(device, abi, ctsBuild.getTestCasesDir(), listener);
- DeviceInfoCollector.collectExtendedDeviceInfo(
- device, abi, ctsBuild.getTestCasesDir(), listener, mBuildInfo);
- }
- }
-
- /**
- * Prepares the report log directory on host to store test metric report logs.
- */
- void prepareReportLogContainers(ITestDevice device, IBuildInfo buildInfo) {
- ReportLogUtil.prepareReportLogContainers(device, buildInfo);
- }
-
- /**
- * Collects the test metric report logs written out by device-side and host-side tests.
- */
- void collectReportLogs(ITestDevice device, IBuildInfo buildInfo) {
- ReportLogUtil.collectReportLogs(device, buildInfo);
- }
-
- /**
- * Factory method for creating a {@link ITestPackageRepo}.
- * <p/>
- * Exposed for unit testing
- */
- ITestPackageRepo createTestCaseRepo() {
- return new TestPackageRepo(mCtsBuild.getTestCasesDir(), mIncludeKnownFailures);
- }
-
- /**
- * Factory method for creating a {@link TestPlan}.
- * <p/>
- * Exposed for unit testing
- */
- ITestPlan createPlan(String planName) {
- return new TestPlan(planName, AbiUtils.getAbisSupportedByCompatibility());
- }
-
- /**
- * Gets the set of ABIs supported by both CTS and the device under test
- * <p/>
- * Exposed for unit testing
- * @return The set of ABIs to run the tests on
- * @throws DeviceNotAvailableException
- */
- Set<String> getAbis() throws DeviceNotAvailableException {
- String bitness = (mForceAbi == null) ? "" : mForceAbi;
- Set<String> abis = new HashSet<>();
- for (String abi : AbiFormatter.getSupportedAbis(mDevice, bitness)) {
- if (AbiUtils.isAbiSupportedByCompatibility(abi)) {
- abis.add(abi);
- }
- }
- return abis;
- }
-
- /**
- * Factory method for creating a {@link TestPlan} from a {@link PlanCreator}.
- * <p/>
- * Exposed for unit testing
- * @throws ConfigurationException
- */
- ITestPlan createPlan(PlanCreator planCreator)
- throws ConfigurationException {
- return planCreator.createDerivedPlan(mCtsBuild, AbiUtils.getAbisSupportedByCompatibility());
- }
-
- /**
- * Factory method for creating a {@link InputStream} from a plan xml file.
- * <p/>
- * Exposed for unit testing
- */
- InputStream createXmlStream(File xmlFile) throws FileNotFoundException {
- return new BufferedInputStream(new FileInputStream(xmlFile));
- }
-
- private void checkFields() {
- // for simplicity of command line usage, make --plan, --package, --test and --class mutually
- // exclusive
- boolean mutualExclusiveArgs = xor(mPlanName != null, mPackageNames.size() > 0,
- mClassName != null, mContinueSessionId != null, mTestName != null);
-
- if (!mutualExclusiveArgs) {
- throw new IllegalArgumentException(String.format(
- "Ambiguous or missing arguments. " +
- "One and only one of --%s --%s(s), --%s or --%s to run can be specified",
- PLAN_OPTION, PACKAGE_OPTION, CLASS_OPTION, CONTINUE_OPTION));
- }
- if (mMethodName != null && mClassName == null) {
- throw new IllegalArgumentException(String.format(
- "Must specify --%s when --%s is used", CLASS_OPTION, METHOD_OPTION));
- }
- if (mCtsBuild == null) {
- throw new IllegalArgumentException("missing CTS build");
- }
- }
-
- /**
- * Helper method to perform exclusive or on list of boolean arguments
- *
- * @param args set of booleans on which to perform exclusive or
- * @return <code>true</code> if one and only one of <var>args</code> is <code>true</code>.
- * Otherwise return <code>false</code>.
- */
- private static boolean xor(boolean... args) {
- boolean currentVal = args[0];
- for (int i=1; i < args.length; i++) {
- if (currentVal && args[i]) {
- return false;
- }
- currentVal |= args[i];
- }
- return currentVal;
- }
-
- /**
- * Forward the digest and package name to the listener as a metric
- *
- * @param listener Handles test results
- */
- private static void forwardPackageDetails(ITestPackageDef def, ITestInvocationListener listener) {
- Map<String, String> metrics = new HashMap<>(3);
- metrics.put(PACKAGE_NAME_METRIC, def.getName());
- metrics.put(PACKAGE_ABI_METRIC, def.getAbi().getName());
- metrics.put(PACKAGE_DIGEST_METRIC, def.getDigest());
- listener.testRunStarted(def.getId(), 0);
- listener.testRunEnded(0, metrics);
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java
deleted file mode 100644
index 851f4a6..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java
+++ /dev/null
@@ -1,1916 +0,0 @@
-package com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.ddmlib.AdbCommandRejectedException;
-import com.android.ddmlib.IShellOutputReceiver;
-import com.android.ddmlib.MultiLineReceiver;
-import com.android.ddmlib.ShellCommandUnresponsiveException;
-import com.android.ddmlib.TimeoutException;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ByteArrayInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.IRunUtil;
-import com.android.tradefed.util.RunInterruptedException;
-import com.android.tradefed.util.RunUtil;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Test runner for dEQP tests
- *
- * Supports running drawElements Quality Program tests found under external/deqp.
- */
-public class DeqpTestRunner implements IBuildReceiver, IDeviceTest, IRemoteTest {
-
- private static final String DEQP_ONDEVICE_APK = "com.drawelements.deqp.apk";
- private static final String DEQP_ONDEVICE_PKG = "com.drawelements.deqp";
- private static final String INCOMPLETE_LOG_MESSAGE = "Crash: Incomplete test log";
- private static final String SKIPPED_INSTANCE_LOG_MESSAGE = "Configuration skipped";
- private static final String NOT_EXECUTABLE_LOG_MESSAGE = "Abort: Test cannot be executed";
- private static final String CASE_LIST_FILE_NAME = "/sdcard/dEQP-TestCaseList.txt";
- private static final String LOG_FILE_NAME = "/sdcard/TestLog.qpa";
- public static final String FEATURE_LANDSCAPE = "android.hardware.screen.landscape";
- public static final String FEATURE_PORTRAIT = "android.hardware.screen.portrait";
-
- private static final int TESTCASE_BATCH_LIMIT = 1000;
- private static final BatchRunConfiguration DEFAULT_CONFIG =
- new BatchRunConfiguration("rgba8888d24s8", "unspecified", "window");
-
- private static final int UNRESPOSIVE_CMD_TIMEOUT_MS = 10*60*1000; // ten minutes
-
- private final String mPackageName;
- private final String mName;
- private final Collection<TestIdentifier> mRemainingTests;
- private final Map<TestIdentifier, Set<BatchRunConfiguration>> mTestInstances;
- private final TestInstanceResultListener mInstanceListerner = new TestInstanceResultListener();
- private final Map<TestIdentifier, Integer> mTestInstabilityRatings;
- private IAbi mAbi;
- private CtsBuildHelper mCtsBuild;
- private boolean mLogData = false;
- private ITestDevice mDevice;
- private Set<String> mDeviceFeatures;
- private Map<String, Boolean> mConfigQuerySupportCache = new HashMap<>();
- private IRunUtil mRunUtil = RunUtil.getDefault();
-
- private IRecovery mDeviceRecovery = new Recovery();
- {
- mDeviceRecovery.setSleepProvider(new SleepProvider());
- }
-
- public DeqpTestRunner(String packageName, String name, Collection<TestIdentifier> tests,
- Map<TestIdentifier, List<Map<String,String>>> testInstances) {
- mPackageName = packageName;
- mName = name;
- mRemainingTests = new LinkedList<>(tests); // avoid modifying arguments
- mTestInstances = parseTestInstances(tests, testInstances);
- mTestInstabilityRatings = new HashMap<>();
- }
-
- /**
- * @param abi the ABI to run the test on
- */
- public void setAbi(IAbi abi) {
- mAbi = abi;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setBuild(IBuildInfo buildInfo) {
- mCtsBuild = CtsBuildHelper.createBuildHelper(buildInfo);
- }
-
- /**
- * Set the CTS build container.
- * <p/>
- * Exposed so unit tests can mock the provided build.
- *
- * @param buildHelper
- */
- public void setBuildHelper(CtsBuildHelper buildHelper) {
- mCtsBuild = buildHelper;
- }
-
- /**
- * Enable or disable raw dEQP test log collection.
- */
- public void setCollectLogs(boolean logData) {
- mLogData = logData;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setDevice(ITestDevice device) {
- mDevice = device;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ITestDevice getDevice() {
- return mDevice;
- }
-
- /**
- * Set recovery handler.
- *
- * Exposed for unit testing.
- */
- public void setRecovery(IRecovery deviceRecovery) {
- mDeviceRecovery = deviceRecovery;
- }
-
- /**
- * Set IRunUtil.
- *
- * Exposed for unit testing.
- */
- public void setRunUtil(IRunUtil runUtil) {
- mRunUtil = runUtil;
- }
-
- private static final class CapabilityQueryFailureException extends Exception {
- }
-
- /**
- * Test configuration of dEPQ test instance execution.
- * Exposed for unit testing
- */
- public static final class BatchRunConfiguration {
- public static final String ROTATION_UNSPECIFIED = "unspecified";
- public static final String ROTATION_PORTRAIT = "0";
- public static final String ROTATION_LANDSCAPE = "90";
- public static final String ROTATION_REVERSE_PORTRAIT = "180";
- public static final String ROTATION_REVERSE_LANDSCAPE = "270";
-
- private final String mGlConfig;
- private final String mRotation;
- private final String mSurfaceType;
-
- public BatchRunConfiguration(String glConfig, String rotation, String surfaceType) {
- mGlConfig = glConfig;
- mRotation = rotation;
- mSurfaceType = surfaceType;
- }
-
- /**
- * Get string that uniquely identifies this config
- */
- public String getId() {
- return String.format("{glformat=%s,rotation=%s,surfacetype=%s}",
- mGlConfig, mRotation, mSurfaceType);
- }
-
- /**
- * Get the GL config used in this configuration.
- */
- public String getGlConfig() {
- return mGlConfig;
- }
-
- /**
- * Get the screen rotation used in this configuration.
- */
- public String getRotation() {
- return mRotation;
- }
-
- /**
- * Get the surface type used in this configuration.
- */
- public String getSurfaceType() {
- return mSurfaceType;
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == null) {
- return false;
- } else if (!(other instanceof BatchRunConfiguration)) {
- return false;
- } else {
- return getId().equals(((BatchRunConfiguration)other).getId());
- }
- }
-
- @Override
- public int hashCode() {
- return getId().hashCode();
- }
- }
-
- /**
- * dEQP test instance listerer and invocation result forwarded
- */
- private class TestInstanceResultListener {
- private ITestInvocationListener mSink;
- private BatchRunConfiguration mRunConfig;
-
- private TestIdentifier mCurrentTestId;
- private boolean mGotTestResult;
- private String mCurrentTestLog;
-
- private class PendingResult {
- boolean allInstancesPassed;
- Map<BatchRunConfiguration, String> testLogs;
- Map<BatchRunConfiguration, String> errorMessages;
- Set<BatchRunConfiguration> remainingConfigs;
- }
-
- private final Map<TestIdentifier, PendingResult> mPendingResults = new HashMap<>();
-
- public void setSink(ITestInvocationListener sink) {
- mSink = sink;
- }
-
- public void setCurrentConfig(BatchRunConfiguration runConfig) {
- mRunConfig = runConfig;
- }
-
- /**
- * Get currently processed test id, or null if not currently processing a test case
- */
- public TestIdentifier getCurrentTestId() {
- return mCurrentTestId;
- }
-
- /**
- * Forward result to sink
- */
- private void forwardFinalizedPendingResult(TestIdentifier testId) {
- if (mRemainingTests.contains(testId)) {
- final PendingResult result = mPendingResults.get(testId);
-
- mPendingResults.remove(testId);
- mRemainingTests.remove(testId);
-
- // Forward results to the sink
- mSink.testStarted(testId);
-
- // Test Log
- if (mLogData) {
- for (Map.Entry<BatchRunConfiguration, String> entry :
- result.testLogs.entrySet()) {
- final ByteArrayInputStreamSource source
- = new ByteArrayInputStreamSource(entry.getValue().getBytes());
-
- mSink.testLog(testId.getClassName() + "." + testId.getTestName() + "@"
- + entry.getKey().getId(), LogDataType.XML, source);
-
- source.cancel();
- }
- }
-
- // Error message
- if (!result.allInstancesPassed) {
- final StringBuilder errorLog = new StringBuilder();
-
- for (Map.Entry<BatchRunConfiguration, String> entry :
- result.errorMessages.entrySet()) {
- if (errorLog.length() > 0) {
- errorLog.append('\n');
- }
- errorLog.append(String.format("=== with config %s ===\n",
- entry.getKey().getId()));
- errorLog.append(entry.getValue());
- }
-
- mSink.testFailed(testId, errorLog.toString());
- }
-
- final Map<String, String> emptyMap = Collections.emptyMap();
- mSink.testEnded(testId, emptyMap);
- } else {
- CLog.w("Finalization for non-pending case %s", testId);
- }
- }
-
- /**
- * Declare existence of a test and instances
- */
- public void setTestInstances(TestIdentifier testId, Set<BatchRunConfiguration> configs) {
- // Test instances cannot change at runtime, ignore if we have already set this
- if (!mPendingResults.containsKey(testId)) {
- final PendingResult pendingResult = new PendingResult();
- pendingResult.allInstancesPassed = true;
- pendingResult.testLogs = new LinkedHashMap<>();
- pendingResult.errorMessages = new LinkedHashMap<>();
- pendingResult.remainingConfigs = new HashSet<>(configs); // avoid mutating argument
- mPendingResults.put(testId, pendingResult);
- }
- }
-
- /**
- * Query if test instance has not yet been executed
- */
- public boolean isPendingTestInstance(TestIdentifier testId,
- BatchRunConfiguration config) {
- final PendingResult result = mPendingResults.get(testId);
- if (result == null) {
- // test is not in the current working batch of the runner, i.e. it cannot be
- // "partially" completed.
- if (!mRemainingTests.contains(testId)) {
- // The test has been fully executed. Not pending.
- return false;
- } else {
- // Test has not yet been executed. Check if such instance exists
- return mTestInstances.get(testId).contains(config);
- }
- } else {
- // could be partially completed, check this particular config
- return result.remainingConfigs.contains(config);
- }
- }
-
- /**
- * Fake execution of an instance with current config
- */
- public void skipTest(TestIdentifier testId) {
- final PendingResult result = mPendingResults.get(testId);
-
- result.errorMessages.put(mRunConfig, SKIPPED_INSTANCE_LOG_MESSAGE);
- result.remainingConfigs.remove(mRunConfig);
-
- // Pending result finished, report result
- if (result.remainingConfigs.isEmpty()) {
- forwardFinalizedPendingResult(testId);
- }
- }
-
- /**
- * Fake failure of an instance with current config
- */
- public void abortTest(TestIdentifier testId, String errorMessage) {
- final PendingResult result = mPendingResults.get(testId);
-
- CLog.i("Test %s aborted with message %s", testId, errorMessage);
-
- // Mark as executed
- result.allInstancesPassed = false;
- result.errorMessages.put(mRunConfig, errorMessage);
- result.remainingConfigs.remove(mRunConfig);
-
- // Pending result finished, report result
- if (result.remainingConfigs.isEmpty()) {
- forwardFinalizedPendingResult(testId);
- }
-
- if (testId.equals(mCurrentTestId)) {
- mCurrentTestId = null;
- }
- }
-
- /**
- * Handles beginning of dEQP session.
- */
- private boolean handleBeginSession(Map<String, String> values) {
- // ignore
- return true;
- }
-
- /**
- * Handle session info
- */
- private boolean handleSessionInfo(Map<String, String> values) {
- // ignore
- return true;
- }
-
- /**
- * Handles end of dEQP session.
- */
- private boolean handleEndSession(Map<String, String> values) {
- // ignore
- return true;
- }
-
- /**
- * Handles beginning of dEQP testcase.
- */
- private boolean handleBeginTestCase(Map<String, String> values) {
- String casePath = values.get("dEQP-BeginTestCase-TestCasePath");
-
- if (mCurrentTestId != null) {
- CLog.w("Got unexpected start of %s, so aborting", mCurrentTestId);
- abortTest(mCurrentTestId, INCOMPLETE_LOG_MESSAGE);
- mCurrentTestId = null;
- }
-
- mCurrentTestLog = "";
- mGotTestResult = false;
-
- if (casePath == null) {
- CLog.w("Got null case path for test case begin event. Current test ID: %s", mCurrentTestId);
- mCurrentTestId = null;
- return false;
- }
-
- mCurrentTestId = pathToIdentifier(casePath);
-
- if (mPendingResults.get(mCurrentTestId) == null) {
- CLog.w("Got unexpected start of %s", mCurrentTestId);
- }
- return true;
- }
-
- /**
- * Handles end of dEQP testcase.
- */
- private boolean handleEndTestCase(Map<String, String> values) {
- final PendingResult result = mPendingResults.get(mCurrentTestId);
-
- if (result != null) {
- if (!mGotTestResult) {
- result.allInstancesPassed = false;
- result.errorMessages.put(mRunConfig, INCOMPLETE_LOG_MESSAGE);
- CLog.i("Test %s failed as it ended before receiving result.", mCurrentTestId);
- }
- result.remainingConfigs.remove(mRunConfig);
-
- if (mLogData && mCurrentTestLog != null && mCurrentTestLog.length() > 0) {
- result.testLogs.put(mRunConfig, mCurrentTestLog);
- }
-
- // Pending result finished, report result
- if (result.remainingConfigs.isEmpty()) {
- forwardFinalizedPendingResult(mCurrentTestId);
- }
- } else {
- CLog.w("Got unexpected end of %s", mCurrentTestId);
- }
- mCurrentTestId = null;
- return true;
- }
-
- /**
- * Handles dEQP testcase result.
- */
- private boolean handleTestCaseResult(Map<String, String> values) {
- String code = values.get("dEQP-TestCaseResult-Code");
- if (code == null) {
- return false;
- }
-
- String details = values.get("dEQP-TestCaseResult-Details");
-
- if (mPendingResults.get(mCurrentTestId) == null) {
- CLog.w("Got unexpected result for %s", mCurrentTestId);
- mGotTestResult = true;
- return true;
- }
-
- if (code.compareTo("Pass") == 0) {
- mGotTestResult = true;
- } else if (code.compareTo("NotSupported") == 0) {
- mGotTestResult = true;
- } else if (code.compareTo("QualityWarning") == 0) {
- mGotTestResult = true;
- } else if (code.compareTo("CompatibilityWarning") == 0) {
- mGotTestResult = true;
- } else if (code.compareTo("Fail") == 0 || code.compareTo("ResourceError") == 0
- || code.compareTo("InternalError") == 0 || code.compareTo("Crash") == 0
- || code.compareTo("Timeout") == 0) {
- mPendingResults.get(mCurrentTestId).allInstancesPassed = false;
- mPendingResults.get(mCurrentTestId)
- .errorMessages.put(mRunConfig, code + ": " + details);
- mGotTestResult = true;
- } else {
- String codeError = "Unknown result code: " + code;
- mPendingResults.get(mCurrentTestId).allInstancesPassed = false;
- mPendingResults.get(mCurrentTestId)
- .errorMessages.put(mRunConfig, codeError + ": " + details);
- mGotTestResult = true;
- CLog.e("Got invalid result code '%s' for test %s", code, mCurrentTestId);
- }
- return true;
- }
-
- /**
- * Handles terminated dEQP testcase.
- */
- private boolean handleTestCaseTerminate(Map<String, String> values) {
- final PendingResult result = mPendingResults.get(mCurrentTestId);
-
- if (result != null) {
- String reason = values.get("dEQP-TerminateTestCase-Reason");
- mPendingResults.get(mCurrentTestId).allInstancesPassed = false;
- mPendingResults.get(mCurrentTestId)
- .errorMessages.put(mRunConfig, "Terminated: " + reason);
- result.remainingConfigs.remove(mRunConfig);
-
- // Pending result finished, report result
- if (result.remainingConfigs.isEmpty()) {
- forwardFinalizedPendingResult(mCurrentTestId);
- }
- } else {
- CLog.w("Got unexpected termination of %s", mCurrentTestId);
- }
-
- mCurrentTestId = null;
- mGotTestResult = true;
- return true;
- }
-
- /**
- * Handles dEQP testlog data.
- */
- private boolean handleTestLogData(Map<String, String> values) {
- String newLog = values.get("dEQP-TestLogData-Log");
- if (newLog == null) {
- return false;
- }
- mCurrentTestLog = mCurrentTestLog + newLog;
- return true;
- }
-
- /**
- * Handles new instrumentation status message.
- * @return true if handled correctly, false if missing values.
- */
- public boolean handleStatus(Map<String, String> values) {
- String eventType = values.get("dEQP-EventType");
-
- if (eventType == null) {
- // Not an event, but some other line
- return true;
- }
-
- if (eventType.compareTo("BeginSession") == 0) {
- return handleBeginSession(values);
- } else if (eventType.compareTo("SessionInfo") == 0) {
- return handleSessionInfo(values);
- } else if (eventType.compareTo("EndSession") == 0) {
- return handleEndSession(values);
- } else if (eventType.compareTo("BeginTestCase") == 0) {
- return handleBeginTestCase(values);
- } else if (eventType.compareTo("EndTestCase") == 0) {
- return handleEndTestCase(values);
- } else if (eventType.compareTo("TestCaseResult") == 0) {
- return handleTestCaseResult(values);
- } else if (eventType.compareTo("TerminateTestCase") == 0) {
- return handleTestCaseTerminate(values);
- } else if (eventType.compareTo("TestLogData") == 0) {
- return handleTestLogData(values);
- }
- CLog.e("Unknown event type (%s)", eventType);
- return false;
- }
-
- /**
- * Signal listener that batch ended and forget incomplete results.
- */
- public void endBatch() {
- // end open test if when stream ends
- if (mCurrentTestId != null) {
- // Current instance was removed from remainingConfigs when case
- // started. Mark current instance as pending.
- CLog.i("Batch ended with test '%s' current", mCurrentTestId);
- if (mPendingResults.get(mCurrentTestId) != null) {
- mPendingResults.get(mCurrentTestId).remainingConfigs.add(mRunConfig);
- } else {
- CLog.w("Got unexpected internal state of %s", mCurrentTestId);
- }
- }
- mCurrentTestId = null;
- }
- }
-
- /**
- * dEQP instrumentation parser
- */
- private static class InstrumentationParser extends MultiLineReceiver {
- private TestInstanceResultListener mListener;
-
- private Map<String, String> mValues;
- private String mCurrentName;
- private String mCurrentValue;
- private int mResultCode;
- private boolean mGotExitValue = false;
- private boolean mParseSuccessful = true;
-
-
- public InstrumentationParser(TestInstanceResultListener listener) {
- mListener = listener;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void processNewLines(String[] lines) {
- for (String line : lines) {
- if (mValues == null) mValues = new HashMap<String, String>();
-
- if (line.startsWith("INSTRUMENTATION_STATUS_CODE: ")) {
- if (mCurrentName != null) {
- mValues.put(mCurrentName, mCurrentValue);
-
- mCurrentName = null;
- mCurrentValue = null;
- }
-
- mParseSuccessful &= mListener.handleStatus(mValues);
- mValues = null;
- } else if (line.startsWith("INSTRUMENTATION_STATUS: dEQP-")) {
- if (mCurrentName != null) {
- mValues.put(mCurrentName, mCurrentValue);
-
- mCurrentValue = null;
- mCurrentName = null;
- }
-
- String prefix = "INSTRUMENTATION_STATUS: ";
- int nameBegin = prefix.length();
- int nameEnd = line.indexOf('=');
- if (nameEnd < 0) {
- CLog.e("Line does not contain value. Logcat interrupted? (%s)", line);
- mCurrentValue = null;
- mCurrentName = null;
- mParseSuccessful = false;
- return;
- } else {
- int valueBegin = nameEnd + 1;
- mCurrentName = line.substring(nameBegin, nameEnd);
- mCurrentValue = line.substring(valueBegin);
- }
- } else if (line.startsWith("INSTRUMENTATION_CODE: ")) {
- try {
- mResultCode = Integer.parseInt(line.substring(22));
- mGotExitValue = true;
- } catch (NumberFormatException ex) {
- CLog.e("Instrumentation code format unexpected");
- mParseSuccessful = false;
- return;
- }
- } else if (mCurrentValue != null) {
- mCurrentValue = mCurrentValue + line;
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void done() {
- if (mCurrentName != null) {
- mValues.put(mCurrentName, mCurrentValue);
-
- mCurrentName = null;
- mCurrentValue = null;
- }
-
- if (mValues != null) {
- mParseSuccessful &= mListener.handleStatus(mValues);
- mValues = null;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isCancelled() {
- return false;
- }
-
- /**
- * Returns whether target instrumentation exited normally.
- */
- public boolean wasSuccessful() {
- return mGotExitValue && mParseSuccessful;
- }
-
- /**
- * Returns Instrumentation return code
- */
- public int getResultCode() {
- return mResultCode;
- }
- }
-
- /**
- * dEQP platfom query instrumentation parser
- */
- private static class PlatformQueryInstrumentationParser extends MultiLineReceiver {
- private Map<String,String> mResultMap = new LinkedHashMap<>();
- private int mResultCode;
- private boolean mGotExitValue = false;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void processNewLines(String[] lines) {
- for (String line : lines) {
- if (line.startsWith("INSTRUMENTATION_RESULT: ")) {
- final String parts[] = line.substring(24).split("=",2);
- if (parts.length == 2) {
- mResultMap.put(parts[0], parts[1]);
- } else {
- CLog.w("Instrumentation status format unexpected");
- }
- } else if (line.startsWith("INSTRUMENTATION_CODE: ")) {
- try {
- mResultCode = Integer.parseInt(line.substring(22));
- mGotExitValue = true;
- } catch (NumberFormatException ex) {
- CLog.w("Instrumentation code format unexpected");
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isCancelled() {
- return false;
- }
-
- /**
- * Returns whether target instrumentation exited normally.
- */
- public boolean wasSuccessful() {
- return mGotExitValue;
- }
-
- /**
- * Returns Instrumentation return code
- */
- public int getResultCode() {
- return mResultCode;
- }
-
- public Map<String,String> getResultMap() {
- return mResultMap;
- }
- }
-
- /**
- * Interface for sleeping.
- *
- * Exposed for unit testing
- */
- public static interface ISleepProvider {
- public void sleep(int milliseconds);
- }
-
- private static class SleepProvider implements ISleepProvider {
- public void sleep(int milliseconds) {
- try {
- Thread.sleep(milliseconds);
- } catch (InterruptedException ex) {
- }
- }
- }
-
- /**
- * Interface for failure recovery.
- *
- * Exposed for unit testing
- */
- public static interface IRecovery {
- /**
- * Sets the sleep provider IRecovery works on
- */
- public void setSleepProvider(ISleepProvider sleepProvider);
-
- /**
- * Sets the device IRecovery works on
- */
- public void setDevice(ITestDevice device);
-
- /**
- * Informs Recovery that test execution has progressed since the last recovery
- */
- public void onExecutionProgressed();
-
- /**
- * Tries to recover device after failed refused connection.
- *
- * @throws DeviceNotAvailableException if recovery did not succeed
- */
- public void recoverConnectionRefused() throws DeviceNotAvailableException;
-
- /**
- * Tries to recover device after abnormal execution termination or link failure.
- *
- * @param progressedSinceLastCall true if test execution has progressed since last call
- * @throws DeviceNotAvailableException if recovery did not succeed
- */
- public void recoverComLinkKilled() throws DeviceNotAvailableException;
- };
-
- /**
- * State machine for execution failure recovery.
- *
- * Exposed for unit testing
- */
- public static class Recovery implements IRecovery {
- private int RETRY_COOLDOWN_MS = 6000; // 6 seconds
- private int PROCESS_KILL_WAIT_MS = 1000; // 1 second
-
- private static enum MachineState {
- WAIT, // recover by waiting
- RECOVER, // recover by calling recover()
- REBOOT, // recover by rebooting
- FAIL, // cannot recover
- };
-
- private MachineState mState = MachineState.WAIT;
- private ITestDevice mDevice;
- private ISleepProvider mSleepProvider;
-
- private static class ProcessKillFailureException extends Exception {
- }
-
- /**
- * {@inheritDoc}
- */
- public void setSleepProvider(ISleepProvider sleepProvider) {
- mSleepProvider = sleepProvider;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setDevice(ITestDevice device) {
- mDevice = device;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onExecutionProgressed() {
- mState = MachineState.WAIT;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void recoverConnectionRefused() throws DeviceNotAvailableException {
- switch (mState) {
- case WAIT: // not a valid stratedy for connection refusal, fallthrough
- case RECOVER:
- // First failure, just try to recover
- CLog.w("ADB connection failed, trying to recover");
- mState = MachineState.REBOOT; // the next step is to reboot
-
- try {
- recoverDevice();
- } catch (DeviceNotAvailableException ex) {
- // chain forward
- recoverConnectionRefused();
- }
- break;
-
- case REBOOT:
- // Second failure in a row, try to reboot
- CLog.w("ADB connection failed after recovery, rebooting device");
- mState = MachineState.FAIL; // the next step is to fail
-
- try {
- rebootDevice();
- } catch (DeviceNotAvailableException ex) {
- // chain forward
- recoverConnectionRefused();
- }
- break;
-
- case FAIL:
- // Third failure in a row, just fail
- CLog.w("Cannot recover ADB connection");
- throw new DeviceNotAvailableException("failed to connect after reboot");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void recoverComLinkKilled() throws DeviceNotAvailableException {
- switch (mState) {
- case WAIT:
- // First failure, just try to wait and try again
- CLog.w("ADB link failed, retrying after a cooldown period");
- mState = MachineState.RECOVER; // the next step is to recover the device
-
- waitCooldown();
-
- // even if the link to deqp on-device process was killed, the process might
- // still be alive. Locate and terminate such unwanted processes.
- try {
- killDeqpProcess();
- } catch (DeviceNotAvailableException ex) {
- // chain forward
- recoverComLinkKilled();
- } catch (ProcessKillFailureException ex) {
- // chain forward
- recoverComLinkKilled();
- }
- break;
-
- case RECOVER:
- // Second failure, just try to recover
- CLog.w("ADB link failed, trying to recover");
- mState = MachineState.REBOOT; // the next step is to reboot
-
- try {
- recoverDevice();
- killDeqpProcess();
- } catch (DeviceNotAvailableException ex) {
- // chain forward
- recoverComLinkKilled();
- } catch (ProcessKillFailureException ex) {
- // chain forward
- recoverComLinkKilled();
- }
- break;
-
- case REBOOT:
- // Third failure in a row, try to reboot
- CLog.w("ADB link failed after recovery, rebooting device");
- mState = MachineState.FAIL; // the next step is to fail
-
- try {
- rebootDevice();
- } catch (DeviceNotAvailableException ex) {
- // chain forward
- recoverComLinkKilled();
- }
- break;
-
- case FAIL:
- // Fourth failure in a row, just fail
- CLog.w("Cannot recover ADB connection");
- throw new DeviceNotAvailableException("link killed after reboot");
- }
- }
-
- private void waitCooldown() {
- mSleepProvider.sleep(RETRY_COOLDOWN_MS);
- }
-
- private Iterable<Integer> getDeqpProcessPids() throws DeviceNotAvailableException {
- final List<Integer> pids = new ArrayList<Integer>(2);
- final String processes = mDevice.executeShellCommand("ps | grep com.drawelements");
- final String[] lines = processes.split("(\\r|\\n)+");
- for (String line : lines) {
- final String[] fields = line.split("\\s+");
- if (fields.length < 2) {
- continue;
- }
-
- try {
- final int processId = Integer.parseInt(fields[1], 10);
- pids.add(processId);
- } catch (NumberFormatException ex) {
- continue;
- }
- }
- return pids;
- }
-
- private void killDeqpProcess() throws DeviceNotAvailableException,
- ProcessKillFailureException {
- for (Integer processId : getDeqpProcessPids()) {
- CLog.i("Killing deqp device process with ID %d", processId);
- mDevice.executeShellCommand(String.format("kill -9 %d", processId));
- }
-
- mSleepProvider.sleep(PROCESS_KILL_WAIT_MS);
-
- // check that processes actually died
- if (getDeqpProcessPids().iterator().hasNext()) {
- // a process is still alive, killing failed
- CLog.w("Failed to kill all deqp processes on device");
- throw new ProcessKillFailureException();
- }
- }
-
- public void recoverDevice() throws DeviceNotAvailableException {
- // Work around the API. We need to call recoverDevice() on the test device and
- // we know that mDevice is a TestDevice. However even though the recoverDevice()
- // method is public suggesting it should be publicly accessible, the class itself
- // and its super-interface (IManagedTestDevice) are package-private.
- final Method recoverDeviceMethod;
- try {
- recoverDeviceMethod = mDevice.getClass().getMethod("recoverDevice");
- recoverDeviceMethod.setAccessible(true);
- } catch (NoSuchMethodException ex) {
- throw new AssertionError("Test device must have recoverDevice()");
- }
-
- try {
- recoverDeviceMethod.invoke(mDevice);
- } catch (InvocationTargetException ex) {
- if (ex.getCause() instanceof DeviceNotAvailableException) {
- throw (DeviceNotAvailableException)ex.getCause();
- } else if (ex.getCause() instanceof RuntimeException) {
- throw (RuntimeException)ex.getCause();
- } else {
- throw new AssertionError("unexpected throw", ex);
- }
- } catch (IllegalAccessException ex) {
- throw new AssertionError("unexpected throw", ex);
- }
- }
-
- private void rebootDevice() throws DeviceNotAvailableException {
- mDevice.reboot();
- }
- }
-
- /**
- * Parse map of instance arguments to map of BatchRunConfigurations
- */
- private static Map<TestIdentifier, Set<BatchRunConfiguration>> parseTestInstances(
- Collection<TestIdentifier> tests,
- Map<TestIdentifier, List<Map<String,String>>> testInstances) {
- final Map<TestIdentifier, Set<BatchRunConfiguration>> instances = new HashMap<>();
- for (final TestIdentifier test : tests) {
- final Set<BatchRunConfiguration> testInstanceSet = new LinkedHashSet<>();
- if (testInstances.get(test).isEmpty()) {
- // no instances defined, use default
- testInstanceSet.add(DEFAULT_CONFIG);
- } else {
- for (Map<String, String> instanceArgs : testInstances.get(test)) {
- testInstanceSet.add(parseRunConfig(instanceArgs));
- }
- }
- instances.put(test, testInstanceSet);
- }
- return instances;
- }
-
- private static BatchRunConfiguration parseRunConfig(Map<String,String> instanceArguments) {
- final String glConfig;
- final String rotation;
- final String surfaceType;
-
- if (instanceArguments.containsKey("glconfig")) {
- glConfig = instanceArguments.get("glconfig");
- } else {
- glConfig = DEFAULT_CONFIG.getGlConfig();
- }
- if (instanceArguments.containsKey("rotation")) {
- rotation = instanceArguments.get("rotation");
- } else {
- rotation = DEFAULT_CONFIG.getRotation();
- }
- if (instanceArguments.containsKey("surfaceType")) {
- surfaceType = instanceArguments.get("surfaceType");
- } else {
- surfaceType = DEFAULT_CONFIG.getSurfaceType();
- }
-
- return new BatchRunConfiguration(glConfig, rotation, surfaceType);
- }
-
- private Set<BatchRunConfiguration> getTestRunConfigs (TestIdentifier testId) {
- return mTestInstances.get(testId);
- }
-
- /**
- * Converts dEQP testcase path to TestIdentifier.
- */
- private static TestIdentifier pathToIdentifier(String testPath) {
- String[] components = testPath.split("\\.");
- String name = components[components.length - 1];
- String className = null;
-
- for (int i = 0; i < components.length - 1; i++) {
- if (className == null) {
- className = components[i];
- } else {
- className = className + "." + components[i];
- }
- }
-
- return new TestIdentifier(className, name);
- }
-
- private String getId() {
- return AbiUtils.createId(mAbi.getName(), mPackageName);
- }
-
- /**
- * Generates tescase trie from dEQP testcase paths. Used to define which testcases to execute.
- */
- private static String generateTestCaseTrieFromPaths(Collection<String> tests) {
- String result = "{";
- boolean first = true;
-
- // Add testcases to results
- for (Iterator<String> iter = tests.iterator(); iter.hasNext();) {
- String test = iter.next();
- String[] components = test.split("\\.");
-
- if (components.length == 1) {
- if (!first) {
- result = result + ",";
- }
- first = false;
-
- result += components[0];
- iter.remove();
- }
- }
-
- if (!tests.isEmpty()) {
- HashMap<String, ArrayList<String> > testGroups = new HashMap<>();
-
- // Collect all sub testgroups
- for (String test : tests) {
- String[] components = test.split("\\.");
- ArrayList<String> testGroup = testGroups.get(components[0]);
-
- if (testGroup == null) {
- testGroup = new ArrayList<String>();
- testGroups.put(components[0], testGroup);
- }
-
- testGroup.add(test.substring(components[0].length()+1));
- }
-
- for (String testGroup : testGroups.keySet()) {
- if (!first) {
- result = result + ",";
- }
-
- first = false;
- result = result + testGroup
- + generateTestCaseTrieFromPaths(testGroups.get(testGroup));
- }
- }
-
- return result + "}";
- }
-
- /**
- * Generates testcase trie from TestIdentifiers.
- */
- private static String generateTestCaseTrie(Collection<TestIdentifier> tests) {
- ArrayList<String> testPaths = new ArrayList<String>();
-
- for (TestIdentifier test : tests) {
- testPaths.add(test.getClassName() + "." + test.getTestName());
- }
-
- return generateTestCaseTrieFromPaths(testPaths);
- }
-
- private static class TestBatch {
- public BatchRunConfiguration config;
- public List<TestIdentifier> tests;
- }
-
- private TestBatch selectRunBatch() {
- return selectRunBatch(mRemainingTests, null);
- }
-
- /**
- * Creates a TestBatch from the given tests or null if not tests remaining.
- *
- * @param pool List of tests to select from
- * @param requiredConfig Select only instances with pending requiredConfig, or null to select
- * any run configuration.
- */
- private TestBatch selectRunBatch(Collection<TestIdentifier> pool,
- BatchRunConfiguration requiredConfig) {
- // select one test (leading test) that is going to be executed and then pack along as many
- // other compatible instances as possible.
-
- TestIdentifier leadingTest = null;
- for (TestIdentifier test : pool) {
- if (!mRemainingTests.contains(test)) {
- continue;
- }
- if (requiredConfig != null &&
- !mInstanceListerner.isPendingTestInstance(test, requiredConfig)) {
- continue;
- }
- leadingTest = test;
- break;
- }
-
- // no remaining tests?
- if (leadingTest == null) {
- return null;
- }
-
- BatchRunConfiguration leadingTestConfig = null;
- if (requiredConfig != null) {
- leadingTestConfig = requiredConfig;
- } else {
- for (BatchRunConfiguration runConfig : getTestRunConfigs(leadingTest)) {
- if (mInstanceListerner.isPendingTestInstance(leadingTest, runConfig)) {
- leadingTestConfig = runConfig;
- break;
- }
- }
- }
-
- // test pending <=> test has a pending config
- if (leadingTestConfig == null) {
- throw new AssertionError("search postcondition failed");
- }
-
- final int leadingInstability = getTestInstabilityRating(leadingTest);
-
- final TestBatch runBatch = new TestBatch();
- runBatch.config = leadingTestConfig;
- runBatch.tests = new ArrayList<>();
- runBatch.tests.add(leadingTest);
-
- for (TestIdentifier test : pool) {
- if (test == leadingTest) {
- // do not re-select the leading tests
- continue;
- }
- if (!mInstanceListerner.isPendingTestInstance(test, leadingTestConfig)) {
- // select only compatible
- continue;
- }
- if (getTestInstabilityRating(test) != leadingInstability) {
- // pack along only cases in the same stability category. Packing more dangerous
- // tests along jeopardizes the stability of this run. Packing more stable tests
- // along jeopardizes their stability rating.
- continue;
- }
- if (runBatch.tests.size() >= getBatchSizeLimitForInstability(leadingInstability)) {
- // batch size is limited.
- break;
- }
- runBatch.tests.add(test);
- }
-
- return runBatch;
- }
-
- private int getBatchNumPendingCases(TestBatch batch) {
- int numPending = 0;
- for (TestIdentifier test : batch.tests) {
- if (mInstanceListerner.isPendingTestInstance(test, batch.config)) {
- ++numPending;
- }
- }
- return numPending;
- }
-
- private int getBatchSizeLimitForInstability(int batchInstabilityRating) {
- // reduce group size exponentially down to one
- return Math.max(1, TESTCASE_BATCH_LIMIT / (1 << batchInstabilityRating));
- }
-
- private int getTestInstabilityRating(TestIdentifier testId) {
- if (mTestInstabilityRatings.containsKey(testId)) {
- return mTestInstabilityRatings.get(testId);
- } else {
- return 0;
- }
- }
-
- private void recordTestInstability(TestIdentifier testId) {
- mTestInstabilityRatings.put(testId, getTestInstabilityRating(testId) + 1);
- }
-
- private void clearTestInstability(TestIdentifier testId) {
- mTestInstabilityRatings.put(testId, 0);
- }
-
- /**
- * Executes all tests on the device.
- */
- private void runTests() throws DeviceNotAvailableException, CapabilityQueryFailureException {
- for (;;) {
- TestBatch batch = selectRunBatch();
-
- if (batch == null) {
- break;
- }
-
- runTestRunBatch(batch);
- }
- }
-
- /**
- * Runs a TestBatch by either faking it or executing it on a device.
- */
- private void runTestRunBatch(TestBatch batch) throws DeviceNotAvailableException,
- CapabilityQueryFailureException {
- // prepare instance listener
- mInstanceListerner.setCurrentConfig(batch.config);
- for (TestIdentifier test : batch.tests) {
- mInstanceListerner.setTestInstances(test, getTestRunConfigs(test));
- }
-
- // execute only if config is executable, else fake results
- if (isSupportedRunConfiguration(batch.config)) {
- executeTestRunBatch(batch);
- } else {
- fakePassTestRunBatch(batch);
- }
- }
-
- private boolean isSupportedRunConfiguration(BatchRunConfiguration runConfig)
- throws DeviceNotAvailableException, CapabilityQueryFailureException {
- // orientation support
- if (!BatchRunConfiguration.ROTATION_UNSPECIFIED.equals(runConfig.getRotation())) {
- final Set<String> features = getDeviceFeatures(mDevice);
-
- if (isPortraitClassRotation(runConfig.getRotation()) &&
- !features.contains(FEATURE_PORTRAIT)) {
- return false;
- }
- if (isLandscapeClassRotation(runConfig.getRotation()) &&
- !features.contains(FEATURE_LANDSCAPE)) {
- return false;
- }
- }
-
- if (isOpenGlEsPackage()) {
- // renderability support for OpenGL ES tests
- return isSupportedGlesRenderConfig(runConfig);
- } else {
- return true;
- }
- }
-
- private static final class AdbComLinkOpenError extends Exception {
- public AdbComLinkOpenError(String description, Throwable inner) {
- super(description, inner);
- }
- }
-
- private static final class AdbComLinkKilledError extends Exception {
- public AdbComLinkKilledError(String description, Throwable inner) {
- super(description, inner);
- }
- }
-
- /**
- * Executes a given command in adb shell
- *
- * @throws AdbComLinkOpenError if connection cannot be established.
- * @throws AdbComLinkKilledError if established connection is killed prematurely.
- */
- private void executeShellCommandAndReadOutput(final String command,
- final IShellOutputReceiver receiver)
- throws AdbComLinkOpenError, AdbComLinkKilledError {
- try {
- mDevice.getIDevice().executeShellCommand(command, receiver,
- UNRESPOSIVE_CMD_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- } catch (TimeoutException ex) {
- // Opening connection timed out
- CLog.e("Opening connection timed out for command: '%s'", command);
- throw new AdbComLinkOpenError("opening connection timed out", ex);
- } catch (AdbCommandRejectedException ex) {
- // Command rejected
- CLog.e("Device rejected command: '%s'", command);
- throw new AdbComLinkOpenError("command rejected", ex);
- } catch (IOException ex) {
- // shell command channel killed
- CLog.e("Channel died for command: '%s'", command);
- throw new AdbComLinkKilledError("command link killed", ex);
- } catch (ShellCommandUnresponsiveException ex) {
- // shell command halted
- CLog.e("No output from command in %d ms: '%s'", UNRESPOSIVE_CMD_TIMEOUT_MS, command);
- throw new AdbComLinkKilledError("command link hung", ex);
- }
- }
-
- /**
- * Executes given test batch on a device
- */
- private void executeTestRunBatch(TestBatch batch) throws DeviceNotAvailableException {
- // attempt full run once
- executeTestRunBatchRun(batch);
-
- // split remaining tests to two sub batches and execute both. This will terminate
- // since executeTestRunBatchRun will always progress for a batch of size 1.
- final ArrayList<TestIdentifier> pendingTests = new ArrayList<>();
-
- for (TestIdentifier test : batch.tests) {
- if (mInstanceListerner.isPendingTestInstance(test, batch.config)) {
- pendingTests.add(test);
- }
- }
-
- final int divisorNdx = pendingTests.size() / 2;
- final List<TestIdentifier> headList = pendingTests.subList(0, divisorNdx);
- final List<TestIdentifier> tailList = pendingTests.subList(divisorNdx, pendingTests.size());
-
- // head
- for (;;) {
- TestBatch subBatch = selectRunBatch(headList, batch.config);
-
- if (subBatch == null) {
- break;
- }
-
- executeTestRunBatch(subBatch);
- }
-
- // tail
- for (;;) {
- TestBatch subBatch = selectRunBatch(tailList, batch.config);
-
- if (subBatch == null) {
- break;
- }
-
- executeTestRunBatch(subBatch);
- }
-
- if (getBatchNumPendingCases(batch) != 0) {
- throw new AssertionError("executeTestRunBatch postcondition failed");
- }
- }
-
- /**
- * Runs one execution pass over the given batch.
- *
- * Tries to run the batch. Always makes progress (executes instances or modifies stability
- * scores).
- */
- private void executeTestRunBatchRun(TestBatch batch) throws DeviceNotAvailableException {
- if (getBatchNumPendingCases(batch) != batch.tests.size()) {
- throw new AssertionError("executeTestRunBatchRun precondition failed");
- }
-
- checkInterrupted(); // throws if interrupted
-
- final String testCases = generateTestCaseTrie(batch.tests);
-
- mDevice.executeShellCommand("rm " + CASE_LIST_FILE_NAME);
- mDevice.executeShellCommand("rm " + LOG_FILE_NAME);
- mDevice.pushString(testCases + "\n", CASE_LIST_FILE_NAME);
-
- final String instrumentationName =
- "com.drawelements.deqp/com.drawelements.deqp.testercore.DeqpInstrumentation";
-
- final StringBuilder deqpCmdLine = new StringBuilder();
- deqpCmdLine.append("--deqp-caselist-file=");
- deqpCmdLine.append(CASE_LIST_FILE_NAME);
- deqpCmdLine.append(" ");
- deqpCmdLine.append(getRunConfigDisplayCmdLine(batch.config));
-
- // If we are not logging data, do not bother outputting the images from the test exe.
- if (!mLogData) {
- deqpCmdLine.append(" --deqp-log-images=disable");
- }
-
- deqpCmdLine.append(" --deqp-watchdog=enable");
-
- final String command = String.format(
- "am instrument %s -w -e deqpLogFileName \"%s\" -e deqpCmdLine \"%s\""
- + " -e deqpLogData \"%s\" %s",
- AbiUtils.createAbiFlag(mAbi.getName()), LOG_FILE_NAME, deqpCmdLine.toString(),
- mLogData, instrumentationName);
-
- final int numRemainingInstancesBefore = getNumRemainingInstances();
- final InstrumentationParser parser = new InstrumentationParser(mInstanceListerner);
- Throwable interruptingError = null;
-
- try {
- CLog.d("Running command '%s'", command);
- executeShellCommandAndReadOutput(command, parser);
- parser.flush();
- } catch (Throwable ex) {
- CLog.w("Instrumented call threw '%s'", ex.getMessage());
- interruptingError = ex;
- }
-
- final boolean progressedSinceLastCall = mInstanceListerner.getCurrentTestId() != null ||
- getNumRemainingInstances() < numRemainingInstancesBefore;
-
- if (progressedSinceLastCall) {
- mDeviceRecovery.onExecutionProgressed();
- }
-
- // interrupted, try to recover
- if (interruptingError != null) {
- if (interruptingError instanceof AdbComLinkOpenError) {
- CLog.i("Recovering from comm link error");
- mDeviceRecovery.recoverConnectionRefused();
- } else if (interruptingError instanceof AdbComLinkKilledError) {
- CLog.i("Recovering from comm link killed");
- mDeviceRecovery.recoverComLinkKilled();
- } else if (interruptingError instanceof RunInterruptedException) {
- // external run interruption request. Terminate immediately.
- CLog.i("Run termination requested. Throwing forward.");
- throw (RunInterruptedException)interruptingError;
- } else {
- CLog.e(interruptingError);
- throw new RuntimeException(interruptingError);
- }
-
- // recoverXXX did not throw => recovery succeeded
- } else if (!parser.wasSuccessful()) {
- CLog.i("Parse not successful. Will attempt comm link recovery.");
- mDeviceRecovery.recoverComLinkKilled();
- // recoverXXX did not throw => recovery succeeded
- }
-
- // Progress guarantees.
- if (batch.tests.size() == 1) {
- final TestIdentifier onlyTest = batch.tests.iterator().next();
- final boolean wasTestExecuted =
- !mInstanceListerner.isPendingTestInstance(onlyTest, batch.config) &&
- mInstanceListerner.getCurrentTestId() == null;
- final boolean wasLinkFailure = !parser.wasSuccessful() || interruptingError != null;
-
- // Link failures can be caused by external events, require at least two observations
- // until bailing.
- if (!wasTestExecuted && (!wasLinkFailure || getTestInstabilityRating(onlyTest) > 0)) {
- recordTestInstability(onlyTest);
- // If we cannot finish the test, mark the case as a crash.
- //
- // If we couldn't even start the test, fail the test instance as non-executable.
- // This is required so that a consistently crashing or non-existent tests will
- // not cause futile (non-terminating) re-execution attempts.
- if (mInstanceListerner.getCurrentTestId() != null) {
- CLog.w("Test '%s' started, but not completed", onlyTest);
- mInstanceListerner.abortTest(onlyTest, INCOMPLETE_LOG_MESSAGE);
- } else {
- CLog.w("Test '%s' could not start", onlyTest);
- mInstanceListerner.abortTest(onlyTest, NOT_EXECUTABLE_LOG_MESSAGE);
- }
- } else if (wasTestExecuted) {
- clearTestInstability(onlyTest);
- }
- }
- else
- {
- // Analyze results to update test stability ratings. If there is no interrupting test
- // logged, increase instability rating of all remaining tests. If there is a
- // interrupting test logged, increase only its instability rating.
- //
- // A successful run of tests clears instability rating.
- if (mInstanceListerner.getCurrentTestId() == null) {
- for (TestIdentifier test : batch.tests) {
- if (mInstanceListerner.isPendingTestInstance(test, batch.config)) {
- recordTestInstability(test);
- } else {
- clearTestInstability(test);
- }
- }
- } else {
- recordTestInstability(mInstanceListerner.getCurrentTestId());
- for (TestIdentifier test : batch.tests) {
- // \note: isPendingTestInstance is false for getCurrentTestId. Current ID is
- // considered 'running' and will be restored to 'pending' in endBatch().
- if (!test.equals(mInstanceListerner.getCurrentTestId()) &&
- !mInstanceListerner.isPendingTestInstance(test, batch.config)) {
- clearTestInstability(test);
- }
- }
- }
- }
-
- mInstanceListerner.endBatch();
- }
-
- private static String getRunConfigDisplayCmdLine(BatchRunConfiguration runConfig) {
- final StringBuilder deqpCmdLine = new StringBuilder();
- if (!runConfig.getGlConfig().isEmpty()) {
- deqpCmdLine.append("--deqp-gl-config-name=");
- deqpCmdLine.append(runConfig.getGlConfig());
- }
- if (!runConfig.getRotation().isEmpty()) {
- if (deqpCmdLine.length() != 0) {
- deqpCmdLine.append(" ");
- }
- deqpCmdLine.append("--deqp-screen-rotation=");
- deqpCmdLine.append(runConfig.getRotation());
- }
- if (!runConfig.getSurfaceType().isEmpty()) {
- if (deqpCmdLine.length() != 0) {
- deqpCmdLine.append(" ");
- }
- deqpCmdLine.append("--deqp-surface-type=");
- deqpCmdLine.append(runConfig.getSurfaceType());
- }
- return deqpCmdLine.toString();
- }
-
- private int getNumRemainingInstances() {
- int retVal = 0;
- for (TestIdentifier testId : mRemainingTests) {
- // If case is in current working set, sum only not yet executed instances.
- // If case is not in current working set, sum all instances (since they are not yet
- // executed).
- if (mInstanceListerner.mPendingResults.containsKey(testId)) {
- retVal += mInstanceListerner.mPendingResults.get(testId).remainingConfigs.size();
- } else {
- retVal += mTestInstances.get(testId).size();
- }
- }
- return retVal;
- }
-
- /**
- * Checks if this execution has been marked as interrupted and throws if it has.
- */
- private void checkInterrupted() throws RunInterruptedException {
- // Work around the API. RunUtil::checkInterrupted is private but we can call it indirectly
- // by sleeping a value <= 0.
- mRunUtil.sleep(0);
- }
-
- /**
- * Pass given batch tests without running it
- */
- private void fakePassTestRunBatch(TestBatch batch) {
- for (TestIdentifier test : batch.tests) {
- CLog.d("Skipping test '%s' invocation in config '%s'", test.toString(),
- batch.config.getId());
- mInstanceListerner.skipTest(test);
- }
- }
-
- /**
- * Pass all remaining tests without running them
- */
- private void fakePassTests(ITestInvocationListener listener) {
- Map <String, String> emptyMap = Collections.emptyMap();
- for (TestIdentifier test : mRemainingTests) {
- CLog.d("Skipping test '%s', Opengl ES version not supported", test.toString());
- listener.testStarted(test);
- listener.testEnded(test, emptyMap);
- }
- mRemainingTests.clear();
- }
-
- /**
- * Check if device supports OpenGL ES version.
- */
- private static boolean isSupportedGles(ITestDevice device, int requiredMajorVersion,
- int requiredMinorVersion) throws DeviceNotAvailableException {
- String roOpenglesVersion = device.getProperty("ro.opengles.version");
-
- if (roOpenglesVersion == null)
- return false;
-
- int intValue = Integer.parseInt(roOpenglesVersion);
-
- int majorVersion = ((intValue & 0xffff0000) >> 16);
- int minorVersion = (intValue & 0xffff);
-
- return (majorVersion > requiredMajorVersion)
- || (majorVersion == requiredMajorVersion && minorVersion >= requiredMinorVersion);
- }
-
- /**
- * Query if rendertarget is supported
- */
- private boolean isSupportedGlesRenderConfig(BatchRunConfiguration runConfig)
- throws DeviceNotAvailableException, CapabilityQueryFailureException {
- // query if configuration is supported
- final StringBuilder configCommandLine =
- new StringBuilder(getRunConfigDisplayCmdLine(runConfig));
- if (configCommandLine.length() != 0) {
- configCommandLine.append(" ");
- }
- configCommandLine.append("--deqp-gl-major-version=");
- configCommandLine.append(getGlesMajorVersion());
- configCommandLine.append(" --deqp-gl-minor-version=");
- configCommandLine.append(getGlesMinorVersion());
-
- final String commandLine = configCommandLine.toString();
-
- // check for cached result first
- if (mConfigQuerySupportCache.containsKey(commandLine)) {
- return mConfigQuerySupportCache.get(commandLine);
- }
-
- final boolean supported = queryIsSupportedConfigCommandLine(commandLine);
- mConfigQuerySupportCache.put(commandLine, supported);
- return supported;
- }
-
- private boolean queryIsSupportedConfigCommandLine(String deqpCommandLine)
- throws DeviceNotAvailableException, CapabilityQueryFailureException {
- final String instrumentationName =
- "com.drawelements.deqp/com.drawelements.deqp.platformutil.DeqpPlatformCapabilityQueryInstrumentation";
- final String command = String.format(
- "am instrument %s -w -e deqpQueryType renderConfigSupported -e deqpCmdLine \"%s\""
- + " %s",
- AbiUtils.createAbiFlag(mAbi.getName()), deqpCommandLine, instrumentationName);
-
- final PlatformQueryInstrumentationParser parser = new PlatformQueryInstrumentationParser();
- mDevice.executeShellCommand(command, parser);
- parser.flush();
-
- if (parser.wasSuccessful() && parser.getResultCode() == 0 &&
- parser.getResultMap().containsKey("Supported")) {
- if ("Yes".equals(parser.getResultMap().get("Supported"))) {
- return true;
- } else if ("No".equals(parser.getResultMap().get("Supported"))) {
- return false;
- } else {
- CLog.e("Capability query did not return a result");
- throw new CapabilityQueryFailureException();
- }
- } else if (parser.wasSuccessful()) {
- CLog.e("Failed to run capability query. Code: %d, Result: %s",
- parser.getResultCode(), parser.getResultMap().toString());
- throw new CapabilityQueryFailureException();
- } else {
- CLog.e("Failed to run capability query");
- throw new CapabilityQueryFailureException();
- }
- }
-
- /**
- * Return feature set supported by the device
- */
- private Set<String> getDeviceFeatures(ITestDevice device)
- throws DeviceNotAvailableException, CapabilityQueryFailureException {
- if (mDeviceFeatures == null) {
- mDeviceFeatures = queryDeviceFeatures(device);
- }
- return mDeviceFeatures;
- }
-
- /**
- * Query feature set supported by the device
- */
- private static Set<String> queryDeviceFeatures(ITestDevice device)
- throws DeviceNotAvailableException, CapabilityQueryFailureException {
- // NOTE: Almost identical code in BaseDevicePolicyTest#hasDeviceFeatures
- // TODO: Move this logic to ITestDevice.
- String command = "pm list features";
- String commandOutput = device.executeShellCommand(command);
-
- // Extract the id of the new user.
- HashSet<String> availableFeatures = new HashSet<>();
- for (String feature: commandOutput.split("\\s+")) {
- // Each line in the output of the command has the format "feature:{FEATURE_VALUE}".
- String[] tokens = feature.split(":");
- if (tokens.length < 2 || !"feature".equals(tokens[0])) {
- CLog.e("Failed parse features. Unexpect format on line \"%s\"", tokens[0]);
- throw new CapabilityQueryFailureException();
- }
- availableFeatures.add(tokens[1]);
- }
- return availableFeatures;
- }
-
- private boolean isPortraitClassRotation(String rotation) {
- return BatchRunConfiguration.ROTATION_PORTRAIT.equals(rotation) ||
- BatchRunConfiguration.ROTATION_REVERSE_PORTRAIT.equals(rotation);
- }
-
- private boolean isLandscapeClassRotation(String rotation) {
- return BatchRunConfiguration.ROTATION_LANDSCAPE.equals(rotation) ||
- BatchRunConfiguration.ROTATION_REVERSE_LANDSCAPE.equals(rotation);
- }
-
- /**
- * Install dEQP OnDevice Package
- */
- private void installTestApk() throws DeviceNotAvailableException {
- try {
- File apkFile = mCtsBuild.getTestApp(DEQP_ONDEVICE_APK);
- String[] options = {AbiUtils.createAbiFlag(mAbi.getName())};
- String errorCode = getDevice().installPackage(apkFile, true, options);
- if (errorCode != null) {
- CLog.e("Failed to install %s. Reason: %s", DEQP_ONDEVICE_APK, errorCode);
- }
- } catch (FileNotFoundException e) {
- CLog.e("Could not find test apk %s", DEQP_ONDEVICE_APK);
- }
- }
-
- /**
- * Uninstall dEQP OnDevice Package
- */
- private void uninstallTestApk() throws DeviceNotAvailableException {
- getDevice().uninstallPackage(DEQP_ONDEVICE_PKG);
- }
-
- /**
- * Parse gl nature from package name
- */
- private boolean isOpenGlEsPackage() {
- if ("dEQP-GLES2".equals(mName) || "dEQP-GLES3".equals(mName) ||
- "dEQP-GLES31".equals(mName)) {
- return true;
- } else if ("dEQP-EGL".equals(mName)) {
- return false;
- } else {
- throw new IllegalStateException("dEQP runner was created with illegal name");
- }
- }
-
- /**
- * Check GL support (based on package name)
- */
- private boolean isSupportedGles() throws DeviceNotAvailableException {
- return isSupportedGles(mDevice, getGlesMajorVersion(), getGlesMinorVersion());
- }
-
- /**
- * Get GL major version (based on package name)
- */
- private int getGlesMajorVersion() throws DeviceNotAvailableException {
- if ("dEQP-GLES2".equals(mName)) {
- return 2;
- } else if ("dEQP-GLES3".equals(mName)) {
- return 3;
- } else if ("dEQP-GLES31".equals(mName)) {
- return 3;
- } else {
- throw new IllegalStateException("getGlesMajorVersion called for non gles pkg");
- }
- }
-
- /**
- * Get GL minor version (based on package name)
- */
- private int getGlesMinorVersion() throws DeviceNotAvailableException {
- if ("dEQP-GLES2".equals(mName)) {
- return 0;
- } else if ("dEQP-GLES3".equals(mName)) {
- return 0;
- } else if ("dEQP-GLES31".equals(mName)) {
- return 1;
- } else {
- throw new IllegalStateException("getGlesMinorVersion called for non gles pkg");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
- final Map<String, String> emptyMap = Collections.emptyMap();
- final boolean isSupportedApi = !isOpenGlEsPackage() || isSupportedGles();
-
- listener.testRunStarted(getId(), mRemainingTests.size());
-
- try {
- if (isSupportedApi) {
- // Make sure there is no pre-existing package form earlier interrupted test run.
- uninstallTestApk();
- installTestApk();
-
- mInstanceListerner.setSink(listener);
- mDeviceRecovery.setDevice(mDevice);
- runTests();
-
- uninstallTestApk();
- } else {
- // Pass all tests if OpenGL ES version is not supported
- CLog.i("Package %s not supported by the device. Tests trivially pass.", mPackageName);
- fakePassTests(listener);
- }
- } catch (CapabilityQueryFailureException ex) {
- // Platform is not behaving correctly, for example crashing when trying to create
- // a window. Instead of silenty failing, signal failure by leaving the rest of the
- // test cases in "NotExecuted" state
- uninstallTestApk();
- }
-
- listener.testRunEnded(0, emptyMap);
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java
deleted file mode 100644
index f11c76d..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.ddmlib.testrunner.ITestRunListener;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Test runner for native gTests.
- *
- * TODO: This is similar to Tradefed's existing GTest, but it doesn't confirm
- * each directory segment exists using ddmlib's file service. This was
- * a problem since /data is not visible on a user build, but it is
- * executable. It's also a lot more verbose when it comes to errors.
- */
-public class GeeTest implements IBuildReceiver, IDeviceTest, IRemoteTest {
-
- private static final String NATIVE_TESTS_DIRECTORY = "/data/local/tmp/cts-native-tests";
- private static final String NATIVE_TESTS_DIRECTORY_TMP = "/data/local/tmp";
- private static final String ANDROID_PATH_SEPARATOR = "/";
- private static final String GTEST_FLAG_FILTER = "--gtest_filter=";
-
- private int mMaxTestTimeMs = 1 * 90 * 1000;
-
- private CtsBuildHelper mCtsBuild;
- private ITestDevice mDevice;
- private IAbi mAbi;
- private String mExeName;
-
- private final String mPackageName;
-
- private String mPositiveFilters = "";
- private String mNegativeFilters = "";
-
- public GeeTest(String packageName, String exeName) {
- mPackageName = packageName;
- mExeName = exeName;
- }
-
- public void setPositiveFilters(String positiveFilters) {
- mPositiveFilters = positiveFilters;
- }
-
- public void setNegativeFilters(String negativeFilters) {
- mNegativeFilters = negativeFilters;
- }
-
- protected String getGTestFilters() {
- // If both filters are empty or null return empty string.
- if (mPositiveFilters == null && mNegativeFilters == null) {
- return "";
- }
- if (mPositiveFilters.isEmpty() && mNegativeFilters.isEmpty()) {
- return "";
- }
- // Build filter string.
- StringBuilder sb = new StringBuilder();
- sb.append(GTEST_FLAG_FILTER);
- boolean hasPositiveFilters = false;
- if (mPositiveFilters != null && !mPositiveFilters.isEmpty()) {
- sb.append(mPositiveFilters);
- hasPositiveFilters = true;
- }
- if (mNegativeFilters != null && ! mNegativeFilters.isEmpty()) {
- if (hasPositiveFilters) {
- sb.append(":");
- }
- sb.append("-");
- sb.append(mNegativeFilters);
- }
- return sb.toString();
- }
-
- /**
- * @param abi The ABI to run the test on
- */
- public void setAbi(IAbi abi) {
- mAbi = abi;
- mExeName += mAbi.getBitness();
- }
-
- @Override
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
- if (installTest()) {
- runTest(listener);
- } else {
- CLog.e("Failed to install native tests");
- }
- }
-
- private boolean installTest() throws DeviceNotAvailableException {
- if (!createRemoteDir(NATIVE_TESTS_DIRECTORY)) {
- CLog.e("Could not create directory for native tests: " + NATIVE_TESTS_DIRECTORY);
- return false;
- }
-
- File nativeExe = new File(mCtsBuild.getTestCasesDir(), mExeName);
- if (!nativeExe.exists()) {
- CLog.e("Native test not found: " + nativeExe);
- return false;
- }
-
- String devicePath = NATIVE_TESTS_DIRECTORY + ANDROID_PATH_SEPARATOR + mExeName;
- if (!mDevice.pushFile(nativeExe, devicePath)) {
- CLog.e("Failed to push native test to device");
- return false;
- }
- return true;
- }
-
- private boolean createRemoteDir(String remoteFilePath) throws DeviceNotAvailableException {
- if (mDevice.doesFileExist(remoteFilePath)) {
- return true;
- }
- if (!(mDevice.doesFileExist(NATIVE_TESTS_DIRECTORY_TMP))) {
- CLog.e("Could not find the /data/local/tmp directory");
- return false;
- }
-
- mDevice.executeShellCommand(String.format("mkdir %s", remoteFilePath));
- return mDevice.doesFileExist(remoteFilePath);
- }
-
- void runTest(ITestRunListener listener) throws DeviceNotAvailableException {
- String id = AbiUtils.createId(mAbi.getName(), mPackageName);
- GeeTestResultParser resultParser = new GeeTestResultParser(id, listener);
- resultParser.setFakePackagePrefix(mPackageName + ".");
-
- String fullPath = NATIVE_TESTS_DIRECTORY + ANDROID_PATH_SEPARATOR + mExeName;
- String flags = getGTestFilters();
- CLog.v("Running gtest %s %s on %s", fullPath, flags, mDevice.getSerialNumber());
- // force file to be executable
- CLog.v("%s", mDevice.executeShellCommand(String.format("chmod 755 %s", fullPath)));
-
- try {
- mDevice.executeShellCommand(String.format("%s %s", fullPath, flags), resultParser,
- mMaxTestTimeMs /* maxTimeToShellOutputResponse */,
- 0 /* retryAttempts */);
- } catch (DeviceNotAvailableException e) {
- resultParser.flush();
- throw e;
- } catch (RuntimeException e) {
- resultParser.flush();
- throw e;
- }
- }
-
-
- @Override
- public void setBuild(IBuildInfo buildInfo) {
- mCtsBuild = CtsBuildHelper.createBuildHelper(buildInfo);
- }
-
- @Override
- public void setDevice(ITestDevice device) {
- mDevice = device;
- }
-
- @Override
- public ITestDevice getDevice() {
- return mDevice;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTestResultParser.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTestResultParser.java
deleted file mode 100644
index d0ea0cf..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTestResultParser.java
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.testtype;
-
-import com.android.ddmlib.IShellOutputReceiver;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.MultiLineReceiver;
-import com.android.ddmlib.testrunner.ITestRunListener;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.testtype.testdefs.XmlDefsTest;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * TODO: Merge change to add package prefix to tradefed's GTestResultParser.
- * Otherwise this file should be the same as TradeFed's version.
- *
- * Parses the 'raw output mode' results of native tests using GTest that run from shell, and informs
- * a ITestRunListener of the results.
- * <p>Sample format of output expected:
- *
- * <pre>
- * [==========] Running 15 tests from 1 test case.
- * [----------] Global test environment set-up.
- * [----------] 15 tests from MessageTest
- * [ RUN ] MessageTest.DefaultConstructor
- * [ OK ] MessageTest.DefaultConstructor (1 ms)
- * [ RUN ] MessageTest.CopyConstructor
- * external/gtest/test/gtest-message_test.cc:67: Failure
- * Value of: 5
- * Expected: 2
- * external/gtest/test/gtest-message_test.cc:68: Failure
- * Value of: 1 == 1
- * Actual: true
- * Expected: false
- * [ FAILED ] MessageTest.CopyConstructor (2 ms)
- * ...
- * [ RUN ] MessageTest.DoesNotTakeUpMuchStackSpace
- * [ OK ] MessageTest.DoesNotTakeUpMuchStackSpace (0 ms)
- * [----------] 15 tests from MessageTest (26 ms total)
- *
- * [----------] Global test environment tear-down
- * [==========] 15 tests from 1 test case ran. (26 ms total)
- * [ PASSED ] 6 tests.
- * [ FAILED ] 9 tests, listed below:
- * [ FAILED ] MessageTest.CopyConstructor
- * [ FAILED ] MessageTest.ConstructsFromCString
- * [ FAILED ] MessageTest.StreamsCString
- * [ FAILED ] MessageTest.StreamsNullCString
- * [ FAILED ] MessageTest.StreamsString
- * [ FAILED ] MessageTest.StreamsStringWithEmbeddedNUL
- * [ FAILED ] MessageTest.StreamsNULChar
- * [ FAILED ] MessageTest.StreamsInt
- * [ FAILED ] MessageTest.StreamsBasicIoManip
- * 9 FAILED TESTS
- * </pre>
- *
- * <p>where the following tags are used to signal certain events:
- * <pre>
- * [==========]: the first occurrence indicates a new run started, including the number of tests
- * to be expected in this run
- * [ RUN ]: indicates a new test has started to run; a series of zero or more lines may
- * follow a test start, and will be captured in case of a test failure or error
- * [ OK ]: the preceding test has completed successfully, optionally including the time it
- * took to run (in ms)
- * [ FAILED ]: the preceding test has failed, optionally including the time it took to run (in ms)
- * [==========]: the preceding test run has completed, optionally including the time it took to run
- * (in ms)
- * </pre>
- *
- * All other lines are ignored.
- */
-public class GeeTestResultParser extends MultiLineReceiver {
- private static final String LOG_TAG = "GTestResultParser";
-
- // Variables to keep track of state
- private TestResult mCurrentTestResult = null;
- private int mNumTestsRun = 0;
- private int mNumTestsExpected = 0;
- private long mTotalRunTime = 0;
- private boolean mTestInProgress = false;
- private boolean mTestRunInProgress = false;
- private final String mTestRunId;
- private final Collection<ITestRunListener> mTestListeners;
-
- /** Fake adding a package prefix if the test listener needs it. */
- private String mFakePackagePrefix = "";
-
- /** True if start of test has already been reported to listener. */
- private boolean mTestRunStartReported = false;
-
- /** True if current test run has been canceled by user. */
- private boolean mIsCancelled = false;
-
- private String mCoverageTarget = null;
-
- /**
- * Test result data
- */
- private static class TestResult {
- private String mTestName = null;
- private String mTestClass = null;
- private StringBuilder mStackTrace = null;
- @SuppressWarnings("unused")
- private Long mRunTime = null;
-
- /** Returns whether expected values have been parsed
- *
- * @return true if all expected values have been parsed
- */
- boolean isComplete() {
- return mTestName != null && mTestClass != null;
- }
-
- /** Returns whether there is currently a stack trace
- *
- * @return true if there is currently a stack trace, false otherwise
- */
- boolean hasStackTrace() {
- return mStackTrace != null;
- }
-
- /**
- * Returns the stack trace of the current test.
- *
- * @return a String representation of the current test's stack trace; if there is not
- * a current stack trace, it returns an error string. Use {@link TestResult#hasStackTrace}
- * if you need to know whether there is a stack trace.
- */
- String getTrace() {
- if (hasStackTrace()) {
- return mStackTrace.toString();
- } else {
- Log.e(LOG_TAG, "Could not find stack trace for failed test");
- return new Throwable("Unknown failure").toString();
- }
- }
-
- /** Provides a more user readable string for TestResult, if possible */
- @Override
- public String toString() {
- StringBuilder output = new StringBuilder();
- if (mTestClass != null ) {
- output.append(mTestClass);
- output.append('#');
- }
- if (mTestName != null) {
- output.append(mTestName);
- }
- if (output.length() > 0) {
- return output.toString();
- }
- return "unknown result";
- }
- }
-
- /** Internal helper struct to store parsed test info. */
- private static class ParsedTestInfo {
- String mTestName = null;
- String mTestClassName = null;
- String mTestRunTime = null;
-
- public ParsedTestInfo(String testName, String testClassName, String testRunTime) {
- mTestName = testName;
- mTestClassName = testClassName;
- mTestRunTime = testRunTime;
- }
- }
-
- /** Prefixes used to demarcate and identify output. */
- private static class Prefixes {
- @SuppressWarnings("unused")
- private static final String INFORMATIONAL_MARKER = "[----------]";
- private static final String START_TEST_RUN_MARKER = "[==========] Running";
- private static final String TEST_RUN_MARKER = "[==========]";
- private static final String START_TEST_MARKER = "[ RUN ]";
- private static final String OK_TEST_MARKER = "[ OK ]";
- private static final String FAILED_TEST_MARKER = "[ FAILED ]";
- }
-
- /**
- * Creates the GTestResultParser.
- *
- * @param testRunId the test run id to provide to
- * {@link ITestRunListener#testRunStarted(String, int)}
- * @param listeners informed of test results as the tests are executing
- */
- public GeeTestResultParser(String testRunId, Collection<ITestRunListener> listeners) {
- mTestRunId = testRunId;
- mTestListeners = new ArrayList<ITestRunListener>(listeners);
- }
-
- /**
- * Creates the GTestResultParser for a single listener.
- *
- * @param testRunId the test run id to provide to
- * {@link ITestRunListener#testRunStarted(String, int)}
- * @param listener informed of test results as the tests are executing
- */
- public GeeTestResultParser(String testRunId, ITestRunListener listener) {
- mTestRunId = testRunId;
- mTestListeners = new ArrayList<ITestRunListener>(1);
- mTestListeners.add(listener);
- }
-
- /**
- * Package prefix to be added to test names when they are reported like
- * "android.nativemedia." You may need to add the dot if you need it.
- */
- public void setFakePackagePrefix(String prefix) {
- mFakePackagePrefix = prefix;
- }
-
- /**
- * Returns the current TestResult for test in progress, or a new default one.
- *
- * @return The TestResult for the current test run
- */
- private TestResult getCurrentTestResult() {
- if (mCurrentTestResult == null) {
- mCurrentTestResult = new TestResult();
- }
- return mCurrentTestResult;
- }
-
-
- /**
- * Clears out the current TestResult.
- */
- private void clearCurrentTestResult() {
- mCurrentTestResult = null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void processNewLines(String[] lines) {
- for (String line : lines) {
- parse(line);
- }
- }
-
- /**
- * Parse an individual output line.
- *
- * @param line Text output line
- */
- private void parse(String line) {
- String message = null;
-
- if (mTestRunInProgress || line.startsWith(Prefixes.TEST_RUN_MARKER)) {
- if (line.startsWith(Prefixes.START_TEST_MARKER)) {
- // Individual test started
- message = line.substring(Prefixes.START_TEST_MARKER.length()).trim();
- processTestStartedTag(message);
- }
- else if (line.startsWith(Prefixes.OK_TEST_MARKER)) {
- // Individual test completed successfully
- message = line.substring(Prefixes.OK_TEST_MARKER.length()).trim();
- processOKTag(message);
- clearCurrentTestResult();
- }
- else if (line.startsWith(Prefixes.FAILED_TEST_MARKER)) {
- // Individual test completed with failure
- message = line.substring(Prefixes.FAILED_TEST_MARKER.length()).trim();
- processFailedTag(message);
- clearCurrentTestResult();
- }
- else if (line.startsWith(Prefixes.START_TEST_RUN_MARKER)) {
- // Test run started
- // Make sure to leave the "Running" in the string
- message = line.substring(Prefixes.TEST_RUN_MARKER.length()).trim();
- processRunStartedTag(message);
- }
- else if (line.startsWith(Prefixes.TEST_RUN_MARKER)) {
- // Test run ended
- // This is for the end of the test suite run, so make sure this else-if is after the
- // check for START_TEST_SUITE_MARKER
- message = line.substring(Prefixes.TEST_RUN_MARKER.length()).trim();
- processRunCompletedTag(message);
- }
- else if (testInProgress()) {
- // Note this does not handle the case of an error outside an actual test run
- appendTestOutputLine(line);
- }
- }
- }
-
- /**
- * Returns true if test run canceled.
- *
- * @see IShellOutputReceiver#isCancelled()
- */
- @Override
- public boolean isCancelled() {
- return mIsCancelled;
- }
-
- /**
- * Requests cancellation of test run.
- */
- public void cancel() {
- mIsCancelled = true;
- }
-
- /**
- * Returns whether we're in the middle of running a test.
- *
- * @return True if a test was started, false otherwise
- */
- private boolean testInProgress() {
- return mTestInProgress;
- }
-
- /**
- * Set state to indicate we've started running a test.
- *
- */
- private void setTestStarted() {
- mTestInProgress = true;
- }
-
- /**
- * Set state to indicate we've started running a test.
- *
- */
- private void setTestEnded() {
- mTestInProgress = false;
- }
-
- /**
- * Reports the start of a test run, and the total test count, if it has not been previously
- * reported.
- */
- private void reportTestRunStarted() {
- // if start test run not reported yet
- if (!mTestRunStartReported) {
- for (ITestRunListener listener : mTestListeners) {
- listener.testRunStarted(mTestRunId, mNumTestsExpected);
- }
- mTestRunStartReported = true;
- }
- }
-
- /**
- * Reports the end of a test run, and resets that test
- */
- private void reportTestRunEnded() {
- for (ITestRunListener listener : mTestListeners) {
- listener.testRunEnded(mTotalRunTime, getRunMetrics());
- }
- mTestRunStartReported = false;
- }
-
- /**
- * Create the run metrics {@link Map} to report.
- *
- * @return a {@link Map} of run metrics data
- */
- private Map<String, String> getRunMetrics() {
- Map<String, String> metricsMap = new HashMap<String, String>();
- if (mCoverageTarget != null) {
- metricsMap.put(XmlDefsTest.COVERAGE_TARGET_KEY, mCoverageTarget);
- }
- return metricsMap;
- }
-
- /**
- * Parse the test identifier (class and test name), and optional time info.
- *
- * @param identifier Raw identifier of the form classname.testname, with an optional time
- * element in the format of (XX ms) at the end
- * @return A ParsedTestInfo representing the parsed info from the identifier string.
- *
- * If no time tag was detected, then the third element in the array (time_in_ms) will
- * be null. If the line failed to parse properly (eg: could not determine name of
- * test/class) then an "UNKNOWN" string value will be returned for the classname and
- * testname. This method guarantees a string will always be returned for the class and
- * test names (but not for the time value).
- */
- private ParsedTestInfo parseTestIdentifier(String identifier) {
- ParsedTestInfo returnInfo = new ParsedTestInfo("UNKNOWN_CLASS", "UNKNOWN_TEST", null);
-
- Pattern timePattern = Pattern.compile(".*(\\((\\d+) ms\\))"); // eg: (XX ms)
- Matcher time = timePattern.matcher(identifier);
-
- // Try to find a time
- if (time.find()) {
- String timeString = time.group(2); // the "XX" in "(XX ms)"
- String discardPortion = time.group(1); // everything after the test class/name
- identifier = identifier.substring(0, identifier.lastIndexOf(discardPortion)).trim();
- returnInfo.mTestRunTime = timeString;
- }
-
- String[] testId = identifier.split("\\.");
- if (testId.length < 2) {
- Log.e(LOG_TAG, "Could not detect the test class and test name, received: " +
- identifier);
- }
- else {
- returnInfo.mTestClassName = testId[0];
- returnInfo.mTestName = testId[1];
- }
- return returnInfo;
- }
-
- /**
- * Parses and stores the test identifier (class and test name).
- *
- * @param identifier Raw identifier
- */
- private void processRunStartedTag(String identifier) {
- // eg: (Running XX tests from 1 test case.)
- Pattern numTestsPattern = Pattern.compile("Running (\\d+) test[s]? from .*");
- Matcher numTests = numTestsPattern.matcher(identifier);
-
- // Try to find number of tests
- if (numTests.find()) {
- try {
- mNumTestsExpected = Integer.parseInt(numTests.group(1));
- }
- catch (NumberFormatException e) {
- Log.e(LOG_TAG, "Unable to determine number of tests expected, received: " +
- numTests.group(1));
- }
- }
- if (mNumTestsExpected > 0) {
- reportTestRunStarted();
- mNumTestsRun = 0;
- mTestRunInProgress = true;
- }
- }
-
- /**
- * Processes and informs listener when we encounter a tag indicating that a test suite is done.
- *
- * @param identifier Raw log output from the suite ended tag
- */
- private void processRunCompletedTag(String identifier) {
- Pattern timePattern = Pattern.compile(".*\\((\\d+) ms total\\)"); // eg: (XX ms total)
- Matcher time = timePattern.matcher(identifier);
-
- // Try to find the total run time
- if (time.find()) {
- try {
- mTotalRunTime = Long.parseLong(time.group(1));
- }
- catch (NumberFormatException e) {
- Log.e(LOG_TAG, "Unable to determine the total running time, received: " +
- time.group(1));
- }
- }
- reportTestRunEnded();
- mTestRunInProgress = false;
- }
-
- /**
- * Processes and informs listener when we encounter a tag indicating that a test has started.
- *
- * @param identifier Raw log output of the form classname.testname, with an optional time (x ms)
- */
- private void processTestStartedTag(String identifier) {
- ParsedTestInfo parsedResults = parseTestIdentifier(identifier);
- TestResult testResult = getCurrentTestResult();
- testResult.mTestClass = parsedResults.mTestClassName;
- testResult.mTestName = parsedResults.mTestName;
-
- TestIdentifier testId = new TestIdentifier(mFakePackagePrefix + testResult.mTestClass,
- testResult.mTestName);
-
- for (ITestRunListener listener : mTestListeners) {
- listener.testStarted(testId);
- }
- setTestStarted();
- }
-
- /**
- * Helper method to do the work necessary when a test has ended.
- *
- * @param identifier Raw log output of the form "classname.testname" with an optional (XX ms)
- * at the end indicating the running time.
- * @param testPassed Indicates whether the test passed or failed (set to true if passed, false
- * if failed)
- */
- private void doTestEnded(String identifier, boolean testPassed) {
- ParsedTestInfo parsedResults = parseTestIdentifier(identifier);
- TestResult testResult = getCurrentTestResult();
- TestIdentifier testId = new TestIdentifier(mFakePackagePrefix + testResult.mTestClass,
- testResult.mTestName);
-
- // Error - trying to end a test when one isn't in progress
- if (!testInProgress()) {
- Log.e(LOG_TAG, "Test currently not in progress when trying to end test: " + identifier);
- return;
- }
-
- // Save the run time for this test if one exists
- if (parsedResults.mTestRunTime != null) {
- try {
- testResult.mRunTime = new Long(parsedResults.mTestRunTime);
- }
- catch (NumberFormatException e) {
- Log.e(LOG_TAG, "Test run time value is invalid, received: " +
- parsedResults.mTestRunTime);
- }
- }
-
- // Check that the test result is for the same test/class we're expecting it to be for
- boolean encounteredUnexpectedTest = false;
- if (!testResult.isComplete()) {
- Log.e(LOG_TAG, "No test/class name is currently recorded as running!");
- }
- else {
- if (testResult.mTestClass.compareTo(parsedResults.mTestClassName) != 0) {
- Log.e(LOG_TAG, "Name for current test class does not match class we started " +
- "with, expected: " + testResult.mTestClass + " but got: " +
- parsedResults.mTestClassName);
- encounteredUnexpectedTest = true;
- }
- if (testResult.mTestName.compareTo(parsedResults.mTestName) != 0) {
- Log.e(LOG_TAG, "Name for current test does not match test we started with," +
- "expected: " + testResult.mTestName + " bug got: " +
- parsedResults.mTestName);
- encounteredUnexpectedTest = true;
- }
- }
-
- if (encounteredUnexpectedTest) {
- // If the test name of the result changed from what we started with, report that
- // the last known test failed, regardless of whether we received a pass or fail tag.
- for (ITestRunListener listener : mTestListeners) {
- listener.testFailed(testId, mCurrentTestResult.getTrace());
- }
- }
- else if (!testPassed) { // test failed
- for (ITestRunListener listener : mTestListeners) {
- listener.testFailed(testId, mCurrentTestResult.getTrace());
- }
- }
- // For all cases (pass or fail), we ultimately need to report test has ended
- Map <String, String> emptyMap = Collections.emptyMap();
- for (ITestRunListener listener : mTestListeners) {
- // @TODO: Add reporting of test run time to ITestRunListener
- listener.testEnded(testId, emptyMap);
- }
-
- setTestEnded();
- ++mNumTestsRun;
- }
-
- /**
- * Processes and informs listener when we encounter the OK tag.
- *
- * @param identifier Raw log output of the form "classname.testname" with an optional (XX ms)
- * at the end indicating the running time.
- */
- private void processOKTag(String identifier) {
- doTestEnded(identifier, true);
- }
-
- /**
- * Processes and informs listener when we encounter the FAILED tag.
- *
- * @param identifier Raw log output of the form "classname.testname" with an optional (XX ms)
- * at the end indicating the running time.
- */
- private void processFailedTag(String identifier) {
- doTestEnded(identifier, false);
- }
-
- /**
- * Appends the test output to the current TestResult.
- *
- * @param line Raw test result line of output.
- */
- private void appendTestOutputLine(String line) {
- TestResult testResult = getCurrentTestResult();
- if (testResult.mStackTrace == null) {
- testResult.mStackTrace = new StringBuilder();
- }
- else {
- testResult.mStackTrace.append("\r\n");
- }
- testResult.mStackTrace.append(line);
- }
-
- /**
- * Process an instrumentation run failure
- *
- * @param errorMsg The message to output about the nature of the error
- */
- private void handleTestRunFailed(String errorMsg) {
- errorMsg = (errorMsg == null ? "Unknown error" : errorMsg);
- Log.i(LOG_TAG, String.format("Test run failed: %s", errorMsg));
- String testRunStackTrace = "";
-
- // Report that the last known test failed
- if ((mCurrentTestResult != null) && (mCurrentTestResult.isComplete())) {
- // current test results are cleared out after every complete test run,
- // if it's not null, assume the last test caused this and report as a test failure
- TestIdentifier testId = new TestIdentifier(mCurrentTestResult.mTestClass,
- mCurrentTestResult.mTestName);
-
- // If there was any stack trace during the test run, append it to the "test failed"
- // error message so we have an idea of what caused the crash/failure.
- Map<String, String> emptyMap = Collections.emptyMap();
- if (mCurrentTestResult.hasStackTrace()) {
- testRunStackTrace = mCurrentTestResult.getTrace();
- }
- for (ITestRunListener listener : mTestListeners) {
- listener.testFailed(testId, "No test results.\r\n" + testRunStackTrace);
- listener.testEnded(testId, emptyMap);
- }
- clearCurrentTestResult();
- }
- // Report the test run failed
- for (ITestRunListener listener : mTestListeners) {
- listener.testRunFailed(errorMsg);
- listener.testRunEnded(mTotalRunTime, getRunMetrics());
- }
- }
-
- /**
- * Called by parent when adb session is complete.
- */
- @Override
- public void done() {
- super.done();
- if (mNumTestsExpected > mNumTestsRun) {
- handleTestRunFailed(String.format("Test run incomplete. Expected %d tests, received %d",
- mNumTestsExpected, mNumTestsRun));
- }
- else if (mTestRunInProgress) {
- handleTestRunFailed("No test results");
- }
- }
-
- /**
- * Sets the coverage target for this test.
- * <p/>
- * Will be sent as a metric to test listeners.
- *
- * @param coverageTarget the coverage target
- */
- public void setCoverageTarget(String coverageTarget) {
- mCoverageTarget = coverageTarget;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ITestPackageDef.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ITestPackageDef.java
deleted file mode 100644
index 13f3572..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ITestPackageDef.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.targetprep.ITargetPreparer;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IRemoteTest;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Container for CTS test info.
- * <p/>
- * Knows how to translate this info into a runnable {@link IRemoteTest}.
- */
-public interface ITestPackageDef extends Comparable<ITestPackageDef> {
-
- /**
- * Get the id of the test package.
- * @return the {@link String} id
- */
- public String getId();
-
- /**
- * Creates a runnable {@link IRemoteTest} from info stored in this definition.
- *
- * @param testCaseDir {@link File} representing directory of test case data
- * @return a {@link IRemoteTest} with all necessary data populated to run the test or
- * <code>null</code> if test could not be created
- */
- public IRemoteTest createTest(File testCaseDir);
-
- /**
- * Get the collection of tests in this test package.
- */
- public Collection<TestIdentifier> getTests();
-
- /**
- * Return the sha1sum of the binary file for this test package.
- * <p/>
- * Will only return a valid value after {@link #createTest(File)} has been called.
- *
- * @return the sha1sum in {@link String} form
- */
- public String getDigest();
-
- /**
- * @return the name of this test package.
- */
- public String getName();
-
- /**
- * @return the ABI of this test package.
- */
- public IAbi getAbi();
-
- /**
- * Set the filter to use for tests
- *
- * @param testFilter
- */
- public void setTestFilter(TestFilter testFilter);
-
- /**
- * Restrict this test package to run a specific class and method name
- *
- * @param className the test class to restrict this run to
- * @param methodName the optional test method to restrict this run to, or <code>null</code> to
- * run all tests in class
- */
- public void setClassName(String className, String methodName);
-
- /**
- * Return the file name of this package's instrumentation target apk.
- *
- * @return the file name or <code>null</code> if not applicable.
- */
- public String getTargetApkName();
-
- /**
- * Return the Android package name of this package's instrumentation target, or
- * <code>null</code> if not applicable.
- */
- public String getTargetPackageName();
-
- /**
- * Return a list of preparers used for setup or teardown of test cases in this package
- * @return
- */
- public List<ITargetPreparer> getPackagePreparers();
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ITestPackageRepo.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ITestPackageRepo.java
deleted file mode 100644
index 893758f..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ITestPackageRepo.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Interface for accessing tests from the CTS repository.
- */
-public interface ITestPackageRepo {
-
- /**
- * Get a {@link TestPackageDef} given an id.
- *
- * @param id the unique identifier of this test package, generated by
- * {@link AbiUtils#createId(String, String)}.
- * @return a {@link TestPackageDef}
- */
- public ITestPackageDef getTestPackage(String id);
-
- /**
- * @return a sorted {@link List} of all package ids found in repo.
- */
- public List<String> getPackageIds();
-
- /**
- * @return a sorted {@link List} of test package names
- */
- public List<String> getPackageNames();
-
- /**
- * @return A {@link Map} of test package name to a {@link List} of {@link ITestPackageDef}s.
- */
- public Map<String, List<ITestPackageDef>> getTestPackageDefsByName();
-
- /**
- * Attempt to find the package ids for a given test class name
- *
- * @param testClassName the test class name
- * @return a {@link List} of package ids.
- */
- public List<String> findPackageIdsForTest(String testClassName);
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ITestPlan.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ITestPlan.java
deleted file mode 100644
index 2d5f4a7..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ITestPlan.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Interface for accessing test plan data.
- */
-public interface ITestPlan {
-
- /**
- * Populates the test plan data from given XML stream.
- *
- * @param xmlStream the {@link InputStream} that contains the test plan xml.
- */
- public void parse(InputStream xmlStream) throws ParseException;
-
- /**
- * Gets a sorted list of test ids contained in this plan.
- */
- public Collection<String> getTestIds();
-
- /**
- * Gets a sorted {@link List} of test names contained in this plan.
- */
- public List<String> getTestNames();
-
- /**
- * Gets the {@link TestFilter} that should be used to filter tests from given package.
- */
- public TestFilter getTestFilter(String id);
-
- /**
- * Add a package to this test plan
- * @param id
- */
- public void addPackage(String id);
-
- /**
- * Add a excluded test to this test plan
- *
- * @param id the package id
- * @param testToExclude the test to exclude for given package
- */
- public void addExcludedTest(String id, TestIdentifier testToExclude);
-
- /**
- * Adds the list of excluded tests for given package
- *
- * @param id
- * @param excludedTests
- */
- public void addExcludedTests(String id, Collection<TestIdentifier> excludedTests);
-
- /**
- * Serialize the contents of this test plan.
- *
- * @param xmlOutStream the {@link OutputStream} to serialize test plan contents to
- * @throws IOException
- */
- public void serialize(OutputStream xmlOutStream) throws IOException;
-
- /**
- * @return the test plan name
- */
- public String getName();
-
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/JUnitDeviceTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/JUnitDeviceTest.java
deleted file mode 100644
index 5efa7cd..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/JUnitDeviceTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.cts.tradefed.testtype;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.AbiFormatter;
-import com.android.tradefed.util.ArrayUtil;
-
-import junit.framework.Assert;
-import junit.framework.Test;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- * {@link Test} for running CTS JUnit tests on the device.
- */
-public class JUnitDeviceTest implements IDeviceTest, IRemoteTest, IBuildReceiver {
-
- private static final String TMP_DIR = "/data/local/tmp/";
-
- @Option(name = "junit-device-runtime",
- description = "The name of the runtime to use on the device",
- importance = Importance.ALWAYS)
- private String mRuntimePath = "dalvikvm|#ABI#|";
-
- @Option(name = "junit-device-tmpdir", description = "Device path where to store the test jars."
- , importance = Importance.IF_UNSET)
- private String mDeviceTestTmpPath = TMP_DIR;
-
-
-
- // default to no timeout
- private long mMaxTimeToOutputResponse = 0;
-
- private ITestDevice mDevice;
- private String mRunName;
- private Collection<TestIdentifier> mTests;
- private CtsBuildHelper mCtsBuild = null;
-
- private List<String> mJarPaths = new ArrayList<String>();
-
- private String mRuntimeArgs;
-
- private IAbi mAbi;
-
- private static final String JUNIT_JAR = "cts-junit.jar";
-
- private Set<String> mTestJars = new HashSet<String>(Arrays.asList(JUNIT_JAR));
-
- /**
- * @param abi The ABI to run the test on
- */
- public void setAbi(IAbi abi) {
- mAbi = abi;
- }
-
- @Override
- public ITestDevice getDevice() {
- return mDevice;
- }
-
- @Override
- public void setDevice(ITestDevice device) {
- mDevice = device;
- }
-
- public void addTestJarFileName(String jarFileName) {
- mTestJars.add(jarFileName);
- }
-
- public void setRunName(String runName) {
- mRunName = runName;
- }
-
- public void setTests(Collection<TestIdentifier> tests) {
- mTests = tests;
- }
-
- public Collection<TestIdentifier> getTests() {
- return mTests;
- }
-
- @Override
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
- addTestJarFileName(JUNIT_JAR);
- checkFields();
- long startTime = System.currentTimeMillis();
- listener.testRunStarted(mRunName, mTests.size());
- try {
- installJars();
- String jarPath = ArrayUtil.join(":", mJarPaths);
- for (TestIdentifier testId : mTests) {
- SingleJUnitTestResultParser resultParser = new SingleJUnitTestResultParser(
- testId, listener);
- String cmdLine = String.format("ANDROID_DATA=%s %s -cp %s %s " +
- "com.android.cts.junit.SingleJUnitTestRunner %s#%s",
- mDeviceTestTmpPath, mRuntimePath, jarPath, mRuntimeArgs,
- testId.getClassName(), testId.getTestName());
- String cmd = AbiFormatter.formatCmdForAbi(cmdLine, mAbi.getBitness());
- CLog.d("Running %s", cmd);
- listener.testStarted(testId);
- mDevice.executeShellCommand(cmd, resultParser, mMaxTimeToOutputResponse,
- TimeUnit.MILLISECONDS, 0);
- }
- } finally {
- listener.testRunEnded(System.currentTimeMillis() - startTime,
- Collections.<String, String> emptyMap());
- // Remove jar files from device
- removeJars();
- }
- }
-
- /**
- * Installs the jar files on the device under test.
- *
- * @throws DeviceNotAvailableException
- */
- protected void installJars() throws DeviceNotAvailableException {
- for (String f : mTestJars) {
- CLog.d("Installing %s on %s", f, getDevice().getSerialNumber());
- File jarFile;
- try {
- String fullJarPath = String.format("%s%s", mDeviceTestTmpPath, f);
- jarFile = mCtsBuild.getTestApp(f);
- boolean result = getDevice().pushFile(jarFile, fullJarPath);
- Assert.assertTrue(String.format("Failed to push file to %s", fullJarPath), result);
- mJarPaths.add(fullJarPath);
- } catch (FileNotFoundException e) {
- Assert.fail(String.format("Could not find file %s", f));
- }
- }
- }
-
- /**
- * Cleans up the jar files from the device under test.
- *
- * @throws DeviceNotAvailableException
- */
- protected void removeJars() throws DeviceNotAvailableException {
- for (String f : mTestJars) {
- String fullJarPath = String.format("%s%s", mDeviceTestTmpPath, f);
- CLog.d("Uninstalling %s on %s", fullJarPath, getDevice().getSerialNumber());
- getDevice().executeShellCommand(String.format("rm %s", fullJarPath));
- }
- }
-
- @Override
- public void setBuild(IBuildInfo buildInfo) {
- mCtsBuild = CtsBuildHelper.createBuildHelper(buildInfo);
- }
-
- /**
- * Checks that all mandatory member fields has been set.
- */
- protected void checkFields() {
- if (mRunName == null) {
- throw new IllegalArgumentException("run name has not been set");
- }
- if (mDevice == null) {
- throw new IllegalArgumentException("Device has not been set");
- }
- if (mTestJars.isEmpty()) {
- throw new IllegalArgumentException("No test jar has been set");
- }
- if (mTests == null) {
- throw new IllegalArgumentException("tests has not been set");
- }
- if (mCtsBuild == null) {
- throw new IllegalArgumentException("build has not been set");
- }
- for (String f : mTestJars) {
- try {
-
- mCtsBuild.getTestApp(f);
- } catch (FileNotFoundException e) {
- throw new IllegalArgumentException(String.format(
- "Could not find jar %s in CTS build %s", f,
- mCtsBuild.getRootDir().getAbsolutePath()));
- }
- }
- }
-
- /**
- * Add runtime arguments to run the tests with.
- *
- * @param mRunTimeArgs
- */
- public void addRunTimeArgs(String mRunTimeArgs) {
- mRuntimeArgs = mRunTimeArgs;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/JarHostTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/JarHostTest.java
deleted file mode 100644
index 9d9596e..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/JarHostTest.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.testtype.DeviceTestResult.RuntimeDeviceNotAvailableException;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IAbiReceiver;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.testtype.JUnitRunUtil;
-import com.android.tradefed.util.CommandStatus;
-import com.android.tradefed.util.IRunUtil.IRunnableResult;
-import com.android.tradefed.util.RunUtil;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collection;
-
-/**
- * A {@link IRemoteTest} that can run a set of JUnit tests from a CTS jar.
- */
-public class JarHostTest implements IDeviceTest, IRemoteTest, IBuildReceiver, Test {
-
- private static final String LOG_TAG = "JarHostTest";
-
- private ITestDevice mDevice;
- private String mJarFileName;
- private Collection<TestIdentifier> mTests;
- private long mTimeoutMs = 10 * 60 * 1000;
- private String mRunName;
- private CtsBuildHelper mCtsBuild = null;
- private IBuildInfo mBuildInfo = null;
- private IAbi mAbi;
- private ClassLoader mClassLoader;
-
- /**
- * @param abi the ABI to run the test on
- */
- public void setAbi(IAbi abi) {
- mAbi = abi;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setBuild(IBuildInfo buildInfo) {
- mBuildInfo = buildInfo;
- mCtsBuild = CtsBuildHelper.createBuildHelper(buildInfo);
- }
-
- /**
- * Set the CTS build container.
- * <p/>
- * Exposed so unit tests can mock the provided build.
- *
- * @param buildHelper
- */
- void setBuildHelper(CtsBuildHelper buildHelper) {
- mCtsBuild = buildHelper;
- }
-
- /**
- * Get the CTS build container.
- *
- * @return {@link CtsBuildHelper}
- */
- CtsBuildHelper getBuildHelper() {
- return mCtsBuild;
- }
-
- /**
- * Set the jar file to load tests from.
- *
- * @param jarFileName the file name of the CTS host test jar to use
- */
- void setJarFileName(String jarFileName) {
- mJarFileName = jarFileName;
- }
-
- /**
- * Gets the jar file to load tests from.
- *
- * @return jarFileName the file name of the CTS host test jar to use
- */
- String getJarFileName() {
- return mJarFileName;
- }
-
- /**
- * Sets the collection of tests to run
- *
- * @param tests
- */
- void setTests(Collection<TestIdentifier> tests) {
- mTests = tests;
- }
-
- /**
- * Gets the collection of tests to run
- *
- * @return Collection<{@link TestIdentifier}>
- */
- Collection<TestIdentifier> getTests() {
- return mTests;
- }
-
- /**
- * Set the maximum time in ms each test should run.
- * <p/>
- * Tests that take longer than this amount will be failed with a {@link TestTimeoutException}
- * as the cause.
- *
- * @param testTimeoutMs
- */
- void setTimeout(long testTimeoutMs) {
- mTimeoutMs = testTimeoutMs;
- }
-
- /**
- * Set the run name to report to {@link ITestInvocationListener#testRunStarted(String, int)}
- *
- * @param runName
- */
- void setRunName(String runName) {
- mRunName = runName;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ITestDevice getDevice() {
- return mDevice;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setDevice(ITestDevice device) {
- mDevice = device;
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- @Override
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
- checkFields();
- Log.i(LOG_TAG, String.format("Running %s test package from jar, contains %d tests.",
- mRunName, mTests.size()));
- JUnitRunUtil.runTest(listener, this, mRunName);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void run(TestResult junitResult) {
- for (TestIdentifier testId : mTests) {
- Test junitTest = loadTest(testId.getClassName(), testId.getTestName());
- if (junitTest != null) {
- runTest(testId, junitTest, junitResult);
- }
- }
- }
-
- /**
- * Run test with timeout support.
- */
- private void runTest(TestIdentifier testId, final Test junitTest, final TestResult junitResult) {
- if (junitTest instanceof IDeviceTest) {
- ((IDeviceTest)junitTest).setDevice(getDevice());
- } else if (junitTest instanceof com.android.hosttest.DeviceTest) {
- // legacy check - see if test uses hosttestlib. This check should go away once
- // all host tests are converted to use tradefed
- com.android.hosttest.DeviceTest deviceTest = (com.android.hosttest.DeviceTest)junitTest;
- deviceTest.setDevice(getDevice().getIDevice());
- deviceTest.setTestAppPath(mCtsBuild.getTestCasesDir().getAbsolutePath());
- }
- if (junitTest instanceof IAbiReceiver) {
- ((IAbiReceiver)junitTest).setAbi(mAbi);
- }
- if (junitTest instanceof IBuildReceiver) {
- ((IBuildReceiver)junitTest).setBuild(mBuildInfo);
- }
- TestRunnable testRunnable = new TestRunnable(junitTest, junitResult);
-
- CommandStatus status = RunUtil.getDefault().runTimed(mTimeoutMs, testRunnable, true);
- if (status.equals(CommandStatus.TIMED_OUT)) {
- junitResult.addError(junitTest, new TestTimeoutException());
- junitResult.endTest(junitTest);
- }
- if (testRunnable.getException() != null) {
- throw testRunnable.getException();
- }
- }
-
- private static class TestRunnable implements IRunnableResult {
-
- private final Test mJunitTest;
- private RuntimeDeviceNotAvailableException mException = null;
- private TestResult mJunitResult;
-
- TestRunnable(Test junitTest, TestResult junitResult) {
- mJunitTest = junitTest;
- mJunitResult = junitResult;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean run() throws Exception {
- try {
- mJunitTest.run(mJunitResult);
- } catch (RuntimeDeviceNotAvailableException e) {
- mException = e;
- }
- return true;
- }
-
- public RuntimeDeviceNotAvailableException getException() {
- return mException;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void cancel() {
- }
-
- }
-
- /**
- * Load the test with given names from the jar.
- *
- * @param className
- * @param testName
- * @return the loaded {@link Test} or <code>null</code> if test could not be loaded.
- */
- private Test loadTest(String className, String testName) {
- try {
- Class<?> testClass = loadClass(className);
- if (testClass == null) {
- return null;
- }
- if (TestCase.class.isAssignableFrom(testClass)) {
- TestCase testCase = (TestCase)testClass.newInstance();
- testCase.setName(testName);
- return testCase;
- } else if (Test.class.isAssignableFrom(testClass)) {
- Test test = (Test)testClass.newInstance();
- return test;
- } else {
- Log.e(LOG_TAG, String.format("Class '%s' from jar '%s' is not a Test",
- className, mJarFileName));
- }
- } catch (IllegalAccessException e) {
- reportLoadError(mJarFileName, className, e);
- } catch (InstantiationException e) {
- reportLoadError(mJarFileName, className, e);
- }
- return null;
- }
-
- private Class<?> loadClass(String className) {
- try {
- if (mClassLoader == null) {
- File jarFile = mCtsBuild.getTestApp(mJarFileName);
- URL urls[] = {jarFile.getCanonicalFile().toURI().toURL()};
- mClassLoader = new URLClassLoader(urls);
- }
- return mClassLoader.loadClass(className);
- } catch (FileNotFoundException fnfe) {
- reportLoadError(mJarFileName, className, fnfe);
- } catch (MalformedURLException mue) {
- reportLoadError(mJarFileName, className, mue);
- } catch (IOException ioe) {
- reportLoadError(mJarFileName, className, ioe);
- } catch (ClassNotFoundException cnfe) {
- reportLoadError(mJarFileName, className, cnfe);
- }
- return null;
- }
-
- /**
- * Loads a class from given URLs.
- * <p/>
- * Exposed so unit tests can mock
- *
- * @param className
- * @param urls
- * @return
- * @throws ClassNotFoundException
- */
- Class<?> loadClass(String className, URL[] urls) throws ClassNotFoundException {
- URLClassLoader cl = new URLClassLoader(urls);
- Class<?> testClass = cl.loadClass(className);
- return testClass;
- }
-
- private void reportLoadError(String jarFileName, String className, Exception e) {
- Log.e(LOG_TAG, String.format("Failed to load test class '%s' from jar '%s'",
- className, jarFileName));
- Log.e(LOG_TAG, e);
- }
-
- /**
- * Checks that all mandatory member fields has been set.
- */
- protected void checkFields() {
- if (mRunName == null) {
- throw new IllegalArgumentException("run name has not been set");
- }
- if (mDevice == null) {
- throw new IllegalArgumentException("Device has not been set");
- }
- if (mJarFileName == null) {
- throw new IllegalArgumentException("jar file name has not been set");
- }
- if (mTests == null) {
- throw new IllegalArgumentException("tests has not been set");
- }
- if (mCtsBuild == null) {
- throw new IllegalArgumentException("build has not been set");
- }
- try {
- mCtsBuild.getTestApp(mJarFileName);
- } catch (FileNotFoundException e) {
- throw new IllegalArgumentException(String.format(
- "Could not find jar %s in CTS build %s", mJarFileName,
- mCtsBuild.getRootDir().getAbsolutePath()));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int countTestCases() {
- return mTests.size();
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ResultFilter.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ResultFilter.java
deleted file mode 100644
index f4f2f5d..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/ResultFilter.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.cts.tradefed.testtype.CtsTest.TestPackage;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.ResultForwarder;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A {@link ITestInvocationListener} that filters test results based on the set of expected tests
- * in CTS test package xml files.
- * <p/>
- * It will only report test results for expected tests, and at end of invocation, will report the
- * set of expected tests that were not executed.
- */
-class ResultFilter extends ResultForwarder {
-
- private final Set<TestIdentifier> mKnownTests;
- private final Set<TestIdentifier> mRemainingTests;
- private final String mTestRun;
-
- /**
- * Create a {@link ResultFilter}.
- *
- * @param listener the real {@link ITestInvocationListener} to forward results to
- */
- ResultFilter(ITestInvocationListener listener, TestPackage testPackage) {
- super(listener);
- mTestRun = testPackage.getTestRunName();
- Collection<TestIdentifier> tests = testPackage.getKnownTests();
- mKnownTests = new HashSet<TestIdentifier>(tests);
- // use LinkedHashMap for predictable test order
- mRemainingTests = new LinkedHashSet<TestIdentifier>(tests);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testRunStarted(String runName, int testCount) {
- if (mTestRun.equals(runName)) {
- super.testRunStarted(runName, testCount);
- } else {
- CLog.d("Skipping reporting unknown test run %s", runName);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testStarted(TestIdentifier test) {
- if (isKnownTest(test)) {
- super.testStarted(test);
- } else {
- CLog.d("Skipping reporting unknown test %s", test);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testFailed(TestIdentifier test, String trace) {
- if (isKnownTest(test)) {
- super.testFailed(test, trace);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void testEnded(TestIdentifier test, Map<String, String> testMetrics) {
- if (isKnownTest(test)) {
- super.testEnded(test, testMetrics);
- removeExecutedTest(test);
- }
- }
-
- /**
- * @param test
- * @return
- */
- private boolean isKnownTest(TestIdentifier test) {
- return mKnownTests.contains(test);
- }
-
- /**
- * Remove given test from the 'remaining tests' data structure.
- * @param test
- */
- private void removeExecutedTest(TestIdentifier test) {
- mRemainingTests.remove(test);
- }
-
- /**
- * Report the set of expected tests that were not executed
- */
- public void reportUnexecutedTests() {
- if (mRemainingTests.isEmpty()) {
- return;
- }
- super.testRunStarted(mTestRun, mRemainingTests.size());
- for (TestIdentifier test : mRemainingTests) {
- // an unexecuted test is currently reported as a 'testStarted' event without a
- // 'testEnded'. TODO: consider adding an explict API for reporting an unexecuted
- // test
- super.testStarted(test);
- }
- super.testRunEnded(0, new HashMap<String, String>());
- }
-
- /** @return the number of known tests */
- public int getKnownTestCount() {
- return mKnownTests.size();
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/SingleJUnitTestResultParser.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/SingleJUnitTestResultParser.java
deleted file mode 100644
index 150d265..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/SingleJUnitTestResultParser.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.cts.tradefed.testtype;
-
-import com.android.ddmlib.MultiLineReceiver;
-import com.android.ddmlib.testrunner.ITestRunListener;
-import com.android.ddmlib.testrunner.TestIdentifier;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Parses the test results from {@link com.android.cts.junit.SingleJUnitTestRunner}
- */
-public class SingleJUnitTestResultParser extends MultiLineReceiver {
-
- private static final String PASSED_TEST_MARKER = "[ PASSED ]";
- private static final String FAILED_TEST_MARKER = "[ FAILED ]";
- private final TestIdentifier mTestId;
- private final Collection<ITestRunListener> mTestListeners;
- private StringBuilder mStackTrace = new StringBuilder();
-
- public SingleJUnitTestResultParser(TestIdentifier testId, Collection<ITestRunListener> listeners) {
- mTestId = testId;
- mTestListeners = new ArrayList<ITestRunListener>(listeners);
- }
-
- public SingleJUnitTestResultParser(TestIdentifier testId, ITestRunListener listener) {
- mTestId = testId;
- mTestListeners = new ArrayList<ITestRunListener>(1);
- mTestListeners.add(listener);
- }
-
- @Override
- public boolean isCancelled() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public void processNewLines(String[] lines) {
- for (String line : lines) {
- parse(line);
- }
- }
-
- /**
- * Parses a given string.
- * @param line
- */
- private void parse(String line) {
- if (line.startsWith(PASSED_TEST_MARKER)) {
- doTestEnded(true);
- } else if (line.startsWith(FAILED_TEST_MARKER)) {
- doTestEnded(false);
- } else {
- // Store everything in case there is a failure.
- mStackTrace.append("\n");
- mStackTrace.append(line);
- }
- }
-
- /**
- * Handle cases when test ends.
- * @param testPassed whether or not the test passed.
- */
- private void doTestEnded(boolean testPassed) {
- // If test failed.
- if (!testPassed) {
- for (ITestRunListener listener : mTestListeners) {
- listener.testFailed(mTestId, mStackTrace.toString());
- }
- }
- Map<String, String> emptyMap = Collections.emptyMap();
- for (ITestRunListener listener : mTestListeners) {
- listener.testEnded(mTestId, emptyMap);
- }
- mStackTrace = new StringBuilder();
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestFilter.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestFilter.java
deleted file mode 100644
index 4d1b3e2..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestFilter.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.testtype;
-
-import com.android.ddmlib.testrunner.TestIdentifier;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-/**
- * Filter for {@link TestIdentifier}s.
- */
-public class TestFilter {
-
- private final Set<String> mExcludedClasses;
- private final Set<TestIdentifier> mExcludedTests;
-
- private final Set<String> mIncludedClasses;
- private final Set<TestIdentifier> mIncludedTests;
-
- private String mIncludedClass = null;
- private Pattern mIncludedMethod = null;
-
- /**
- * Creates a {@link TestFilter}
- */
- public TestFilter() {
- mExcludedClasses = new HashSet<String>();
- mExcludedTests = new HashSet<TestIdentifier>();
-
- mIncludedClasses = new HashSet<String>();
- mIncludedTests = new HashSet<TestIdentifier>();
- }
-
- /**
- * Adds a test class to the filter.
- * <p/>
- * All tests in this class should be filtered.
- */
- public void addExcludedClass(String className) {
- mExcludedClasses.add(className);
- }
-
- /**
- * Adds a test class to the filter. All tests in this class should be excluded.
- */
- public void addExcludedTest(TestIdentifier test) {
- mExcludedTests.add(test);
- }
-
- /**
- * Get the test classes to exclude.
- * <p/>
- * Exposed for unit testing
- */
- Set<String> getExcludedClasses() {
- return mExcludedClasses;
- }
-
- /**
- * Get the tests to exclude.
- * <p/>
- * Exposed for unit testing
- */
- Set<TestIdentifier> getExcludedTests() {
- return mExcludedTests;
- }
-
- /**
- * Adds a test class to the filter.
- * <p/>
- * All tests in this class should be allowed.
- */
- public void addIncludedClass(String className) {
- mIncludedClasses.add(className);
- }
-
- /**
- * Adds a test class to the filter. All tests in this class should be excluded.
- */
- public void addIncludedTest(TestIdentifier test) {
- mIncludedTests.add(test);
- }
-
- /**
- * @return the mIncludedClasses
- */
- public Set<String> getIncludedClasses() {
- return mIncludedClasses;
- }
-
- /**
- * @return the mIncludedTests
- */
- public Set<TestIdentifier> getIncludedTests() {
- return mIncludedTests;
- }
-
- /**
- * Sets the class name and optionally method that should pass this filter. If non-null, all
- * other tests will be excluded.
- *
- * @param className the test class name to exclusively include
- * @param method the test method name to exclusively include
- */
- public void setTestInclusion(String className, String method) {
- mIncludedClass = className;
- if (method != null) {
- mIncludedMethod = Pattern.compile(method);
- }
- }
-
- /**
- * Filter the list of tests based on rules in this filter
- *
- * @param tests the list of tests to filter
- * @return a new sorted list of tests that passed the filter
- */
- public Collection<TestIdentifier> filter(Collection<TestIdentifier> tests) {
- List<TestIdentifier> filteredTests = new ArrayList<TestIdentifier>(tests.size());
- for (TestIdentifier test : tests) {
- if (mIncludedClass != null && !test.getClassName().equals(mIncludedClass)) {
- // skip
- continue;
- }
- if (mIncludedMethod != null && !mIncludedMethod.matcher(test.getTestName()).matches()) {
- // skip
- continue;
- }
- if (mExcludedClasses.contains(test.getClassName())) {
- // skip
- continue;
- }
- if (mExcludedTests.contains(test)) {
- // skip
- continue;
- }
- if ((!mIncludedTests.isEmpty() || !mIncludedClasses.isEmpty())
- && !(mIncludedClasses.contains(test.getClassName())
- || mIncludedTests.contains(test))) {
- // skip
- continue;
- }
- filteredTests.add(test);
- }
- Collections.sort(filteredTests, new TestIdComparator());
- return filteredTests;
- }
-
- /**
- * Return true if there are exclusions rules defined.
- */
- public boolean hasExclusion() {
- return !mExcludedClasses.isEmpty() || !mExcludedTests.isEmpty();
- }
-
- /**
- * @return true if there are inclusion rules defined.
- */
- public boolean hasInclusion() {
- return !mIncludedClasses.isEmpty() || !mIncludedTests.isEmpty();
- }
-
- /**
- * A {@link Comparator} for {@link TestIdentifier} that compares using
- * {@link TestIdentifier#toString()}
- */
- private class TestIdComparator implements Comparator<TestIdentifier> {
-
- @Override
- public int compare(TestIdentifier o1, TestIdentifier o2) {
- return o1.toString().compareTo(o2.toString());
- }
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestNGDeviceTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestNGDeviceTest.java
deleted file mode 100644
index 377c0c0..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestNGDeviceTest.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (C) 2016 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 com.android.cts.tradefed.testtype;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.AbiFormatter;
-import com.android.tradefed.util.ArrayUtil;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- * {@code Test} for running CTS TestNG tests on the device.
- */
-public class TestNGDeviceTest implements IDeviceTest, IRemoteTest, IBuildReceiver {
-
- private static final String TMP_DIR = "/data/local/tmp/";
-
- @Option(name = "testng-device-runtime",
- description = "The name of the runtime to use on the device",
- importance = Importance.ALWAYS)
- private String mRuntimePath = "dalvikvm|#ABI#|";
-
- @Option(name = "testng-device-tmpdir", description = "Device path where to store the test jars."
- , importance = Importance.IF_UNSET)
- private String mDeviceTestTmpPath = TMP_DIR;
-
-
- // default to no timeout
- private long mMaxTimeToOutputResponse = 0;
-
- private ITestDevice mDevice;
- private String mRunName;
- private Collection<TestIdentifier> mTests;
- private CtsBuildHelper mCtsBuild = null;
-
- private List<String> mJarPaths = new ArrayList<String>();
-
- private String mRuntimeArgs;
-
- private IAbi mAbi;
-
- private static final String TESTNG_JAR = "cts-testng.jar";
-
- private Set<String> mTestJars = new HashSet<String>(Arrays.asList(TESTNG_JAR));
-
- /**
- * @param abi The ABI to run the test on
- */
- public void setAbi(IAbi abi) {
- mAbi = abi;
- }
-
- @Override
- public ITestDevice getDevice() {
- return mDevice;
- }
-
- @Override
- public void setDevice(ITestDevice device) {
- mDevice = device;
- }
-
- public void addTestJarFileName(String jarFileName) {
- mTestJars.add(jarFileName);
- }
-
- public void setRunName(String runName) {
- mRunName = runName;
- }
-
- public void setTests(Collection<TestIdentifier> tests) {
- mTests = tests;
- }
-
- public Collection<TestIdentifier> getTests() {
- return mTests;
- }
-
- @Override
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
- addTestJarFileName(TESTNG_JAR);
- checkFields();
- long startTime = System.currentTimeMillis();
- listener.testRunStarted(mRunName, mTests.size());
- try {
- installJars();
- String jarPath = ArrayUtil.join(":", mJarPaths);
- for (TestIdentifier testId : mTests) {
- SingleJUnitTestResultParser resultParser = new SingleJUnitTestResultParser(
- testId, listener);
- String cmdLine = String.format("ANDROID_DATA=%s %s -cp %s %s " +
- "com.android.cts.testng.SingleTestNGTestRunner %s#%s",
- mDeviceTestTmpPath, mRuntimePath, jarPath, getRuntimeArgsNotNull(),
- testId.getClassName(), testId.getTestName());
- String cmd = AbiFormatter.formatCmdForAbi(cmdLine, mAbi.getBitness());
- CLog.d("Running %s", cmd);
- listener.testStarted(testId);
- mDevice.executeShellCommand(cmd, resultParser, mMaxTimeToOutputResponse,
- TimeUnit.MILLISECONDS, 0);
- }
- } finally {
- listener.testRunEnded(System.currentTimeMillis() - startTime,
- Collections.<String, String> emptyMap());
- // Remove jar files from device
- removeJars();
- }
- }
-
- /**
- * Installs the jar files on the device under test.
- *
- * @throws DeviceNotAvailableException
- */
- protected void installJars() throws DeviceNotAvailableException {
- for (String f : mTestJars) {
- CLog.d("Installing %s on %s", f, getDevice().getSerialNumber());
- File jarFile;
- try {
- String fullJarPath = String.format("%s%s", mDeviceTestTmpPath, f);
- jarFile = mCtsBuild.getTestApp(f);
- boolean result = getDevice().pushFile(jarFile, fullJarPath);
- if (!result) {
- throw new AssertionError(String.format("Failed to push file to %s", fullJarPath));
- }
- mJarPaths.add(fullJarPath);
- } catch (FileNotFoundException e) {
- throw new AssertionError(String.format("Could not find file %s", f));
- }
- }
- }
-
- /**
- * Cleans up the jar files from the device under test.
- *
- * @throws DeviceNotAvailableException
- */
- protected void removeJars() throws DeviceNotAvailableException {
- for (String f : mTestJars) {
- String fullJarPath = String.format("%s%s", mDeviceTestTmpPath, f);
- CLog.d("Uninstalling %s on %s", fullJarPath, getDevice().getSerialNumber());
- getDevice().executeShellCommand(String.format("rm %s", fullJarPath));
- }
- }
-
- @Override
- public void setBuild(IBuildInfo buildInfo) {
- mCtsBuild = CtsBuildHelper.createBuildHelper(buildInfo);
- }
-
- /**
- * Checks that all mandatory member fields has been set.
- */
- protected void checkFields() {
- if (mRunName == null) {
- throw new IllegalArgumentException("run name has not been set");
- }
- if (mDevice == null) {
- throw new IllegalArgumentException("Device has not been set");
- }
- if (mTestJars.isEmpty()) {
- throw new IllegalArgumentException("No test jar has been set");
- }
- if (mTests == null) {
- throw new IllegalArgumentException("tests has not been set");
- }
- if (mCtsBuild == null) {
- throw new IllegalArgumentException("build has not been set");
- }
- for (String f : mTestJars) {
- try {
-
- mCtsBuild.getTestApp(f);
- } catch (FileNotFoundException e) {
- throw new IllegalArgumentException(String.format(
- "Could not find jar %s in CTS build %s", f,
- mCtsBuild.getRootDir().getAbsolutePath()));
- }
- }
- }
-
- /**
- * Add runtime arguments to run the tests with.
- *
- * @param mRunTimeArgs
- */
- public void addRunTimeArgs(String mRunTimeArgs) {
- mRuntimeArgs = mRunTimeArgs;
- }
-
- private String getRuntimeArgsNotNull() {
- if (mRuntimeArgs == null) {
- return "";
- }
- return mRuntimeArgs;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
deleted file mode 100644
index 9478900..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.targetprep.ITargetPreparer;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.testtype.InstrumentationTest;
-import com.android.tradefed.util.StreamUtil;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.DigestInputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Container for CTS test info.
- * <p/>
- * Knows how to translate this info into a runnable {@link IRemoteTest}.
- */
-class TestPackageDef implements ITestPackageDef {
-
- public static final String HOST_SIDE_ONLY_TEST = "hostSideOnly";
- public static final String NATIVE_TEST = "native";
- public static final String WRAPPED_NATIVE_TEST = "wrappednative";
- public static final String VM_HOST_TEST = "vmHostTest";
- public static final String DEQP_TEST = "deqpTest";
- public static final String JUNIT_DEVICE_TEST = "jUnitDeviceTest";
- public static final String TESTNG_DEVICE_TEST = "testNGDeviceTest";
-
- private String mAppPackageName = null;
- private String mAppNameSpace = null;
- private String mName = null;
- private String mRunner = null;
- private String mTestType = null;
- private String mJarPath = null;
- private String mRunTimeArgs = null;
- private String mTestPackageName = null;
- private String mDigest = null;
- private IAbi mAbi = null;
- private List<ITargetPreparer> mPreparers = null;
-
- // use a LinkedHashSet for predictable iteration insertion-order, and fast
- // lookups
- private Collection<TestIdentifier> mTests = new LinkedHashSet<TestIdentifier>();
- // also maintain an index of known test classes
- private Collection<String> mTestClasses = new LinkedHashSet<String>();
- // store instance arguments in order too for consistency
- private Map<TestIdentifier, List<Map<String, String>>> mTestInstanceArguments =
- new LinkedHashMap<>();
-
- // dynamic options, not parsed from package xml
- private String mClassName;
- private String mMethodName;
- private TestFilter mTestFilter = new TestFilter();
- private String mTargetBinaryName;
- private String mTargetNameSpace;
- // only timeout per package is supported. To change this to method granularity,
- // test invocation should be done in method level.
- // So for now, only max timeout for the package is used.
- private int mTimeoutInMins = -1;
-
- @Override
- public IAbi getAbi() {
- return mAbi;
- }
-
- /**
- * @param abi the ABI to run this package on
- */
- public void setAbi(IAbi abi) {
- mAbi = abi;
- }
-
- /**
- * @return unique id representing this test package for this ABI.
- */
- @Override
- public String getId() {
- return AbiUtils.createId(getAbi().getName(), getAppPackageName());
- }
-
- void setAppPackageName(String appPackageName) {
- mAppPackageName = appPackageName;
- }
-
- String getAppPackageName() {
- return mAppPackageName;
- }
-
- void setRunTimeArgs(String runTimeArgs) {
- mRunTimeArgs = runTimeArgs;
- }
-
- void setAppNameSpace(String appNameSpace) {
- mAppNameSpace = appNameSpace;
- }
-
- String getAppNameSpace() {
- return mAppNameSpace;
- }
-
- void setName(String name) {
- mName = name;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return mName;
- }
-
- void setRunner(String runnerName) {
- mRunner = runnerName;
- }
-
- String getRunner() {
- return mRunner;
- }
-
- void setTestType(String testType) {
- mTestType = testType;
- }
-
- String getTestType() {
- return mTestType;
- }
-
- void setJarPath(String jarPath) {
- mJarPath = jarPath;
- }
-
- String getJarPath() {
- return mJarPath;
- }
-
- void setTestPackageName(String testPackageName) {
- mTestPackageName = testPackageName;
- }
-
- void setTargetBinaryName(String targetBinaryName) {
- mTargetBinaryName = targetBinaryName;
- }
-
- void setTargetNameSpace(String targetNameSpace) {
- mTargetNameSpace = targetNameSpace;
- }
-
- @Override
- public String getTargetApkName() {
- if (mTargetBinaryName != null && !mTargetBinaryName.isEmpty()) {
- return String.format("%s.apk", mTargetBinaryName);
- }
- return null;
- }
-
- @Override
- public String getTargetPackageName() {
- if (mTargetNameSpace != null && mTargetNameSpace.isEmpty()) {
- return null;
- }
- return mTargetNameSpace;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setTestFilter(TestFilter testFilter) {
- mTestFilter = testFilter;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setClassName(String className, String methodName) {
- mClassName = className;
- mMethodName = methodName;
- }
-
- /**
- * Setter for injecting a list of {@link ITargetPreparer}s as configured in module test config.
- * @param preparers
- */
- void setPackagePreparers(List<ITargetPreparer> preparers) {
- mPreparers = preparers;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<ITargetPreparer> getPackagePreparers() {
- return mPreparers;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IRemoteTest createTest(File testCaseDir) {
- mTestFilter.setTestInclusion(mClassName, mMethodName);
- mTests = filterTests();
-
- if (HOST_SIDE_ONLY_TEST.equals(mTestType)) {
- CLog.d("Creating host test for %s", mName);
- JarHostTest hostTest = new JarHostTest();
- if (mTimeoutInMins >= 0) {
- CLog.d("Setting new timeout to " + mTimeoutInMins + " mins");
- hostTest.setTimeout(mTimeoutInMins * 60 * 1000);
- }
- hostTest.setRunName(getId());
- hostTest.setJarFileName(mJarPath);
- hostTest.setTests(mTests);
- hostTest.setAbi(mAbi);
- mDigest = generateDigest(testCaseDir, mJarPath);
- return hostTest;
- } else if (VM_HOST_TEST.equals(mTestType)) {
- CLog.d("Creating vm host test for %s", mName);
- VMHostTest vmHostTest = new VMHostTest();
- vmHostTest.setRunName(getId());
- vmHostTest.setJarFileName(mJarPath);
- vmHostTest.setTests(mTests);
- vmHostTest.setAbi(mAbi);
- mDigest = generateDigest(testCaseDir, mJarPath);
- return vmHostTest;
- } else if (DEQP_TEST.equals(mTestType)) {
- DeqpTestRunner deqpTest =
- new DeqpTestRunner(mAppPackageName, mName, mTests, mTestInstanceArguments);
- deqpTest.setAbi(mAbi);
- return deqpTest;
- } else if (NATIVE_TEST.equals(mTestType)) {
- GeeTest geeTest = new GeeTest(mAppPackageName, mName);
- geeTest.setAbi(mAbi);
- return geeTest;
- } else if (WRAPPED_NATIVE_TEST.equals(mTestType)) {
- CLog.d("Creating new wrapped native test for %s", mName);
- WrappedGTest wrappedGeeTest = new WrappedGTest(mAppNameSpace, mAppPackageName, mName, mRunner);
- wrappedGeeTest.setAbi(mAbi);
- return wrappedGeeTest;
- } else if (JUNIT_DEVICE_TEST.equals(mTestType)){
- CLog.d("Creating JUnit device test %s", mName);
- JUnitDeviceTest jUnitDeviceTest = new JUnitDeviceTest();
- jUnitDeviceTest.setRunName(getId());
- jUnitDeviceTest.addTestJarFileName(mJarPath);
- jUnitDeviceTest.addRunTimeArgs(mRunTimeArgs);
- jUnitDeviceTest.setTests(mTests);
- jUnitDeviceTest.setAbi(mAbi);
- mDigest = generateDigest(testCaseDir, mJarPath);
- return jUnitDeviceTest;
- } else if (TESTNG_DEVICE_TEST.equals(mTestType)){
- CLog.d("Creating TestNG device test %s", mName);
- TestNGDeviceTest testNGDeviceTest = new TestNGDeviceTest();
- testNGDeviceTest.setRunName(getId());
- testNGDeviceTest.addTestJarFileName(mJarPath);
- testNGDeviceTest.addRunTimeArgs(mRunTimeArgs);
- testNGDeviceTest.setTests(mTests);
- testNGDeviceTest.setAbi(mAbi);
- mDigest = generateDigest(testCaseDir, mJarPath);
- return testNGDeviceTest;
- }
- else {
- CLog.d("Creating instrumentation test for %s", mName);
- CtsInstrumentationApkTest instrTest = new CtsInstrumentationApkTest();
- if (mTimeoutInMins >= 0) {
- // as timeout cannot be set for each test,
- // increase the time-out of the whole package
- CLog.d("Setting new timeout to " + mTimeoutInMins + " mins");
- instrTest.setTestTimeout(mTimeoutInMins * 60 * 1000);
- }
- return setInstrumentationTest(instrTest, testCaseDir);
- }
- }
-
- /**
- * Populates given {@link CtsInstrumentationApkTest} with data from the package xml.
- *
- * @param testCaseDir
- * @param instrTest
- * @return the populated {@link InstrumentationTest} or <code>null</code>
- */
- private InstrumentationTest setInstrumentationTest(CtsInstrumentationApkTest instrTest,
- File testCaseDir) {
- instrTest.setRunName(getId());
- instrTest.setPackageName(mAppNameSpace);
- instrTest.setRunnerName(mRunner);
- instrTest.setAbi(mAbi);
- instrTest.setTestsToRun(mTests, false
- /* force batch mode off to always run using testFile */);
- instrTest.setReRunUsingTestFile(true);
- // mName means 'apk file name' for instrumentation tests
- instrTest.addInstallApk(String.format("%s.apk", mName), mAppNameSpace);
- mDigest = generateDigest(testCaseDir, String.format("%s.apk", mName));
- return instrTest;
- }
-
- /**
- * Filter the tests to run based on list of included/excluded tests, class and method name.
- *
- * @return the filtered collection of tests
- */
- private Collection<TestIdentifier> filterTests() {
- mTestFilter.setTestInclusion(mClassName, mMethodName);
- return mTestFilter.filter(mTests);
- }
-
- boolean isKnownTestClass(String className) {
- return mTestClasses.contains(className);
- }
-
- /**
- * Add a {@link TestIdentifier} to the list of tests in this package.
- *
- * @param testDef
- * @param timeout in mins
- */
- void addTest(TestIdentifier testDef, int timeout) {
- mTests.add(testDef);
- mTestClasses.add(testDef.getClassName());
- mTestInstanceArguments.put(testDef, new LinkedList<Map<String, String>>());
- // 0 means no timeout, so keep 0 if already is.
- if ((timeout > mTimeoutInMins) && (mTimeoutInMins != 0)) {
- mTimeoutInMins = timeout;
- }
- }
-
- /**
- * Add a test instance to an existing {@link TestIdentifier}.
- */
- void addTestInstance(TestIdentifier testDef, Map<String, String> instanceArguments) {
- if (!mTestInstanceArguments.containsKey(testDef)) {
- throw new IllegalStateException("test id does not name an existing test");
- }
- mTestInstanceArguments.get(testDef).add(instanceArguments);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<TestIdentifier> getTests() {
- return mTests;
- }
-
- /**
- * Get the instance argument map for tests.
- * <p/>
- * Exposed for unit testing.
- */
- public Map<TestIdentifier, List<Map<String, String>>> getTestInstanceArguments() {
- return mTestInstanceArguments;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getDigest() {
- return mDigest;
- }
-
- /**
- * Generate a sha1sum digest for a file.
- * <p/>
- * Exposed for unit testing.
- *
- * @param fileDir the directory of the file
- * @param fileName the name of the file
- * @return a hex {@link String} of the digest
- */
- String generateDigest(File fileDir, String fileName) {
- final String algorithm = "SHA-1";
- InputStream fileStream = null;
- DigestInputStream d = null;
- try {
- fileStream = getFileStream(fileDir, fileName);
- MessageDigest md = MessageDigest.getInstance(algorithm);
- d = new DigestInputStream(fileStream, md);
- byte[] buffer = new byte[8196];
- while (d.read(buffer) != -1) {
- }
- return toHexString(md.digest());
- } catch (NoSuchAlgorithmException e) {
- return algorithm + " not found";
- } catch (IOException e) {
- CLog.e(e);
- } finally {
- StreamUtil.close(d);
- StreamUtil.close(fileStream);
- }
- return "failed to generate digest";
- }
-
- /**
- * Retrieve an input stream for given file
- * <p/>
- * Exposed so unit tests can mock.
- */
- InputStream getFileStream(File fileDir, String fileName) throws FileNotFoundException {
- InputStream fileStream;
- fileStream = new BufferedInputStream(new FileInputStream(new File(fileDir, fileName)));
- return fileStream;
- }
-
- /**
- * Convert the given byte array into a lowercase hex string.
- *
- * @param arr The array to convert.
- * @return The hex encoded string.
- */
- private String toHexString(byte[] arr) {
- StringBuilder buf = new StringBuilder(arr.length * 2);
- for (byte b : arr) {
- buf.append(String.format("%02x", b & 0xFF));
- }
- return buf.toString();
- }
-
- @Override
- public int compareTo(ITestPackageDef testPackageDef) {
- return getId().compareTo(testPackageDef.getId());
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java
deleted file mode 100644
index 9857105..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.ddmlib.Log;
-import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.config.ConfigurationFactory;
-import com.android.tradefed.config.IConfiguration;
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Retrieves CTS test package definitions from the repository.
- */
-public class TestPackageRepo implements ITestPackageRepo {
-
- private static final String LOG_TAG = "TestCaseRepo";
-
- /** mapping of ABI to a mapping of appPackageName to test definition */
- private final Map<String, Map<String, TestPackageDef>> mTestMap;
- private final boolean mIncludeKnownFailures;
-
- /**
- * Creates a {@link TestPackageRepo}, initialized from provided repo files
- *
- * @param testCaseDir directory containing all test case definition xml and build files
- * ABIs supported by the device under test.
- * @param includeKnownFailures Whether to run tests which are known to fail.
- */
- public TestPackageRepo(File testCaseDir, boolean includeKnownFailures) {
- mTestMap = new HashMap<>();
- mIncludeKnownFailures = includeKnownFailures;
- parse(testCaseDir);
- }
-
- /**
- * Builds mTestMap based on directory contents
- */
- private void parse(File dir) {
- File[] xmlFiles = dir.listFiles(new XmlFilter());
- for (File xmlFile : xmlFiles) {
- parseModuleTestConfigs(xmlFile);
- }
- }
-
- /**
- * Infer package preparer config from package XML definition file and return if exists
- * @param pkgXml {@link File} instance referencing the package XML definition
- * @return the matching package preparer if exists, <code>null</code> otherwise
- */
- private File getPreparerDefForPackage(File pkgXml) {
- String fullPath = pkgXml.getAbsolutePath();
- int lastDot = fullPath.lastIndexOf('.');
- if (lastDot == -1) {
- // huh?
- return null;
- }
- File preparer = new File(fullPath.substring(0, lastDot) + ".config");
- if (preparer.exists()) {
- return preparer;
- }
- return null;
- }
-
- /**
- * Processes test module definition XML file, and stores parsed data structure in class member
- * variable. Parsed config objects will be associated with each applicable ABI type so multiple
- * {@link TestPackageDef}s will be generated accordingly. In addition, based on
- * <module name>.config file naming convention, this method also looks for the optional
- * module test config, and attaches defined configuration objects to the {@link TestPackageDef}
- * representing the module accordingly.
- * @param xmlFile the module definition XML
- */
- private void parseModuleTestConfigs(File xmlFile) {
- TestPackageXmlParser parser = new TestPackageXmlParser(mIncludeKnownFailures);
- try {
- parser.parse(createStreamFromFile(xmlFile));
- // based on test module XML file path, and the <module name>.config naming convention,
- // infers the module test config file, and parses it
- File preparer = getPreparerDefForPackage(xmlFile);
- IConfiguration config = null;
- if (preparer != null) {
- try {
- // invokes parser to process the test module config file
- config = ConfigurationFactory.getInstance().createConfigurationFromArgs(
- new String[]{preparer.getAbsolutePath()});
- } catch (ConfigurationException e) {
- throw new RuntimeException(
- String.format("error parsing config file: %s", xmlFile.getName()), e);
- }
- }
- Set<TestPackageDef> defs = parser.getTestPackageDefs();
- if (defs.isEmpty()) {
- Log.w(LOG_TAG, String.format("Could not find test package info in xml file %s",
- xmlFile.getAbsolutePath()));
- }
- // loops over multiple package defs defined for each ABI type
- for (TestPackageDef def : defs) {
- String name = def.getAppPackageName();
- String abi = def.getAbi().getName();
- if (config != null) {
- def.setPackagePreparers(config.getTargetPreparers());
- }
- if (!mTestMap.containsKey(abi)) {
- mTestMap.put(abi, new HashMap<String, TestPackageDef>());
- }
- mTestMap.get(abi).put(name, def);
- }
- } catch (FileNotFoundException e) {
- Log.e(LOG_TAG, String.format("Could not find test case xml file %s",
- xmlFile.getAbsolutePath()));
- Log.e(LOG_TAG, e);
- } catch (ParseException e) {
- Log.e(LOG_TAG, String.format("Failed to parse test case xml file %s",
- xmlFile.getAbsolutePath()));
- Log.e(LOG_TAG, e);
- }
- }
-
- /**
- * Helper method to create a stream to read data from given file
- * <p/>
- * Exposed for unit testing
- *
- * @param xmlFile The file containing the xml description of the package
- * @return stream to read data
- *
- */
- InputStream createStreamFromFile(File xmlFile) throws FileNotFoundException {
- return new BufferedInputStream(new FileInputStream(xmlFile));
- }
-
- private static class XmlFilter implements FilenameFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean accept(File dir, String name) {
- return name.endsWith(".xml");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ITestPackageDef getTestPackage(String id) {
- String[] parts = AbiUtils.parseId(id);
- String abi = parts[0];
- String name = parts[1];
- if (mTestMap.containsKey(abi) && mTestMap.get(abi).containsKey(name)) {
- return mTestMap.get(abi).get(name);
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<String> getPackageIds() {
- Set<String> ids = new HashSet<>();
- for (String abi : mTestMap.keySet()) {
- Map<String, TestPackageDef> testNameMap = mTestMap.get(abi);
- for (TestPackageDef testPackageDef : testNameMap.values()) {
- ids.add(testPackageDef.getId());
- }
- }
- List<String> idList = new ArrayList<>(ids);
- Collections.sort(idList);
- return idList;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<String> getPackageNames() {
- Set<String> nameSet = new HashSet<String>();
- for (String abi : mTestMap.keySet()) {
- Map<String, TestPackageDef> testNameMap = mTestMap.get(abi);
- for (TestPackageDef testPackageDef : testNameMap.values()) {
- nameSet.add(AbiUtils.parseTestName(testPackageDef.getId()));
- }
- }
- List<String> nameList = new ArrayList<>(nameSet);
- Collections.sort(nameList);
- return nameList;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<String, List<ITestPackageDef>> getTestPackageDefsByName() {
- Map<String, List<ITestPackageDef>> packageDefMap =
- new HashMap<String, List<ITestPackageDef>>();
-
- for (String abi : mTestMap.keySet()) {
- Map<String, TestPackageDef> testNameMap = mTestMap.get(abi);
- for (String packageName : testNameMap.keySet()) {
- if (!packageDefMap.containsKey(packageName)) {
- packageDefMap.put(packageName, new ArrayList<ITestPackageDef>());
- }
- packageDefMap.get(packageName).add(testNameMap.get(packageName));
- }
- }
- return packageDefMap;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<String> findPackageIdsForTest(String testClassName) {
- Set<String> ids = new HashSet<String>();
- for (String abi : mTestMap.keySet()) {
- for (String name : mTestMap.get(abi).keySet()) {
- if (mTestMap.get(abi).get(name).isKnownTestClass(testClassName)) {
- ids.add(AbiUtils.createId(abi, name));
- }
- }
- }
- List<String> idList = new ArrayList<String>(ids);
- Collections.sort(idList);
- return idList;
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
deleted file mode 100644
index acd977e..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.util.xml.AbstractXmlParser;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.DefaultHandler;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-
-/**
- * Parser for CTS test case XML.
- * <p/>
- * Dumb parser that just retrieves data from in the test case xml and stuff it into a
- * {@link TestPackageDef}. Currently performs limited error checking.
- */
-public class TestPackageXmlParser extends AbstractXmlParser {
-
- private static final String LOG_TAG = "TestPackageXmlParser";
-
- private final boolean mIncludeKnownFailures;
-
- private Map<String, TestPackageDef> mPackageDefs = new HashMap<String, TestPackageDef>();
-
- /**
- * @param includeKnownFailures Whether to run tests which are known to fail.
- */
- public TestPackageXmlParser(boolean includeKnownFailures) {
- mIncludeKnownFailures = includeKnownFailures;
- }
-
- /**
- * SAX callback object. Handles parsing data from the xml tags.
- * <p/>
- * Expected structure:
- * <TestPackage>
- * <TestSuite ...>
- * <TestCase>
- * <Test>
- * <TestInstance> (optional)
- */
- private class TestPackageHandler extends DefaultHandler {
-
- private static final String TEST_PACKAGE_TAG = "TestPackage";
- private static final String TEST_SUITE_TAG = "TestSuite";
- private static final String TEST_CASE_TAG = "TestCase";
- private static final String TEST_TAG = "Test";
- private static final String TEST_INSTANCE_TAG = "TestInstance";
-
- // holds current class name segments
- private Stack<String> mClassNameStack = new Stack<String>();
- private TestIdentifier mTestId;
-
- @Override
- public void startElement(String uri, String localName, String name, Attributes attributes) {
- if (TEST_PACKAGE_TAG.equals(localName)) {
- final String appPackageName = attributes.getValue("appPackageName");
- final String testPackageNameSpace = attributes.getValue("appNameSpace");
- final String packageName = attributes.getValue("name");
- final String runnerName = attributes.getValue("runner");
- final String jarPath = attributes.getValue("jarPath");
- final String javaPackageFilter = attributes.getValue("javaPackageFilter");
- final String targetBinaryName = attributes.getValue("targetBinaryName");
- final String targetNameSpace = attributes.getValue("targetNameSpace");
- final String runTimeArgs = attributes.getValue("runtimeArgs");
- final String testType = getTestType(attributes);
-
- for (String abiName : AbiUtils.getAbisSupportedByCompatibility()) {
- Abi abi = new Abi(abiName, AbiUtils.getBitness(abiName));
- TestPackageDef packageDef = new TestPackageDef();
- packageDef.setAppPackageName(appPackageName);
- packageDef.setAppNameSpace(testPackageNameSpace);
- packageDef.setName(packageName);
- packageDef.setRunner(runnerName);
- packageDef.setTestType(testType);
- packageDef.setJarPath(jarPath);
- packageDef.setRunTimeArgs(runTimeArgs);
- if (!"".equals(javaPackageFilter)) {
- packageDef.setTestPackageName(javaPackageFilter);
- }
- packageDef.setTargetBinaryName(targetBinaryName);
- packageDef.setTargetNameSpace(targetNameSpace);
- packageDef.setAbi(abi);
- mPackageDefs.put(abiName, packageDef);
- }
-
- // reset the class name
- mClassNameStack = new Stack<String>();
- } else if (TEST_SUITE_TAG.equals(localName)) {
- String packageSegment = attributes.getValue("name");
- if (packageSegment != null) {
- mClassNameStack.push(packageSegment);
- } else {
- Log.e(LOG_TAG, String.format("Invalid XML: missing 'name' attribute for '%s'",
- TEST_SUITE_TAG));
- }
- } else if (TEST_CASE_TAG.equals(localName)) {
- String classSegment = attributes.getValue("name");
- if (classSegment != null) {
- mClassNameStack.push(classSegment);
- } else {
- Log.e(LOG_TAG, String.format("Invalid XML: missing 'name' attribute for '%s'",
- TEST_CASE_TAG));
- }
- } else if (TEST_TAG.equals(localName)) {
- String methodName = attributes.getValue("name");
- if (mPackageDefs.isEmpty()) {
- Log.e(LOG_TAG, String.format(
- "Invalid XML: encountered a '%s' tag not enclosed within a '%s' tag",
- TEST_TAG, TEST_PACKAGE_TAG));
- } else if (methodName == null) {
- Log.e(LOG_TAG, String.format("Invalid XML: missing 'name' attribute for '%s'",
- TEST_TAG));
- } else {
- // build class name from package segments
- StringBuilder classNameBuilder = new StringBuilder();
- for (Iterator<String> iter = mClassNameStack.iterator(); iter.hasNext(); ) {
- classNameBuilder.append(iter.next());
- if (iter.hasNext()) {
- classNameBuilder.append(".");
- }
- }
- mTestId = new TestIdentifier(classNameBuilder.toString(), methodName);
- int timeout = -1;
- String timeoutStr = attributes.getValue("timeout");
- if (timeoutStr != null) {
- timeout = Integer.parseInt(timeoutStr);
- }
- boolean isKnownFailure = "failure".equals(attributes.getValue("expectation"));
- if (!isKnownFailure || mIncludeKnownFailures) {
- String abiList = attributes.getValue("abis");
- Set<String> abis = new HashSet<String>();
- if (abiList == null) {
- // If no specification, add all supported abis
- abis.addAll(AbiUtils.getAbisSupportedByCompatibility());
- } else {
- for (String abi : abiList.split(",")) {
- // Else only add the abi which are supported
- abis.add(abi.trim());
- }
- }
- for (String abi : abis) {
- mPackageDefs.get(abi).addTest(mTestId, timeout);
- }
- }
- }
- } else if (TEST_INSTANCE_TAG.equals(localName)) {
- if (mTestId != null) {
- final Map<String, String> instanceArguments = genAttributeMap(attributes);
- for (TestPackageDef packageDef : mPackageDefs.values()) {
- if (packageDef.getTests().contains(mTestId)) {
- packageDef.addTestInstance(mTestId, instanceArguments);
- }
- }
- } else {
- Log.e(LOG_TAG, String.format(
- "Invalid XML: encountered a '%s' tag not enclosed within a '%s' tag",
- TEST_INSTANCE_TAG, TEST_TAG));
- }
- }
- }
-
- private String getTestType(Attributes attributes) {
- if (parseBoolean(attributes.getValue("hostSideOnly"))) {
- return TestPackageDef.HOST_SIDE_ONLY_TEST;
- } else if (parseBoolean(attributes.getValue("vmHostTest"))) {
- return TestPackageDef.VM_HOST_TEST;
- } else {
- return attributes.getValue("testType");
- }
- }
-
- @Override
- public void endElement (String uri, String localName, String qName) {
- if (TEST_SUITE_TAG.equals(localName) || TEST_CASE_TAG.equals(localName)) {
- mClassNameStack.pop();
- } else if (TEST_TAG.equals(localName)) {
- mTestId = null;
- }
- }
-
- /**
- * Parse a boolean attribute value
- */
- private boolean parseBoolean(final String stringValue) {
- return stringValue != null &&
- Boolean.parseBoolean(stringValue);
- }
-
- private Map<String, String> genAttributeMap(Attributes attributes) {
- final Map<String, String> attribMap = new HashMap<String, String>();
- for (int i = 0; i < attributes.getLength(); ++i) {
- final String localName = attributes.getLocalName(i);
- final String namespace = attributes.getURI(i);
- final String fullyQualifiedName =
- (namespace.isEmpty()) ? (localName) : (namespace + ":" + localName);
-
- attribMap.put(fullyQualifiedName, attributes.getValue(i));
- }
- return attribMap;
- }
- }
-
- @Override
- protected DefaultHandler createXmlHandler() {
- return new TestPackageHandler();
- }
-
- /**
- * @return the set of {@link TestPackageDef} containing data parsed from xml
- */
- public Set<TestPackageDef> getTestPackageDefs() {
- return new HashSet<>(mPackageDefs.values());
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPlan.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPlan.java
deleted file mode 100644
index 6b02db9..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPlan.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.util.ArrayUtil;
-import com.android.tradefed.util.xml.AbstractXmlParser;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * Implementation of {@link TestPlan}.
- */
-public class TestPlan extends AbstractXmlParser implements ITestPlan {
-
- /**
- * Map of ids found in plan, and their filters
- */
- private Map<String, TestFilter> mIdFilterMap;
-
- private static final String ENTRY_TAG = "Entry";
- private static final String TEST_DELIM = ";";
- private static final String METHOD_DELIM = "#";
- private static final String EXCLUDE_ATTR = "exclude";
- private static final String INCLUDE_ATTR = "include";
- private static final String ABI_ATTR = "abi";
- private static final String NAME_ATTR = "name";
-
- private final String mName;
- private final Set<String> mAbis;
-
- /**
- * SAX callback object. Handles parsing data from the xml tags.
- */
- private class EntryHandler extends DefaultHandler {
-
- @Override
- public void startElement(String uri, String localName, String name, Attributes attributes)
- throws SAXException {
- if (ENTRY_TAG.equals(localName)) {
- TestFilter filter = parseTestList(
- attributes.getValue(EXCLUDE_ATTR), attributes.getValue(INCLUDE_ATTR));
- final String entryNameValue = attributes.getValue(NAME_ATTR);
- final String entryAbiValue = attributes.getValue(ABI_ATTR);
- if (entryAbiValue != null) {
- mIdFilterMap.put(AbiUtils.createId(entryAbiValue, entryNameValue), filter);
- } else {
- for (String abi : mAbis) {
- mIdFilterMap.put(AbiUtils.createId(abi, entryNameValue), filter);
- }
- }
- }
- }
-
- /**
- * Parse a semicolon separated list of tests.
- * <p/>
- * Expected format:
- * testClassName[#testMethodName][;testClassName2...]
- *
- * @param excludedString the excluded string list
- * @param includedString the included string list
- * @return
- */
- private TestFilter parseTestList(String excludedString, String includedString) {
- TestFilter filter = new TestFilter();
- if (excludedString != null) {
- String[] testStrings = excludedString.split(TEST_DELIM);
- for (String testString : testStrings) {
- String[] classMethodPair = testString.split(METHOD_DELIM);
- if (classMethodPair.length == 2) {
- filter.addExcludedTest(new TestIdentifier(classMethodPair[0],
- classMethodPair[1]));
- } else {
- filter.addExcludedClass(testString);
- }
- }
- }
- if (includedString != null) {
- String[] testStrings = includedString.split(TEST_DELIM);
- for (String testString : testStrings) {
- String[] classMethodPair = testString.split(METHOD_DELIM);
- if (classMethodPair.length == 2) {
- filter.addIncludedTest(new TestIdentifier(classMethodPair[0],
- classMethodPair[1]));
- } else {
- filter.addIncludedClass(testString);
- }
- }
- }
-
- return filter;
- }
- }
-
- public TestPlan(String name, Set<String> abis) {
- mName = name;
- mAbis = abis;
- // Uses a LinkedHashMap to have predictable iteration order
- mIdFilterMap = new LinkedHashMap<String, TestFilter>();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return mName;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<String> getTestIds() {
- List<String> ids = new ArrayList<String>(mIdFilterMap.keySet());
- Collections.sort(ids);
- return ids;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<String> getTestNames() {
- TreeSet<String> testNameSet = new TreeSet<>();
- for (String id : mIdFilterMap.keySet()) {
- testNameSet.add(AbiUtils.parseTestName(id));
- }
- return new ArrayList<>(testNameSet);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public TestFilter getTestFilter(String id) {
- return mIdFilterMap.get(id);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addPackage(String id) {
- mIdFilterMap.put(id, new TestFilter());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected DefaultHandler createXmlHandler() {
- return new EntryHandler();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addExcludedTest(String id, TestIdentifier testToExclude) {
- TestFilter filter = mIdFilterMap.get(id);
- if (filter != null) {
- filter.addExcludedTest(testToExclude);
- } else {
- throw new IllegalArgumentException(String.format("Could not find package %s", id));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addExcludedTests(String id, Collection<TestIdentifier> excludedTests) {
- TestFilter filter = mIdFilterMap.get(id);
- if (filter != null) {
- filter.getExcludedTests().addAll(excludedTests);
- } else {
- throw new IllegalArgumentException(String.format("Could not find package %s", id));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void serialize(OutputStream stream) throws IOException {
- KXmlSerializer serializer = new KXmlSerializer();
- serializer.setOutput(stream, "UTF-8");
- serializer.startDocument("UTF-8", false);
- serializer.setFeature(
- "http://xmlpull.org/v1/doc/features.html#indent-output", true);
- serializer.startTag(null, "TestPlan");
- serializer.attribute(null, "version", "1.0");
- for (Map.Entry<String, TestFilter> packageEntry : mIdFilterMap.entrySet()) {
- serializer.startTag(null, ENTRY_TAG);
- String[] parts = AbiUtils.parseId(packageEntry.getKey());
- serializer.attribute(null, ABI_ATTR, parts[0]);
- serializer.attribute(null, NAME_ATTR, parts[1]);
- serializeFilter(serializer, packageEntry.getValue());
- serializer.endTag(null, ENTRY_TAG);
- }
- serializer.endTag(null, "TestPlan");
- serializer.endDocument();
- }
-
- /**
- * Adds an xml attribute containing {@link TestFilter} contents.
- * <p/>
- * If {@link TestFilter} is empty, no data will be output.
- *
- * @param serializer
- * @param testFilter
- * @throws IOException
- */
- private void serializeFilter(KXmlSerializer serializer, TestFilter testFilter)
- throws IOException {
- if (testFilter.hasExclusion()) {
- List<String> exclusionStrings = new ArrayList<String>();
- exclusionStrings.addAll(testFilter.getExcludedClasses());
- for (TestIdentifier test : testFilter.getExcludedTests()) {
- // TODO: this relies on TestIdentifier.toString() using METHOD_DELIM.
- exclusionStrings.add(test.toString());
- }
- String exclusionAttrValue = ArrayUtil.join(TEST_DELIM, exclusionStrings);
- serializer.attribute(null, EXCLUDE_ATTR, exclusionAttrValue);
- }
-
- if (testFilter.hasInclusion()) {
- List<String> inclusionStrings = new ArrayList<String>();
- inclusionStrings.addAll(testFilter.getIncludedClasses());
- for (TestIdentifier test : testFilter.getIncludedTests()) {
- // TODO: this relies on TestIdentifier.toString() using METHOD_DELIM.
- inclusionStrings.add(test.toString());
- }
- String exclusionAttrValue = ArrayUtil.join(TEST_DELIM, inclusionStrings);
- serializer.attribute(null, INCLUDE_ATTR, exclusionAttrValue);
- }
-
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java
deleted file mode 100644
index 0ebdeea..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.testtype;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.util.FileUtil;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.zip.ZipFile;
-
-/**
- * A wrapper around {@link JarHostTest} that includes additional device setup and clean up.
- *
- */
-public class VMHostTest extends JarHostTest {
-
- private static final String VM_TEST_TEMP_DIR = "/data/local/tmp/vm-tests";
- private static final String EMULATOR_TEMP_DIR = "/data/local/tmp";
-
- /**
- * {@inheritDoc}
- */
- @Override
- @SuppressWarnings("unchecked")
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
- if (!installVmPrereqs(getDevice(), getBuildHelper())) {
- throw new RuntimeException(String.format(
- "Failed to install vm-tests prereqs on device %s",
- getDevice().getSerialNumber()));
- }
- super.run(listener);
- cleanupDeviceFiles(getDevice());
- }
-
- /**
- * Install pre-requisite jars for running vm-tests, creates temp directories for test.
- *
- * @param device the {@link ITestDevice}
- * @param ctsBuild the {@link CtsBuildHelper}
- * @throws DeviceNotAvailableException
- * @return true if test jar files are extracted and pushed to device successfully
- */
- private boolean installVmPrereqs(ITestDevice device, CtsBuildHelper ctsBuild)
- throws DeviceNotAvailableException {
- cleanupDeviceFiles(device);
- // Creates temp directory recursively. We also need to create the dalvik-cache directory
- // which is used by the dalvikvm to optimize things. Without the dalvik-cache, there will be
- // a sigsev thrown by the vm.
- CLog.d("Creating device temp directory, including dalvik-cache.");
- createRemoteDir(device, VM_TEST_TEMP_DIR + "/dalvik-cache" );
- try {
- File localTmpDir = FileUtil.createTempDir("cts-vm", new File(System.getProperty("java.io.tmpdir")));
- CLog.d("Creating host temp dir %s", localTmpDir.getPath());
- File jarFile = new File(ctsBuild.getTestCasesDir(), getJarFileName());
- if (!jarFile.exists()) {
- CLog.e("Missing jar file %s", jarFile.getPath());
- return false;
- }
- CLog.d("Extracting jar file %s to host temp directory %s.",
- jarFile.getPath(), localTmpDir.getPath());
- ZipFile zipFile = new ZipFile(jarFile);
- FileUtil.extractZip(zipFile, localTmpDir);
- File localTestTmpDir = new File(localTmpDir, "tests");
- CLog.d("Syncing host dir %s to device dir %s",
- localTestTmpDir.getPath(), VM_TEST_TEMP_DIR);
- if (!device.pushDir(localTestTmpDir, VM_TEST_TEMP_DIR)) {
- CLog.e("Failed to push vm test files");
- return false;
- }
- CLog.d("Cleaning up host temp dir %s", localTmpDir.getPath());
- FileUtil.recursiveDelete(localTmpDir);
- } catch (IOException e) {
- CLog.e("Failed to extract jar file %s and sync it to device %s.",
- getJarFileName(), device.getSerialNumber());
- return false;
- }
- return true;
- }
-
- /**
- * Removes temporary file directory from device
- *
- * @param device
- * @throws DeviceNotAvailableException
- */
- private void cleanupDeviceFiles(ITestDevice device) throws DeviceNotAvailableException {
- if (device.doesFileExist(VM_TEST_TEMP_DIR)) {
- CLog.d("Removing device's temp dir %s from previous runs.", VM_TEST_TEMP_DIR);
- device.executeShellCommand(String.format("rm -r %s", VM_TEST_TEMP_DIR));
- }
- }
-
- /**
- * Creates the file directory recursively in the device.
- *
- * @param device the {@link ITestDevice}
- * @param remoteFilePath the absolute path.
- * @throws DeviceNotAvailableException
- */
- private void createRemoteDir(ITestDevice device, String remoteFilePath)
- throws DeviceNotAvailableException {
- if (device.doesFileExist(remoteFilePath)) {
- return;
- }
- if (!(device.doesFileExist(EMULATOR_TEMP_DIR))) {
- CLog.e("Error: Can not found the /data/local/tmp directory!!!");
- }
- device.executeShellCommand(String.format("mkdir %s", VM_TEST_TEMP_DIR));
- device.executeShellCommand(String.format("mkdir %s", remoteFilePath));
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/WrappedGTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/WrappedGTest.java
deleted file mode 100644
index 4f40c89..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/WrappedGTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2012 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.ddmlib.testrunner.ITestRunListener;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-
-/**
- * Test runner for wrapped (native) GTests
- */
-public class WrappedGTest implements IBuildReceiver, IDeviceTest, IRemoteTest {
-
- private static final String LOG_TAG = WrappedGTest.class.getSimpleName();
-
- private int mMaxTestTimeMs = 1 * 60 * 1000;
-
- private CtsBuildHelper mCtsBuild;
- private ITestDevice mDevice;
- private IAbi mAbi;
-
- private final String mAppNameSpace;
- private final String mPackageName;
- private final String mName;
- private final String mRunner;
-
- public WrappedGTest(String appNameSpace, String packageName, String name, String runner) {
- mAppNameSpace = appNameSpace;
- mPackageName = packageName;
- mName = name;
- mRunner = runner;
- }
-
- /**
- * @param abi The ABI to run the test on
- */
- public void setAbi(IAbi abi) {
- mAbi = abi;
- }
-
- @Override
- public void setBuild(IBuildInfo buildInfo) {
- mCtsBuild = CtsBuildHelper.createBuildHelper(buildInfo);
- }
-
- @Override
- public void setDevice(ITestDevice device) {
- mDevice = device;
- }
-
- @Override
- public ITestDevice getDevice() {
- return mDevice;
- }
-
- @Override
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
- if (installTest()) {
- runTest(listener);
- uninstallTest();
- } else {
- CLog.e("Failed to install test");
- }
- }
-
- private boolean installTest() throws DeviceNotAvailableException {
- try {
- File testApp = mCtsBuild.getTestApp(String.format("%s.apk", mName));
- String[] options = {AbiUtils.createAbiFlag(mAbi.getName())};
- String installCode = mDevice.installPackage(testApp, true, options);
-
- if (installCode != null) {
- CLog.e("Failed to install %s.apk on %s. Reason: %s", mName,
- mDevice.getSerialNumber(), installCode);
- return false;
- }
- }
- catch (FileNotFoundException e) {
- CLog.e("Package %s.apk not found", mName);
- return false;
- }
- return true;
- }
-
- private void runTest(ITestRunListener listener) throws DeviceNotAvailableException {
- String id = AbiUtils.createId(mAbi.getName(), mPackageName);
- WrappedGTestResultParser resultParser = new WrappedGTestResultParser(id, listener);
- resultParser.setFakePackagePrefix(mPackageName + ".");
- try {
- String options = mAbi == null ? "" : String.format("--abi %s ", mAbi.getName());
- String command = String.format("am instrument -w %s%s/.%s", options, mAppNameSpace, mRunner);
- mDevice.executeShellCommand(command, resultParser, mMaxTestTimeMs, 0);
- } catch (DeviceNotAvailableException e) {
- resultParser.flush();
- throw e;
- } catch (RuntimeException e) {
- resultParser.flush();
- throw e;
- }
- }
-
- private void uninstallTest() throws DeviceNotAvailableException {
- mDevice.uninstallPackage(mAppNameSpace);
- }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/WrappedGTestResultParser.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/WrappedGTestResultParser.java
deleted file mode 100644
index 3050738..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/WrappedGTestResultParser.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2012 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 com.android.cts.tradefed.testtype;
-
-import com.android.ddmlib.testrunner.ITestRunListener;
-import com.android.tradefed.log.LogUtil.CLog;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.ArrayList;
-
-public class WrappedGTestResultParser extends GeeTestResultParser {
-
- private boolean mInstrumentationError;
-
- /**
- * Creates the WrappedGTestResultParser.
- *
- * @param testRunId the test run id to provide to
- * {@link ITestRunListener#testRunStarted(String, int)}
- * @param listeners informed of test results as the tests are executing
- */
- public WrappedGTestResultParser(String testRunId, Collection<ITestRunListener> listeners) {
- super(testRunId, listeners);
- }
-
- /**
- * Creates the WrappedGTestResultParser for a single listener.
- *
- * @param testRunId the test run id to provide to
- * {@link ITestRunListener#testRunStarted(String, int)}
- * @param listener informed of test results as the tests are executing
- */
- public WrappedGTestResultParser(String testRunId, ITestRunListener listener) {
- super(testRunId, listener);
- }
-
- /**
- * Strips the instrumentation information and then forwards
- * the raw gtest output to the {@link GeeTestResultParser}.
- */
- @Override
- public void processNewLines(String[] lines) {
- if (mInstrumentationError) {
- return;
- }
-
- String[] gtestOutput = parseInstrumentation(lines);
- super.processNewLines(gtestOutput);
- }
-
- /**
- * Parses raw instrumentation output and returns the
- * contained gtest output
- *
- * @param lines the raw instrumentation output
- * @return the gtest output
- */
- public String[] parseInstrumentation(String[] lines) {
- List<String> output = new ArrayList<String>();
- boolean readMultiLine = false;
- for (String line : lines) {
-
- if (line.startsWith("INSTRUMENTATION_RESULT: ")) {
- CLog.e("Instrumentation Error:");
- mInstrumentationError = true;
- }
-
- if (mInstrumentationError) {
- CLog.e(line);
- continue;
- }
-
- if (line.startsWith("INSTRUMENTATION_STATUS: gtest=")) {
- output.add(line.replace("INSTRUMENTATION_STATUS: gtest=", ""));
- readMultiLine = true;
- continue;
- }
-
- if (line.startsWith("INSTRUMENTATION_")) {
- readMultiLine = false;
- continue;
- }
-
- if (readMultiLine) {
- output.add(line);
- }
- }
-
- return output.toArray(new String[output.size()]);
- }
-}
-
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/util/ReportLogUtil.java b/tools/tradefed-host/src/com/android/cts/tradefed/util/ReportLogUtil.java
deleted file mode 100644
index 9233a4a..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/util/ReportLogUtil.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2016 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 com.android.cts.tradefed.util;
-
-import com.android.cts.tradefed.result.CtsXmlResultReporter;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.util.FileUtil;
-
-import java.io.File;
-
-/**
- * Collects report logs from device and host after cts_v1 test runs.
- */
-public class ReportLogUtil{
-
- /**
- * Directory values must match the src-dir, dest-dir and temp-dir values configured in
- * ReportLogCollector target preparer in
- * cts/tools/cts-tradefed/res/config/cts-preconditions.xml.
- */
- private static final String SRC_DIR = "/sdcard/report-log-files/";
- private static final String DEST_DIR = "report-log-files/";
- private static final String TEMP_REPORT_DIR= "temp-report-logs/";
-
- public static void prepareReportLogContainers(ITestDevice device, IBuildInfo buildInfo) {
- try {
- // Delete earlier report logs if present on device.
- String command = String.format("adb -s %s shell rm -rf %s", device.getSerialNumber(),
- SRC_DIR);
- if (device.doesFileExist(SRC_DIR)) {
- Process process = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c",
- command});
- if (process.waitFor() != 0) {
- CLog.e("Failed to run %s", command);
- }
- }
- // Create folder in result directory to store report logs.
- File resultDir = new File(buildInfo.getBuildAttributes().get(
- CtsXmlResultReporter.CTS_RESULT_DIR));
- if (DEST_DIR != null) {
- resultDir = new File(resultDir, DEST_DIR);
- }
- resultDir.mkdirs();
- if (!resultDir.isDirectory()) {
- CLog.e("%s is not a directory", resultDir.getAbsolutePath());
- return;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static void collectReportLogs(ITestDevice device, IBuildInfo buildInfo) {
- // Pull report log files from device and host.
- try {
- File resultDir = new File(buildInfo.getBuildAttributes().get(
- CtsXmlResultReporter.CTS_RESULT_DIR));
- if (DEST_DIR != null) {
- resultDir = new File(resultDir, DEST_DIR);
- }
- resultDir.mkdirs();
- if (!resultDir.isDirectory()) {
- CLog.e("%s is not a directory", resultDir.getAbsolutePath());
- return;
- }
- final File hostReportDir = FileUtil.createNamedTempDir(TEMP_REPORT_DIR);
- if (!hostReportDir.isDirectory()) {
- CLog.e("%s is not a directory", hostReportDir.getAbsolutePath());
- return;
- }
- pull(device, SRC_DIR, hostReportDir, resultDir);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private static void pull(ITestDevice device, String deviceSrc, File hostDir, File destDir) {
- String hostSrc = hostDir.getAbsolutePath();
- String dest = destDir.getAbsolutePath();
- String deviceSideCommand = String.format("adb -s %s pull %s %s", device.getSerialNumber(),
- deviceSrc, dest);
- CLog.e(deviceSideCommand);
- try {
- if (device.doesFileExist(deviceSrc)) {
- Process deviceProcess = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c",
- deviceSideCommand});
- if (deviceProcess.waitFor() != 0) {
- CLog.e("Failed to run %s", deviceSideCommand);
- }
- }
- FileUtil.recursiveCopy(hostDir, destDir);
- FileUtil.recursiveDelete(hostDir);
- } catch (Exception e) {
- CLog.e("Caught exception during pull.");
- CLog.e(e);
- }
- }
-}
diff --git a/tools/tradefed-host/tests/.classpath b/tools/tradefed-host/tests/.classpath
deleted file mode 100644
index 10ad23c..0000000
--- a/tools/tradefed-host/tests/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
- <classpathentry combineaccessrules="false" kind="src" path="/ddmlib"/>
- <classpathentry combineaccessrules="false" kind="src" path="/tradefederation"/>
- <classpathentry combineaccessrules="false" kind="src" path="/cts-tradefed-host"/>
- <classpathentry kind="var" path="CTS_SRC_ROOT/out/host/common/obj/JAVA_LIBRARIES/easymock_intermediates/javalib.jar" sourcepath="/CTS_SRC_ROOT/external/easymock/src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tools/tradefed-host/tests/.project b/tools/tradefed-host/tests/.project
deleted file mode 100644
index 1c385d8..0000000
--- a/tools/tradefed-host/tests/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>cts-tradefed-host-tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/tools/tradefed-host/tests/run_unit_func_tests.sh b/tools/tradefed-host/tests/run_unit_func_tests.sh
deleted file mode 100755
index 8c08c4e..0000000
--- a/tools/tradefed-host/tests/run_unit_func_tests.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2015 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.
-
-# helper script for running the cts-tradefed unit tests
-
-checkFile() {
- if [ ! -f "$1" ]; then
- echo "Unable to locate $1"
- exit
- fi;
-}
-
-# check if in Android build env
-if [ ! -z ${ANDROID_BUILD_TOP} ]; then
- HOST=`uname`
- if [ "$HOST" == "Linux" ]; then
- OS="linux-x86"
- elif [ "$HOST" == "Darwin" ]; then
- OS="darwin-x86"
- else
- echo "Unrecognized OS"
- exit
- fi;
-fi;
-
-JAR_DIR=${ANDROID_BUILD_TOP}/out/host/$OS/framework
-JARS="tradefed-prebuilt.jar hosttestlib.jar old-cts-tradefed.jar old-cts-tradefed-tests.jar"
-
-for JAR in $JARS; do
- checkFile ${JAR_DIR}/${JAR}
- JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
-done
-
-java $RDBG_FLAG \
- -cp ${JAR_PATH} com.android.tradefed.command.Console run singleCommand host --class com.android.cts.tradefed.FuncTests "$@"
diff --git a/tools/tradefed-host/tests/run_unit_tests.sh b/tools/tradefed-host/tests/run_unit_tests.sh
deleted file mode 100755
index a1bb12c..0000000
--- a/tools/tradefed-host/tests/run_unit_tests.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2012 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.
-
-# helper script for running the cts-tradefed unit tests
-
-checkFile() {
- if [ ! -f "$1" ]; then
- echo "Unable to locate $1"
- exit
- fi;
-}
-
-# check if in Android build env
-if [ ! -z ${ANDROID_BUILD_TOP} ]; then
- HOST=`uname`
- if [ "$HOST" == "Linux" ]; then
- OS="linux-x86"
- elif [ "$HOST" == "Darwin" ]; then
- OS="darwin-x86"
- else
- echo "Unrecognized OS"
- exit
- fi;
-fi;
-
-JAR_DIR=${ANDROID_BUILD_TOP}/out/host/$OS/framework
-JARS="tradefed-prebuilt.jar hosttestlib.jar old-cts-tradefed.jar old-cts-tradefed-tests.jar"
-
-for JAR in $JARS; do
- checkFile ${JAR_DIR}/${JAR}
- JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
-done
-
-java $RDBG_FLAG \
- -cp ${JAR_PATH} com.android.tradefed.command.Console run singleCommand host -n --class com.android.cts.tradefed.UnitTests "$@"
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/FuncTests.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/FuncTests.java
deleted file mode 100644
index a9420d2..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/FuncTests.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2015 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 com.android.cts.tradefed;
-
-import com.android.cts.tradefed.device.DeviceInfoCollectorFuncTest;
-import com.android.tradefed.testtype.DeviceTestSuite;
-
-import junit.framework.Test;
-
-/**
- * A test suite for all cts-tradefed functional tests.
- * <p/>
- * Tests listed here should require a device.
- */
-public class FuncTests extends DeviceTestSuite {
-
- public FuncTests() {
- super();
-
- // device package
- addTestSuite(DeviceInfoCollectorFuncTest.class);
- }
-
- public static Test suite() {
- return new FuncTests();
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/UnitTests.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/UnitTests.java
deleted file mode 100644
index 29c1324..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/UnitTests.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed;
-
-import com.android.cts.tradefed.result.CtsXmlResultReporterTest;
-import com.android.cts.tradefed.result.DeviceInfoResultTest;
-import com.android.cts.tradefed.result.TestPackageResultTest;
-import com.android.cts.tradefed.result.TestResultsTest;
-import com.android.cts.tradefed.result.TestSummaryXmlTest;
-import com.android.cts.tradefed.result.TestTest;
-import com.android.cts.tradefed.result.TestLogTest;
-import com.android.cts.tradefed.testtype.Abi;
-import com.android.cts.tradefed.testtype.CtsTestTest;
-import com.android.cts.tradefed.testtype.DeqpTestRunnerTest;
-import com.android.cts.tradefed.testtype.GeeTestTest;
-import com.android.cts.tradefed.testtype.JarHostTestTest;
-import com.android.cts.tradefed.testtype.TestFilterTest;
-import com.android.cts.tradefed.testtype.TestPackageDefTest;
-import com.android.cts.tradefed.testtype.TestPackageXmlParserTest;
-import com.android.cts.tradefed.testtype.TestPlanTest;
-import com.android.cts.tradefed.testtype.WrappedGTestResultParserTest;
-import com.android.tradefed.testtype.IAbi;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * A test suite for all cts-tradefed unit tests.
- * <p/>
- * All tests listed here should be self-contained, and do not require any external dependencies
- * (such as a full CTS build with XML etc).
- */
-public class UnitTests extends TestSuite {
-
- public static final IAbi ABI = new Abi("armeabi-v7a", "32");
-
- public UnitTests() {
- super();
-
- // result package
- addTestSuite(CtsXmlResultReporterTest.class);
- addTestSuite(DeviceInfoResultTest.class);
- addTestSuite(TestPackageResultTest.class);
- addTestSuite(TestResultsTest.class);
- addTestSuite(TestSummaryXmlTest.class);
- addTestSuite(TestTest.class);
- addTestSuite(TestLogTest.class);
-
- // testtype package
- addTestSuite(CtsTestTest.class);
- addTestSuite(DeqpTestRunnerTest.class);
- addTestSuite(GeeTestTest.class);
- addTestSuite(JarHostTestTest.class);
- addTestSuite(TestFilterTest.class);
- addTestSuite(TestPackageDefTest.class);
- addTestSuite(TestPackageXmlParserTest.class);
- addTestSuite(TestPlanTest.class);
- addTestSuite(WrappedGTestResultParserTest.class);
- }
-
- public static Test suite() {
- return new UnitTests();
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/build/StubCtsBuildHelper.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/build/StubCtsBuildHelper.java
deleted file mode 100644
index 0fe2f7a..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/build/StubCtsBuildHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.build;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-
-/**
- * Stub implementation of CtsBuildHelper that returns empty files for all methods
- */
-public class StubCtsBuildHelper extends CtsBuildHelper {
-
- public StubCtsBuildHelper() {
- super(new File("tmp"));
- }
-
- @Override
- public void validateStructure() {
- // ignore
- }
-
- @Override
- public File getTestApp(String appFileName) throws FileNotFoundException {
- return new File("tmp");
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/device/DeviceInfoCollectorFuncTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/device/DeviceInfoCollectorFuncTest.java
deleted file mode 100644
index 60e30cc..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/device/DeviceInfoCollectorFuncTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.device;
-
-import com.android.ddmlib.Log.LogLevel;
-import com.android.cts.tradefed.UnitTests;
-import com.android.cts.tradefed.result.CtsXmlResultReporter;
-import com.android.tradefed.build.BuildInfo;
-import com.android.tradefed.build.IFolderBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.CollectingTestListener;
-import com.android.tradefed.testtype.DeviceTestCase;
-import com.android.tradefed.util.FileUtil;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.easymock.EasyMock;
-
-/**
- * Functional test for {@link DeviceInfoCollector}.
- * <p/>
- * TODO: this test assumes the TestDeviceSetup and DeviceInfoCollector apks are located in the
- * "java.io.tmpdir"
- */
-public class DeviceInfoCollectorFuncTest extends DeviceTestCase {
-
- private CollectingTestListener testListener;
- private File mResultDir;
- private IFolderBuildInfo mMockBuildInfo;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- testListener = new CollectingTestListener();
- mResultDir = FileUtil.createTempDir("cts-result-dir");
- mMockBuildInfo = EasyMock.createMock(IFolderBuildInfo.class);
- Map<String, String> attributes = new HashMap<>();
- attributes.put(CtsXmlResultReporter.CTS_RESULT_DIR, mResultDir.getAbsolutePath());
- EasyMock.expect(mMockBuildInfo.getBuildAttributes()).andStubReturn(attributes);
- EasyMock.replay(mMockBuildInfo);
-
- assertNotNull(getDevice().getSerialNumber());
- }
-
- public void testCollectDeviceInfo() throws DeviceNotAvailableException {
- testListener.invocationStarted(mMockBuildInfo);
- DeviceInfoCollector.collectDeviceInfo(getDevice(), UnitTests.ABI.getName(), new File(
- System.getProperty("java.io.tmpdir")), testListener);
- assertNotNull(testListener.getCurrentRunResults());
-
- Map<String, String> runMetrics = testListener.getCurrentRunResults().getRunMetrics();
- assertTrue(runMetrics.size() > 0);
- displayMetrics(runMetrics);
- testListener.invocationEnded(0);
- }
-
- public void testExtendedDeviceInfo() throws DeviceNotAvailableException {
- testListener.invocationStarted(mMockBuildInfo);
- DeviceInfoCollector.collectExtendedDeviceInfo(getDevice(), UnitTests.ABI.getName(),
- new File(System.getProperty("java.io.tmpdir")), testListener, mMockBuildInfo);
- assertNotNull(testListener.getCurrentRunResults());
-
- Map<String, String> runMetrics = testListener.getCurrentRunResults().getRunMetrics();
- assertTrue(runMetrics.size() > 0);
- displayMetrics(runMetrics);
- testListener.invocationEnded(0);
- }
-
- private void displayMetrics(Map<String, String> runMetrics) {
- for (Map.Entry<String, String> metricEntry : runMetrics.entrySet()) {
- CLog.logAndDisplay(LogLevel.INFO,
- String.format("%s=%s", metricEntry.getKey(), metricEntry.getValue()));
- }
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/CtsXmlResultReporterTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/CtsXmlResultReporterTest.java
deleted file mode 100644
index 361b91c..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/CtsXmlResultReporterTest.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.result;
-
-import static com.android.cts.tradefed.result.CtsXmlResultReporter.CTS_RESULT_FILE_VERSION;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.UnitTests;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.build.IFolderBuildInfo;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.LogFile;
-import com.android.tradefed.result.TestSummary;
-import com.android.tradefed.result.XmlResultReporter;
-import com.android.tradefed.util.FileUtil;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Unit tests for {@link XmlResultReporter}.
- */
-public class CtsXmlResultReporterTest extends TestCase {
-
- private static final String TEST_SUMMARY_URL = "http://www.google.com?q=android";
- private static final List<TestSummary> SUMMARY_LIST =
- new ArrayList<>(Arrays.asList(new TestSummary(TEST_SUMMARY_URL)));
- private CtsXmlResultReporter mResultReporter;
- private ByteArrayOutputStream mOutputStream;
- private File mBuildDir;
- private File mReportDir;
- private IFolderBuildInfo mMockBuild;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- mOutputStream = new ByteArrayOutputStream();
- mResultReporter = new CtsXmlResultReporter() {
- @Override
- OutputStream createOutputResultStream(File reportDir) throws IOException {
- return mOutputStream;
- }
-
- @Override
- String getTimestamp() {
- return "ignore";
- }
- };
- // TODO: use mock file dir instead
- mReportDir = FileUtil.createTempDir("foo");
- mResultReporter.setReportDir(mReportDir);
- mBuildDir = FileUtil.createTempDir("build");
- File ctsDir = new File(mBuildDir, "android-cts");
- File repoDir = new File(ctsDir, "repository");
- File casesDir = new File(repoDir, "testcases");
- File plansDir = new File(repoDir, "plans");
- assertTrue(casesDir.mkdirs());
- assertTrue(plansDir.mkdirs());
- mMockBuild = EasyMock.createMock(IFolderBuildInfo.class);
- EasyMock.expect(mMockBuild.getDeviceSerial()).andStubReturn(null);
- EasyMock.expect(mMockBuild.getRootDir()).andStubReturn(mBuildDir);
- mMockBuild.addBuildAttribute(EasyMock.cmpEq(CtsXmlResultReporter.CTS_RESULT_DIR),
- (String) EasyMock.anyObject());
- EasyMock.expectLastCall();
- Map<String, String> attributes = new HashMap<>();
- attributes.put(CtsXmlResultReporter.CTS_RESULT_DIR, "");
- EasyMock.expect(mMockBuild.getBuildAttributes()).andStubReturn(attributes);
- EasyMock.expect(mMockBuild.getBuildId()).andStubReturn("");
- }
-
- @Override
- protected void tearDown() throws Exception {
- if (mReportDir != null) {
- FileUtil.recursiveDelete(mReportDir);
- }
- if (mBuildDir != null) {
- FileUtil.recursiveDelete(mBuildDir);
- }
- super.tearDown();
- }
-
- /**
- * A simple test to ensure expected output is generated for test run with no tests.
- */
- public void testEmptyGeneration() {
- final String expectedHeaderOutput = "<?xml version='1.0' encoding='UTF-8' standalone='no' ?>" +
- "<?xml-stylesheet type=\"text/xsl\" href=\"cts_result.xsl\"?>";
- final String expectedTestOutput = String.format(
- "<TestResult testPlan=\"NA\" starttime=\"ignore\" endtime=\"ignore\" " +
- "version=\"%s\" suite=\"%s\"> ", CTS_RESULT_FILE_VERSION, "CTS");
- final String expectedSummaryOutput =
- "<Summary failed=\"0\" notExecuted=\"0\" timeout=\"0\" pass=\"0\" />";
- final String expectedEndTag = "</TestResult>";
- EasyMock.replay(mMockBuild);
- mResultReporter.invocationStarted(mMockBuild);
- mResultReporter.invocationEnded(1);
- String actualOutput = getOutput();
- assertTrue(actualOutput.startsWith(expectedHeaderOutput));
- assertTrue(String.format("test output did not contain expected test result [%s]. Got %s",
- expectedTestOutput, actualOutput), actualOutput.contains(expectedTestOutput));
- assertTrue(String.format("test output did not contain expected test summary [%s]. Got %s",
- expectedSummaryOutput, actualOutput), actualOutput.contains(expectedSummaryOutput));
- assertTrue(String.format("test output did not contain expected TestResult end tag. Got %s",
- actualOutput), actualOutput.endsWith(expectedEndTag));
- EasyMock.verify(mMockBuild);
- }
-
- /**
- * A simple test to ensure expected output is generated for test run with a single passed test.
- */
- public void testSinglePass() {
- Map<String, String> emptyMap = Collections.emptyMap();
- final TestIdentifier testId = new TestIdentifier("com.foo.FooTest", "testFoo");
- EasyMock.replay(mMockBuild);
- mResultReporter.invocationStarted(mMockBuild);
- mResultReporter.testRunStarted(AbiUtils.createId(UnitTests.ABI.getName(), "run"), 1);
- mResultReporter.testStarted(testId);
- mResultReporter.testEnded(testId, emptyMap);
- mResultReporter.testRunEnded(3000, emptyMap);
- mResultReporter.putSummary(SUMMARY_LIST);
- mResultReporter.invocationEnded(1);
- String output = getOutput();
- // TODO: consider doing xml based compare
- final String expectedTestOutput = String.format(
- "<TestResult testPlan=\"NA\" starttime=\"ignore\" endtime=\"ignore\" " +
- "version=\"%s\" suite=\"%s\" referenceUrl=\"%s\"> ",
- CTS_RESULT_FILE_VERSION, "CTS", TEST_SUMMARY_URL);
- assertTrue("Found output: " + output, output.contains(expectedTestOutput));
- assertTrue(output.contains(
- "<Summary failed=\"0\" notExecuted=\"0\" timeout=\"0\" pass=\"1\" />"));
- assertTrue(output.contains("<TestPackage name=\"\" appPackageName=\"run\" abi=\"" +
- UnitTests.ABI.getName() + "\" digest=\"\">"));
- assertTrue(output.contains("<TestCase name=\"FooTest\" priority=\"\">"));
-
- final String testCaseTag = String.format(
- "<Test name=\"%s\" result=\"pass\"", testId.getTestName());
- assertTrue(output.contains(testCaseTag));
- EasyMock.verify(mMockBuild);
- }
-
- /**
- * A simple test to ensure expected output is generated for test run with a single failed test.
- */
- public void testSingleFail() {
- Map<String, String> emptyMap = Collections.emptyMap();
- final TestIdentifier testId = new TestIdentifier("FooTest", "testFoo");
- final String trace = "this is a trace\nmore trace\nyet more trace";
- EasyMock.replay(mMockBuild);
- mResultReporter.invocationStarted(mMockBuild);
- mResultReporter.testRunStarted(AbiUtils.createId(UnitTests.ABI.getName(), "run"), 1);
- mResultReporter.testStarted(testId);
- mResultReporter.testFailed(testId, trace);
- mResultReporter.testEnded(testId, emptyMap);
- mResultReporter.testRunEnded(3, emptyMap);
- mResultReporter.testLogSaved("logcat-foo-bar", LogDataType.TEXT, null,
- new LogFile("path", "url"));
- mResultReporter.invocationEnded(1);
- String output = getOutput();
- // TODO: consider doing xml based compare
- assertTrue(output.contains(
- "<Summary failed=\"1\" notExecuted=\"0\" timeout=\"0\" pass=\"0\" />"));
- final String failureTag =
- "<FailedScene message=\"this is a trace more trace\"> " +
- "<StackTrace>this is a tracemore traceyet more trace</StackTrace>";
- assertTrue(output.contains(failureTag));
-
- // Check that no TestLog tags were added, because the flag wasn't enabled.
- final String testLogTag = String.format("<TestLog type=\"logcat\" url=\"url\" />");
- assertFalse(output, output.contains(testLogTag));
- EasyMock.verify(mMockBuild);
- }
-
- /**
- * Test that flips the include-test-log-tags flag and checks that logs are written to the XML.
- */
- public void testIncludeTestLogTags() {
- Map<String, String> emptyMap = Collections.emptyMap();
- final TestIdentifier testId = new TestIdentifier("FooTest", "testFoo");
- final String trace = "this is a trace\nmore trace\nyet more trace";
-
- // Include TestLogTags in the XML.
- mResultReporter.setIncludeTestLogTags(true);
-
- EasyMock.replay(mMockBuild);
- mResultReporter.invocationStarted(mMockBuild);
- mResultReporter.testRunStarted(AbiUtils.createId(UnitTests.ABI.getName(), "run"), 1);
- mResultReporter.testStarted(testId);
- mResultReporter.testFailed(testId, trace);
- mResultReporter.testEnded(testId, emptyMap);
- mResultReporter.testRunEnded(3, emptyMap);
- mResultReporter.testLogSaved("logcat-foo-bar", LogDataType.TEXT, null,
- new LogFile("path", "url"));
- mResultReporter.invocationEnded(1);
-
- // Check for TestLog tags because the flag was enabled via setIncludeTestLogTags.
- final String output = getOutput();
- final String testLogTag = String.format("<TestLog type=\"logcat\" url=\"url\" />");
- assertTrue(output, output.contains(testLogTag));
- EasyMock.verify(mMockBuild);
- }
-
- public void testDeviceSetup() {
- Map<String, String> emptyMap = Collections.emptyMap();
- final TestIdentifier testId = new TestIdentifier("android.tests.devicesetup", "TestDeviceSetup");
- EasyMock.replay(mMockBuild);
- mResultReporter.invocationStarted(mMockBuild);
- mResultReporter.testRunStarted(AbiUtils.createId(UnitTests.ABI.getName(), testId.getClassName()), 1);
- mResultReporter.testStarted(testId);
- mResultReporter.testEnded(testId, emptyMap);
- mResultReporter.testRunEnded(3, emptyMap);
- mResultReporter.invocationEnded(1);
- String output = getOutput();
- // TODO: consider doing xml based compare
- final String deviceSetupTag = "appPackageName=\"android.tests.devicesetup\"";
- assertFalse(output, output.contains(deviceSetupTag));
- EasyMock.verify(mMockBuild);
- }
-
- /**
- * Gets the output produced, stripping it of extraneous whitespace characters.
- */
- private String getOutput() {
- String output = mOutputStream.toString();
- // ignore newlines and tabs whitespace
- output = output.replaceAll("[\\r\\n\\t]", "");
- // replace two ws chars with one
- return output.replaceAll(" ", " ");
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/DeviceInfoResultTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/DeviceInfoResultTest.java
deleted file mode 100644
index fa36430..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/DeviceInfoResultTest.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import android.tests.getinfo.DeviceInfoConstants;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-/**
- * Unit tests for {@link DeviceInfoResult}
- */
-public class DeviceInfoResultTest extends TestCase {
-
- private DeviceInfoResult mDeserializingInfo;
-
- @Override
- protected void setUp() throws Exception {
- mDeserializingInfo = new DeviceInfoResult() {
- // override parent to advance xml parser to correct tag
- @Override
- void parse(XmlPullParser parser) throws XmlPullParserException, IOException {
- int eventType = parser.getEventType();
- while (eventType != XmlPullParser.END_DOCUMENT) {
- if (eventType == XmlPullParser.START_TAG && parser.getName().equals(TAG)) {
- super.parse(parser);
- return;
- }
- eventType = parser.next();
- }
- throw new XmlPullParserException(String.format("Could not find tag %s", TAG));
- }
- };
- }
-
- public void testFeatures() throws Exception {
- assertSerializeParse(DeviceInfoConstants.FEATURES, "");
- assertSerializeParse(DeviceInfoConstants.FEATURES,
- "android.hardware.audio.low_latency:sdk:false;");
- assertSerializeParse(DeviceInfoConstants.FEATURES, "android.hardware.audio.low_latency:"
- + "sdk:false;android.hardware.bluetooth:sdk:true;");
- }
-
- public void testProcesses() throws Exception {
- assertSerializeParse(DeviceInfoConstants.PROCESSES, "");
- assertSerializeParse(DeviceInfoConstants.PROCESSES, "ueventd:0;");
- assertSerializeParse(DeviceInfoConstants.PROCESSES, "ueventd:0;netd:0;");
- }
-
- public void testOpenGlTextureFormats() throws Exception {
- assertSerializeParse(DeviceInfoConstants.OPEN_GL_COMPRESSED_TEXTURE_FORMATS, "");
- assertSerializeParse(DeviceInfoConstants.OPEN_GL_COMPRESSED_TEXTURE_FORMATS, "texture1;");
- assertSerializeParse(DeviceInfoConstants.OPEN_GL_COMPRESSED_TEXTURE_FORMATS,
- "texture1;texture2;");
- }
-
- public void testSystemLibraries() throws Exception {
- assertSerializeParse(DeviceInfoConstants.SYS_LIBRARIES, "");
- assertSerializeParse(DeviceInfoConstants.SYS_LIBRARIES, "lib1;");
- assertSerializeParse(DeviceInfoConstants.SYS_LIBRARIES, "lib1;lib2;");
- }
-
- private void assertSerializeParse(String name, String value)
- throws IOException, ParseException {
- DeviceInfoResult serializedInfo = new DeviceInfoResult();
- addMetric(name, value, serializedInfo);
- String serializedOutput = serialize(serializedInfo);
- mDeserializingInfo.parse(new StringReader(serializedOutput));
- assertEquals(value, mDeserializingInfo.getMetrics().get(name));
- }
-
- /**
- * Test populating a combined metric like device serial
- */
- public void testPopulateMetrics_combinedSerial() throws Exception {
- DeviceInfoResult info = new DeviceInfoResult();
- // first add another metric to make hashmap non empty, so combined logic is triggered
- addMetric(DeviceInfoConstants.PROCESSES, "proc", info);
- addMetric(DeviceInfoConstants.SERIAL_NUMBER, "device1", info);
- // ensure the stored serial number equals the value that was just set
- assertEquals("device1", info.getMetrics().get(
- DeviceInfoConstants.SERIAL_NUMBER));
- // now add it again
- addMetric(DeviceInfoConstants.SERIAL_NUMBER, "device1", info);
- // should still equal same value
- assertEquals("device1", info.getMetrics().get(
- DeviceInfoConstants.SERIAL_NUMBER));
- // now store different serial, and expect csv
- addMetric(DeviceInfoConstants.SERIAL_NUMBER, "device2", info);
- assertEquals("device1,device2", info.getMetrics().get(
- DeviceInfoConstants.SERIAL_NUMBER));
- }
-
- /**
- * Test populating a verified-to-be-identical metric like DeviceInfoConstants.BUILD_FINGERPRINT
- */
- public void testPopulateMetrics_verify() throws Exception {
- DeviceInfoResult info = new DeviceInfoResult();
- addMetric(DeviceInfoConstants.BUILD_FINGERPRINT, "fingerprint1", info);
- // ensure the stored fingerprint equals the value that was just set
- assertEquals("fingerprint1", info.getMetrics().get(
- DeviceInfoConstants.BUILD_FINGERPRINT));
- // now add it again
- addMetric(DeviceInfoConstants.BUILD_FINGERPRINT, "fingerprint1", info);
- // should still equal same value
- assertEquals("fingerprint1", info.getMetrics().get(
- DeviceInfoConstants.BUILD_FINGERPRINT));
- // now store different serial, and expect error message
- addMetric(DeviceInfoConstants.BUILD_FINGERPRINT, "fingerprint2", info);
- assertTrue(info.getMetrics().get(
- DeviceInfoConstants.BUILD_FINGERPRINT).contains("ERROR"));
- }
-
- /**
- * Helper method to add given metric to the {@link DeviceInfoResult}
- */
- private void addMetric(String metricName, String metricValue, DeviceInfoResult serializedInfo) {
- Map<String, String> collectedMetrics = new HashMap<String, String>();
- collectedMetrics.put(metricName, metricValue);
- serializedInfo.populateMetrics(collectedMetrics);
- }
-
- /**
- * Helper method to serialize given object to XML
- */
- private String serialize(DeviceInfoResult serializedInfo)
- throws IOException {
- KXmlSerializer xmlSerializer = new KXmlSerializer();
- StringWriter serializedOutput = new StringWriter();
- xmlSerializer.setOutput(serializedOutput);
- serializedInfo.serialize(xmlSerializer);
- return serializedOutput.toString();
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestLogTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestLogTest.java
deleted file mode 100644
index 55c3071..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestLogTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.cts.tradefed.result;
-
-import com.android.cts.tradefed.result.TestLog.TestLogType;
-
-import org.kxml2.io.KXmlSerializer;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
-
-import junit.framework.TestCase;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-/** Tests for {@link TestLog}. */
-public class TestLogTest extends TestCase {
-
- public void testTestLogType_fromDataName() {
- assertNull(TestLogType.fromDataName(null));
- assertNull(TestLogType.fromDataName(""));
- assertNull(TestLogType.fromDataName("kmsg-foo_bar_test"));
-
- assertEquals(TestLogType.LOGCAT,
- TestLogType.fromDataName("logcat-foo_bar_test"));
- assertEquals(TestLogType.BUGREPORT,
- TestLogType.fromDataName("bug-foo_bar_test"));
- }
-
- public void testTestLogType_getAttrValue() {
- assertEquals("logcat", TestLogType.LOGCAT.getAttrValue());
- assertEquals("bugreport", TestLogType.BUGREPORT.getAttrValue());
- }
-
- public void testFromDataName() {
- TestLog log = TestLog.fromDataName("logcat-baz_test", "http://logs/baz_test");
- assertEquals(TestLogType.LOGCAT, log.getLogType());
- assertEquals("http://logs/baz_test", log.getUrl());
- }
-
- public void testFromDataName_unrecognizedDataName() {
- assertNull(TestLog.fromDataName("kmsg-baz_test", null));
- }
-
- public void testFromDataName_nullDataName() {
- assertNull(TestLog.fromDataName(null, "http://logs/baz_test"));
- }
-
- public void testFromDataName_nullUrl() {
- assertNull(TestLog.fromDataName("logcat-bar_test", null));
- }
-
- public void testFromDataName_allNull() {
- assertNull(TestLog.fromDataName(null, null));
- }
-
- public void testFromXml() throws Exception {
- TestLog log = TestLog.fromXml(newXml("<TestLog type=\"logcat\" url=\"http://logs/baz_test\">"));
- assertEquals(TestLogType.LOGCAT, log.getLogType());
- assertEquals("http://logs/baz_test", log.getUrl());
- }
-
- public void testFromXml_unrecognizedType() throws Exception {
- assertNull(TestLog.fromXml(newXml("<TestLog type=\"kmsg\" url=\"http://logs/baz_test\">")));
- }
-
- public void testFromXml_noTypeAttribute() throws Exception {
- assertNull(TestLog.fromXml(newXml("<TestLog url=\"http://logs/baz_test\">")));
- }
-
- public void testFromXml_noUrlAttribute() throws Exception {
- assertNull(TestLog.fromXml(newXml("<TestLog type=\"bugreport\">")));
- }
-
- public void testFromXml_allNull() throws Exception {
- assertNull(TestLog.fromXml(newXml("<TestLog>")));
- }
-
- public void testSerialize() throws Exception {
- KXmlSerializer serializer = new KXmlSerializer();
- StringWriter writer = new StringWriter();
- serializer.setOutput(writer);
-
- TestLog log = TestLog.of(TestLogType.LOGCAT, "http://logs/foo/bar");
- log.serialize(serializer);
- assertEquals("<TestLog type=\"logcat\" url=\"http://logs/foo/bar\" />", writer.toString());
- }
-
- public void testIsTag() {
- assertTrue(TestLog.isTag("TestLog"));
- assertFalse(TestLog.isTag("TestResult"));
- }
-
- private XmlPullParser newXml(String xml) throws Exception {
- XmlPullParserFactory factory = org.xmlpull.v1.XmlPullParserFactory.newInstance();
- XmlPullParser parser = factory.newPullParser();
- parser.setInput(new StringReader(xml));
-
- // Move the parser from the START_DOCUMENT stage to the START_TAG of the data.
- parser.next();
-
- return parser;
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestPackageResultTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestPackageResultTest.java
deleted file mode 100644
index 57d322e..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestPackageResultTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.ddmlib.testrunner.TestIdentifier;
-
-import junit.framework.TestCase;
-
-import java.util.Collection;
-import java.util.HashMap;
-
-/**
- * Unit tests for {@link TestPackageResult}.
- */
-public class TestPackageResultTest extends TestCase {
-
- /**
- * Simple test for {@link TestPackageResult#getTestsWithStatus(CtsTestStatus)}.
- */
- public void testGetTestsWithStatus() {
- TestPackageResult pkgResult = new TestPackageResult();
- TestIdentifier excludedTest = new TestIdentifier("com.example.ExampleTest", "testPass");
- pkgResult.insertTest(excludedTest);
- pkgResult.reportTestEnded(excludedTest, new HashMap<String, String>());
- TestIdentifier includedTest = new TestIdentifier("com.example.ExampleTest",
- "testNotExecuted");
- pkgResult.insertTest(includedTest);
- Collection<TestIdentifier> tests = pkgResult.getTestsWithStatus(
- CtsTestStatus.NOT_EXECUTED);
- assertEquals(1, tests.size());
- assertEquals(includedTest, tests.iterator().next());
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestResultsTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestResultsTest.java
deleted file mode 100644
index 75f545e..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestResultsTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import java.io.StringReader;
-
-/**
- * Unit tests for {@link TestResults} parsing.
- */
-public class TestResultsTest extends junit.framework.TestCase {
-
- private static final String RESULT_START = "<TestResult>";
- private static final String RESULT_END = "</TestResult>";
- private static final String TEST_PACKAGE_START =
- "<TestPackage name=\"pkgName\" appPackageName=\"appPkgName\" digest=\"digValue\" >";
- private static final String TEST_PACKAGE_END = "</TestPackage>";
-
- private static final String TEST_PACKAGE_FULL =
- RESULT_START +TEST_PACKAGE_START + TEST_PACKAGE_END + RESULT_END;
-
- private static final String TEST_FULL =
- RESULT_START + TEST_PACKAGE_START +
- "<TestSuite name=\"com\" >" +
- "<TestSuite name=\"example\" >" +
- "<TestCase name=\"ExampleTest\" >" +
- "<Test name=\"testExample\" endtime=\"et\" starttime=\"st\" result=\"fail\" >" +
- "<FailedScene message=\"msg\" >" +
- "<StackTrace>at ExampleTest.testExample()" +
- "</StackTrace>" +
- "</FailedScene>" +
- "</Test>" +
- "</TestCase>" +
- "</TestSuite>" +
- "</TestSuite>";
-
- /**
- * Test parsing data with no result content
- */
- public void testParse_empty() throws Exception {
- TestResults parser = new TestResults();
- parser.parse(new StringReader("<Empty/>"));
- assertEquals(0, parser.getPackages().size());
- }
-
- /**
- * Test parsing data with a single test package
- */
- public void testParse_package() throws Exception {
- TestResults parser = new TestResults();
- parser.parse(new StringReader(TEST_PACKAGE_FULL));
- assertEquals(1, parser.getPackages().size());
- TestPackageResult pkg = parser.getPackages().iterator().next();
- assertEquals("pkgName", pkg.getName());
- assertEquals("appPkgName", pkg.getAppPackageName());
- assertEquals("digValue", pkg.getDigest());
- }
-
- /**
- * Test parsing not well formed XML data
- */
- public void testParse_corrupt() throws Exception {
- TestResults parser = new TestResults();
- // missing TEST_PACKAGE_END
- try {
- parser.parse(new StringReader(RESULT_START + TEST_PACKAGE_START + RESULT_END));
- fail("ParseException not thrown");
- } catch (ParseException e) {
- // expected
- }
- }
-
- /**
- * Test parsing a result with a single failed test
- */
- public void testParse_test() throws Exception {
- TestResults parser = new TestResults();
- parser.parse(new StringReader(TEST_FULL));
- assertEquals(1, parser.getPackages().size());
- TestPackageResult pkg = parser.getPackages().iterator().next();
- TestSuite comSuite = pkg.getTestSuites().iterator().next();
- assertEquals("com", comSuite.getName());
- TestSuite exampleSuite = comSuite.getTestSuites().iterator().next();
- assertEquals("example", exampleSuite.getName());
- TestCase exampleCase = exampleSuite.getTestCases().iterator().next();
- assertEquals("ExampleTest", exampleCase.getName());
- Test exampleTest = exampleCase.getTests().iterator().next();
- assertEquals("testExample", exampleTest.getName());
- assertEquals("msg", exampleTest.getMessage());
- assertEquals("at ExampleTest.testExample()", exampleTest.getStackTrace());
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestSummaryXmlTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestSummaryXmlTest.java
deleted file mode 100644
index f8b135a..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestSummaryXmlTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.result;
-
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import java.io.Reader;
-import java.io.StringReader;
-
-import junit.framework.TestCase;
-
-/**
- * Unit tests for {@link TestSummaryXml}.
- */
-public class TestSummaryXmlTest extends TestCase {
-
- static final String TEST_DATA =
- "<TestResult>" +
- "<Summary failed=\"1\" notExecuted=\"2\" pass=\"3\" timeout=\"4\"/>" +
- "</TestResult>";
-
- static final String MISSING_DATA =
- "<TestResult>" +
- "<Foo failed=\"1\" notExecuted=\"2\" pass=\"3\" timeout=\"4\"/>" +
- "</TestResult>";
-
- public void testConstructor() {
- TestSummaryXml result = new TestSummaryXml(1, "2011-11-01");
- assertEquals(1, result.getId());
- assertEquals("2011-11-01", result.getTimestamp());
- }
-
- /**
- * Simple test for parsing summary data
- */
- public void testParse() throws ParseException {
- TestSummaryXml result = new TestSummaryXml(1, "2011-11-01");
- result.parse(getStringAsReader(TEST_DATA));
- // expect failed and timeout to be summed
- assertEquals(5, result.getNumFailed());
- assertEquals(2, result.getNumIncomplete());
- assertEquals(3, result.getNumPassed());
- }
-
- /**
- * Test data where Summary tag is missing
- */
- public void testParse_missing() {
- TestSummaryXml result = new TestSummaryXml(1, "2011-11-01");
- try {
- result.parse(getStringAsReader(MISSING_DATA));
- fail("ParseException not thrown");
- } catch (ParseException e) {
- // expected
- }
- }
-
- private Reader getStringAsReader(String input) {
- return new StringReader(input);
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestTest.java
deleted file mode 100644
index 6494171..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/result/TestTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.result;
-
-import junit.framework.TestCase;
-
-/**
- * Unit tests for {@link Test}.
- * <p/>
- * Lets hope a TestTestTest is not needed...
- */
-public class TestTest extends TestCase {
-
- /**
- * Test {@link Test#getFailureMessageFromStackTrace(String)} for an empty stack
- */
- public void testGetFailureMessageFromStackTrace_empty() {
- final String stack = "";
- assertEquals(stack, Test.getFailureMessageFromStackTrace(stack));
- }
-
- /**
- * Test {@link Test#getFailureMessageFromStackTrace(String)} for a one line stack
- */
- public void testGetFailureMessageFromStackTrace_oneLine() {
- final String stack = "this is a line";
- assertEquals(stack, Test.getFailureMessageFromStackTrace(stack));
- }
-
- /**
- * Test {@link Test#getFailureMessageFromStackTrace(String)} for a one line stack with a newline
- * char
- */
- public void testGetFailureMessageFromStackTrace_oneNewLine() {
- final String stack = "this is a line\n";
- assertEquals(stack, Test.getFailureMessageFromStackTrace(stack));
- }
-
- /**
- * Test {@link Test#getFailureMessageFromStackTrace(String)} for a two line stack
- */
- public void testGetFailureMessageFromStackTrace_twoLines() {
- final String stack = "this is a line\nthis is also a line";
- assertEquals(stack, Test.getFailureMessageFromStackTrace(stack));
- }
-
- /**
- * Test {@link Test#getFailureMessageFromStackTrace(String)} for a multi line stack
- */
- public void testGetFailureMessageFromStackTrace_multiLines() {
- final String stack = "this is a line\nthis is also a line\n oh look another line";
- assertEquals("this is a line\nthis is also a line",
- Test.getFailureMessageFromStackTrace(stack));
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/CtsTestTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/CtsTestTest.java
deleted file mode 100644
index 19204b7..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/CtsTestTest.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.UnitTests;
-import com.android.cts.tradefed.build.StubCtsBuildHelper;
-import com.android.cts.tradefed.result.PlanCreator;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.targetprep.ITargetPreparer;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Unit tests for {@link CtsTest}.
- */
-public class CtsTestTest extends TestCase {
-
- private static final String PLAN_NAME = "CTS";
- private static final String PACKAGE_NAME = "test-name";
- private static final String ID = AbiUtils.createId(UnitTests.ABI.getName(), PACKAGE_NAME);
- private static final TestIdentifier TEST_IDENTIFIER =
- new TestIdentifier("CLASS_NAME", "TEST_NAME");
- private static final List<String> NAMES = new ArrayList<>();
- private static final List<String> IDS = new ArrayList<>();
- private static final List<TestIdentifier> TEST_IDENTIFIER_LIST = new ArrayList<>();
-
- static {
- NAMES.add(PACKAGE_NAME);
- IDS.add(ID);
- TEST_IDENTIFIER_LIST.add(TEST_IDENTIFIER);
- }
-
- /** the test fixture under test, with all external dependencies mocked out */
- private CtsTest mCtsTest;
- private ITestPackageRepo mMockRepo;
- private ITestPlan mMockPlan;
- private ITestDevice mMockDevice;
- private ITestInvocationListener mMockListener;
- private StubCtsBuildHelper mStubBuildHelper;
- private ITestPackageDef mMockPackageDef;
- private Set<ITestPackageDef> mMockPackageDefs;
- private IRemoteTest mMockTest;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mMockRepo = EasyMock.createMock(ITestPackageRepo.class);
- mMockPlan = EasyMock.createMock(ITestPlan.class);
- mMockDevice = EasyMock.createMock(ITestDevice.class);
- mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);
- mStubBuildHelper = new StubCtsBuildHelper();
- mMockPackageDefs = new HashSet<>();
- mMockPackageDef = EasyMock.createMock(ITestPackageDef.class);
- mMockPackageDefs.add(mMockPackageDef);
- EasyMock.expect(mMockPackageDef.getTargetApkName()).andStubReturn(null);
- EasyMock.expect(mMockPackageDef.getTargetPackageName()).andStubReturn(null);
- mMockTest = EasyMock.createMock(IRemoteTest.class);
-
- mCtsTest = new CtsTest() {
- @Override
- ITestPackageRepo createTestCaseRepo() {
- return mMockRepo;
- }
-
- @Override
- ITestPlan createPlan(String planName) {
- return mMockPlan;
- }
-
- @Override
- ITestPlan createPlan(PlanCreator planCreator) {
- return mMockPlan;
- }
-
- @Override
- InputStream createXmlStream(File xmlFile) throws FileNotFoundException {
- // return empty stream, not used
- return new ByteArrayInputStream(new byte[0]);
- }
- };
- mCtsTest.setDevice(mMockDevice);
- mCtsTest.setBuildHelper(mStubBuildHelper);
- // turn off device collection for simplicity
- mCtsTest.setSkipDeviceInfo(true);
- // only run tests on one ABI
- EasyMock.expect(mMockDevice.getProperty("ro.product.cpu.abilist"))
- .andReturn(UnitTests.ABI.getName()).anyTimes();
- }
-
- /**
- * Test normal case {@link CtsTest#run(ITestInvocationListener)} when running a plan.
- */
- @SuppressWarnings("unchecked")
- public void testRun_plan() throws DeviceNotAvailableException, ParseException {
- setParsePlanExpectations();
-
- setCreateAndRunTestExpectations();
-
- replayMocks();
- mCtsTest.run(mMockListener);
- verifyMocks();
- }
-
- /**
- * Test normal case {@link CtsTest#run(ITestInvocationListener)} when running a package.
- */
- @SuppressWarnings("unchecked")
- public void testRun_package() throws DeviceNotAvailableException {
- mCtsTest.addPackageName(PACKAGE_NAME);
- Map<String, List<ITestPackageDef>> nameMap = new HashMap<>();
- List<ITestPackageDef> testPackageDefList = new ArrayList<>();
- testPackageDefList.add(mMockPackageDef);
- nameMap.put(PACKAGE_NAME, testPackageDefList);
-
- EasyMock.expect(mMockRepo.getTestPackageDefsByName()).andReturn(nameMap);
-
- setCreateAndRunTestExpectations();
-
- replayMocks();
- mCtsTest.run(mMockListener);
- verifyMocks();
- }
-
- /**
- * Test a resumed run
- */
- @SuppressWarnings("unchecked")
- public void testRun_resume() throws DeviceNotAvailableException {
- mCtsTest.addPackageName(PACKAGE_NAME);
- Map<String, List<ITestPackageDef>> nameMap = new HashMap<>();
- List<ITestPackageDef> testPackageDefList = new ArrayList<>();
- testPackageDefList.add(mMockPackageDef);
- nameMap.put(PACKAGE_NAME, testPackageDefList);
-
- EasyMock.expect(mMockRepo.getTestPackageDefsByName()).andReturn(nameMap);
- setCreateAndRunTestExpectations();
- // abort the first run
- EasyMock.expectLastCall().andThrow(new DeviceNotAvailableException());
-
- // now expect test to be resumed
- mMockTest.run((ITestInvocationListener)EasyMock.anyObject());
-
- replayMocks();
- try {
- mCtsTest.run(mMockListener);
- fail("Did not throw DeviceNotAvailableException");
- } catch (DeviceNotAvailableException e) {
- // expected
- }
- // now resume, and expect same test's run method to be called again
- mCtsTest.run(mMockListener);
- verifyMocks();
- }
-
- /**
- * Test normal case {@link CtsTest#run(ITestInvocationListener)} when running a class.
- */
- @SuppressWarnings("unchecked")
- public void testRun_class() throws DeviceNotAvailableException {
- final String className = "className";
- final String methodName = "methodName";
- mCtsTest.setClassName(className);
- mCtsTest.setMethodName(methodName);
-
- EasyMock.expect(mMockRepo.findPackageIdsForTest(className)).andReturn(IDS);
- mMockPackageDef.setClassName(className, methodName);
-
- setCreateAndRunTestExpectations();
-
- replayMocks();
- mCtsTest.run(mMockListener);
- verifyMocks();
- }
-
- /**
- * Test normal case {@link CtsTest#run(ITestInvocationListener)} when running a class.
- */
- @SuppressWarnings("unchecked")
- public void testRun_test() throws DeviceNotAvailableException {
- final String className = "className";
- final String methodName = "methodName";
- final String testName = String.format("%s#%s", className, methodName);
- mCtsTest.setTestName(testName);
-
- EasyMock.expect(mMockRepo.findPackageIdsForTest(className)).andReturn(IDS);
- mMockPackageDef.setClassName(className, methodName);
-
- setCreateAndRunTestExpectations();
-
- replayMocks();
- mCtsTest.run(mMockListener);
- verifyMocks();
- }
-
- /**
- * Test {@link CtsTest#run(ITestInvocationListener)} when --excluded-package is specified
- */
- public void testRun_excludedPackage() throws DeviceNotAvailableException, ParseException {
- mCtsTest.setPlanName(PLAN_NAME);
- mMockPlan.parse((InputStream) EasyMock.anyObject());
- EasyMock.expect(mMockPlan.getTestIds()).andReturn(IDS);
-
- mCtsTest.addExcludedPackageName(PACKAGE_NAME);
-
- // PACKAGE_NAME would normally be run, but it has been excluded. Expect nothing to happen
- replayMocks();
- mCtsTest.run(mMockListener);
- verifyMocks();
- }
-
- /**
- * Test {@link CtsTest#run(ITestInvocationListener)} when --continue-session is specified
- */
- public void testRun_continueSession() throws DeviceNotAvailableException {
- mCtsTest.setContinueSessionId(1);
- EasyMock.expect(mMockPlan.getTestIds()).andReturn(IDS);
- TestFilter filter = new TestFilter();
- EasyMock.expect(mMockPlan.getTestFilter(ID)).andReturn(filter);
-
- mMockPackageDef.setTestFilter(filter);
-
- setCreateAndRunTestExpectations();
-
- replayMocks();
- mCtsTest.run(mMockListener);
- verifyMocks();
- }
-
- /**
- * Set EasyMock expectations for parsing {@link #PLAN_NAME}
- */
- private void setParsePlanExpectations() throws ParseException {
- mCtsTest.setPlanName(PLAN_NAME);
- mMockPlan.parse((InputStream) EasyMock.anyObject());
- EasyMock.expect(mMockPlan.getTestIds()).andReturn(IDS);
- TestFilter filter = new TestFilter();
- EasyMock.expect(mMockPlan.getTestFilter(ID)).andReturn(filter);
- mMockPackageDef.setTestFilter(filter);
- }
-
- /**
- * Set EasyMock expectations for creating and running a package with PACKAGE_NAME
- */
- private void setCreateAndRunTestExpectations() throws DeviceNotAvailableException {
- EasyMock.expect(mMockRepo.getPackageNames()).andReturn(NAMES).anyTimes();
- EasyMock.expect(mMockRepo.getPackageIds()).andReturn(IDS).anyTimes();
- EasyMock.expect(mMockRepo.getTestPackage(ID)).andReturn(mMockPackageDef).anyTimes();
- EasyMock.expect(mMockPackageDef.createTest((File) EasyMock.anyObject())).andReturn(mMockTest);
- EasyMock.expect(mMockPackageDef.getTests()).andReturn(TEST_IDENTIFIER_LIST).times(2);
- EasyMock.expect(mMockPackageDef.getName()).andReturn(PACKAGE_NAME).atLeastOnce();
- EasyMock.expect(mMockPackageDef.getAbi()).andReturn(UnitTests.ABI).atLeastOnce();
- EasyMock.expect(mMockPackageDef.getId()).andReturn(ID).atLeastOnce();
- EasyMock.expect(mMockPackageDef.getDigest()).andReturn("digest").atLeastOnce();
- EasyMock.expect(mMockPackageDef.getPackagePreparers()).andReturn(
- new ArrayList<ITargetPreparer>()).atLeastOnce();
- mMockTest.run((ITestInvocationListener) EasyMock.anyObject());
- }
-
- /**
- * Test {@link CtsTest#run(ITestInvocationListener)} when --plan and --package options have not
- * been specified
- */
- public void testRun_nothingToRun() throws DeviceNotAvailableException {
- replayMocks();
- try {
- mCtsTest.run(mMockListener);
- fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- /**
- * Test {@link CtsTest#run(ITestInvocationListener)} when --plan and --package options have
- * been specified.
- */
- public void testRun_packagePlan() throws DeviceNotAvailableException {
- mCtsTest.setPlanName(PLAN_NAME);
- mCtsTest.addPackageName(PACKAGE_NAME);
- replayMocks();
- try {
- mCtsTest.run(mMockListener);
- fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- /**
- * Test {@link CtsTest#run(ITestInvocationListener)} when --plan and --class options have been
- * specified
- */
- public void testRun_planClass() throws DeviceNotAvailableException {
- mCtsTest.setPlanName(PLAN_NAME);
- mCtsTest.setClassName("class");
- replayMocks();
- try {
- mCtsTest.run(mMockListener);
- fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- /**
- * Test {@link CtsTest#run(ITestInvocationListener)} when --package and --class options have
- * been specified
- */
- public void testRun_packageClass() throws DeviceNotAvailableException {
- mCtsTest.addPackageName(PACKAGE_NAME);
- mCtsTest.setClassName("class");
- replayMocks();
- try {
- mCtsTest.run(mMockListener);
- fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- /**
- * Test {@link CtsTest#run(ITestInvocationListener)} when --plan, --package and --class options
- * have been specified
- */
- public void testRun_planPackageClass() throws DeviceNotAvailableException {
- mCtsTest.setPlanName(PLAN_NAME);
- mCtsTest.addPackageName(PACKAGE_NAME);
- mCtsTest.setClassName("class");
- replayMocks();
- try {
- mCtsTest.run(mMockListener);
- fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- /**
- * Test {@link CtsTest#run(ITestInvocationListener)} when --plan, --continue-option options
- * have been specified
- */
- public void testRun_planContinue() throws DeviceNotAvailableException {
- mCtsTest.setPlanName(PLAN_NAME);
- mCtsTest.setContinueSessionId(1);
- replayMocks();
- try {
- mCtsTest.run(mMockListener);
- fail("IllegalArgumentException not thrown");
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- /**
- * Test {@link CtsTestTest#join} works.
- * @throws DeviceNotAvailableException
- */
- public void testJoin() throws DeviceNotAvailableException {
- String expected = "a@b@c";
- String actual = mCtsTest.join(new ArrayList<String>(Arrays.asList("a", "b", "c")), "@");
- assertEquals(expected, actual);
- }
-
- /**
- * Test {@link CtsTestTest#join} for a single element list.
- * @throws DeviceNotAvailableException
- */
- public void testSingleJoin() throws DeviceNotAvailableException {
- String actual = mCtsTest.join(new ArrayList<String>(Arrays.asList("foo")), "@");
- assertEquals("foo", actual);
- }
-
- /**
- * Test {@link CtsTestTest#join} for an empty list.
- * @throws DeviceNotAvailableException
- */
- public void testEmptyJoin() throws DeviceNotAvailableException {
- String actual = mCtsTest.join(new ArrayList<String>(), "@");
- assertEquals("", actual);
- }
-
- private void replayMocks(Object... mocks) {
- EasyMock.replay(mMockRepo, mMockPlan, mMockDevice, mMockPackageDef, mMockListener, mMockTest);
- EasyMock.replay(mocks);
- }
-
- private void verifyMocks(Object... mocks) {
- EasyMock.verify(mMockRepo, mMockPlan, mMockDevice, mMockPackageDef, mMockListener, mMockTest);
- EasyMock.verify(mocks);
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/DeqpTestRunnerTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/DeqpTestRunnerTest.java
deleted file mode 100644
index 2ba6b42..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/DeqpTestRunnerTest.java
+++ /dev/null
@@ -1,3076 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.cts.tradefed.UnitTests;
-import com.android.cts.tradefed.build.StubCtsBuildHelper;
-import com.android.ddmlib.IDevice;
-import com.android.ddmlib.IShellOutputReceiver;
-import com.android.ddmlib.ShellCommandUnresponsiveException;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.util.IRunUtil;
-import com.android.tradefed.util.RunInterruptedException;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.easymock.IMocksControl;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Unit tests for {@link DeqpTestRunner}.
- */
-public class DeqpTestRunnerTest extends TestCase {
- private static final String NAME = "dEQP-GLES3";
- private static final String ID = AbiUtils.createId(UnitTests.ABI.getName(), NAME);
- private static final String CASE_LIST_FILE_NAME = "/sdcard/dEQP-TestCaseList.txt";
- private static final String LOG_FILE_NAME = "/sdcard/TestLog.qpa";
- private static final String INSTRUMENTATION_NAME =
- "com.drawelements.deqp/com.drawelements.deqp.testercore.DeqpInstrumentation";
- private static final String QUERY_INSTRUMENTATION_NAME =
- "com.drawelements.deqp/com.drawelements.deqp.platformutil.DeqpPlatformCapabilityQueryInstrumentation";
- private static final String DEQP_ONDEVICE_APK = "com.drawelements.deqp.apk";
- private static final String DEQP_ONDEVICE_PKG = "com.drawelements.deqp";
- private static final String ONLY_LANDSCAPE_FEATURES =
- "feature:"+DeqpTestRunner.FEATURE_LANDSCAPE;
- private static final String ALL_FEATURES =
- ONLY_LANDSCAPE_FEATURES + "\nfeature:"+DeqpTestRunner.FEATURE_PORTRAIT;
- private static List<Map<String,String>> DEFAULT_INSTANCE_ARGS;
-
- static {
- DEFAULT_INSTANCE_ARGS = new ArrayList<>(1);
- DEFAULT_INSTANCE_ARGS.add(new HashMap<String,String>());
- DEFAULT_INSTANCE_ARGS.iterator().next().put("glconfig", "rgba8888d24s8");
- DEFAULT_INSTANCE_ARGS.iterator().next().put("rotation", "unspecified");
- DEFAULT_INSTANCE_ARGS.iterator().next().put("surfacetype", "window");
- }
-
- private static class StubRecovery implements DeqpTestRunner.IRecovery {
- /**
- * {@inheritDoc}
- */
- @Override
- public void setSleepProvider(DeqpTestRunner.ISleepProvider sleepProvider) {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setDevice(ITestDevice device) {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onExecutionProgressed() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void recoverConnectionRefused() throws DeviceNotAvailableException {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void recoverComLinkKilled() throws DeviceNotAvailableException {
- }
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /**
- * Test version of OpenGL ES.
- */
- private void testGlesVersion(int requiredMajorVersion, int requiredMinorVersion, int majorVersion, int minorVersion) throws Exception {
- final TestIdentifier testId = new TestIdentifier("dEQP-GLES"
- + Integer.toString(requiredMajorVersion) + Integer.toString(requiredMinorVersion)
- + ".info", "version");
-
- final String testPath = "dEQP-GLES"
- + Integer.toString(requiredMajorVersion) + Integer.toString(requiredMinorVersion)
- +".info.version";
-
- final String testTrie = "{dEQP-GLES"
- + Integer.toString(requiredMajorVersion) + Integer.toString(requiredMinorVersion)
- + "{info{version}}}";
-
- final String resultCode = "Pass";
-
- /* MultiLineReceiver expects "\r\n" line ending. */
- final String output = "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=" + testPath + "\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=" + resultCode + "\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Detail" + resultCode + "\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IDevice mockIDevice = EasyMock.createMock(IDevice.class);
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- tests.add(testId);
-
- Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
- instance.put(testId, DEFAULT_INSTANCE_ARGS);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME,
- "dEQP-GLES" + Integer.toString(requiredMajorVersion)
- + (requiredMinorVersion > 0 ? Integer.toString(requiredMinorVersion) : ""),
- tests, instance);
- deqpTest.setAbi(UnitTests.ABI);
-
- int version = (majorVersion << 16) | minorVersion;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- if (majorVersion > requiredMajorVersion
- || (majorVersion == requiredMajorVersion && minorVersion >= requiredMinorVersion)) {
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName()))))
- .andReturn(null).once();
-
- expectRenderConfigQuery(mockDevice, requiredMajorVersion,
- requiredMinorVersion);
-
- String commandLine = String.format(
- "--deqp-caselist-file=%s --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable",
- CASE_LIST_FILE_NAME);
-
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice, testTrie, commandLine,
- output);
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
- }
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- mockListener.testStarted(EasyMock.eq(testId));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testId), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- EasyMock.replay(mockDevice, mockIDevice);
- EasyMock.replay(mockListener);
-
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.run(mockListener);
-
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice, mockIDevice);
- }
-
- private void expectRenderConfigQuery(ITestDevice mockDevice, int majorVersion,
- int minorVersion) throws Exception {
- expectRenderConfigQuery(mockDevice,
- String.format("--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=%d "
- + "--deqp-gl-minor-version=%d", majorVersion, minorVersion));
- }
-
- private void expectRenderConfigQuery(ITestDevice mockDevice, String commandLine)
- throws Exception {
- expectRenderConfigQueryAndReturn(mockDevice, commandLine, "Yes");
- }
-
- private void expectRenderConfigQueryAndReturn(ITestDevice mockDevice, String commandLine,
- String output) throws Exception {
- final String queryOutput = "INSTRUMENTATION_RESULT: Supported=" + output + "\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
- final String command = String.format(
- "am instrument %s -w -e deqpQueryType renderConfigSupported -e deqpCmdLine "
- + "\"%s\" %s",
- AbiUtils.createAbiFlag(UnitTests.ABI.getName()), commandLine,
- QUERY_INSTRUMENTATION_NAME);
-
- mockDevice.executeShellCommand(EasyMock.eq(command),
- EasyMock.<IShellOutputReceiver>notNull());
-
- EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
- @Override
- public Object answer() {
- IShellOutputReceiver receiver
- = (IShellOutputReceiver)EasyMock.getCurrentArguments()[1];
-
- receiver.addOutput(queryOutput.getBytes(), 0, queryOutput.length());
- receiver.flush();
-
- return null;
- }
- });
- }
-
- /**
- * Test that result code produces correctly pass or fail.
- */
- private void testResultCode(final String resultCode, boolean pass) throws Exception {
- final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.info", "version");
- final String testPath = "dEQP-GLES3.info.version";
- final String testTrie = "{dEQP-GLES3{info{version}}}";
-
- /* MultiLineReceiver expects "\r\n" line ending. */
- final String output = "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=" + testPath + "\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=" + resultCode + "\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Detail" + resultCode + "\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IDevice mockIDevice = EasyMock.createMock(IDevice.class);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- tests.add(testId);
-
- Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
- instance.put(testId, DEFAULT_INSTANCE_ARGS);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
- deqpTest.setAbi(UnitTests.ABI);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).andReturn("")
- .once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true), EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName()))))
- .andReturn(null).once();
-
- expectRenderConfigQuery(mockDevice, 3, 0);
-
- String commandLine = String.format(
- "--deqp-caselist-file=%s --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable",
- CASE_LIST_FILE_NAME);
-
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice, testTrie, commandLine, output);
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- mockListener.testStarted(EasyMock.eq(testId));
- EasyMock.expectLastCall().once();
-
- if (!pass) {
- mockListener.testFailed(testId,
- "=== with config {glformat=rgba8888d24s8,rotation=unspecified,surfacetype=window} ===\n"
- + resultCode + ": Detail" + resultCode);
-
- EasyMock.expectLastCall().once();
- }
-
- mockListener.testEnded(EasyMock.eq(testId), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).andReturn("")
- .once();
-
- EasyMock.replay(mockDevice, mockIDevice);
- EasyMock.replay(mockListener);
-
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.run(mockListener);
-
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice, mockIDevice);
- }
-
- /**
- * Test running multiple test cases.
- */
- public void testRun_multipleTests() throws Exception {
- /* MultiLineReceiver expects "\r\n" line ending. */
- final String output = "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.info.vendor\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.info.renderer\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.info.version\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.info.shading_language_version\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.info.extensions\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.info.render_target\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- final TestIdentifier[] testIds = {
- new TestIdentifier("dEQP-GLES3.info", "vendor"),
- new TestIdentifier("dEQP-GLES3.info", "renderer"),
- new TestIdentifier("dEQP-GLES3.info", "version"),
- new TestIdentifier("dEQP-GLES3.info", "shading_language_version"),
- new TestIdentifier("dEQP-GLES3.info", "extensions"),
- new TestIdentifier("dEQP-GLES3.info", "render_target")
- };
-
- final String[] testPaths = {
- "dEQP-GLES3.info.vendor",
- "dEQP-GLES3.info.renderer",
- "dEQP-GLES3.info.version",
- "dEQP-GLES3.info.shading_language_version",
- "dEQP-GLES3.info.extensions",
- "dEQP-GLES3.info.render_target"
- };
-
- final String testTrie
- = "{dEQP-GLES3{info{vendor,renderer,version,shading_language_version,extensions,render_target}}}";
-
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IDevice mockIDevice = EasyMock.createMock(IDevice.class);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- Map<TestIdentifier, List<Map<String, String>>> instances = new HashMap<>();
-
- for (TestIdentifier id : testIds) {
- tests.add(id);
- instances.put(id, DEFAULT_INSTANCE_ARGS);
- }
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instances);
- deqpTest.setAbi(UnitTests.ABI);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).andReturn("")
- .once();
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true), EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName()))))
- .andReturn(null).once();
-
- expectRenderConfigQuery(mockDevice, 3, 0);
-
- String commandLine = String.format(
- "--deqp-caselist-file=%s --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable",
- CASE_LIST_FILE_NAME);
-
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice, testTrie, commandLine, output);
-
- mockListener.testRunStarted(ID, testPaths.length);
- EasyMock.expectLastCall().once();
-
- for (int i = 0; i < testPaths.length; i++) {
- mockListener.testStarted(EasyMock.eq(testIds[i]));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[i]),
- EasyMock.<Map<String, String>>notNull());
-
- EasyMock.expectLastCall().once();
- }
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).andReturn("")
- .once();
-
- EasyMock.replay(mockDevice, mockIDevice);
- EasyMock.replay(mockListener);
-
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.run(mockListener);
-
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice, mockIDevice);
- }
-
- /**
- * Test running a unexecutable test.
- */
- public void testRun_unexecutableTests() throws Exception {
- final String instrumentationAnswerNoExecs =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- final TestIdentifier[] testIds = {
- new TestIdentifier("dEQP-GLES3.missing", "no"),
- new TestIdentifier("dEQP-GLES3.missing", "nope"),
- new TestIdentifier("dEQP-GLES3.missing", "donotwant"),
- };
-
- final String[] testPaths = {
- "dEQP-GLES3.missing.no",
- "dEQP-GLES3.missing.nope",
- "dEQP-GLES3.missing.donotwant",
- };
-
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IDevice mockIDevice = EasyMock.createMock(IDevice.class);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- Map<TestIdentifier, List<Map<String, String>>> instances = new HashMap<>();
-
- for (TestIdentifier id : testIds) {
- tests.add(id);
- instances.put(id, DEFAULT_INSTANCE_ARGS);
- }
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instances);
- deqpTest.setAbi(UnitTests.ABI);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).andReturn("")
- .once();
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true), EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName()))))
- .andReturn(null).once();
-
- expectRenderConfigQuery(mockDevice, 3, 0);
-
- String commandLine = String.format(
- "--deqp-caselist-file=%s --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable",
- CASE_LIST_FILE_NAME);
-
- // first try
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{missing{no,nope,donotwant}}}", commandLine, instrumentationAnswerNoExecs);
-
- // splitting begins
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{missing{no}}}", commandLine, instrumentationAnswerNoExecs);
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{missing{nope,donotwant}}}", commandLine, instrumentationAnswerNoExecs);
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{missing{nope}}}", commandLine, instrumentationAnswerNoExecs);
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{missing{donotwant}}}", commandLine, instrumentationAnswerNoExecs);
-
- mockListener.testRunStarted(ID, testPaths.length);
- EasyMock.expectLastCall().once();
-
- for (int i = 0; i < testPaths.length; i++) {
- mockListener.testStarted(EasyMock.eq(testIds[i]));
- EasyMock.expectLastCall().once();
-
- mockListener.testFailed(EasyMock.eq(testIds[i]),
- EasyMock.eq("=== with config {glformat=rgba8888d24s8,rotation=unspecified,surfacetype=window} ===\n"
- + "Abort: Test cannot be executed"));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[i]),
- EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
- }
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).andReturn("")
- .once();
-
- EasyMock.replay(mockDevice, mockIDevice);
- EasyMock.replay(mockListener);
-
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.run(mockListener);
-
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice, mockIDevice);
- }
-
- /**
- * Test that test are left unexecuted if pm list query fails
- */
- public void testRun_queryPmListFailure()
- throws Exception {
- final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.orientation", "test");
-
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- tests.add(testId);
-
- Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
- instance.put(testId, new ArrayList<Map<String,String>>(1));
- instance.get(testId).add(new HashMap<String,String>());
- instance.get(testId).iterator().next().put("glconfig", "rgba8888d24s8");
- instance.get(testId).iterator().next().put("rotation", "90");
- instance.get(testId).iterator().next().put("surfacetype", "window");
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- EasyMock.expect(mockDevice.executeShellCommand("pm list features"))
- .andReturn("not a valid format");
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- EasyMock.replay(mockDevice);
- EasyMock.replay(mockListener);
- deqpTest.run(mockListener);
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice);
- }
-
- /**
- * Test that test are left unexecuted if renderablity query fails
- */
- public void testRun_queryRenderabilityFailure()
- throws Exception {
- final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.orientation", "test");
-
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- tests.add(testId);
-
- Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
- instance.put(testId, new ArrayList<Map<String,String>>(1));
- instance.get(testId).add(new HashMap<String,String>());
- instance.get(testId).iterator().next().put("glconfig", "rgba8888d24s8");
- instance.get(testId).iterator().next().put("rotation", "unspecified");
- instance.get(testId).iterator().next().put("surfacetype", "window");
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Maybe?");
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- EasyMock.replay(mockDevice);
- EasyMock.replay(mockListener);
- deqpTest.run(mockListener);
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice);
- }
-
- /**
- * Test that orientation is supplied to runner correctly
- */
- private void testOrientation(final String rotation, final String featureString)
- throws Exception {
- final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.orientation", "test");
- final String testPath = "dEQP-GLES3.orientation.test";
- final String testTrie = "{dEQP-GLES3{orientation{test}}}";
- final String output = "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=" + testPath + "\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IDevice mockIDevice = EasyMock.createMock(IDevice.class);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- tests.add(testId);
-
- Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
- instance.put(testId, new ArrayList<Map<String,String>>(1));
- instance.get(testId).add(new HashMap<String,String>());
- instance.get(testId).iterator().next().put("glconfig", "rgba8888d24s8");
- instance.get(testId).iterator().next().put("rotation", rotation);
- instance.get(testId).iterator().next().put("surfacetype", "window");
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- if (!rotation.equals(DeqpTestRunner.BatchRunConfiguration.ROTATION_UNSPECIFIED)) {
- EasyMock.expect(mockDevice.executeShellCommand("pm list features"))
- .andReturn(featureString);
- }
-
- final boolean isPortraitOrientation =
- rotation.equals(DeqpTestRunner.BatchRunConfiguration.ROTATION_PORTRAIT) ||
- rotation.equals(DeqpTestRunner.BatchRunConfiguration.ROTATION_REVERSE_PORTRAIT);
- final boolean isLandscapeOrientation =
- rotation.equals(DeqpTestRunner.BatchRunConfiguration.ROTATION_LANDSCAPE) ||
- rotation.equals(DeqpTestRunner.BatchRunConfiguration.ROTATION_REVERSE_LANDSCAPE);
- final boolean executable =
- rotation.equals(DeqpTestRunner.BatchRunConfiguration.ROTATION_UNSPECIFIED) ||
- (isPortraitOrientation &&
- featureString.contains(DeqpTestRunner.FEATURE_PORTRAIT)) ||
- (isLandscapeOrientation &&
- featureString.contains(DeqpTestRunner.FEATURE_LANDSCAPE));
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- if (executable) {
- expectRenderConfigQuery(mockDevice, String.format(
- "--deqp-gl-config-name=rgba8888d24s8 --deqp-screen-rotation=%s "
- + "--deqp-surface-type=window --deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", rotation));
-
- String commandLine = String.format(
- "--deqp-caselist-file=%s --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=%s "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable",
- CASE_LIST_FILE_NAME, rotation);
-
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice, testTrie, commandLine,
- output);
- }
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- mockListener.testStarted(EasyMock.eq(testId));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testId), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- EasyMock.replay(mockDevice, mockIDevice);
- EasyMock.replay(mockListener);
- deqpTest.run(mockListener);
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice, mockIDevice);
- }
-
- /**
- * Test OpeGL ES3 tests on device with OpenGL ES2.
- */
- public void testRun_require30DeviceVersion20() throws Exception {
- testGlesVersion(3, 0, 2, 0);
- }
-
- /**
- * Test OpeGL ES3.1 tests on device with OpenGL ES2.
- */
- public void testRun_require31DeviceVersion20() throws Exception {
- testGlesVersion(3, 1, 2, 0);
- }
-
- /**
- * Test OpeGL ES3 tests on device with OpenGL ES3.
- */
- public void testRun_require30DeviceVersion30() throws Exception {
- testGlesVersion(3, 0, 3, 0);
- }
-
- /**
- * Test OpeGL ES3.1 tests on device with OpenGL ES3.
- */
- public void testRun_require31DeviceVersion30() throws Exception {
- testGlesVersion(3, 1, 3, 0);
- }
-
- /**
- * Test OpeGL ES3 tests on device with OpenGL ES3.1.
- */
- public void testRun_require30DeviceVersion31() throws Exception {
- testGlesVersion(3, 0, 3, 1);
- }
-
- /**
- * Test OpeGL ES3.1 tests on device with OpenGL ES3.1.
- */
- public void testRun_require31DeviceVersion31() throws Exception {
- testGlesVersion(3, 1, 3, 1);
- }
-
- /**
- * Test dEQP Pass result code.
- */
- public void testRun_resultPass() throws Exception {
- testResultCode("Pass", true);
- }
-
- /**
- * Test dEQP Fail result code.
- */
- public void testRun_resultFail() throws Exception {
- testResultCode("Fail", false);
- }
-
- /**
- * Test dEQP NotSupported result code.
- */
- public void testRun_resultNotSupported() throws Exception {
- testResultCode("NotSupported", true);
- }
-
- /**
- * Test dEQP QualityWarning result code.
- */
- public void testRun_resultQualityWarning() throws Exception {
- testResultCode("QualityWarning", true);
- }
-
- /**
- * Test dEQP CompatibilityWarning result code.
- */
- public void testRun_resultCompatibilityWarning() throws Exception {
- testResultCode("CompatibilityWarning", true);
- }
-
- /**
- * Test dEQP ResourceError result code.
- */
- public void testRun_resultResourceError() throws Exception {
- testResultCode("ResourceError", false);
- }
-
- /**
- * Test dEQP InternalError result code.
- */
- public void testRun_resultInternalError() throws Exception {
- testResultCode("InternalError", false);
- }
-
- /**
- * Test dEQP Crash result code.
- */
- public void testRun_resultCrash() throws Exception {
- testResultCode("Crash", false);
- }
-
- /**
- * Test dEQP Timeout result code.
- */
- public void testRun_resultTimeout() throws Exception {
- testResultCode("Timeout", false);
- }
- /**
- * Test dEQP Orientation
- */
- public void testRun_orientationLandscape() throws Exception {
- testOrientation("90", ALL_FEATURES);
- }
-
- /**
- * Test dEQP Orientation
- */
- public void testRun_orientationPortrait() throws Exception {
- testOrientation("0", ALL_FEATURES);
- }
-
- /**
- * Test dEQP Orientation
- */
- public void testRun_orientationReverseLandscape() throws Exception {
- testOrientation("270", ALL_FEATURES);
- }
-
- /**
- * Test dEQP Orientation
- */
- public void testRun_orientationReversePortrait() throws Exception {
- testOrientation("180", ALL_FEATURES);
- }
-
- /**
- * Test dEQP Orientation
- */
- public void testRun_orientationUnspecified() throws Exception {
- testOrientation("unspecified", ALL_FEATURES);
- }
-
- /**
- * Test dEQP Orientation with limited features
- */
- public void testRun_orientationUnspecifiedLimitedFeatures() throws Exception {
- testOrientation("unspecified", ONLY_LANDSCAPE_FEATURES);
- }
-
- /**
- * Test dEQP Orientation with limited features
- */
- public void testRun_orientationLandscapeLimitedFeatures() throws Exception {
- testOrientation("90", ONLY_LANDSCAPE_FEATURES);
- }
-
- /**
- * Test dEQP Orientation with limited features
- */
- public void testRun_orientationPortraitLimitedFeatures() throws Exception {
- testOrientation("0", ONLY_LANDSCAPE_FEATURES);
- }
-
- /**
- * Test dEQP unsupported pixel format
- */
- public void testRun_unsupportedPixelFormat() throws Exception {
- final String pixelFormat = "rgba5658d16m4";
- final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.pixelformat", "test");
- final String testPath = "dEQP-GLES3.pixelformat.test";
- final String testTrie = "{dEQP-GLES3{pixelformat{test}}}";
- final String output = "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=" + testPath + "\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- tests.add(testId);
-
- Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
- instance.put(testId, new ArrayList<Map<String,String>>(1));
- instance.get(testId).add(new HashMap<String,String>());
- instance.get(testId).iterator().next().put("glconfig", pixelFormat);
- instance.get(testId).iterator().next().put("rotation", "unspecified");
- instance.get(testId).iterator().next().put("surfacetype", "window");
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- expectRenderConfigQueryAndReturn(mockDevice, String.format(
- "--deqp-gl-config-name=%s --deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", pixelFormat), "No");
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- mockListener.testStarted(EasyMock.eq(testId));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testId), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- EasyMock.replay(mockDevice);
- EasyMock.replay(mockListener);
- deqpTest.run(mockListener);
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice);
- }
-
- public void testRun_sessionInfoValueMissing() throws Exception {
- final String instrumentationAnswerOk =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.test1\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- final String instrumentationAnswerBroken =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n";
-
- final TestIdentifier[] testIds = {
- new TestIdentifier("dEQP-GLES3.instances", "test1"),
- };
-
- final String[] testPaths = {
- "dEQP-GLES3.instances.test1",
- };
-
- Map<String,String> config = new HashMap<>();
- config.put("glconfig", "rgba8888d24s8");
- config.put("rotation", "unspecified");
- config.put("surfacetype", "window");
-
- Map<TestIdentifier, List<Map<String, String>>> instances = new HashMap<>();
-
- instances.put(testIds[0], new ArrayList<Map<String,String>>());
- instances.get(testIds[0]).add(config);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- for (TestIdentifier id : testIds) {
- tests.add(id);
- }
-
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IMocksControl orderedControl = EasyMock.createStrictControl();
- ITestDevice mockDevice = orderedControl.createMock(ITestDevice.class);
- IDevice mockIDevice = orderedControl.createMock(IDevice.class);
-
- DeqpTestRunner.IRecovery mockRecovery = EasyMock.createMock(DeqpTestRunner.IRecovery.class);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instances);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.setRecovery(mockRecovery);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- mockRecovery.onExecutionProgressed();
- EasyMock.expectLastCall().atLeastOnce();
-
- mockRecovery.setDevice(mockDevice);
- EasyMock.expectLastCall().atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- // query config
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run config and fail
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test1}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerBroken);
-
- mockRecovery.recoverComLinkKilled();
- EasyMock.expectLastCall().once();
-
- // Re-try
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test1}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerOk);
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- // test1
- mockListener.testStarted(EasyMock.eq(testIds[0]));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[0]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- orderedControl.replay();
- EasyMock.replay(mockListener);
- EasyMock.replay(mockRecovery);
- deqpTest.run(mockListener);
-
- EasyMock.verify(mockListener);
- orderedControl.verify();
- EasyMock.verify(mockRecovery);
- }
-
- public void testRun_resultEventTypeMissing() throws Exception {
- final String instrumentationAnswerOk =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.test1\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- final String instrumentationAnswerBroken =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.test1\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n";
-
- final TestIdentifier[] testIds = {
- new TestIdentifier("dEQP-GLES3.instances", "test1"),
- };
-
- final String[] testPaths = {
- "dEQP-GLES3.instances.test1",
- };
-
- Map<String,String> config = new HashMap<>();
- config.put("glconfig", "rgba8888d24s8");
- config.put("rotation", "unspecified");
- config.put("surfacetype", "window");
-
- Map<TestIdentifier, List<Map<String, String>>> instances = new HashMap<>();
-
- instances.put(testIds[0], new ArrayList<Map<String,String>>());
- instances.get(testIds[0]).add(config);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- for (TestIdentifier id : testIds) {
- tests.add(id);
- }
-
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IMocksControl orderedControl = EasyMock.createStrictControl();
- ITestDevice mockDevice = orderedControl.createMock(ITestDevice.class);
- IDevice mockIDevice = orderedControl.createMock(IDevice.class);
-
- DeqpTestRunner.IRecovery mockRecovery = EasyMock.createMock(DeqpTestRunner.IRecovery.class);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instances);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.setRecovery(mockRecovery);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- mockRecovery.onExecutionProgressed();
- EasyMock.expectLastCall().atLeastOnce();
-
- mockRecovery.setDevice(mockDevice);
- EasyMock.expectLastCall().atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- // query config
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run config and fail
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test1}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerBroken);
-
- mockRecovery.recoverComLinkKilled();
- EasyMock.expectLastCall().once();
-
- // Re-try
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test1}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerOk);
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- // test1
- mockListener.testStarted(EasyMock.eq(testIds[0]));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[0]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- orderedControl.replay();
- EasyMock.replay(mockListener);
- EasyMock.replay(mockRecovery);
- deqpTest.run(mockListener);
-
- EasyMock.verify(mockListener);
- orderedControl.verify();
- EasyMock.verify(mockRecovery);
- }
-
- /**
- * Test handling of interrupted line in the instrumentation output
- * and recovery from the error.
- */
- public void testRun_testCasePathInterrupted() throws Exception {
- final String instrumentationAnswerOk1 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.test1\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
- final String instrumentationAnswerOk2 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.test2\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
- final String instrumentationAnswerBroken =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePat";
-
- final TestIdentifier[] testIds = {
- new TestIdentifier("dEQP-GLES3.instances", "test1"),
- new TestIdentifier("dEQP-GLES3.instances", "test2"),
- };
-
- final String[] testPaths = {
- "dEQP-GLES3.instances.test1",
- "dEQP-GLES3.instances.test2",
- };
-
- Map<String,String> config = new HashMap<>();
- config.put("glconfig", "rgba8888d24s8");
- config.put("rotation", "unspecified");
- config.put("surfacetype", "window");
-
- Map<TestIdentifier, List<Map<String, String>>> instances = new HashMap<>();
-
- instances.put(testIds[0], new ArrayList<Map<String,String>>());
- instances.get(testIds[0]).add(config);
- instances.put(testIds[1], new ArrayList<Map<String,String>>());
- instances.get(testIds[1]).add(config);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- for (TestIdentifier id : testIds) {
- tests.add(id);
- }
-
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IMocksControl orderedControl = EasyMock.createStrictControl();
- ITestDevice mockDevice = orderedControl.createMock(ITestDevice.class);
- IDevice mockIDevice = orderedControl.createMock(IDevice.class);
-
- DeqpTestRunner.IRecovery mockRecovery = EasyMock.createMock(DeqpTestRunner.IRecovery.class);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instances);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.setRecovery(mockRecovery);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- mockRecovery.onExecutionProgressed();
- EasyMock.expectLastCall().atLeastOnce();
-
- mockRecovery.setDevice(mockDevice);
- EasyMock.expectLastCall().atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- // query config
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run config and fail
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test1,test2}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerBroken);
-
- mockRecovery.recoverComLinkKilled();
- EasyMock.expectLastCall().once();
-
- // Re-try
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test1}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerOk1);
-
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test2}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerOk2);
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
-
- mockListener.testRunStarted(ID, 2);
- EasyMock.expectLastCall().once();
-
- // test1
- mockListener.testStarted(EasyMock.eq(testIds[0]));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[0]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- // test2
- mockListener.testStarted(EasyMock.eq(testIds[1]));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[1]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- orderedControl.replay();
- EasyMock.replay(mockListener);
- EasyMock.replay(mockRecovery);
- deqpTest.run(mockListener);
-
- EasyMock.verify(mockListener);
- orderedControl.verify();
- EasyMock.verify(mockRecovery);
- }
-
- /**
- * Test handling of interrupted line in the instrumentation output
- * and recovery from the error.
- */
- public void testRun_testCasePathMissing() throws Exception {
- final String instrumentationAnswerOk1 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.test1\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
- final String instrumentationAnswerOk2 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.test2\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
- final String instrumentationAnswerBroken =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n";
-
-
- final TestIdentifier[] testIds = {
- new TestIdentifier("dEQP-GLES3.instances", "test1"),
- new TestIdentifier("dEQP-GLES3.instances", "test2"),
- };
-
- final String[] testPaths = {
- "dEQP-GLES3.instances.test1",
- "dEQP-GLES3.instances.test2",
- };
-
- Map<String,String> config = new HashMap<>();
- config.put("glconfig", "rgba8888d24s8");
- config.put("rotation", "unspecified");
- config.put("surfacetype", "window");
-
- Map<TestIdentifier, List<Map<String, String>>> instances = new HashMap<>();
-
- instances.put(testIds[0], new ArrayList<Map<String,String>>());
- instances.get(testIds[0]).add(config);
- instances.put(testIds[1], new ArrayList<Map<String,String>>());
- instances.get(testIds[1]).add(config);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- for (TestIdentifier id : testIds) {
- tests.add(id);
- }
-
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IMocksControl orderedControl = EasyMock.createStrictControl();
- ITestDevice mockDevice = orderedControl.createMock(ITestDevice.class);
- IDevice mockIDevice = orderedControl.createMock(IDevice.class);
-
- DeqpTestRunner.IRecovery mockRecovery = EasyMock.createMock(DeqpTestRunner.IRecovery.class);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instances);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.setRecovery(mockRecovery);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- mockRecovery.onExecutionProgressed();
- EasyMock.expectLastCall().atLeastOnce();
-
- mockRecovery.setDevice(mockDevice);
- EasyMock.expectLastCall().atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- // query config
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run config and fail
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test1,test2}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerBroken);
-
- mockRecovery.recoverComLinkKilled();
- EasyMock.expectLastCall().once();
-
- // Re-try
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test1}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerOk1);
-
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{test2}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerOk2);
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
-
- mockListener.testRunStarted(ID, 2);
- EasyMock.expectLastCall().once();
-
- // test1
- mockListener.testStarted(EasyMock.eq(testIds[0]));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[0]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- // test2
- mockListener.testStarted(EasyMock.eq(testIds[1]));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[1]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- orderedControl.replay();
- EasyMock.replay(mockListener);
- EasyMock.replay(mockRecovery);
- deqpTest.run(mockListener);
-
- EasyMock.verify(mockListener);
- orderedControl.verify();
- EasyMock.verify(mockRecovery);
- }
-
- /**
- * Test dEQP with multiple instances
- */
- public void testRun_multipleInstances() throws Exception {
- final String instrumentationAnswerConfigAPass1 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.passall\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.failone\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.crashtwo\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"; // early eof
- final String instrumentationAnswerConfigAPass2 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.crashtwo\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"; // early eof
- final String instrumentationAnswerConfigBPass1 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.passall\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.skipone\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
- final String instrumentationAnswerConfigBPass2 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.crashtwo\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TerminateTestCase-Reason=Magic\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TerminateTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
- final String instrumentationAnswerConfigCPass1 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.failone\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Fail\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Fail\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
- final String instrumentationAnswerConfigCPass2 =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.instances.crashtwo\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- final TestIdentifier[] testIds = {
- new TestIdentifier("dEQP-GLES3.instances", "passall"),
- new TestIdentifier("dEQP-GLES3.instances", "failone"),
- new TestIdentifier("dEQP-GLES3.instances", "crashtwo"),
- new TestIdentifier("dEQP-GLES3.instances", "skipone"),
- };
-
- final String[] testPaths = {
- "dEQP-GLES3.instances.passall",
- "dEQP-GLES3.instances.failone",
- "dEQP-GLES3.instances.crashtwo",
- "dEQP-GLES3.instances.skipone",
- };
-
- Map<String,String> supportedConfigA = new HashMap<>();
- supportedConfigA.put("glconfig", "rgba8888d24s8");
- supportedConfigA.put("rotation", "unspecified");
- supportedConfigA.put("surfacetype", "window");
-
- Map<String,String> supportedConfigB = new HashMap<>();
- supportedConfigB.put("glconfig", "rgba8888d24s8");
- supportedConfigB.put("rotation", "90");
- supportedConfigB.put("surfacetype", "window");
-
- Map<String,String> supportedConfigC = new HashMap<>();
- supportedConfigC.put("glconfig", "rgba8888d24s8");
- supportedConfigC.put("rotation", "180");
- supportedConfigC.put("surfacetype", "window");
-
- Map<String,String> unsupportedConfig = new HashMap<>();
- unsupportedConfig.put("glconfig", "rgb565d16s0");
- unsupportedConfig.put("rotation", "unspecified");
- unsupportedConfig.put("surfacetype", "window");
-
- Map<TestIdentifier, List<Map<String, String>>> instances = new HashMap<>();
-
- // pass all
- instances.put(testIds[0], new ArrayList<Map<String,String>>());
- instances.get(testIds[0]).add(supportedConfigA);
- instances.get(testIds[0]).add(supportedConfigB);
-
- // fail one
- instances.put(testIds[1], new ArrayList<Map<String,String>>());
- instances.get(testIds[1]).add(supportedConfigA);
- instances.get(testIds[1]).add(supportedConfigC);
-
- // crash two
- instances.put(testIds[2], new ArrayList<Map<String,String>>());
- instances.get(testIds[2]).add(supportedConfigA);
- instances.get(testIds[2]).add(supportedConfigC);
- instances.get(testIds[2]).add(supportedConfigB);
-
- // skip one
- instances.put(testIds[3], new ArrayList<Map<String,String>>());
- instances.get(testIds[3]).add(supportedConfigB);
- instances.get(testIds[3]).add(unsupportedConfig);
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- for (TestIdentifier id : testIds) {
- tests.add(id);
- }
-
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IMocksControl orderedControl = EasyMock.createStrictControl();
- ITestDevice mockDevice = orderedControl.createMock(ITestDevice.class);
- IDevice mockIDevice = orderedControl.createMock(IDevice.class);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instances);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- // query config A
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run config A - first pass
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{passall,failone,crashtwo}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerConfigAPass1);
-
- // run config A - second pass
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{crashtwo}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerConfigAPass2);
-
- // query for config B
-
- EasyMock.expect(mockDevice.executeShellCommand("pm list features")).andReturn(ALL_FEATURES)
- .once();
-
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=90 "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run for config B - first pass
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{passall,skipone}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=90 "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerConfigBPass1);
-
- // query for config C
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=180 "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run for config C - first pass
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{failone}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=180 "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerConfigCPass1);
-
- // run for config C - second pass
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{crashtwo}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=180 "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerConfigCPass2);
-
- // run for config B - second pass (crashtwo has been deferred due to its instability)
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{instances{crashtwo}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=90 "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerConfigBPass2);
-
- // query for unsupported config
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgb565d16s0 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "No");
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG)))
- .andReturn("").once();
-
- mockListener.testRunStarted(ID, 4);
- EasyMock.expectLastCall().once();
-
- // pass all
- mockListener.testStarted(EasyMock.eq(testIds[0]));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[0]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- // fail one
- mockListener.testStarted(EasyMock.eq(testIds[1]));
- EasyMock.expectLastCall().once();
-
- mockListener.testFailed(testIds[1],
- "=== with config {glformat=rgba8888d24s8,rotation=180,surfacetype=window} ===\n"
- + "Fail: Fail");
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[1]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- // crash two
- mockListener.testStarted(EasyMock.eq(testIds[2]));
- EasyMock.expectLastCall().once();
-
- mockListener.testFailed(testIds[2],
- "=== with config {glformat=rgba8888d24s8,rotation=unspecified,surfacetype=window} ===\n"
- + "Crash: Incomplete test log\n"
- + "=== with config {glformat=rgba8888d24s8,rotation=90,surfacetype=window} ===\n"
- + "Terminated: Magic");
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[2]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- // skip one
- mockListener.testStarted(EasyMock.eq(testIds[3]));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testIds[3]), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- orderedControl.replay();
- EasyMock.replay(mockListener);
- deqpTest.setRecovery(new StubRecovery());
- deqpTest.run(mockListener);
- EasyMock.verify(mockListener);
- orderedControl.verify();
- }
-
- private void testMultipleInstancesLossOfDeviceMidInstance(final boolean recoverySuccessful)
- throws Exception {
- final String instrumentationAnswerFine =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.loss.instance\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Pass\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
- final String instrumentationAnswerCrash =
- "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=dEQP-GLES3.loss.instance\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"; // early <EOF>
-
- final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.loss", "instance");
-
- Map<String,String> supportedConfigA = new HashMap<>();
- supportedConfigA.put("glconfig", "rgba8888d24s8");
- supportedConfigA.put("rotation", "unspecified");
- supportedConfigA.put("surfacetype", "window");
-
- Map<String,String> supportedConfigB = new HashMap<>();
- supportedConfigB.put("glconfig", "rgba8888d24s8");
- supportedConfigB.put("rotation", "90");
- supportedConfigB.put("surfacetype", "window");
-
- Map<String,String> supportedConfigC = new HashMap<>();
- supportedConfigC.put("glconfig", "rgba8888d24s8");
- supportedConfigC.put("rotation", "180");
- supportedConfigC.put("surfacetype", "window");
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- tests.add(testId);
-
- Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
- instance.put(testId, new ArrayList<Map<String,String>>());
- instance.get(testId).add(supportedConfigA);
- instance.get(testId).add(supportedConfigB);
- instance.get(testId).add(supportedConfigC);
-
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- IDevice mockIDevice = EasyMock.createMock(IDevice.class);
- DeqpTestRunner.IRecovery mockRecovery = EasyMock.createMock(DeqpTestRunner.IRecovery.class);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.setRecovery(mockRecovery);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
- EasyMock.expect(mockDevice.executeShellCommand("pm list features")).andReturn(ALL_FEATURES)
- .anyTimes();
-
- mockRecovery.onExecutionProgressed();
- EasyMock.expectLastCall().atLeastOnce();
-
- mockRecovery.setDevice(mockDevice);
- EasyMock.expectLastCall().atLeastOnce();
-
- if (!recoverySuccessful) {
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
- } else {
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").times(2);
- }
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- // query config A
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run config A
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{loss{instance}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerFine);
-
- // query config B
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=90 "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run config B
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + CASE_LIST_FILE_NAME)))
- .andReturn("").once();
-
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + LOG_FILE_NAME)))
- .andReturn("").once();
-
- EasyMock.expect(mockDevice.pushString("{dEQP-GLES3{loss{instance}}}\n", CASE_LIST_FILE_NAME))
- .andReturn(true).once();
-
- String command = String.format(
- "am instrument %s -w -e deqpLogFileName \"%s\" -e deqpCmdLine \""
- + "--deqp-caselist-file=%s"
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=90 "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable\" "
- + "-e deqpLogData \"%s\" %s",
- AbiUtils.createAbiFlag(UnitTests.ABI.getName()), LOG_FILE_NAME,
- CASE_LIST_FILE_NAME, false, INSTRUMENTATION_NAME);
-
- EasyMock.expect(mockDevice.getIDevice()).andReturn(mockIDevice);
- mockIDevice.executeShellCommand(EasyMock.eq(command),
- EasyMock.<IShellOutputReceiver>notNull(), EasyMock.anyLong(),
- EasyMock.isA(TimeUnit.class));
-
- EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
- @Override
- public Object answer() throws ShellCommandUnresponsiveException {
- IShellOutputReceiver receiver
- = (IShellOutputReceiver)EasyMock.getCurrentArguments()[1];
-
- receiver.addOutput(instrumentationAnswerCrash.getBytes(), 0,
- instrumentationAnswerCrash.length());
- throw new ShellCommandUnresponsiveException();
- }
- });
-
- if (!recoverySuccessful) {
- mockRecovery.recoverComLinkKilled();
- EasyMock.expectLastCall().andThrow(new DeviceNotAvailableException()).once();
- } else {
- mockRecovery.recoverComLinkKilled();
- EasyMock.expectLastCall().once();
-
- // retry running config B
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{loss{instance}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=90 "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerFine);
-
- // query config C
- expectRenderConfigQueryAndReturn(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=180 "
- + "--deqp-surface-type=window "
- + "--deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0", "Yes");
-
- // run config C
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice,
- "{dEQP-GLES3{loss{instance}}}",
- "--deqp-caselist-file=" + CASE_LIST_FILE_NAME
- + " --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=180 "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable", instrumentationAnswerFine);
- }
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- // result is reported only if device is available
- if (recoverySuccessful) {
- mockListener.testStarted(EasyMock.eq(testId));
- EasyMock.expectLastCall().once();
-
- mockListener.testEnded(EasyMock.eq(testId), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
-
- mockListener.testRunEnded(EasyMock.anyLong(), EasyMock.<Map<String, String>>notNull());
- EasyMock.expectLastCall().once();
- }
-
- EasyMock.replay(mockDevice, mockIDevice);
- EasyMock.replay(mockListener);
- EasyMock.replay(mockRecovery);
-
- try {
- deqpTest.run(mockListener);
-
- if (!recoverySuccessful) {
- fail("did not get DeviceNotAvailableException");
- }
- } catch (DeviceNotAvailableException ex) {
- if (recoverySuccessful) {
- fail("got DeviceNotAvailableException");
- }
- }
-
- EasyMock.verify(mockRecovery);
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice, mockIDevice);
- }
-
- /**
- * Test dEQP with runner if device is lost during one of multiple instances.
- */
- public void testRun_multipleInstancesLossOfDeviceMidInstance() throws Exception {
- testMultipleInstancesLossOfDeviceMidInstance(false);
- }
-
- /**
- * Test dEQP with runner if device is lost during one of multiple instances but recovery
- * is successful.
- */
- public void testRun_multipleInstancesLossOfDeviceMidInstanceAndRecovery() throws Exception {
- testMultipleInstancesLossOfDeviceMidInstance(true);
- }
-
- public static interface RecoverableTestDevice extends ITestDevice {
- public void recoverDevice() throws DeviceNotAvailableException;
- }
-
- private static enum RecoveryEvent {
- PROGRESS,
- FAIL_CONNECTION_REFUSED,
- FAIL_LINK_KILLED,
- };
-
- private void runRecoveryWithPattern(DeqpTestRunner.Recovery recovery, RecoveryEvent[] events)
- throws DeviceNotAvailableException {
- for (RecoveryEvent event : events) {
- switch (event) {
- case PROGRESS:
- recovery.onExecutionProgressed();
- break;
- case FAIL_CONNECTION_REFUSED:
- recovery.recoverConnectionRefused();
- break;
- case FAIL_LINK_KILLED:
- recovery.recoverComLinkKilled();
- break;
- }
- }
- }
-
- private void setRecoveryExpectationWait(DeqpTestRunner.ISleepProvider mockSleepProvider) {
- mockSleepProvider.sleep(EasyMock.gt(0));
- EasyMock.expectLastCall().once();
- }
-
- private void setRecoveryExpectationKillProcess(RecoverableTestDevice mockDevice,
- DeqpTestRunner.ISleepProvider mockSleepProvider) throws DeviceNotAvailableException {
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.contains("ps"))).
- andReturn("root 1234 com.drawelement.deqp").once();
-
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("kill -9 1234"))).
- andReturn("").once();
-
- // Recovery checks if kill failed
- mockSleepProvider.sleep(EasyMock.gt(0));
- EasyMock.expectLastCall().once();
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.contains("ps"))).
- andReturn("").once();
- }
-
- private void setRecoveryExpectationRecovery(RecoverableTestDevice mockDevice)
- throws DeviceNotAvailableException {
- mockDevice.recoverDevice();
- EasyMock.expectLastCall().once();
- }
-
- private void setRecoveryExpectationReboot(RecoverableTestDevice mockDevice)
- throws DeviceNotAvailableException {
- mockDevice.reboot();
- EasyMock.expectLastCall().once();
- }
-
- private int setRecoveryExpectationOfAConnFailure(RecoverableTestDevice mockDevice,
- DeqpTestRunner.ISleepProvider mockSleepProvider, int numConsecutiveErrors)
- throws DeviceNotAvailableException {
- switch (numConsecutiveErrors) {
- case 0:
- case 1:
- setRecoveryExpectationRecovery(mockDevice);
- return 2;
- case 2:
- setRecoveryExpectationReboot(mockDevice);
- return 3;
- default:
- return 4;
- }
- }
-
- private int setRecoveryExpectationOfAComKilled(RecoverableTestDevice mockDevice,
- DeqpTestRunner.ISleepProvider mockSleepProvider, int numConsecutiveErrors)
- throws DeviceNotAvailableException {
- switch (numConsecutiveErrors) {
- case 0:
- setRecoveryExpectationWait(mockSleepProvider);
- setRecoveryExpectationKillProcess(mockDevice, mockSleepProvider);
- return 1;
- case 1:
- setRecoveryExpectationRecovery(mockDevice);
- setRecoveryExpectationKillProcess(mockDevice, mockSleepProvider);
- return 2;
- case 2:
- setRecoveryExpectationReboot(mockDevice);
- return 3;
- default:
- return 4;
- }
- }
-
- private void setRecoveryExpectationsOfAPattern(RecoverableTestDevice mockDevice,
- DeqpTestRunner.ISleepProvider mockSleepProvider, RecoveryEvent[] events)
- throws DeviceNotAvailableException {
- int numConsecutiveErrors = 0;
- for (RecoveryEvent event : events) {
- switch (event) {
- case PROGRESS:
- numConsecutiveErrors = 0;
- break;
- case FAIL_CONNECTION_REFUSED:
- numConsecutiveErrors = setRecoveryExpectationOfAConnFailure(mockDevice,
- mockSleepProvider, numConsecutiveErrors);
- break;
- case FAIL_LINK_KILLED:
- numConsecutiveErrors = setRecoveryExpectationOfAComKilled(mockDevice,
- mockSleepProvider, numConsecutiveErrors);
- break;
- }
- }
- }
-
- /**
- * Test dEQP runner recovery state machine.
- */
- private void testRecoveryWithPattern(boolean expectSuccess, RecoveryEvent...pattern)
- throws Exception {
- DeqpTestRunner.Recovery recovery = new DeqpTestRunner.Recovery();
- IMocksControl orderedControl = EasyMock.createStrictControl();
- RecoverableTestDevice mockDevice = orderedControl.createMock(RecoverableTestDevice.class);
- DeqpTestRunner.ISleepProvider mockSleepProvider =
- orderedControl.createMock(DeqpTestRunner.ISleepProvider.class);
-
- setRecoveryExpectationsOfAPattern(mockDevice, mockSleepProvider, pattern);
-
- orderedControl.replay();
-
- recovery.setDevice(mockDevice);
- recovery.setSleepProvider(mockSleepProvider);
- try {
- runRecoveryWithPattern(recovery, pattern);
- if (!expectSuccess) {
- fail("Expected DeviceNotAvailableException");
- }
- } catch (DeviceNotAvailableException ex) {
- if (expectSuccess) {
- fail("Did not expect DeviceNotAvailableException");
- }
- }
-
- orderedControl.verify();
- }
-
- // basic patterns
-
- public void testRecovery_NoEvents() throws Exception {
- testRecoveryWithPattern(true);
- }
-
- public void testRecovery_AllOk() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.PROGRESS, RecoveryEvent.PROGRESS);
- }
-
- // conn fail patterns
-
- public void testRecovery_OneConnectionFailureBegin() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.FAIL_CONNECTION_REFUSED,
- RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_TwoConnectionFailuresBegin() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.FAIL_CONNECTION_REFUSED,
- RecoveryEvent.FAIL_CONNECTION_REFUSED, RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_ThreeConnectionFailuresBegin() throws Exception {
- testRecoveryWithPattern(false, RecoveryEvent.FAIL_CONNECTION_REFUSED,
- RecoveryEvent.FAIL_CONNECTION_REFUSED, RecoveryEvent.FAIL_CONNECTION_REFUSED);
- }
-
- public void testRecovery_OneConnectionFailureMid() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.PROGRESS,
- RecoveryEvent.FAIL_CONNECTION_REFUSED, RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_TwoConnectionFailuresMid() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.PROGRESS,
- RecoveryEvent.FAIL_CONNECTION_REFUSED, RecoveryEvent.FAIL_CONNECTION_REFUSED,
- RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_ThreeConnectionFailuresMid() throws Exception {
- testRecoveryWithPattern(false, RecoveryEvent.PROGRESS,
- RecoveryEvent.FAIL_CONNECTION_REFUSED, RecoveryEvent.FAIL_CONNECTION_REFUSED,
- RecoveryEvent.FAIL_CONNECTION_REFUSED);
- }
-
- // link fail patterns
-
- public void testRecovery_OneLinkFailureBegin() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_TwoLinkFailuresBegin() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.FAIL_LINK_KILLED, RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_ThreeLinkFailuresBegin() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.FAIL_LINK_KILLED, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_FourLinkFailuresBegin() throws Exception {
- testRecoveryWithPattern(false, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.FAIL_LINK_KILLED, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.FAIL_LINK_KILLED);
- }
-
- public void testRecovery_OneLinkFailureMid() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.PROGRESS,
- RecoveryEvent.FAIL_LINK_KILLED, RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_TwoLinkFailuresMid() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.PROGRESS,
- RecoveryEvent.FAIL_LINK_KILLED, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_ThreeLinkFailuresMid() throws Exception {
- testRecoveryWithPattern(true, RecoveryEvent.PROGRESS,
- RecoveryEvent.FAIL_LINK_KILLED, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.FAIL_LINK_KILLED, RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_FourLinkFailuresMid() throws Exception {
- testRecoveryWithPattern(false, RecoveryEvent.PROGRESS, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.FAIL_LINK_KILLED, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.FAIL_LINK_KILLED);
- }
-
- // mixed patterns
-
- public void testRecovery_MixedFailuresProgressBetween() throws Exception {
- testRecoveryWithPattern(true,
- RecoveryEvent.PROGRESS, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.PROGRESS, RecoveryEvent.FAIL_CONNECTION_REFUSED,
- RecoveryEvent.PROGRESS, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.PROGRESS, RecoveryEvent.FAIL_CONNECTION_REFUSED,
- RecoveryEvent.PROGRESS);
- }
-
- public void testRecovery_MixedFailuresNoProgressBetween() throws Exception {
- testRecoveryWithPattern(true,
- RecoveryEvent.PROGRESS, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.FAIL_CONNECTION_REFUSED, RecoveryEvent.FAIL_LINK_KILLED,
- RecoveryEvent.PROGRESS);
- }
-
- /**
- * Test recovery if process cannot be killed
- */
- public void testRecovery_unkillableProcess () throws Exception {
- DeqpTestRunner.Recovery recovery = new DeqpTestRunner.Recovery();
- IMocksControl orderedControl = EasyMock.createStrictControl();
- RecoverableTestDevice mockDevice = orderedControl.createMock(RecoverableTestDevice.class);
- DeqpTestRunner.ISleepProvider mockSleepProvider =
- orderedControl.createMock(DeqpTestRunner.ISleepProvider.class);
-
- // recovery attempts to kill the process after a timeout
- mockSleepProvider.sleep(EasyMock.gt(0));
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.contains("ps"))).
- andReturn("root 1234 com.drawelement.deqp").once();
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("kill -9 1234"))).
- andReturn("").once();
-
- // Recovery checks if kill failed
- mockSleepProvider.sleep(EasyMock.gt(0));
- EasyMock.expectLastCall().once();
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.contains("ps"))).
- andReturn("root 1234 com.drawelement.deqp").once();
-
- // Recovery resets the connection
- mockDevice.recoverDevice();
- EasyMock.expectLastCall().once();
-
- // and attempts to kill the process again
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.contains("ps"))).
- andReturn("root 1234 com.drawelement.deqp").once();
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("kill -9 1234"))).
- andReturn("").once();
-
- // Recovery checks if kill failed
- mockSleepProvider.sleep(EasyMock.gt(0));
- EasyMock.expectLastCall().once();
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.contains("ps"))).
- andReturn("root 1234 com.drawelement.deqp").once();
-
- // recovery reboots the device
- mockDevice.reboot();
- EasyMock.expectLastCall().once();
-
- orderedControl.replay();
- recovery.setDevice(mockDevice);
- recovery.setSleepProvider(mockSleepProvider);
- recovery.recoverComLinkKilled();
- orderedControl.verify();
- }
-
- /**
- * Test external interruption before batch run.
- */
- public void testInterrupt_killBeforeBatch() throws Exception {
- final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.interrupt", "test");
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- tests.add(testId);
-
- Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
- instance.put(testId, DEFAULT_INSTANCE_ARGS);
-
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- IDevice mockIDevice = EasyMock.createMock(IDevice.class);
- IRunUtil mockRunUtil = EasyMock.createMock(IRunUtil.class);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.setRunUtil(mockRunUtil);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- expectRenderConfigQuery(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 --deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window --deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0");
-
- mockRunUtil.sleep(0);
- EasyMock.expectLastCall().andThrow(new RunInterruptedException());
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- EasyMock.replay(mockDevice, mockIDevice);
- EasyMock.replay(mockListener);
- EasyMock.replay(mockRunUtil);
- try {
- deqpTest.run(mockListener);
- fail("expected RunInterruptedException");
- } catch (RunInterruptedException ex) {
- // expected
- }
- EasyMock.verify(mockRunUtil);
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice, mockIDevice);
- }
-
- /**
- * Test external interruption in testFailed().
- */
- public void testInterrupt_killReportTestFailed() throws Exception {
- final TestIdentifier testId = new TestIdentifier("dEQP-GLES3.interrupt", "test");
- final String testPath = "dEQP-GLES3.interrupt.test";
- final String testTrie = "{dEQP-GLES3{interrupt{test}}}";
- final String output = "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=2014.x\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=releaseId\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=0xcafebabe\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Name=targetName\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=SessionInfo\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-SessionInfo-Value=android\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=BeginTestCase\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-BeginTestCase-TestCasePath=" + testPath + "\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Code=Fail\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-TestCaseResult-Details=Fail\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=TestCaseResult\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndTestCase\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_STATUS: dEQP-EventType=EndSession\r\n"
- + "INSTRUMENTATION_STATUS_CODE: 0\r\n"
- + "INSTRUMENTATION_CODE: 0\r\n";
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>();
- tests.add(testId);
-
- Map<TestIdentifier, List<Map<String, String>>> instance = new HashMap<>();
- instance.put(testId, DEFAULT_INSTANCE_ARGS);
-
- ITestInvocationListener mockListener
- = EasyMock.createStrictMock(ITestInvocationListener.class);
- ITestDevice mockDevice = EasyMock.createMock(ITestDevice.class);
- IDevice mockIDevice = EasyMock.createMock(IDevice.class);
- IRunUtil mockRunUtil = EasyMock.createMock(IRunUtil.class);
-
- DeqpTestRunner deqpTest = new DeqpTestRunner(NAME, NAME, tests, instance);
- deqpTest.setAbi(UnitTests.ABI);
- deqpTest.setDevice(mockDevice);
- deqpTest.setBuildHelper(new StubCtsBuildHelper());
- deqpTest.setRunUtil(mockRunUtil);
-
- int version = 3 << 16;
- EasyMock.expect(mockDevice.getProperty("ro.opengles.version"))
- .andReturn(Integer.toString(version)).atLeastOnce();
-
- EasyMock.expect(mockDevice.uninstallPackage(EasyMock.eq(DEQP_ONDEVICE_PKG))).
- andReturn("").once();
-
- EasyMock.expect(mockDevice.installPackage(EasyMock.<File>anyObject(),
- EasyMock.eq(true),
- EasyMock.eq(AbiUtils.createAbiFlag(UnitTests.ABI.getName())))).andReturn(null)
- .once();
-
- expectRenderConfigQuery(mockDevice,
- "--deqp-gl-config-name=rgba8888d24s8 --deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window --deqp-gl-major-version=3 "
- + "--deqp-gl-minor-version=0");
-
- mockRunUtil.sleep(0);
- EasyMock.expectLastCall().once();
-
- String commandLine = String.format(
- "--deqp-caselist-file=%s --deqp-gl-config-name=rgba8888d24s8 "
- + "--deqp-screen-rotation=unspecified "
- + "--deqp-surface-type=window "
- + "--deqp-log-images=disable "
- + "--deqp-watchdog=enable",
- CASE_LIST_FILE_NAME);
-
- runInstrumentationLineAndAnswer(mockDevice, mockIDevice, testTrie, commandLine,
- output);
-
- mockListener.testRunStarted(ID, 1);
- EasyMock.expectLastCall().once();
-
- mockListener.testStarted(EasyMock.eq(testId));
- EasyMock.expectLastCall().once();
-
- mockListener.testFailed(EasyMock.eq(testId), EasyMock.<String>notNull());
- EasyMock.expectLastCall().andThrow(new RunInterruptedException());
-
- EasyMock.replay(mockDevice, mockIDevice);
- EasyMock.replay(mockListener);
- EasyMock.replay(mockRunUtil);
- try {
- deqpTest.run(mockListener);
- fail("expected RunInterruptedException");
- } catch (RunInterruptedException ex) {
- // expected
- }
- EasyMock.verify(mockRunUtil);
- EasyMock.verify(mockListener);
- EasyMock.verify(mockDevice, mockIDevice);
- }
-
- private void runInstrumentationLineAndAnswer(ITestDevice mockDevice, IDevice mockIDevice,
- final String testTrie, final String cmd, final String output) throws Exception {
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + CASE_LIST_FILE_NAME)))
- .andReturn("").once();
-
- EasyMock.expect(mockDevice.executeShellCommand(EasyMock.eq("rm " + LOG_FILE_NAME)))
- .andReturn("").once();
-
- EasyMock.expect(mockDevice.pushString(testTrie + "\n", CASE_LIST_FILE_NAME))
- .andReturn(true).once();
-
- String command = String.format(
- "am instrument %s -w -e deqpLogFileName \"%s\" -e deqpCmdLine \"%s\" "
- + "-e deqpLogData \"%s\" %s",
- AbiUtils.createAbiFlag(UnitTests.ABI.getName()), LOG_FILE_NAME, cmd, false,
- INSTRUMENTATION_NAME);
-
- EasyMock.expect(mockDevice.getIDevice()).andReturn(mockIDevice);
- mockIDevice.executeShellCommand(EasyMock.eq(command),
- EasyMock.<IShellOutputReceiver>notNull(), EasyMock.anyLong(),
- EasyMock.isA(TimeUnit.class));
-
- EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
- @Override
- public Object answer() {
- IShellOutputReceiver receiver
- = (IShellOutputReceiver)EasyMock.getCurrentArguments()[1];
-
- receiver.addOutput(output.getBytes(), 0, output.length());
- receiver.flush();
-
- return null;
- }
- });
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/GeeTestTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/GeeTestTest.java
deleted file mode 100644
index 93272be..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/GeeTestTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2015 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 com.android.cts.tradefed.testtype;
-
-import com.android.cts.tradefed.UnitTests;
-
-import junit.framework.TestCase;
-
-/**
- * Unit tests for {@link GeeTest}.
- */
-public class GeeTestTest extends TestCase {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /**
- * Test {@link GeeTestTest#getGTestFilters}
- * @throws DeviceNotAvailableException
- */
- public void testGetGTestFilters() {
- GeeTest test = new GeeTest("package_foo", "exe_foo");
- test.setPositiveFilters("a");
- test.setNegativeFilters("b");
- String actual = test.getGTestFilters();
- assertEquals("--gtest_filter=a:-b", actual);
- }
-
- /**
- * Test {@link GeeTestTest#getGTestFilters} with only positive filters
- * @throws DeviceNotAvailableException
- */
- public void testGetGTestFiltersPositiveOnly() {
- GeeTest test = new GeeTest("package_foo", "exe_foo");
- test.setPositiveFilters("a");
- String actual = test.getGTestFilters();
- assertEquals("--gtest_filter=a", actual);
- }
-
- /**
- * Test {@link GeeTestTest#getGTestFilters} with only negative filters
- * @throws DeviceNotAvailableException
- */
- public void testGetGTestFiltersNegativeOnly() {
- GeeTest test = new GeeTest("package_foo", "exe_foo");
- test.setNegativeFilters("b");
- String actual = test.getGTestFilters();
- assertEquals("--gtest_filter=-b", actual);
- }
-
- /**
- * Test {@link GeeTestTest#getGTestFilters} with empty filters
- * @throws DeviceNotAvailableException
- */
- public void testGetGTestFiltersWithNoFilters() {
- GeeTest test = new GeeTest("package_foo", "exe_foo");
- String actual = test.getGTestFilters();
- assertEquals("", actual);
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/JarHostTestTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/JarHostTestTest.java
deleted file mode 100644
index dfe4413..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/JarHostTestTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.cts.tradefed.build.StubCtsBuildHelper;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.result.ITestInvocationListener;
-
-import org.easymock.EasyMock;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-import junit.framework.TestCase;
-
-/**
- * Unit tests for {@link JarHostTest}.
- */
-public class JarHostTestTest extends TestCase {
-
- private static final String RUN_NAME = "run";
- private JarHostTest mJarTest;
- private StubCtsBuildHelper mStubBuildHelper;
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mJarTest = new JarHostTest() {
- // mock out the loading from jar
- @Override
- Class<?> loadClass(String className, URL[] urls) throws ClassNotFoundException {
- return MockTest.class;
- }
- };
- mStubBuildHelper = new StubCtsBuildHelper();
- mJarTest.setBuildHelper(mStubBuildHelper);
- }
-
- public static class MockTest extends TestCase {
- public MockTest(String name) {
- super(name);
- }
-
- public MockTest() {
- super();
- }
-
- public void testFoo() {
- }
- }
-
- /**
- * Test normal case for
- * {@link JarHostTest#run(com.android.tradefed.result.ITestInvocationListener)}.
- */
- @SuppressWarnings("unchecked")
- public void testRun() throws DeviceNotAvailableException {
- ITestInvocationListener listener = EasyMock.createMock(ITestInvocationListener.class);
- TestIdentifier expectedTest = new TestIdentifier(MockTest.class.getName(), "testFoo");
-
- Collection<TestIdentifier> tests = new ArrayList<TestIdentifier>(1);
- tests.add(expectedTest);
- listener.testRunStarted(RUN_NAME, 1);
- listener.testStarted(expectedTest);
- listener.testEnded(expectedTest, Collections.EMPTY_MAP);
- listener.testRunEnded(EasyMock.anyLong(), EasyMock.eq(Collections.EMPTY_MAP));
- mJarTest.setTests(tests);
- mJarTest.setDevice(EasyMock.createMock(ITestDevice.class));
- mJarTest.setJarFileName("fakefile");
- mJarTest.setRunName(RUN_NAME);
-
- EasyMock.replay(listener);
- mJarTest.run(listener);
- EasyMock.verify(listener);
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestFilterTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestFilterTest.java
deleted file mode 100644
index 2f76e1f..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestFilterTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.testtype;
-
-import com.android.ddmlib.testrunner.TestIdentifier;
-
-import junit.framework.TestCase;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Unit tests for {@link TestFilter}.
- */
-public class TestFilterTest extends TestCase {
-
- private TestFilter mFilter;
- private List<TestIdentifier> mTestList;
-
- private static final TestIdentifier TEST1 = new TestIdentifier("FooTest", "testFoo");
- private static final TestIdentifier TEST2 = new TestIdentifier("FooTest", "testFoo2");
- private static final TestIdentifier TEST3 = new TestIdentifier("FooTest2", "testFoo3");
-
- @Override
- protected void setUp() throws Exception {
- mFilter = new TestFilter();
- mTestList = new ArrayList<TestIdentifier>();
- mTestList.add(TEST1);
- mTestList.add(TEST2);
- mTestList.add(TEST3);
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} with no rules defined
- */
- public void testFilter_empty() {
- assertEquals(mTestList.size(), mFilter.filter(mTestList).size());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} with an excluded test filter
- */
- public void testFilter_excludeTest() {
- mFilter.addExcludedTest(TEST1);
- Collection<TestIdentifier> filteredList = mFilter.filter(mTestList);
- assertEquals(2, filteredList.size());
- Iterator<TestIdentifier> iter = filteredList.iterator();
- assertEquals(TEST2, iter.next());
- assertEquals(TEST3, iter.next());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} with an excluded test filter
- */
- public void testFilter_excludeClass() {
- mFilter.addExcludedClass(TEST1.getClassName());
- Collection<TestIdentifier> filteredList = mFilter.filter(mTestList);
- assertEquals(1, filteredList.size());
- assertEquals(TEST3, filteredList.iterator().next());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} with a class inclusion rule
- */
- public void testFilter_includeClass() {
- mFilter.setTestInclusion(TEST1.getClassName(), null);
- Collection<TestIdentifier> filteredList = mFilter.filter(mTestList);
- assertEquals(2, filteredList.size());
- Iterator<TestIdentifier> iter = filteredList.iterator();
- assertEquals(TEST1, iter.next());
- assertEquals(TEST2, iter.next());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} with a class
- */
- public void testFilter_includeTest() {
- mFilter.setTestInclusion(TEST1.getClassName(), TEST1.getTestName());
- Collection<TestIdentifier> filteredList = mFilter.filter(mTestList);
- assertEquals(1, filteredList.size());
- Iterator<TestIdentifier> iter = filteredList.iterator();
- assertEquals(TEST1, iter.next());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} with an included test filter
- */
- public void testFilter_includeClasses() {
- mFilter.addIncludedClass(TEST3.getClassName());
- Collection<TestIdentifier> filteredList = mFilter.filter(mTestList);
- assertEquals(1, filteredList.size());
- assertEquals(TEST3, filteredList.iterator().next());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} with an included test filter
- */
- public void testFilter_includeTests() {
- mFilter.addIncludedTest(TEST1);
- mFilter.addIncludedTest(TEST3);
- Collection<TestIdentifier> filteredList = mFilter.filter(mTestList);
- assertEquals(2, filteredList.size());
- Iterator<TestIdentifier> iter = filteredList.iterator();
- assertEquals(TEST1, iter.next());
- assertEquals(TEST3, iter.next());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)}. Exclusion overrides
- * inclusion.
- */
- public void testFilter_includeAndExcludeClasses() {
- String className = TEST3.getClassName();
- mFilter.addExcludedClass(className);
- mFilter.addIncludedClass(className);
- assertTrue(mFilter.filter(mTestList).isEmpty());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} Exclusion overrides
- * inclusion.
- */
- public void testFilter_includeAndExcludeTests() {
- mFilter.addExcludedTest(TEST1);
- mFilter.addIncludedTest(TEST1);
- assertTrue(mFilter.filter(mTestList).isEmpty());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} Exclusion overrides
- * inclusion.
- */
- public void testFilter_includeTestAndExcludeClass() {
- mFilter.addExcludedClass(TEST1.getClassName());
- mFilter.addIncludedTest(TEST1);
- assertTrue(mFilter.filter(mTestList).isEmpty());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} Exclusion overrides
- * inclusion.
- */
- public void testFilter_includeClassAndExcludeTest() {
- mFilter.addExcludedTest(TEST1);
- mFilter.addIncludedClass(TEST1.getClassName());
- Collection<TestIdentifier> filteredList = mFilter.filter(mTestList);
- assertEquals(1, filteredList.size());
- Iterator<TestIdentifier> iter = filteredList.iterator();
- assertEquals(TEST2, iter.next());
- }
-
- /**
- * Test {@link TestFilter#filter(java.util.Collection)} Exclusion overrides
- * inclusion.
- */
- public void testFilter_includeClassAndExcludeTests() {
- mFilter.addExcludedTest(TEST1);
- mFilter.addExcludedTest(TEST2);
- mFilter.addIncludedClass(TEST1.getClassName());
- assertTrue(mFilter.filter(mTestList).isEmpty());
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestPackageDefTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestPackageDefTest.java
deleted file mode 100644
index 2a5777b..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestPackageDefTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.cts.tradefed.testtype;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-/**
- * Unit tests for {@link TestPackageDef}.
- */
-public class TestPackageDefTest extends TestCase {
-
- /**
- * Regression test for {@link TestPackageDef#generateDigest(File, String)} that ensures expected
- * digest is generated for fixed data.
- */
- public void testGenerateDigest() {
- TestPackageDef def = new TestPackageDef() {
- @Override
- InputStream getFileStream(File dir, String fileName) {
- return new ByteArrayInputStream("test data for digest".getBytes());
- }
- };
- String digest = def.generateDigest(new File("unused"), "alsounused");
- assertNotNull(digest);
- assertEquals("58c222b5f5f81b4b58891ec59924b9b2f530452e", digest);
-
- }
-
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestPackageXmlParserTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestPackageXmlParserTest.java
deleted file mode 100644
index 8655885..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestPackageXmlParserTest.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Unit tests for {@link TestPackageXmlParser}.
- */
-public class TestPackageXmlParserTest extends TestCase {
-
- private static final String INSTR_TEST_DATA =
- "<TestPackage AndroidFramework=\"Android 1.0\" appNameSpace=\"com.example\" " +
- "appPackageName=\"android.example\" name=\"CtsExampleTestCases\" " +
- "runner=\"android.test.InstrumentationTestRunner\" version=\"1.0\">" +
- "</TestPackage>";
-
- private static final String HOST_TEST_DATA =
- "<TestPackage hostSideOnly=\"true\" >\n" +
- " <TestSuite name=\"com\" >\n" +
- " <TestSuite name=\"example\" >\n" +
- " <TestCase name=\"ExampleTest\" >\n" +
- " <Test name=\"testFoo\" />\n" +
- " <Test name=\"testFoo2\" expectation=\"failure\" />\n" +
- " </TestCase>\n" +
- " </TestSuite>\n" +
- " <TestSuite name=\"example2\" >\n" +
- " <TestCase name=\"Example2Test\" >\n" +
- " <Test name=\"testFoo\" />\n" +
- " </TestCase>\n" +
- " </TestSuite>\n" +
- " </TestSuite>\n" +
- "</TestPackage>";
-
- private static final String BAD_HOST_TEST_DATA =
- "<TestPackage hostSideOnly=\"blah\" >" +
- "</TestPackage>";
-
- private static final String VM_HOST_TEST_XML =
- "<TestPackage vmHostTest=\"true\"></TestPackage>";
-
- private static final String NATIVE_TEST_XML = "<TestPackage testType=\"native\"></TestPackage>";
-
- private static final String NO_TEST_DATA = "<invalid />";
-
- private static final String INSTANCED_TEST_DATA =
- "<TestPackage>\n" +
- " <TestSuite name=\"com\" >\n" +
- " <TestSuite name=\"example\" >\n" +
- " <TestCase name=\"ExampleTest\" >\n" +
- " <Test name=\"testMultiInstanced\" >\n" +
- " <TestInstance foo=\"bar\" />\n" +
- " <TestInstance foo=\"baz\" foo2=\"baz2\"/>\n" +
- " </Test>\n" +
- " <Test name=\"testSingleInstanced\" >\n" +
- " <TestInstance foo=\"bar\" />\n" +
- " </Test>\n" +
- " <Test name=\"testEmptyInstances\" >\n" +
- " <TestInstance />\n" +
- " <TestInstance />\n" +
- " </Test>\n" +
- " <Test name=\"testNotInstanced\" >\n" +
- " </Test>\n" +
- " </TestCase>\n" +
- " </TestSuite>\n" +
- " </TestSuite>\n" +
- "</TestPackage>";
-
- /**
- * Test parsing test case xml containing an instrumentation test definition.
- */
- public void testParse_instrPackage() throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(true);
- parser.parse(getStringAsStream(INSTR_TEST_DATA));
- for (TestPackageDef def : parser.getTestPackageDefs()) {
- assertEquals("com.example", def.getAppNameSpace());
- assertEquals("android.example", def.getAppPackageName());
- assertEquals("android.test.InstrumentationTestRunner", def.getRunner());
- assertTrue(AbiUtils.isAbiSupportedByCompatibility(def.getAbi().getName()));
- }
- }
-
- /**
- * Test parsing test case xml containing an host test attribute and test data.
- */
- public void testParse_hostTest() throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(true);
- parser.parse(getStringAsStream(HOST_TEST_DATA));
- for (TestPackageDef def : parser.getTestPackageDefs()) {
- assertEquals(TestPackageDef.HOST_SIDE_ONLY_TEST, def.getTestType());
- assertEquals(3, def.getTests().size());
- Iterator<TestIdentifier> iterator = def.getTests().iterator();
-
- TestIdentifier firstTest = iterator.next();
- assertEquals("com.example.ExampleTest", firstTest.getClassName());
- assertEquals("testFoo", firstTest.getTestName());
-
- TestIdentifier secondTest = iterator.next();
- assertEquals("com.example.ExampleTest", secondTest.getClassName());
- assertEquals("testFoo2", secondTest.getTestName());
-
- TestIdentifier thirdTest = iterator.next();
- assertEquals("com.example2.Example2Test", thirdTest.getClassName());
- assertEquals("testFoo", thirdTest.getTestName());
-
- assertFalse(iterator.hasNext());
- }
- }
-
- public void testParse_hostTest_noKnownFailures() throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(false);
- parser.parse(getStringAsStream(HOST_TEST_DATA));
- for (TestPackageDef def : parser.getTestPackageDefs()) {
- assertEquals(TestPackageDef.HOST_SIDE_ONLY_TEST, def.getTestType());
- assertEquals(2, def.getTests().size());
- Iterator<TestIdentifier> iterator = def.getTests().iterator();
-
- TestIdentifier firstTest = iterator.next();
- assertEquals("com.example.ExampleTest", firstTest.getClassName());
- assertEquals("testFoo", firstTest.getTestName());
-
- TestIdentifier thirdTest = iterator.next();
- assertEquals("com.example2.Example2Test", thirdTest.getClassName());
- assertEquals("testFoo", thirdTest.getTestName());
-
- assertFalse(iterator.hasNext());
- }
- }
-
- /**
- * Test parsing test case xml containing an invalid host test attribute.
- */
- public void testParse_badHostTest() throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(true);
- parser.parse(getStringAsStream(BAD_HOST_TEST_DATA));
- for (TestPackageDef def : parser.getTestPackageDefs()) {
- assertFalse(TestPackageDef.HOST_SIDE_ONLY_TEST.equals(def.getTestType()));
- }
- }
-
- public void testParse_vmHostTest() throws ParseException {
- assertTestType(TestPackageDef.VM_HOST_TEST, VM_HOST_TEST_XML);
- }
-
- public void testParse_nativeTest() throws ParseException {
- assertTestType(TestPackageDef.NATIVE_TEST, NATIVE_TEST_XML);
- }
-
- private void assertTestType(String expectedType, String xml) throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(true);
- parser.parse(getStringAsStream(xml));
- for (TestPackageDef def : parser.getTestPackageDefs()) {
- assertEquals(expectedType, def.getTestType());
- }
- }
-
- /**
- * Test parsing a test case xml with no test package data.
- */
- public void testParse_noData() throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(true);
- parser.parse(getStringAsStream(NO_TEST_DATA));
- assertTrue(parser.getTestPackageDefs().isEmpty());
- }
-
- /**
- * Test parsing a test case xml with multiple test instances
- */
- public void testParse_instancedMultiple() throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(true);
- parser.parse(getStringAsStream(INSTANCED_TEST_DATA));
- for (TestPackageDef def : parser.getTestPackageDefs()) {
- final TestIdentifier testId =
- new TestIdentifier("com.example.ExampleTest", "testMultiInstanced");
- final List<Map<String, String>> targetInstances =
- def.getTestInstanceArguments().get(testId);
- assertNotNull(targetInstances);
- assertEquals(2, targetInstances.size());
-
- final Iterator<Map<String, String>> iterator = targetInstances.iterator();
- final Map<String, String> firstInstance = iterator.next();
- final Map<String, String> secondInstance = iterator.next();
-
- assertEquals("bar", firstInstance.get("foo"));
- assertEquals("baz", secondInstance.get("foo"));
- assertEquals("baz2", secondInstance.get("foo2"));
- }
- }
-
- /**
- * Test parsing a test case xml with single test instance
- */
- public void testParse_instancedSingle() throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(true);
- parser.parse(getStringAsStream(INSTANCED_TEST_DATA));
- for (TestPackageDef def : parser.getTestPackageDefs()) {
- final TestIdentifier testId =
- new TestIdentifier("com.example.ExampleTest", "testSingleInstanced");
- final List<Map<String, String>> targetInstances =
- def.getTestInstanceArguments().get(testId);
- assertNotNull(targetInstances);
- assertEquals(1, targetInstances.size());
-
- final Iterator<Map<String, String>> iterator = targetInstances.iterator();
- final Map<String, String> firstInstance = iterator.next();
-
- assertEquals("bar", firstInstance.get("foo"));
- }
- }
-
- /**
- * Test parsing a test case xml with multiple test instances with no data
- */
- public void testParse_instancedEmptys() throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(true);
- parser.parse(getStringAsStream(INSTANCED_TEST_DATA));
- for (TestPackageDef def : parser.getTestPackageDefs()) {
- final TestIdentifier testId =
- new TestIdentifier("com.example.ExampleTest", "testEmptyInstances");
- final List<Map<String, String>> targetInstances =
- def.getTestInstanceArguments().get(testId);
- assertNotNull(targetInstances);
- assertEquals(2, targetInstances.size());
-
- final Iterator<Map<String, String>> iterator = targetInstances.iterator();
- final Map<String, String> firstInstance = iterator.next();
- final Map<String, String> secondInstance = iterator.next();
-
- assertTrue(firstInstance.isEmpty());
- assertTrue(secondInstance.isEmpty());
- }
- }
-
- /**
- * Test parsing a test case xml with no test instances
- */
- public void testParse_instancedNoInstances() throws ParseException {
- TestPackageXmlParser parser = new TestPackageXmlParser(true);
- parser.parse(getStringAsStream(INSTANCED_TEST_DATA));
- for (TestPackageDef def : parser.getTestPackageDefs()) {
- final TestIdentifier testId =
- new TestIdentifier("com.example.ExampleTest", "testNotInstanced");
- final List<Map<String, String>> targetInstances =
- def.getTestInstanceArguments().get(testId);
- assertNotNull(targetInstances);
- assertTrue(targetInstances.isEmpty());
- }
- }
-
- private InputStream getStringAsStream(String input) {
- return new ByteArrayInputStream(input.getBytes());
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestPlanTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestPlanTest.java
deleted file mode 100644
index be260ea..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/TestPlanTest.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.cts.tradefed.testtype;
-
-import com.android.compatibility.common.util.AbiUtils;
-import com.android.ddmlib.testrunner.TestIdentifier;
-import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Unit tests for {@link TestPlan}.
- */
-public class TestPlanTest extends TestCase {
-
- private static final String TEST_NAME1 = "foo";
- private static final String TEST_NAME2 = "foo2";
- private static final String EXCLUDE_TEST_CLASS = "com.example.FooTest";
- private static final String EXCLUDE_TEST_METHOD = "testFoo";
- private static final String EXCLUDE_TEST_METHOD2 = "testFoo2";
-
- static final String EMPTY_DATA = "<TestPlan version=\"1.0\" />";
-
- static final String TEST_DATA =
- "<TestPlan version=\"1.0\">" +
- String.format("<Entry name=\"%s\" />", TEST_NAME1) +
- String.format("<Entry name=\"%s\" />", TEST_NAME2) +
- "</TestPlan>";
-
- static final String TEST_EXCLUDED_DATA =
- "<TestPlan version=\"1.0\">" +
- String.format("<Entry name=\"%s\" exclude=\"%s#%s\" />", TEST_NAME1, EXCLUDE_TEST_CLASS,
- EXCLUDE_TEST_METHOD) +
- "</TestPlan>";
-
- static final String TEST_MULTI_EXCLUDED_DATA =
- "<TestPlan version=\"1.0\">" +
- String.format("<Entry name=\"%s\" exclude=\"%s#%s;%s#%s\" />", TEST_NAME1,
- EXCLUDE_TEST_CLASS, EXCLUDE_TEST_METHOD, EXCLUDE_TEST_CLASS,
- EXCLUDE_TEST_METHOD2) +
- "</TestPlan>";
-
- static final String TEST_CLASS_EXCLUDED_DATA =
- "<TestPlan version=\"1.0\">" +
- String.format("<Entry name=\"%s\" exclude=\"%s\" />", TEST_NAME1,
- EXCLUDE_TEST_CLASS) +
- "</TestPlan>";
-
- private TestPlan mPlan;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mPlan = new TestPlan("plan", AbiUtils.getAbisSupportedByCompatibility());
- }
-
- /**
- * Simple test for parsing a plan containing two names
- */
- public void testParse() throws ParseException {
- mPlan.parse(getStringAsStream(TEST_DATA));
- assertTestData(mPlan);
- }
-
- /**
- * Perform checks to ensure TEST_DATA was parsed correctly
- * @param plan
- */
- private void assertTestData(TestPlan plan) {
- Set<String> abis = AbiUtils.getAbisSupportedByCompatibility();
- assertEquals(2 * abis.size(), plan.getTestIds().size());
- List<String> sortedAbis = new ArrayList<String>(abis);
- Collections.sort(sortedAbis);
- Iterator<String> iter = plan.getTestIds().iterator();
- for (String abi : sortedAbis) {
- String test1Id = AbiUtils.createId(abi, TEST_NAME1);
- String test2Id = AbiUtils.createId(abi, TEST_NAME2);
- // assert names in order
- assertEquals(test1Id, iter.next());
- assertEquals(test2Id, iter.next());
- assertFalse(plan.getTestFilter(test1Id).hasExclusion());
- assertFalse(plan.getTestFilter(test2Id).hasExclusion());
- }
- }
-
- /**
- * Test parsing a plan containing a single excluded test
- */
- public void testParse_exclude() throws ParseException {
- mPlan.parse(getStringAsStream(TEST_EXCLUDED_DATA));
- Set<String> abis = AbiUtils.getAbisSupportedByCompatibility();
- assertEquals(abis.size(), mPlan.getTestIds().size());
-
- for (String abi : abis) {
- String test1Id = AbiUtils.createId(abi, TEST_NAME1);
- TestFilter filter = mPlan.getTestFilter(test1Id);
- assertTrue(filter.getExcludedTests().contains(new TestIdentifier(EXCLUDE_TEST_CLASS,
- EXCLUDE_TEST_METHOD)));
- }
- }
-
- /**
- * Test parsing a plan containing multiple excluded tests
- */
- public void testParse_multiExclude() throws ParseException {
- mPlan.parse(getStringAsStream(TEST_MULTI_EXCLUDED_DATA));
- assertMultiExcluded(mPlan);
- }
-
- /**
- * Perform checks to ensure TEST_MULTI_EXCLUDED_DATA was parsed correctly
- * @param plan
- */
- private void assertMultiExcluded(TestPlan plan) {
- Set<String> abis = AbiUtils.getAbisSupportedByCompatibility();
- assertEquals(abis.size(), plan.getTestIds().size());
-
- for (String abi : abis) {
- String test1Id = AbiUtils.createId(abi, TEST_NAME1);
- TestFilter filter = plan.getTestFilter(test1Id);
- assertTrue(filter.getExcludedTests().contains(new TestIdentifier(EXCLUDE_TEST_CLASS,
- EXCLUDE_TEST_METHOD)));
- assertTrue(filter.getExcludedTests().contains(new TestIdentifier(EXCLUDE_TEST_CLASS,
- EXCLUDE_TEST_METHOD2)));
- }
- }
-
- /**
- * Test parsing a plan containing an excluded class
- */
- public void testParse_classExclude() throws ParseException {
- mPlan.parse(getStringAsStream(TEST_CLASS_EXCLUDED_DATA));
- Set<String> abis = AbiUtils.getAbisSupportedByCompatibility();
- assertEquals(abis.size(), mPlan.getTestIds().size());
-
- for (String abi : abis) {
- String test1Id = AbiUtils.createId(abi, TEST_NAME1);
- TestFilter filter = mPlan.getTestFilter(test1Id);
- assertTrue(filter.getExcludedClasses().contains(EXCLUDE_TEST_CLASS));
- }
- }
-
- /**
- * Test serializing an empty plan
- * @throws IOException
- */
- public void testSerialize_empty() throws IOException {
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- mPlan.serialize(outStream);
- assertTrue(outStream.toString().contains(EMPTY_DATA));
- }
-
- /**
- * Test serializing and deserializing plan with two packages
- * @throws IOException
- */
- public void testSerialize_packages() throws ParseException, IOException {
- Set<String> abis = AbiUtils.getAbisSupportedByCompatibility();
- for (String abi : abis) {
- mPlan.addPackage(AbiUtils.createId(abi, TEST_NAME1));
- mPlan.addPackage(AbiUtils.createId(abi, TEST_NAME2));
- }
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- mPlan.serialize(outStream);
- TestPlan parsedPlan = new TestPlan("parsed", AbiUtils.getAbisSupportedByCompatibility());
- parsedPlan.parse(getStringAsStream(outStream.toString()));
- // parsedPlan should contain same contents as TEST_DATA
- assertTestData(parsedPlan);
- }
-
- /**
- * Test serializing and deserializing plan with multiple excluded tests
- */
- public void testSerialize_multiExclude() throws ParseException, IOException {
- Set<String> abis = AbiUtils.getAbisSupportedByCompatibility();
-
- for (String abi : abis) {
- String test1Id = AbiUtils.createId(abi, TEST_NAME1);
- mPlan.addPackage(test1Id);
- mPlan.addExcludedTest(test1Id, new TestIdentifier(EXCLUDE_TEST_CLASS,
- EXCLUDE_TEST_METHOD));
- mPlan.addExcludedTest(test1Id, new TestIdentifier(EXCLUDE_TEST_CLASS,
- EXCLUDE_TEST_METHOD2));
- }
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- mPlan.serialize(outStream);
- TestPlan parsedPlan = new TestPlan("parsed", AbiUtils.getAbisSupportedByCompatibility());
- parsedPlan.parse(getStringAsStream(outStream.toString()));
- // parsedPlan should contain same contents as TEST_DATA
- assertMultiExcluded(parsedPlan);
- }
-
- private InputStream getStringAsStream(String input) {
- return new ByteArrayInputStream(input.getBytes());
- }
-}
diff --git a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/WrappedGTestResultParserTest.java b/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/WrappedGTestResultParserTest.java
deleted file mode 100644
index d386c7a..0000000
--- a/tools/tradefed-host/tests/src/com/android/cts/tradefed/testtype/WrappedGTestResultParserTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2012 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 com.android.cts.tradefed.testtype;
-
-import com.android.ddmlib.testrunner.ITestRunListener;
-
-import junit.framework.TestCase;
-
-
-
-/**
- * Unit tests for {@link WrappedGTestResultParser}.
- */
-public class WrappedGTestResultParserTest extends TestCase {
-
- private WrappedGTestResultParser mParser;
- private final String[] INPUT1 = new String[] {
- "INSTRUMENTATION_STATUS: gtest=[==========] Running 9 tests from 2 test cases.",
- "INSTRUMENTATION_STATUS_CODE: 1",
- "INSTRUMENTATION_STATUS: gtest=[ RUN ] GLTest.Test1",
- "INSTRUMENTATION_STATUS: gtest=[ OK ] GLTest.Test1 (10 ms)",
- "INSTRUMENTATION_STATUS: gtest=/tests/SomeTestFile.cpp:1337: Failure",
- "Value of: 1 == 0",
- " Actual: false",
- "Expected: true",
- "INSTRUMENTATION_STATUS: gtest=[ FAILED ] GLTest.Test2 (1016 ms)",
- "INSTRUMENTATION_STATUS: gtest=[==========] 2 tests from 1 test cases ran. (17 ms total)",
- "INSTRUMENTATION_CODE: -1"
- };
-
- private final String[] EXPECTED_OUTPUT1 = new String[] {
- "[==========] Running 9 tests from 2 test cases.",
- "[ RUN ] GLTest.Test1",
- "[ OK ] GLTest.Test1 (10 ms)",
- "/tests/SomeTestFile.cpp:1337: Failure",
- "Value of: 1 == 0",
- " Actual: false",
- "Expected: true",
- "[ FAILED ] GLTest.Test2 (1016 ms)",
- "[==========] 2 tests from 1 test cases ran. (17 ms total)",
- };
-
- private final String[] INPUT2 = new String[] {
- "INSTRUMENTATION_STATUS_CODE: 1",
- "invalid text",
- "INSTRUMENTATION_STATUS: gtest=[==========] Running 9 tests from 2 test cases.",
- "INSTRUMENTATION_RESULT: some error",
- "INSTRUMENTATION_STATUS: gtest=[ RUN ] GLTest.ExpectTestThatShouldBeSuccessful",
- };
-
- private final String[] EXPECTED_OUTPUT2 = new String[] {
- "[==========] Running 9 tests from 2 test cases.",
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mParser = new WrappedGTestResultParser("unused", (ITestRunListener)null);
- }
-
- private void assertArrayEquals(String[] expected, String[] result) throws Exception {
- if (expected == null) {
- assertNull(result);
- return;
- }
-
- assertEquals(expected.length, result.length);
-
- for (int i = 0; i < expected.length; i++) {
- assertEquals(expected[i], result[i]);
- }
- }
-
- /**
- * Test normal case {@link WrappedGTestResultParser#getRawGTestOutput(java.lang.String[])}
- * with all kinds of valid input lines.
- */
- public void testGetRawGTestOutput_valid() throws Exception {
- assertArrayEquals(EXPECTED_OUTPUT1, mParser.parseInstrumentation(INPUT1));
- }
-
- /**
- * Test normal case {@link WrappedGTestResultParser#getRawGTestOutput(java.lang.String[])}
- * with a instrumentation error/invalid input.
- */
- public void testGetRawGTestOutput_invalid() throws Exception {
- assertArrayEquals(EXPECTED_OUTPUT2, mParser.parseInstrumentation(INPUT2));
- }
-}
diff --git a/tools/utils/Android.mk b/tools/utils/Android.mk
index d26abb1..ef2e1bb 100644
--- a/tools/utils/Android.mk
+++ b/tools/utils/Android.mk
@@ -24,7 +24,7 @@
LOCAL_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
-LOCAL_JAVA_LIBRARIES := junit
+LOCAL_JAVA_LIBRARIES := junit-host
LOCAL_STATIC_JAVA_LIBRARIES := compatibility-host-util vogarexpectlib
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tools/vm-tests-tf/Android.mk b/tools/vm-tests-tf/Android.mk
index ef6aa84..4a4e7ae 100644
--- a/tools/vm-tests-tf/Android.mk
+++ b/tools/vm-tests-tf/Android.mk
@@ -55,7 +55,6 @@
#
include $(CLEAR_VARS)
-LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
LOCAL_MODULE := vm-tests-tf
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
@@ -75,9 +74,7 @@
$(LOCAL_BUILT_MODULE): PRIVATE_JACK_EXTRA_ARGS := $(LOCAL_JACK_EXTRA_ARGS)
-ifdef LOCAL_JACK_ENABLED
- vmteststf_dep_jars += $(cts-tf-dalvik-lib.jack)
-endif
+vmteststf_dep_jars += $(cts-tf-dalvik-lib.jack)
$(LOCAL_BUILT_MODULE): PRIVATE_SRC_FOLDER := $(LOCAL_PATH)/src
$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_CLASSES := $(call intermediates-dir-for,JAVA_LIBRARIES,cts-tf-dalvik-buildutil,HOST)/classes
@@ -87,23 +84,6 @@
$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES := $(intermediates)/hostjunit_files
$(LOCAL_BUILT_MODULE): PRIVATE_CLASS_PATH := $(subst $(space),:,$(vmteststf_dep_jars)):$(HOST_JDK_TOOLS_JAR)
$(LOCAL_BUILT_MODULE): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
-ifndef LOCAL_JACK_ENABLED
-$(LOCAL_BUILT_MODULE) : $(vmteststf_dep_jars) $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar
- $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
- $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/dot/junit $(dir $(PRIVATE_INTERMEDIATES_DEXCORE_JAR))
- # generated and compile the host side junit tests
- @echo "Write generated Main_*.java files to $(PRIVATE_INTERMEDIATES_MAIN_FILES)"
- $(hide) java -cp $(PRIVATE_CLASS_PATH) util.build.BuildDalvikSuite $(PRIVATE_SRC_FOLDER) $(PRIVATE_INTERMEDIATES) \
- $(HOST_OUT_JAVA_LIBRARIES)/cts-tf-dalvik-buildutil.jar:$(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar \
- $(PRIVATE_INTERMEDIATES_MAIN_FILES) $(PRIVATE_INTERMEDIATES_CLASSES) $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES) $$RUN_VM_TESTS_RTO
- @echo "Generate $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)"
- $(hide) jar -cf $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar \
- $(addprefix -C $(PRIVATE_INTERMEDIATES_CLASSES) , dot/junit/DxUtil.class dot/junit/DxAbstractMain.class)
- $(hide) $(DX) -JXms16M -JXmx768M --dex --output=$(PRIVATE_INTERMEDIATES_DEXCORE_JAR) \
- $(if $(NO_OPTIMIZE_DX), --no-optimize) $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar
- $(hide) cd $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/classes && zip -q -r ../../$(notdir $@) .
- $(hide) cd $(dir $@) && zip -q -r $(notdir $@) tests
-else # LOCAL_JACK_ENABLED
oj_jack := $(call intermediates-dir-for,JAVA_LIBRARIES,core-oj,,COMMON)/classes.jack
libart_jack := $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart,,COMMON)/classes.jack
$(LOCAL_BUILT_MODULE): PRIVATE_DALVIK_SUITE_CLASSPATH := $(oj_jack):$(libart_jack):$(cts-tf-dalvik-lib.jack):$(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar
@@ -127,7 +107,6 @@
$(hide) cd $(dir $@) && zip -q -r $(notdir $@) tests
oj_jack :=
libart_jack :=
-endif # LOCAL_JACK_ENABLED
# Clean up temp vars
intermediates :=
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget/TestStubs.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget/TestStubs.java
index 07bb886..b5de007 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget/TestStubs.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget/TestStubs.java
@@ -19,6 +19,6 @@
public class TestStubs {
// used by testVFE4
private int TestStubField = 50;
- // ussed by testVFE15
+ // used by testVFE15 and testVFE35
protected int TestStubProtectedField = 50;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget/Test_iget.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget/Test_iget.java
index c3a0f09..938beec 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget/Test_iget.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget/Test_iget.java
@@ -31,7 +31,7 @@
import dot.junit.opcodes.iget.d.T_iget_9;
public class Test_iget extends DxTestCase {
-
+
/**
* @title type - int
*/
@@ -64,9 +64,9 @@
public void testE2() {
loadAndRun("dot.junit.opcodes.iget.d.T_iget_9", NullPointerException.class);
}
-
+
/**
- * @constraint A11
+ * @constraint A11
* @title constant pool index
*/
public void testVFE1() {
@@ -74,23 +74,22 @@
}
/**
- *
- * @constraint A23
+ * @constraint A23
* @title number of registers
*/
public void testVFE2() {
load("dot.junit.opcodes.iget.d.T_iget_3", VerifyError.class);
}
-
+
/**
- * @constraint B13
- * @title read integer from long field - only field with same name but
+ * @constraint B13
+ * @title read integer from long field - only field with same name but
* different type exist
*/
public void testVFE3() {
loadAndRun("dot.junit.opcodes.iget.d.T_iget_13", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read inaccessible private field.
@@ -115,7 +114,7 @@
public void testVFE6() {
loadAndRun("dot.junit.opcodes.iget.d.T_iget_8", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read superclass' private field from subclass.
@@ -124,69 +123,63 @@
//@uses dot.junit.opcodes.iget.d.T_iget_1
loadAndRun("dot.junit.opcodes.iget.d.T_iget_12", IllegalAccessError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget shall not work for reference fields
*/
public void testVFE8() {
load("dot.junit.opcodes.iget.d.T_iget_14", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget shall not work for short fields
*/
public void testVFE9() {
load("dot.junit.opcodes.iget.d.T_iget_15", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget shall not work for boolean fields
*/
public void testVFE10() {
load("dot.junit.opcodes.iget.d.T_iget_16", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget shall not work for char fields
*/
public void testVFE11() {
load("dot.junit.opcodes.iget.d.T_iget_17", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget shall not work for byte fields
*/
public void testVFE12() {
load("dot.junit.opcodes.iget.d.T_iget_18", VerifyError.class);
- }
-
+ }
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget shall not work for double fields
*/
public void testVFE13() {
load("dot.junit.opcodes.iget.d.T_iget_19", VerifyError.class);
- }
-
+ }
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget shall not work for long fields
*/
public void testVFE14() {
load("dot.junit.opcodes.iget.d.T_iget_20", VerifyError.class);
}
-
+
/**
* @constraint B12
* @title Attempt to read protected field of unrelated class.
@@ -195,18 +188,17 @@
//@uses dot.junit.opcodes.iget.TestStubs
loadAndRun("dot.junit.opcodes.iget.d.T_iget_21", IllegalAccessError.class);
}
-
+
/**
* @constraint A11
* @title Attempt to read static field.
*/
public void testVFE16() {
- //@uses dot.junit.opcodes.iget.TestStubs
loadAndRun("dot.junit.opcodes.iget.d.T_iget_5", IncompatibleClassChangeError.class);
}
/**
- * @constraint B6
+ * @constraint B6
* @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE30() {
@@ -214,11 +206,20 @@
}
/**
- * @constraint N/A
+ * @constraint N/A
* @title instance fields may only be accessed on reference values.
*/
public void testVFE31() {
load("dot.junit.opcodes.iget.d.T_iget_31", VerifyError.class);
}
+
+ /**
+ * @constraint N/A
+ * @title Attempt to read inaccessible protected field on uninitialized reference.
+ */
+ public void testVFE35() {
+ //@uses dot.junit.opcodes.iget.TestStubs
+ load("dot.junit.opcodes.iget.d.T_iget_35", VerifyError.class);
+ }
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget/d/T_iget_35.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget/d/T_iget_35.d
new file mode 100644
index 0000000..57df084
--- /dev/null
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget/d/T_iget_35.d
@@ -0,0 +1,31 @@
+; Copyright (C) 2016 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.
+
+.source T_iget_35.java
+.class public dot.junit.opcodes.iget.d.T_iget_35
+.super java/lang/Object
+
+.method public <init>()V
+.limit regs 1
+ invoke-direct {v0}, java/lang/Object/<init>()V
+ return-void
+.end method
+
+.method public run()I
+.limit regs 2
+ iget v0, v1, dot.junit.opcodes.iget.TestStubs.TestStubProtectedField I
+ return v0
+.end method
+
+
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tools/vm-tests-tf/src/dot/junit/opcodes/iget/d/T_iget_35.java
similarity index 76%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to tools/vm-tests-tf/src/dot/junit/opcodes/iget/d/T_iget_35.java
index 1293572..696a6a1 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget/d/T_iget_35.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -14,6 +14,11 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+package dot.junit.opcodes.iget.d;
-struct sock_fprog GetTestSeccompFilterProgram();
+public class T_iget_35 {
+
+ public int run() {
+ return 0;
+ }
+}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/TestStubs.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/TestStubs.java
index 8dcd427..af78d74 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/TestStubs.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/TestStubs.java
@@ -19,6 +19,6 @@
public class TestStubs {
// used by testVFE4
private boolean TestStubField = true;
- // used by testVFE15
+ // used by testVFE15 and testVFE35
protected boolean TestStubProtectedField = true;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/Test_iget_boolean.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/Test_iget_boolean.java
index f16b89c..1f6a94a 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/Test_iget_boolean.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/Test_iget_boolean.java
@@ -30,16 +30,15 @@
import dot.junit.opcodes.iget_boolean.d.T_iget_boolean_9;
public class Test_iget_boolean extends DxTestCase {
-
+
/**
- * @title get boolean from field
+ * @title get boolean from field
*/
public void testN1() {
T_iget_boolean_1 t = new T_iget_boolean_1();
assertEquals(true, t.run());
}
-
/**
* @title access protected field from subclass
*/
@@ -59,7 +58,7 @@
}
/**
- * @constraint A11
+ * @constraint A11
* @title constant pool index
*/
public void testVFE1() {
@@ -67,22 +66,22 @@
}
/**
- * @constraint A23
+ * @constraint A23
* @title number of registers
*/
public void testVFE2() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_3", VerifyError.class);
}
-
+
/**
- * @constraint B13
- * @title read boolean from long field - only field with same name but
+ * @constraint B13
+ * @title read boolean from long field - only field with same name but
* different type exists
*/
public void testVFE3() {
loadAndRun("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_13", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read inaccessible field
@@ -108,7 +107,7 @@
public void testVFE6() {
loadAndRun("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_8", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read superclass' private field from subclass.
@@ -118,64 +117,63 @@
//@uses dot.junit.opcodes.iget_boolean.d.T_iget_boolean_12
loadAndRun("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_12", IllegalAccessError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_boolean shall not work for reference fields
*/
public void testVFE8() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_14", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_boolean shall not work for short fields
*/
public void testVFE9() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_15", VerifyError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_boolean shall not work for int fields
*/
public void testVFE10() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_16", VerifyError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_boolean shall not work for char fields
*/
public void testVFE11() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_17", VerifyError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_boolean shall not work for byte fields
*/
public void testVFE12() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_18", VerifyError.class);
- }
-
+ }
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_boolean shall not work for double fields
*/
public void testVFE13() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_19", VerifyError.class);
- }
-
+ }
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_boolean shall not work for long fields
*/
public void testVFE14() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_20", VerifyError.class);
}
-
+
/**
* @constraint B12
* @title Attempt to read inaccessible protected field.
@@ -191,14 +189,13 @@
* @title Attempt to read static field.
*/
public void testVFE16() {
- //@uses dot.junit.opcodes.iget_boolean.TestStubs
loadAndRun("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_5",
IncompatibleClassChangeError.class);
}
/**
- * @constraint B6
- * @title instance fields may only be accessed on already initialized instances.
+ * @constraint B6
+ * @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE30() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_30", VerifyError.class);
@@ -211,4 +208,13 @@
public void testVFE31() {
load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_31", VerifyError.class);
}
+
+ /**
+ * @constraint N/A
+ * @title Attempt to read inaccessible protected field on uninitialized reference.
+ */
+ public void testVFE35() {
+ //@uses dot.junit.opcodes.iget_boolean.TestStubs
+ load("dot.junit.opcodes.iget_boolean.d.T_iget_boolean_35", VerifyError.class);
+ }
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/d/T_iget_boolean_35.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/d/T_iget_boolean_35.d
new file mode 100644
index 0000000..babcc08
--- /dev/null
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/d/T_iget_boolean_35.d
@@ -0,0 +1,31 @@
+; Copyright (C) 2016 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.
+
+.source T_iget_boolean_35.java
+.class public dot.junit.opcodes.iget_boolean.d.T_iget_boolean_35
+.super java/lang/Object
+
+.method public <init>()V
+.limit regs 1
+ invoke-direct {v0}, java/lang/Object/<init>()V
+ return-void
+.end method
+
+.method public run()Z
+.limit regs 2
+ iget-boolean v0, v1, dot.junit.opcodes.iget_boolean.TestStubs.TestStubProtectedField Z
+ return v0
+.end method
+
+
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/d/T_iget_boolean_35.java
similarity index 74%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/d/T_iget_boolean_35.java
index 1293572..7c95c37 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_boolean/d/T_iget_boolean_35.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -14,6 +14,11 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+package dot.junit.opcodes.iget_boolean.d;
-struct sock_fprog GetTestSeccompFilterProgram();
+public class T_iget_boolean_35 {
+
+ public boolean run(){
+ return false;
+ }
+}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/TestStubs.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/TestStubs.java
index 90b1f13..ffae3b1 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/TestStubs.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/TestStubs.java
@@ -19,6 +19,6 @@
public class TestStubs {
// used by testVFE4
private byte TestStubField = 50;
- // ussed by testVFE15
+ // used by testVFE15 and testVFE35
protected byte TestStubProtectedField = 50;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/Test_iget_byte.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/Test_iget_byte.java
index 410dad4..4e7bbc7 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/Test_iget_byte.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/Test_iget_byte.java
@@ -30,16 +30,15 @@
import dot.junit.opcodes.iget_byte.d.T_iget_byte_9;
public class Test_iget_byte extends DxTestCase {
-
+
/**
- * @title get byte from field
+ * @title get byte from field
*/
public void testN1() {
T_iget_byte_1 t = new T_iget_byte_1();
assertEquals(77, t.run());
}
-
/**
* @title access protected field from subclass
*/
@@ -55,10 +54,10 @@
*/
public void testE2() {
loadAndRun("dot.junit.opcodes.iget_byte.d.T_iget_byte_9", NullPointerException.class);
- }
+ }
/**
- * @constraint A11
+ * @constraint A11
* @title constant pool index
*/
public void testVFE1() {
@@ -66,22 +65,22 @@
}
/**
- * @constraint A23
+ * @constraint A23
* @title number of registers
*/
public void testVFE2() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_3", VerifyError.class);
}
-
+
/**
- * @constraint B13
- * @title read byte from long field - only field with same name but
+ * @constraint B13
+ * @title read byte from long field - only field with same name but
* different type exists
*/
public void testVFE3() {
loadAndRun("dot.junit.opcodes.iget_byte.d.T_iget_byte_13", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read inaccessible field.
@@ -106,7 +105,7 @@
public void testVFE6() {
loadAndRun("dot.junit.opcodes.iget_byte.d.T_iget_byte_8", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read superclass' private field from subclass.
@@ -115,63 +114,63 @@
//@uses dot.junit.opcodes.iget_byte.d.T_iget_byte_1
loadAndRun("dot.junit.opcodes.iget_byte.d.T_iget_byte_12", IllegalAccessError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_byte shall not work for reference fields
*/
public void testVFE8() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_14", VerifyError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_byte shall not work for short fields
*/
public void testVFE9() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_15", VerifyError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_byte shall not work for int fields
*/
public void testVFE10() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_16", VerifyError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_byte shall not work for char fields
*/
public void testVFE11() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_17", VerifyError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_byte shall not work for boolean fields
*/
public void testVFE12() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_18", VerifyError.class);
- }
-
+ }
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_byte shall not work for double fields
*/
public void testVFE13() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_19", VerifyError.class);
- }
-
+ }
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_byte shall not work for long fields
*/
public void testVFE14() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_20", VerifyError.class);
}
-
+
/**
* @constraint B12
* @title Attempt to read inaccessible protected field.
@@ -181,20 +180,18 @@
loadAndRun("dot.junit.opcodes.iget_byte.d.T_iget_byte_21", IllegalAccessError.class);
}
-
/**
* @constraint A11
* @title Attempt to read static field.
*/
public void testVFE16() {
- //@uses dot.junit.opcodes.iget_byte.TestStubs
loadAndRun("dot.junit.opcodes.iget_byte.d.T_iget_byte_5",
IncompatibleClassChangeError.class);
}
/**
- * @constraint B6
- * @title instance fields may only be accessed on already initialized instances.
+ * @constraint B6
+ * @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE30() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_30", VerifyError.class);
@@ -207,4 +204,13 @@
public void testVFE31() {
load("dot.junit.opcodes.iget_byte.d.T_iget_byte_31", VerifyError.class);
}
+
+ /**
+ * @constraint N/A
+ * @title Attempt to read inaccessible protected field on uninitialized reference.
+ */
+ public void testVFE35() {
+ //@uses dot.junit.opcodes.iget_byte.TestStubs
+ load("dot.junit.opcodes.iget_byte.d.T_iget_byte_35", VerifyError.class);
+ }
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/d/T_iget_byte_35.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/d/T_iget_byte_35.d
new file mode 100644
index 0000000..8792c96
--- /dev/null
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/d/T_iget_byte_35.d
@@ -0,0 +1,33 @@
+; Copyright (C) 2016 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.
+
+.source T_iget_byte_35.java
+.class public dot.junit.opcodes.iget_byte.d.T_iget_byte_35
+.super java/lang/Object
+
+.method public <init>()V
+.limit regs 1
+ invoke-direct {v0}, java/lang/Object/<init>()V
+ return-void
+.end method
+
+.method public run()B
+.limit regs 2
+ iget-byte v0, v1, dot.junit.opcodes.iget_byte.TestStubs.TestStubProtectedField B
+ return v0
+.end method
+
+
+
+
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/d/T_iget_byte_35.java
similarity index 75%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/d/T_iget_byte_35.java
index 1293572..17e78f1 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_byte/d/T_iget_byte_35.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -14,6 +14,11 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+package dot.junit.opcodes.iget_byte.d;
-struct sock_fprog GetTestSeccompFilterProgram();
+public class T_iget_byte_35 {
+
+ public byte run() {
+ return 0;
+ }
+}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/TestStubs.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/TestStubs.java
index 5bf73ae..6969a104 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/TestStubs.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/TestStubs.java
@@ -19,6 +19,6 @@
public class TestStubs {
// used by testVFE4
private char TestStubField = 50;
- // ussed by testVFE15
+ // ussed by testVFE15 and testVFE35
protected char TestStubProtectedField = 50;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/Test_iget_char.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/Test_iget_char.java
index ff86ae3..c2b8f1c 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/Test_iget_char.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/Test_iget_char.java
@@ -30,9 +30,9 @@
import dot.junit.opcodes.iget_char.d.T_iget_char_9;
public class Test_iget_char extends DxTestCase {
-
+
/**
- * @title get char from field
+ * @title get char from field
*/
public void testN1() {
T_iget_char_1 t = new T_iget_char_1();
@@ -56,10 +56,9 @@
public void testE2() {
loadAndRun("dot.junit.opcodes.iget_char.d.T_iget_char_9", NullPointerException.class);
}
-
/**
- * @constraint A11
+ * @constraint A11
* @title constant pool index
*/
public void testVFE1() {
@@ -67,24 +66,22 @@
}
/**
- *
- * @constraint A23
+ * @constraint A23
* @title number of registers
*/
public void testVFE2() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_3", VerifyError.class);
}
-
+
/**
- *
- * @constraint B13
- * @title read char from long field - only field with same name but
+ * @constraint B13
+ * @title read char from long field - only field with same name but
* different type exists
*/
public void testVFE3() {
loadAndRun("dot.junit.opcodes.iget_char.d.T_iget_char_13", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read inaccessible field.
@@ -109,7 +106,7 @@
public void testVFE6() {
loadAndRun("dot.junit.opcodes.iget_char.d.T_iget_char_8", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read superclass' private field from subclass.
@@ -118,67 +115,63 @@
//@uses dot.junit.opcodes.iget_char.d.T_iget_char_1
loadAndRun("dot.junit.opcodes.iget_char.d.T_iget_char_12", IllegalAccessError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_char shall not work for reference fields
*/
public void testVFE8() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_14", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_char shall not work for short fields
*/
public void testVFE9() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_15", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_char shall not work for int fields
*/
public void testVFE10() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_16", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_char shall not work for byte fields
*/
public void testVFE11() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_17", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_char shall not work for boolean fields
*/
public void testVFE12() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_18", VerifyError.class);
- }
-
+ }
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_char shall not work for double fields
*/
public void testVFE13() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_19", VerifyError.class);
- }
-
+ }
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_char shall not work for long fields
*/
public void testVFE14() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_20", VerifyError.class);
}
-
+
/**
* @constraint B12
* @title Attempt to read inaccessible protected field.
@@ -194,15 +187,13 @@
* @title Attempt to read static field.
*/
public void testVFE16() {
- //@uses dot.junit.opcodes.iget_char.TestStubs
loadAndRun("dot.junit.opcodes.iget_char.d.T_iget_char_5",
IncompatibleClassChangeError.class);
}
-
/**
- * @constraint B6
- * @title instance fields may only be accessed on already initialized instances.
+ * @constraint B6
+ * @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE30() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_30", VerifyError.class);
@@ -215,4 +206,13 @@
public void testVFE31() {
load("dot.junit.opcodes.iget_char.d.T_iget_char_31", VerifyError.class);
}
+
+ /**
+ * @constraint N/A
+ * @title Attempt to read inaccessible protected field on uninitialized reference.
+ */
+ public void testVFE35() {
+ //@uses dot.junit.opcodes.iget_char.TestStubs
+ load("dot.junit.opcodes.iget_char.d.T_iget_char_35", VerifyError.class);
+ }
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/d/T_iget_char_35.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/d/T_iget_char_35.d
new file mode 100644
index 0000000..53ac999
--- /dev/null
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/d/T_iget_char_35.d
@@ -0,0 +1,31 @@
+; Copyright (C) 2016 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.
+
+.source T_iget_char_35.java
+.class public dot.junit.opcodes.iget_char.d.T_iget_char_35
+.super java/lang/Object
+
+.method public <init>()V
+.limit regs 1
+ invoke-direct {v0}, java/lang/Object/<init>()V
+ return-void
+.end method
+
+.method public run()C
+.limit regs 2
+ iget-char v0, v1, dot.junit.opcodes.iget_char.TestStubs.TestStubProtectedField C
+ return v0
+.end method
+
+
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/d/T_iget_char_35.java
similarity index 75%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/d/T_iget_char_35.java
index 1293572..0b3434a 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_char/d/T_iget_char_35.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -14,6 +14,11 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+package dot.junit.opcodes.iget_char.d;
-struct sock_fprog GetTestSeccompFilterProgram();
+public class T_iget_char_35 {
+
+ public char run() {
+ return 0;
+ }
+}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/TestStubs.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/TestStubs.java
index 0a68e56..74d7f93 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/TestStubs.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/TestStubs.java
@@ -19,6 +19,6 @@
public class TestStubs {
// used by testVFE4
private Object TestStubField = null;
- // used by testVFE15
+ // used by testVFE16 and testVFE35
protected Object TestStubProtectedField = null;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/Test_iget_object.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/Test_iget_object.java
index 7314141..9ae5548 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/Test_iget_object.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/Test_iget_object.java
@@ -24,6 +24,7 @@
import dot.junit.opcodes.iget_object.d.T_iget_object_13;
import dot.junit.opcodes.iget_object.d.T_iget_object_21;
import dot.junit.opcodes.iget_object.d.T_iget_object_22;
+import dot.junit.opcodes.iget_object.d.T_iget_object_35;
import dot.junit.opcodes.iget_object.d.T_iget_object_5;
import dot.junit.opcodes.iget_object.d.T_iget_object_6;
import dot.junit.opcodes.iget_object.d.T_iget_object_7;
@@ -31,9 +32,9 @@
import dot.junit.opcodes.iget_object.d.T_iget_object_9;
public class Test_iget_object extends DxTestCase {
-
+
/**
- * @title get reference from field
+ * @title get reference from field
*/
public void testN1() {
T_iget_object_1 t = new T_iget_object_1();
@@ -56,10 +57,10 @@
*/
public void testE2() {
loadAndRun("dot.junit.opcodes.iget_object.d.T_iget_object_9", NullPointerException.class);
- }
+ }
/**
- * @constraint A11
+ * @constraint A11
* @title constant pool index
*/
public void testVFE1() {
@@ -67,24 +68,22 @@
}
/**
- *
- * @constraint A23
+ * @constraint A23
* @title number of registers
*/
public void testVFE2() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_3", VerifyError.class);
}
-
+
/**
- *
- * @constraint B13
- * @title (read object from long field - only field with same name but
+ * @constraint B13
+ * @title (read object from long field - only field with same name but
* different type exists)
*/
public void testVFE3() {
loadAndRun("dot.junit.opcodes.iget_object.d.T_iget_object_13", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read inaccessible field.
@@ -109,7 +108,7 @@
public void testVFE6() {
loadAndRun("dot.junit.opcodes.iget_object.d.T_iget_object_8", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read superclass' private field from subclass.
@@ -118,78 +117,71 @@
//@uses dot.junit.opcodes.iget_object.d.T_iget_object_1
loadAndRun("dot.junit.opcodes.iget_object.d.T_iget_object_12", IllegalAccessError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_object shall not work for short fields
*/
public void testVFE8() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_14", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_object shall not work for char fields
*/
public void testVFE9() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_15", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_object shall not work for int fields
*/
public void testVFE10() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_16", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_object shall not work for byte fields
*/
public void testVFE11() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_17", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_object shall not work for boolean fields
*/
public void testVFE12() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_18", VerifyError.class);
- }
-
+ }
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_object shall not work for double fields
*/
public void testVFE13() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_19", VerifyError.class);
- }
-
+ }
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_object shall not work for long fields
*/
public void testVFE14() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_20", VerifyError.class);
- }
-
+ }
+
/**
- *
- * @constraint B13
+ * @constraint B13
* @title only field of different type exists
*/
public void testVFE15() {
loadAndRun("dot.junit.opcodes.iget_object.d.T_iget_object_21", NoSuchFieldError.class);
}
-
+
/**
* @constraint B12
* @title Attempt to read inaccessible protected field.
@@ -204,14 +196,13 @@
* @title Attempt to read static field.
*/
public void testVFE17() {
- //@uses dot.junit.opcodes.iget_object.TestStubs
loadAndRun("dot.junit.opcodes.iget_object.d.T_iget_object_5",
IncompatibleClassChangeError.class);
}
/**
- * @constraint B6
- * @title instance fields may only be accessed on already initialized instances.
+ * @constraint B6
+ * @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE30() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_30", VerifyError.class);
@@ -219,9 +210,18 @@
/**
* @constraint N/A
- * @title instance fields may only be accessed on already initialized instances.
+ * @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE31() {
load("dot.junit.opcodes.iget_object.d.T_iget_object_31", VerifyError.class);
}
+
+ /**
+ * @constraint N/A
+ * @title Attempt to read inaccessible protected field on uninitialized reference.
+ */
+ public void testVFE35() {
+ //@uses dot.junit.opcodes.iget_object.TestStubs
+ load("dot.junit.opcodes.iget_object.d.T_iget_object_35", VerifyError.class);
+ }
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_22.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_22.d
index 2858934..38872fd 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_22.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_22.d
@@ -30,7 +30,7 @@
new-instance v0, Ldot/junit/opcodes/iget_object/TestStubs;
invoke-direct {v0}, dot/junit/opcodes/iget_object/TestStubs/<init>()V
- iget-object v1, v2, dot.junit.opcodes.iget_object.TestStubs.TestStubProtectedField Ljava/lang/Object;
+ iget-object v1, v0, dot.junit.opcodes.iget_object.TestStubs.TestStubProtectedField Ljava/lang/Object;
return-object v1
.end method
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_35.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_35.d
new file mode 100644
index 0000000..a4fc423
--- /dev/null
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_35.d
@@ -0,0 +1,31 @@
+; Copyright (C) 2016 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.
+
+.source T_iget_object_35.java
+.class public dot.junit.opcodes.iget_object.d.T_iget_object_35
+.super java/lang/Object
+
+.method public <init>()V
+.limit regs 1
+ invoke-direct {v0}, java/lang/Object/<init>()V
+ return-void
+.end method
+
+.method public run()Ljava/lang/Object;
+.limit regs 2
+ iget-object v0, v1, dot.junit.opcodes.iget_object.TestStubs.TestStubProtectedField Ljava/lang/Object;
+ return-object v0
+.end method
+
+
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_35.java
similarity index 74%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_35.java
index 1293572..f7ceb9b 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_35.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -14,6 +14,11 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+package dot.junit.opcodes.iget_object.d;
-struct sock_fprog GetTestSeccompFilterProgram();
+public class T_iget_object_35 {
+
+ public Object run() {
+ return null;
+ }
+}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_6.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_6.d
index e9082e0..ccf829d 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_6.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_object/d/T_iget_object_6.d
@@ -30,7 +30,7 @@
new-instance v0, Ldot/junit/opcodes/iget_object/TestStubs;
invoke-direct {v0}, dot/junit/opcodes/iget_object/TestStubs/<init>()V
- iget-object v1, v2, dot.junit.opcodes.iget_object.TestStubs.TestStubField Ljava/lang/Object;
+ iget-object v1, v0, dot.junit.opcodes.iget_object.TestStubs.TestStubField Ljava/lang/Object;
return-object v1
.end method
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/TestStubs.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/TestStubs.java
index 8580ec3..f299301 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/TestStubs.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/TestStubs.java
@@ -19,6 +19,6 @@
public class TestStubs {
// used by testVFE4
private short TestStubField = 50;
- // used by testVFE15
+ // used by testVFE15 and testVFE35
protected short TestStubProtectedField = 50;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/Test_iget_short.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/Test_iget_short.java
index 566ec3f..bd77708 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/Test_iget_short.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/Test_iget_short.java
@@ -30,7 +30,7 @@
import dot.junit.opcodes.iget_short.d.T_iget_short_9;
public class Test_iget_short extends DxTestCase {
-
+
/**
* @title get short from field
*/
@@ -58,7 +58,7 @@
}
/**
- * @constraint A11
+ * @constraint A11
* @title constant pool index
*/
public void testVFE1() {
@@ -66,24 +66,22 @@
}
/**
- *
- * @constraint A23
+ * @constraint A23
* @title number of registers
*/
public void testVFE2() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_3", VerifyError.class);
}
-
+
/**
- *
- * @constraint B13
- * @title read short from long field - only field with same name but
+ * @constraint B13
+ * @title read short from long field - only field with same name but
* different type exists
*/
public void testVFE3() {
loadAndRun("dot.junit.opcodes.iget_short.d.T_iget_short_13", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read inaccessible field.
@@ -108,7 +106,7 @@
public void testVFE6() {
loadAndRun("dot.junit.opcodes.iget_short.d.T_iget_short_8", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read superclass' private field from subclass.
@@ -117,69 +115,63 @@
//@uses dot.junit.opcodes.iget_short.d.T_iget_short_1
loadAndRun("dot.junit.opcodes.iget_short.d.T_iget_short_12", IllegalAccessError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget_short shall not work for reference fields
*/
public void testVFE8() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_14", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_short shall not work for char fields
*/
public void testVFE9() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_15", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_short shall not work for int fields
*/
public void testVFE10() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_16", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_short shall not work for byte fields
*/
public void testVFE11() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_17", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_short shall not work for boolean fields
*/
public void testVFE12() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_18", VerifyError.class);
- }
-
+ }
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_short shall not work for double fields
*/
public void testVFE13() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_19", VerifyError.class);
- }
-
+ }
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget_short shall not work for long fields
*/
public void testVFE14() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_20", VerifyError.class);
}
-
+
/**
* @constraint B12
* @title Attempt to read inaccessible protected field.
@@ -194,24 +186,32 @@
* @title Attempt to read static field.
*/
public void testVFE16() {
- //@uses dot.junit.opcodes.iget_short.TestStubs
loadAndRun("dot.junit.opcodes.iget_short.d.T_iget_short_5",
IncompatibleClassChangeError.class);
}
/**
- * @constraint B6
- * @title instance fields may only be accessed on already initialized instances.
+ * @constraint B6
+ * @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE30() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_30", VerifyError.class);
}
/**
- * @constraint N/A
- * @title instance fields may only be accessed on already initialized instances.
+ * @constraint N/A
+ * @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE31() {
load("dot.junit.opcodes.iget_short.d.T_iget_short_31", VerifyError.class);
}
+
+ /**
+ * @constraint N/A
+ * @title Attempt to read inaccessible protected field on uninitialized reference.
+ */
+ public void testVFE35() {
+ //@uses dot.junit.opcodes.iget_short.TestStubs
+ load("dot.junit.opcodes.iget_short.d.T_iget_short_35", VerifyError.class);
+ }
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_21.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_21.d
index e806df2..f3298fb 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_21.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_21.d
@@ -24,14 +24,14 @@
return-void
.end method
-.method public run()V
+.method public run()S
.limit regs 3
new-instance v0, Ldot/junit/opcodes/iget_short/TestStubs;
invoke-direct {v0}, dot/junit/opcodes/iget_short/TestStubs/<init>()V
-
+
iget-short v1, v0, dot.junit.opcodes.iget_short.TestStubs.TestStubProtectedField S
- return-void
+ return v1
.end method
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_21.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_21.java
index 5bb7f6e..bcb8dca 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_21.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_21.java
@@ -18,6 +18,7 @@
public class T_iget_short_21 {
- public void run() {
+ public short run() {
+ return 0;
}
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_35.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_35.d
new file mode 100644
index 0000000..5cde5bb
--- /dev/null
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_35.d
@@ -0,0 +1,32 @@
+; Copyright (C) 2016 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.
+
+.source T_iget_short_35.java
+.class public dot.junit.opcodes.iget_short.d.T_iget_short_35
+.super java/lang/Object
+
+.method public <init>()V
+.limit regs 1
+ invoke-direct {v0}, java/lang/Object/<init>()V
+ return-void
+.end method
+
+.method public run()S
+.limit regs 2
+ iget-short v0, v1, dot.junit.opcodes.iget_short.TestStubs.TestStubProtectedField S
+ return v0
+.end method
+
+
+
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_35.java
similarity index 75%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_35.java
index 1293572..f92f2b6 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_35.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -14,6 +14,11 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+package dot.junit.opcodes.iget_short.d;
-struct sock_fprog GetTestSeccompFilterProgram();
+public class T_iget_short_35 {
+
+ public short run() {
+ return 0;
+ }
+}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_6.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_6.d
index 764d42e..2d9ab9b 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_6.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_short/d/T_iget_short_6.d
@@ -27,7 +27,10 @@
.method public run()S
.limit regs 3
- iget-short v1, v2, dot.junit.opcodes.iget_short.TestStubs.TestStubField S
+ new-instance v0, Ldot/junit/opcodes/iget_short/TestStubs;
+ invoke-direct {v0}, dot/junit/opcodes/iget_short/TestStubs/<init>()V
+
+ iget-short v1, v0, dot.junit.opcodes.iget_short.TestStubs.TestStubField S
return v1
.end method
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/TestStubs.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/TestStubs.java
index f90a470..79e71c4 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/TestStubs.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/TestStubs.java
@@ -19,6 +19,6 @@
public class TestStubs {
// used by testVFE4
private long TestStubField = 50;
- // ussed by testVFE15
+ // ussed by testVFE15 and testVFE35
protected long TestStubProtectedField = 50;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/Test_iget_wide.java b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/Test_iget_wide.java
index f82a1d3..6bb996f 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/Test_iget_wide.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/Test_iget_wide.java
@@ -31,7 +31,7 @@
import dot.junit.opcodes.iget_wide.d.T_iget_wide_9;
public class Test_iget_wide extends DxTestCase {
-
+
/**
* @title type - long
*/
@@ -63,10 +63,10 @@
*/
public void testE2() {
loadAndRun("dot.junit.opcodes.iget_wide.d.T_iget_wide_9", NullPointerException.class);
- }
+ }
/**
- * @constraint A11
+ * @constraint A11
* @title constant pool index
*/
public void testVFE1() {
@@ -74,24 +74,22 @@
}
/**
- *
- * @constraint A23
+ * @constraint A23
* @title number of registers
*/
public void testVFE2() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_3", VerifyError.class);
}
-
+
/**
- *
- * @constraint B13
- * @title read long from integer field - only field with same name but
+ * @constraint B13
+ * @title read long from integer field - only field with same name but
* different type exists
*/
public void testVFE3() {
loadAndRun("dot.junit.opcodes.iget_wide.d.T_iget_wide_13", NoSuchFieldError.class);
}
-
+
/**
* @constraint n/a
* @title Attempt to read inaccessible field.
@@ -103,7 +101,7 @@
/**
* @constraint n/a
- * @title Attempt to read field of undefined class.
+ * @title Attempt to read field of undefined class.
*/
public void testVFE5() {
loadAndRun("dot.junit.opcodes.iget_wide.d.T_iget_wide_7", NoClassDefFoundError.class);
@@ -125,69 +123,63 @@
//@uses dot.junit.opcodes.iget_wide.d.T_iget_wide_1
loadAndRun("dot.junit.opcodes.iget_wide.d.T_iget_wide_12", IllegalAccessError.class);
}
-
+
/**
- * @constraint B1
+ * @constraint B1
* @title iget-wide shall not work for reference fields
*/
public void testVFE8() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_14", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget-wide shall not work for short fields
*/
public void testVFE9() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_15", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget-wide shall not work for boolean fields
*/
public void testVFE10() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_16", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget-wide shall not work for char fields
*/
public void testVFE11() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_17", VerifyError.class);
}
-
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget-wide shall not work for byte fields
*/
public void testVFE12() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_18", VerifyError.class);
- }
-
+ }
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget-wide shall not work for float fields
*/
public void testVFE13() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_19", VerifyError.class);
- }
-
+ }
+
/**
- *
- * @constraint B1
+ * @constraint B1
* @title iget-wide shall not work for int fields
*/
public void testVFE14() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_20", VerifyError.class);
}
-
+
/**
* @constraint B12
* @title Attempt to read inaccessible protected field.
@@ -202,14 +194,13 @@
* @title Attempt to read static field.
*/
public void testVFE16() {
- //@uses dot.junit.opcodes.iget_wide.TestStubs
- loadAndRun("dot.junit.opcodes.iget_wide.d.T_iget_wide_5",
+ loadAndRun("dot.junit.opcodes.iget_wide.d.T_iget_wide_5",
IncompatibleClassChangeError.class);
}
/**
- * @constraint B6
- * @title instance fields may only be accessed on already initialized instances.
+ * @constraint B6
+ * @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE30() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_30", VerifyError.class);
@@ -217,9 +208,18 @@
/**
* @constraint N/A
- * @title instance fields may only be accessed on already initialized instances.
+ * @title instance fields may only be accessed on already initialized instances.
*/
public void testVFE31() {
load("dot.junit.opcodes.iget_wide.d.T_iget_wide_31", VerifyError.class);
}
+
+ /**
+ * @constraint N/A
+ * @title Attempt to read inaccessible protected field on uninitialized reference.
+ */
+ public void testVFE35() {
+ //@uses dot.junit.opcodes.iget_wide.TestStubs
+ load("dot.junit.opcodes.iget_wide.d.T_iget_wide_35", VerifyError.class);
+ }
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/d/T_iget_wide_35.d b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/d/T_iget_wide_35.d
new file mode 100644
index 0000000..505b06e
--- /dev/null
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/d/T_iget_wide_35.d
@@ -0,0 +1,31 @@
+; Copyright (C) 2016 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.
+
+.source T_iget_wide_35.java
+.class public dot.junit.opcodes.iget_wide.d.T_iget_wide_35
+.super java/lang/Object
+
+.method public <init>()V
+.limit regs 1
+ invoke-direct {v0}, java/lang/Object/<init>()V
+ return-void
+.end method
+
+.method public run()J
+.limit regs 2
+ iget-wide v0, v1, dot.junit.opcodes.iget_wide.TestStubs.TestStubProtectedField J
+ return-wide v0
+.end method
+
+
diff --git a/tests/tests/os/jni/seccomp_sample_program.h b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/d/T_iget_wide_35.java
similarity index 75%
copy from tests/tests/os/jni/seccomp_sample_program.h
copy to tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/d/T_iget_wide_35.java
index 1293572..5a8fc86 100644
--- a/tests/tests/os/jni/seccomp_sample_program.h
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/iget_wide/d/T_iget_wide_35.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -14,6 +14,11 @@
* limitations under the License.
*/
-#include <linux/filter.h>
+package dot.junit.opcodes.iget_wide.d;
-struct sock_fprog GetTestSeccompFilterProgram();
+public class T_iget_wide_35 {
+
+ public long run() {
+ return -99;
+ }
+}