diff options
20 files changed, 1119 insertions, 79 deletions
diff --git a/audio/V2_0/target/AndroidTest.xml b/audio/V2_0/target/AndroidTest.xml index a4c67af2..f71ca474 100644 --- a/audio/V2_0/target/AndroidTest.xml +++ b/audio/V2_0/target/AndroidTest.xml @@ -28,7 +28,7 @@ <option name="binary-test-disable-framework" value="true"/> <option name="binary-test-stop-native-servers" value="true"/> <option name="precondition-lshal" value="android.hardware.audio@2.0"/> - <option name="test-timeout" value="30m"/> + <option name="test-timeout" value="60m"/> <option name="runtime-hint" value="10m"/> </test> </configuration> diff --git a/audio/V2_0/target_profiling/AndroidTest.xml b/audio/V2_0/target_profiling/AndroidTest.xml index 21417301..3655a904 100644 --- a/audio/V2_0/target_profiling/AndroidTest.xml +++ b/audio/V2_0/target_profiling/AndroidTest.xml @@ -34,6 +34,6 @@ <option name="binary-test-disable-framework" value="true"/> <option name="binary-test-stop-native-servers" value="true"/> <option name="precondition-lshal" value="android.hardware.audio@2.0"/> - <option name="test-timeout" value="30m"/> + <option name="test-timeout" value="120m"/> </test> </configuration> diff --git a/automotive/vehicle/V2_0/host/VtsHalAutomotiveVehicleV2_0HostTest.py b/automotive/vehicle/V2_0/host/VtsHalAutomotiveVehicleV2_0HostTest.py index 2fd0f4b1..107a8f39 100644 --- a/automotive/vehicle/V2_0/host/VtsHalAutomotiveVehicleV2_0HostTest.py +++ b/automotive/vehicle/V2_0/host/VtsHalAutomotiveVehicleV2_0HostTest.py @@ -199,67 +199,6 @@ class VtsHalAutomotiveVehicleV2_0HostTest(base_test.BaseTestClass): asserts.assertEqual(1, len(propValue["value"]["int32Values"])) asserts.assertEqual(value, propValue["value"]["int32Values"][0]) - def testObd2SensorProperties(self): - """Test reading the live and freeze OBD2 frame properties. - - OBD2 (On-Board Diagnostics 2) is the industry standard protocol - for retrieving diagnostic sensor information from vehicles. - """ - class CheckRead(object): - """This class wraps the logic of an actual property read. - - Attributes: - testobject: the test case this object is used on behalf of. - propertyId: the identifier of the Vehiche HAL property to read. - name: the engineer-readable name of this test operation. - """ - - def __init__(self, testobject, propertyId, name): - self.testobject = testobject - self.propertyId = propertyId - self.name = name - - def onReadSuccess(self, propValue): - """Override this to perform any post-read validation. - - Args: - propValue: the property value obtained from Vehicle HAL. - """ - pass - - def __call__(self): - """Reads the specified property and validates the result.""" - propValue = self.testobject.readVhalProperty(self.propertyId) - asserts.assertNotEqual(propValue, None, - msg="reading %s should not return None" % - self.name) - logging.info("%s = %s", self.name, propValue) - self.onReadSuccess(propValue) - logging.info("%s pass" % self.name) - - def checkLiveFrameRead(): - """Validates reading the OBD2_LIVE_FRAME (if available).""" - checker = CheckRead(self, - self.vtypes.VehicleProperty.OBD2_LIVE_FRAME, - "OBD2_LIVE_FRAME") - checker() - - def checkFreezeFrameRead(): - """Validates reading the OBD2_FREEZE_FRAME (if available).""" - checker = CheckRead(self, - self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME, - "OBD2_FREEZE_FRAME") - checker() - - isLiveSupported = self.vtypes.VehicleProperty.OBD2_LIVE_FRAME in self.propToConfig - isFreezeSupported = self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME in self.propToConfig - logging.info("isLiveSupported = %s, isFreezeSupported = %s", - isLiveSupported, isFreezeSupported) - if isLiveSupported: - checkLiveFrameRead() - if isFreezeSupported: - checkFreezeFrameRead() - def testDrivingStatus(self): """Checks that DRIVING_STATUS property returns correct result.""" propValue = self.readVhalProperty( @@ -686,5 +625,294 @@ class VtsHalAutomotiveVehicleV2_0HostTest(base_test.BaseTestClass): time.sleep(1) asserts.fail("Callback not called in 5 seconds.") + def getDiagnosticSupportInfo(self): + """Check which of the OBD2 diagnostic properties are supported.""" + properties = [self.vtypes.VehicleProperty.OBD2_LIVE_FRAME, + self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME, + self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_INFO, + self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_CLEAR] + return {x:self.isPropSupported(x) for x in properties} + + class CheckRead(object): + """An object whose job it is to read a Vehicle HAL property and run + routine validation checks on the result.""" + + def __init__(self, test, propertyId, areaId=0): + """Creates a CheckRead instance. + + Args: + test: the containing testcase object. + propertyId: the numeric identifier of the vehicle property. + """ + self.test = test + self.propertyId = propertyId + self.areaId = 0 + + def validateGet(self, status, value): + """Validate the result of IVehicle.get. + + Args: + status: the StatusCode returned from Vehicle HAL. + value: the VehiclePropValue returned from Vehicle HAL. + + Returns: a VehiclePropValue instance, or None on failure.""" + asserts.assertEqual(self.test.vtypes.StatusCode.OK, status) + asserts.assertNotEqual(value, None) + asserts.assertEqual(self.propertyId, value['prop']) + return value + + def prepareRequest(self, propValue): + """Setup this request with any property-specific data. + + Args: + propValue: a dictionary in the format of a VehiclePropValue. + + Returns: a dictionary in the format of a VehclePropValue.""" + return propValue + + def __call__(self): + asserts.assertTrue(self.test.isPropSupported(self.propertyId), "error") + request = { + 'prop' : self.propertyId, + 'timestamp' : 0, + 'areaId' : self.areaId, + 'value' : { + 'int32Values' : [], + 'floatValues' : [], + 'int64Values' : [], + 'bytes' : [], + 'stringValue' : "" + } + } + request = self.prepareRequest(request) + requestPropValue = self.test.vtypes.Py2Pb("VehiclePropValue", + request) + status, responsePropValue = self.test.vehicle.get(requestPropValue) + return self.validateGet(status, responsePropValue) + + class CheckWrite(object): + """An object whose job it is to write a Vehicle HAL property and run + routine validation checks on the result.""" + + def __init__(self, test, propertyId, areaId=0): + """Creates a CheckWrite instance. + + Args: + test: the containing testcase object. + propertyId: the numeric identifier of the vehicle property. + areaId: the numeric identifier of the vehicle area. + """ + self.test = test + self.propertyId = propertyId + self.areaId = 0 + + def validateSet(self, status): + """Validate the result of IVehicle.set. + Reading back the written-to property to ensure a consistent + value is fair game for this method. + + Args: + status: the StatusCode returned from Vehicle HAL. + + Returns: None.""" + asserts.assertEqual(self.test.vtypes.StatusCode.OK, status) + + def prepareRequest(self, propValue): + """Setup this request with any property-specific data. + + Args: + propValue: a dictionary in the format of a VehiclePropValue. + + Returns: a dictionary in the format of a VehclePropValue.""" + return propValue + + def __call__(self): + asserts.assertTrue(self.test.isPropSupported(self.propertyId), "error") + request = { + 'prop' : self.propertyId, + 'timestamp' : 0, + 'areaId' : self.areaId, + 'value' : { + 'int32Values' : [], + 'floatValues' : [], + 'int64Values' : [], + 'bytes' : [], + 'stringValue' : "" + } + } + request = self.prepareRequest(request) + requestPropValue = self.test.vtypes.Py2Pb("VehiclePropValue", + request) + status = self.test.vehicle.set(requestPropValue) + return self.validateSet(status) + + def testReadObd2LiveFrame(self): + """Test that one can correctly read the OBD2 live frame.""" + supportInfo = self.getDiagnosticSupportInfo() + if supportInfo[self.vtypes.VehicleProperty.OBD2_LIVE_FRAME]: + checkRead = self.CheckRead(self, + self.vtypes.VehicleProperty.OBD2_LIVE_FRAME) + checkRead() + else: + # live frame not supported by this HAL implementation. done + logging.info("OBD2_LIVE_FRAME not supported.") + + def testReadObd2FreezeFrameInfo(self): + """Test that one can read the list of OBD2 freeze timestamps.""" + supportInfo = self.getDiagnosticSupportInfo() + if supportInfo[self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_INFO]: + checkRead = self.CheckRead(self, + self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_INFO) + checkRead() + else: + # freeze frame info not supported by this HAL implementation. done + logging.info("OBD2_FREEZE_FRAME_INFO not supported.") + + def testReadValidObd2FreezeFrame(self): + """Test that one can read the OBD2 freeze frame data.""" + class FreezeFrameCheckRead(self.CheckRead): + def __init__(self, test, timestamp): + self.test = test + self.propertyId = \ + self.test.vtypes.VehicleProperty.OBD2_FREEZE_FRAME + self.timestamp = timestamp + self.areaId = 0 + + def prepareRequest(self, propValue): + propValue['value']['int64Values'] = [self.timestamp] + return propValue + + def validateGet(self, status, value): + # None is acceptable, as a newer fault could have overwritten + # the one we're trying to read + if value is not None: + asserts.assertEqual(self.test.vtypes.StatusCode.OK, status) + asserts.assertEqual(self.propertyId, value['prop']) + asserts.assertEqual(self.timestamp, value['timestamp']) + + supportInfo = self.getDiagnosticSupportInfo() + if supportInfo[self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_INFO] \ + and supportInfo[self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME]: + infoCheckRead = self.CheckRead(self, + self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_INFO) + frameInfos = infoCheckRead() + timestamps = frameInfos["value"]["int64Values"] + for timestamp in timestamps: + freezeCheckRead = FreezeFrameCheckRead(self, timestamp) + freezeCheckRead() + else: + # freeze frame not supported by this HAL implementation. done + logging.info("OBD2_FREEZE_FRAME and _INFO not supported.") + + def testReadInvalidObd2FreezeFrame(self): + """Test that trying to read freeze frame at invalid timestamps + behaves correctly (i.e. returns an error code).""" + class FreezeFrameCheckRead(self.CheckRead): + def __init__(self, test, timestamp): + self.test = test + self.propertyId = self.test.vtypes.VehicleProperty.OBD2_FREEZE_FRAME + self.timestamp = timestamp + self.areaId = 0 + + def prepareRequest(self, propValue): + propValue['value']['int64Values'] = [self.timestamp] + return propValue + + def validateGet(self, status, value): + asserts.assertEqual( + self.test.vtypes.StatusCode.INVALID_ARG, status) + + supportInfo = self.getDiagnosticSupportInfo() + invalidTimestamps = [0,482005800] + if supportInfo[self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME]: + for timestamp in invalidTimestamps: + freezeCheckRead = FreezeFrameCheckRead(self, timestamp) + freezeCheckRead() + else: + # freeze frame not supported by this HAL implementation. done + logging.info("OBD2_FREEZE_FRAME not supported.") + + def testClearValidObd2FreezeFrame(self): + """Test that deleting a diagnostic freeze frame works. + Given the timing behavor of OBD2_FREEZE_FRAME, the only sensible + definition of works here is that, after deleting a frame, trying to read + at its timestamp, will not be successful.""" + class FreezeFrameClearCheckWrite(self.CheckWrite): + def __init__(self, test, timestamp): + self.test = test + self.propertyId = self.test.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_CLEAR + self.timestamp = timestamp + self.areaId = 0 + + def prepareRequest(self, propValue): + propValue['value']['int64Values'] = [self.timestamp] + return propValue + + def validateSet(self, status): + asserts.assertTrue(status in [ + self.test.vtypes.StatusCode.OK, + self.test.vtypes.StatusCode.INVALID_ARG], "error") + + class FreezeFrameCheckRead(self.CheckRead): + def __init__(self, test, timestamp): + self.test = test + self.propertyId = \ + self.test.vtypes.VehicleProperty.OBD2_FREEZE_FRAME + self.timestamp = timestamp + self.areaId = 0 + + def prepareRequest(self, propValue): + propValue['value']['int64Values'] = [self.timestamp] + return propValue + + def validateGet(self, status, value): + asserts.assertEqual( + self.test.vtypes.StatusCode.INVALID_ARG, status) + + supportInfo = self.getDiagnosticSupportInfo() + if supportInfo[self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_INFO] \ + and supportInfo[self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME] \ + and supportInfo[self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_CLEAR]: + infoCheckRead = self.CheckRead(self, + self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_INFO) + frameInfos = infoCheckRead() + timestamps = frameInfos["value"]["int64Values"] + for timestamp in timestamps: + checkWrite = FreezeFrameClearCheckWrite(self, timestamp) + checkWrite() + checkRead = FreezeFrameCheckRead(self, timestamp) + checkRead() + else: + # freeze frame not supported by this HAL implementation. done + logging.info("OBD2_FREEZE_FRAME, _CLEAR and _INFO not supported.") + + def testClearInvalidObd2FreezeFrame(self): + """Test that deleting an invalid freeze frame behaves correctly.""" + class FreezeFrameClearCheckWrite(self.CheckWrite): + def __init__(self, test, timestamp): + self.test = test + self.propertyId = \ + self.test.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_CLEAR + self.timestamp = timestamp + self.areaId = 0 + + def prepareRequest(self, propValue): + propValue['value']['int64Values'] = [self.timestamp] + return propValue + + def validateSet(self, status): + asserts.assertEqual(self.test.vtypes.StatusCode.INVALID_ARG, + status, "PropId: 0x%s, Timestamp: %d" % (self.propertyId, self.timestamp)) + + supportInfo = self.getDiagnosticSupportInfo() + if supportInfo[self.vtypes.VehicleProperty.OBD2_FREEZE_FRAME_CLEAR]: + invalidTimestamps = [0,482005800] + for timestamp in invalidTimestamps: + checkWrite = FreezeFrameClearCheckWrite(self, timestamp) + checkWrite() + else: + # freeze frame not supported by this HAL implementation. done + logging.info("OBD2_FREEZE_FRAME_CLEAR not supported.") + if __name__ == "__main__": test_runner.main() diff --git a/camera/Android.bp b/camera/Android.bp index 7e79b702..fb12cd53 100644 --- a/camera/Android.bp +++ b/camera/Android.bp @@ -5,6 +5,7 @@ subdirs = [ "common/V1_0", "device/V1_0", "device/V3_2", + "device/V3_3", "metadata/V3_2", "provider/V2_4", ] diff --git a/camera/device/V3_3/Android.bp b/camera/device/V3_3/Android.bp new file mode 100644 index 00000000..995dd5b0 --- /dev/null +++ b/camera/device/V3_3/Android.bp @@ -0,0 +1,6 @@ +// This file was auto-generated. Do not edit manually. +// Use test/vts-testcase/hal/update_makefiles.py to generate this file. + +subdirs = [ + "*", +] diff --git a/camera/device/V3_3/build/Android.bp b/camera/device/V3_3/build/Android.bp new file mode 100644 index 00000000..1cc2e8f2 --- /dev/null +++ b/camera/device/V3_3/build/Android.bp @@ -0,0 +1,151 @@ +// This file was auto-generated. Do not edit manually. +// Use test/vts-testcase/hal/update_makefiles.py to generate this file. + +// Generate .vts spec files. +hal2vts { + name: "android.hardware.camera.device@3.3-vts.spec", + srcs: [ + ":android.hardware.camera.device@3.3_hal", + ], + out: [ + "android/hardware/camera/device/3.3/CameraDeviceSession.vts", + "android/hardware/camera/device/3.3/types.vts", + ], +} + +// Build VTS driver. +genrule { + name: "android.hardware.camera.device@3.3-vts.driver_genc++", + tools: ["hidl-gen", "vtsc"], + cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.camera.device@3.3 && $(location vtsc) -mDRIVER -tSOURCE -b$(genDir) android/hardware/camera/device/3.3/ $(genDir)/android/hardware/camera/device/3.3/", + srcs: [ + ":android.hardware.camera.device@3.3_hal", + ], + out: [ + "android/hardware/camera/device/3.3/CameraDeviceSession.vts.cpp", + "android/hardware/camera/device/3.3/types.vts.cpp", + ], +} + +genrule { + name: "android.hardware.camera.device@3.3-vts.driver_genc++_headers", + tools: ["hidl-gen", "vtsc"], + cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.camera.device@3.3 && $(location vtsc) -mDRIVER -tHEADER -b$(genDir) android/hardware/camera/device/3.3/ $(genDir)/android/hardware/camera/device/3.3/", + srcs: [ + ":android.hardware.camera.device@3.3_hal", + ], + out: [ + "android/hardware/camera/device/3.3/CameraDeviceSession.vts.h", + "android/hardware/camera/device/3.3/types.vts.h", + ], +} + +cc_library_shared { + name: "android.hardware.camera.device@3.3-vts.driver", + generated_sources: ["android.hardware.camera.device@3.3-vts.driver_genc++"], + generated_headers: ["android.hardware.camera.device@3.3-vts.driver_genc++_headers"], + export_generated_headers: ["android.hardware.camera.device@3.3-vts.driver_genc++_headers"], + shared_libs: [ + "libcamera_metadata", + "libcutils", + "libfmq", + "libhidlbase", + "libhidltransport", + "libhwbinder", + "liblog", + "libprotobuf-cpp-full", + "libutils", + "libvts_common", + "libvts_datatype", + "libvts_drivercomm", + "libvts_measurement", + "libvts_multidevice_proto", + "android.hidl.allocator@1.0", + "android.hardware.camera.device@3.3", + "android.hardware.camera.common@1.0", + "android.hardware.camera.common@1.0-vts.driver", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.2-vts.driver", + "android.hardware.graphics.common@1.0", + "android.hardware.graphics.common@1.0-vts.driver", + ], + export_shared_lib_headers: [ + "android.hardware.camera.common@1.0", + "android.hardware.camera.common@1.0-vts.driver", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.2-vts.driver", + "android.hardware.graphics.common@1.0", + "android.hardware.graphics.common@1.0-vts.driver", + ], + cflags: [ + "-Wall", + "-Werror", + + // These warnings are in code generated with vtsc + // b/31362043 + "-Wno-duplicate-decl-specifier", + "-Wno-implicitly-unsigned-literal", + ], +} + +// Build VTS profiler. +genrule { + name: "android.hardware.camera.device@3.3-vts.profiler_genc++", + tools: ["hidl-gen", "vtsc"], + cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.camera.device@3.3 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/camera/device/3.3/ $(genDir)/android/hardware/camera/device/3.3/", + srcs: [ + ":android.hardware.camera.device@3.3_hal", + ], + out: [ + "android/hardware/camera/device/3.3/CameraDeviceSession.vts.cpp", + "android/hardware/camera/device/3.3/types.vts.cpp", + ], +} + +genrule { + name: "android.hardware.camera.device@3.3-vts.profiler_genc++_headers", + tools: ["hidl-gen", "vtsc"], + cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.camera.device@3.3 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/camera/device/3.3/ $(genDir)/android/hardware/camera/device/3.3/", + srcs: [ + ":android.hardware.camera.device@3.3_hal", + ], + out: [ + "android/hardware/camera/device/3.3/CameraDeviceSession.vts.h", + "android/hardware/camera/device/3.3/types.vts.h", + ], +} + +cc_library_shared { + name: "android.hardware.camera.device@3.3-vts.profiler", + generated_sources: ["android.hardware.camera.device@3.3-vts.profiler_genc++"], + generated_headers: ["android.hardware.camera.device@3.3-vts.profiler_genc++_headers"], + export_generated_headers: ["android.hardware.camera.device@3.3-vts.profiler_genc++_headers"], + shared_libs: [ + "libbase", + "libcutils", + "libfmq", + "libhidlbase", + "libhidltransport", + "libvts_common", + "libvts_profiling", + "libvts_multidevice_proto", + "libprotobuf-cpp-full", + "android.hardware.camera.device@3.3", + "android.hardware.camera.common@1.0", + "android.hardware.camera.common@1.0-vts.profiler", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.2-vts.profiler", + "android.hardware.graphics.common@1.0", + "android.hardware.graphics.common@1.0-vts.profiler", + ], + cflags: [ + "-Wall", + "-Werror", + + // These warnings are in code generated with vtsc + // b/31362043 + "-Wno-duplicate-decl-specifier", + "-Wno-implicitly-unsigned-literal", + ], +} + diff --git a/cas/V1_0/target/Android.mk b/cas/V1_0/target/Android.mk new file mode 100644 index 00000000..72836ba5 --- /dev/null +++ b/cas/V1_0/target/Android.mk @@ -0,0 +1,23 @@ +# +# Copyright (C) 2017 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 := VtsHalCasV1_0Target +VTS_CONFIG_SRC_DIR := testcases/hal/cas/V1_0/target +include test/vts/tools/build/Android.host_config.mk diff --git a/cas/V1_0/target/AndroidTest.xml b/cas/V1_0/target/AndroidTest.xml new file mode 100644 index 00000000..5d875158 --- /dev/null +++ b/cas/V1_0/target/AndroidTest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2017 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 VTS VtsHalCasV1_0Target test cases"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="abort-on-push-failure" value="false"/> + <option name="push-group" value="HalHidlTargetTest.push"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"/> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-module-name" value="VtsHalCasV1_0Target"/> + <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalCasV1_0TargetTest/VtsHalCasV1_0TargetTest"/> + <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalCasV1_0TargetTest/VtsHalCasV1_0TargetTest"/> + <option name="binary-test-type" value="hal_hidl_gtest"/> + <option name="binary-test-disable-framework" value="true"/> + <option name="binary-test-stop-native-servers" value="true"/> + <option name="precondition-lshal" value="android.hardware.cas@1.0"/> + <option name="test-timeout" value="1m"/> + </test> +</configuration> diff --git a/drm/V1_0/target/AndroidTest.xml b/drm/V1_0/target/AndroidTest.xml index f8dcff10..132c9c01 100644 --- a/drm/V1_0/target/AndroidTest.xml +++ b/drm/V1_0/target/AndroidTest.xml @@ -17,8 +17,8 @@ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> <option name="abort-on-push-failure" value="false"/> <option name="push-group" value="HalHidlTargetTest.push"/> - <option name="push" value="DATA/vendor/lib/drm-vts-test-libs->/data/local/tmp/32/lib"/> - <option name="push" value="DATA/vendor/lib64/drm-vts-test-libs->/data/local/tmp/64/lib"/> + <option name="push" value="vendor/lib/drm-vts-test-libs->/data/local/tmp/32/lib"/> + <option name="push" value="vendor/lib64/drm-vts-test-libs->/data/local/tmp/64/lib"/> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"/> <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> diff --git a/drm/V1_0/target_profiling/AndroidTest.xml b/drm/V1_0/target_profiling/AndroidTest.xml index 4a431c4f..071123c2 100644 --- a/drm/V1_0/target_profiling/AndroidTest.xml +++ b/drm/V1_0/target_profiling/AndroidTest.xml @@ -18,8 +18,8 @@ <option name="abort-on-push-failure" value="false"/> <option name="push-group" value="HalHidlTargetProfilingTest.push"/> <option name="cleanup" value="true"/> - <option name="push" value="DATA/vendor/lib/drm-vts-test-libs->/data/local/tmp/32/lib"/> - <option name="push" value="DATA/vendor/lib64/drm-vts-test-libs->/data/local/tmp/64/lib"/> + <option name="push" value="vendor/lib/drm-vts-test-libs->/data/local/tmp/32/lib"/> + <option name="push" value="vendor/lib64/drm-vts-test-libs->/data/local/tmp/64/lib"/> <option name="push" value="DATA/lib/android.hardware.drm@1.0-vts.profiler.so->/data/local/tmp/32/android.hardware.drm@1.0-vts.profiler.so"/> <option name="push" value="DATA/lib64/android.hardware.drm@1.0-vts.profiler.so->/data/local/tmp/64/android.hardware.drm@1.0-vts.profiler.so"/> </target_preparer> diff --git a/media/omx/V1_0/host/AndroidTest.xml b/media/omx/V1_0/host/AndroidTest.xml index eec58b89..9c21b9dc 100644 --- a/media/omx/V1_0/host/AndroidTest.xml +++ b/media/omx/V1_0/host/AndroidTest.xml @@ -35,10 +35,14 @@ <option name="push" value="DATA/lib/android.hardware.media.omx@1.0-vts.driver.so->/data/local/tmp/32/android.hardware.media.omx@1.0-vts.driver.so"/> <option name="push" value="DATA/lib64/android.hardware.media.omx@1.0-vts.driver.so->/data/local/tmp/64/android.hardware.media.omx@1.0-vts.driver.so"/> <option name="push" value="DATA/media/res/bbb_352x288_420p_30fps_32frames.yuv->/sdcard/media/bbb_352x288_420p_30fps_32frames.yuv"/> + <option name="push" value="DATA/media/res/bbb_avc_176x144_300kbps_60fps.h264->/sdcard/media/bbb_avc_176x144_300kbps_60fps.h264"/> + <option name="push" value="DATA/media/res/bbb_avc_176x144_300kbps_60fps.info->/sdcard/media/bbb_avc_176x144_300kbps_60fps.info"/> <option name="push" value="DATA/media/res/bbb_avc_1920x1080_5000kbps_30fps.h264->/sdcard/media/bbb_avc_1920x1080_5000kbps_30fps.h264"/> <option name="push" value="DATA/media/res/bbb_avc_1920x1080_5000kbps_30fps.info->/sdcard/media/bbb_avc_1920x1080_5000kbps_30fps.info"/> <option name="push" value="DATA/media/res/bbb_mp3_stereo_192kbps_48000hz.info->/sdcard/media/bbb_mp3_stereo_192kbps_48000hz.info"/> <option name="push" value="DATA/media/res/bbb_mp3_stereo_192kbps_48000hz.mp3->/sdcard/media/bbb_mp3_stereo_192kbps_48000hz.mp3"/> + <option name="push" value="DATA/media/res/bbb_flac_stereo_680kbps_48000hz.flac->/sdcard/media/bbb_flac_stereo_680kbps_48000hz.flac"/> + <option name="push" value="DATA/media/res/bbb_flac_stereo_680kbps_48000hz.info->/sdcard/media/bbb_flac_stereo_680kbps_48000hz.info"/> <option name="push" value="DATA/media/res/bbb_raw_1ch_16khz_s16le.raw->/sdcard/media/bbb_raw_1ch_16khz_s16le.raw"/> <option name="push" value="DATA/media/res/bbb_raw_1ch_8khz_s16le.raw->/sdcard/media/bbb_raw_1ch_8khz_s16le.raw"/> <option name="push" value="DATA/media/res/bbb_raw_2ch_48khz_s16le.raw->/sdcard/media/bbb_raw_2ch_48khz_s16le.raw"/> @@ -46,14 +50,22 @@ <option name="push" value="DATA/media/res/sine_amrnb_1ch_12kbps_8000hz.info->/sdcard/media/sine_amrnb_1ch_12kbps_8000hz.info"/> <option name="push" value="DATA/media/res/bbb_h263_352x288_300kbps_12fps.h263->/sdcard/media/bbb_h263_352x288_300kbps_12fps.h263"/> <option name="push" value="DATA/media/res/bbb_h263_352x288_300kbps_12fps.info->/sdcard/media/bbb_h263_352x288_300kbps_12fps.info"/> + <option name="push" value="DATA/media/res/bbb_hevc_176x144_176kbps_60fps.hevc->/sdcard/media/bbb_hevc_176x144_176kbps_60fps.hevc"/> + <option name="push" value="DATA/media/res/bbb_hevc_176x144_176kbps_60fps.info->/sdcard/media/bbb_hevc_176x144_176kbps_60fps.info"/> <option name="push" value="DATA/media/res/bbb_hevc_640x360_1600kbps_30fps.hevc->/sdcard/media/bbb_hevc_640x360_1600kbps_30fps.hevc"/> <option name="push" value="DATA/media/res/bbb_hevc_640x360_1600kbps_30fps.info->/sdcard/media/bbb_hevc_640x360_1600kbps_30fps.info"/> <option name="push" value="DATA/media/res/bbb_mpeg2_176x144_105kbps_25fps.m2v->/sdcard/media/bbb_mpeg2_176x144_105kbps_25fps.m2v"/> <option name="push" value="DATA/media/res/bbb_mpeg2_176x144_105kbps_25fps.info->/sdcard/media/bbb_mpeg2_176x144_105kbps_25fps.info"/> + <option name="push" value="DATA/media/res/bbb_mpeg2_352x288_1mbps_60fps.m2v->/sdcard/media/bbb_mpeg2_352x288_1mbps_60fps.m2v"/> + <option name="push" value="DATA/media/res/bbb_mpeg2_352x288_1mbps_60fps.info->/sdcard/media/bbb_mpeg2_352x288_1mbps_60fps.info"/> <option name="push" value="DATA/media/res/bbb_mpeg4_1280x720_1000kbps_25fps.m4v->/sdcard/media/bbb_mpeg4_1280x720_1000kbps_25fps.m4v"/> <option name="push" value="DATA/media/res/bbb_mpeg4_1280x720_1000kbps_25fps.info->/sdcard/media/bbb_mpeg4_1280x720_1000kbps_25fps.info"/> + <option name="push" value="DATA/media/res/bbb_vp8_176x144_240kbps_60fps.vp8->/sdcard/media/bbb_vp8_176x144_240kbps_60fps.vp8"/> + <option name="push" value="DATA/media/res/bbb_vp8_176x144_240kbps_60fps.info->/sdcard/media/bbb_vp8_176x144_240kbps_60fps.info"/> <option name="push" value="DATA/media/res/bbb_vp8_640x360_2mbps_30fps.vp8->/sdcard/media/bbb_vp8_640x360_2mbps_30fps.vp8"/> <option name="push" value="DATA/media/res/bbb_vp8_640x360_2mbps_30fps.info->/sdcard/media/bbb_vp8_640x360_2mbps_30fps.info"/> + <option name="push" value="DATA/media/res/bbb_vp9_176x144_285kbps_60fps.vp9->/sdcard/media/bbb_vp9_176x144_285kbps_60fps.vp9"/> + <option name="push" value="DATA/media/res/bbb_vp9_176x144_285kbps_60fps.info->/sdcard/media/bbb_vp9_176x144_285kbps_60fps.info"/> <option name="push" value="DATA/media/res/bbb_vp9_640x360_1600kbps_30fps.vp9->/sdcard/media/bbb_vp9_640x360_1600kbps_30fps.vp9"/> <option name="push" value="DATA/media/res/bbb_vp9_640x360_1600kbps_30fps.info->/sdcard/media/bbb_vp9_640x360_1600kbps_30fps.info"/> <option name="push" value="DATA/media/res/bbb_aac_stereo_128kbps_48000hz.aac->/sdcard/media/bbb_aac_stereo_128kbps_48000hz.aac"/> @@ -83,6 +95,11 @@ <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalMediaOmxV1_0TargetAudioDecTest/VtsHalMediaOmxV1_0TargetAudioDecTest"/> <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalMediaOmxV1_0TargetVideoEncTest/VtsHalMediaOmxV1_0TargetVideoEncTest"/> <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalMediaOmxV1_0TargetVideoDecTest/VtsHalMediaOmxV1_0TargetVideoDecTest"/> + <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetComponentTest/VtsHalMediaOmxV1_0TargetComponentTest"/> + <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetAudioEncTest/VtsHalMediaOmxV1_0TargetAudioEncTest"/> + <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetAudioDecTest/VtsHalMediaOmxV1_0TargetAudioDecTest"/> + <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetVideoEncTest/VtsHalMediaOmxV1_0TargetVideoEncTest"/> + <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMediaOmxV1_0TargetVideoDecTest/VtsHalMediaOmxV1_0TargetVideoDecTest"/> <option name="binary-test-disable-framework" value="true"/> <option name="binary-test-stop-native-servers" value="true"/> <option name="hal-hidl-package-name" value="android.hardware.media.omx@1.0"/> diff --git a/media/omx/V1_0/host/VtsHalMediaOmxV1_0HostTest.py b/media/omx/V1_0/host/VtsHalMediaOmxV1_0HostTest.py index 8d77ac3c..338c1d91 100644 --- a/media/omx/V1_0/host/VtsHalMediaOmxV1_0HostTest.py +++ b/media/omx/V1_0/host/VtsHalMediaOmxV1_0HostTest.py @@ -42,6 +42,7 @@ class VtsHalMediaOmxV1_0Host(hal_hidl_gtest.HidlHalGTest): "audio_decoder.aac", "audio_decoder.amrnb", "audio_decoder.amrwb", + "audio_decoder.flac", "audio_decoder.g711alaw", "audio_decoder.g711mlaw", "audio_decoder.gsm", @@ -120,7 +121,7 @@ class VtsHalMediaOmxV1_0Host(hal_hidl_gtest.HidlHalGTest): instance_name = "default" test_case = omx_test_case.VtsHalMediaOmxV1_0TestCase( component, role, instance_name, test_suite, test_name, - path) + path, tag) test_cases.append(test_case) logging.info("num of test_testcases: %s", len(test_cases)) return test_cases diff --git a/media/omx/V1_0/host_omxstore/Android.mk b/media/omx/V1_0/host_omxstore/Android.mk new file mode 100644 index 00000000..7f178b20 --- /dev/null +++ b/media/omx/V1_0/host_omxstore/Android.mk @@ -0,0 +1,23 @@ +# +# Copyright (C) 2017 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 := VtsHalMediaOmxStoreV1_0Host +VTS_CONFIG_SRC_DIR := testcases/hal/media/omx/V1_0/host_omxstore +include test/vts/tools/build/Android.host_config.mk diff --git a/media/omx/V1_0/host_omxstore/AndroidTest.xml b/media/omx/V1_0/host_omxstore/AndroidTest.xml new file mode 100644 index 00000000..ee9d3e82 --- /dev/null +++ b/media/omx/V1_0/host_omxstore/AndroidTest.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2017 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 VTS VtsHalMediaOmxStoreV1_0Host test cases"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="abort-on-push-failure" value="true"/> + <option name="push-group" value="HalHidlHostTest.push"/> + <option name="cleanup" value="true"/> + <option name="push" value="spec/hardware/interfaces/media/omx/1.0/vts/GraphicBufferSource.vts->/data/local/tmp/spec/android/hardware/media/omx/1.0/GraphicBufferSource.vts"/> + <option name="push" value="spec/hardware/interfaces/media/omx/1.0/vts/Omx.vts->/data/local/tmp/spec/android/hardware/media/omx/1.0/Omx.vts"/> + <option name="push" value="spec/hardware/interfaces/media/omx/1.0/vts/OmxBufferSource.vts->/data/local/tmp/spec/android/hardware/media/omx/1.0/OmxBufferSource.vts"/> + <option name="push" value="spec/hardware/interfaces/media/omx/1.0/vts/OmxNode.vts->/data/local/tmp/spec/android/hardware/media/omx/1.0/OmxNode.vts"/> + <option name="push" value="spec/hardware/interfaces/media/omx/1.0/vts/OmxObserver.vts->/data/local/tmp/spec/android/hardware/media/omx/1.0/OmxObserver.vts"/> + <option name="push" value="spec/hardware/interfaces/media/omx/1.0/vts/OmxStore.vts->/data/local/tmp/spec/android/hardware/media/omx/1.0/OmxStore.vts"/> + <option name="push" value="spec/hardware/interfaces/media/omx/1.0/vts/types.vts->/data/local/tmp/spec/android/hardware/media/omx/1.0/types.vts"/> + <option name="push" value="spec/hardware/interfaces/graphics/common/1.0/vts/types.vts->/data/local/tmp/spec/android/hardware/graphics/common/1.0/types.vts"/> + <option name="push" value="spec/hardware/interfaces/media/1.0/vts/types.vts->/data/local/tmp/spec/android/hardware/media/1.0/types.vts"/> + <option name="push" value="DATA/lib/android.hardware.graphics.bufferqueue@1.0-vts.driver.so->/data/local/tmp/32/android.hardware.graphics.bufferqueue@1.0-vts.driver.so"/> + <option name="push" value="DATA/lib64/android.hardware.graphics.bufferqueue@1.0-vts.driver.so->/data/local/tmp/64/android.hardware.graphics.bufferqueue@1.0-vts.driver.so"/> + <option name="push" value="DATA/lib/android.hardware.graphics.common@1.0-vts.driver.so->/data/local/tmp/32/android.hardware.graphics.common@1.0-vts.driver.so"/> + <option name="push" value="DATA/lib64/android.hardware.graphics.common@1.0-vts.driver.so->/data/local/tmp/64/android.hardware.graphics.common@1.0-vts.driver.so"/> + <option name="push" value="DATA/lib/android.hardware.media@1.0-vts.driver.so->/data/local/tmp/32/android.hardware.media@1.0-vts.driver.so"/> + <option name="push" value="DATA/lib64/android.hardware.media@1.0-vts.driver.so->/data/local/tmp/64/android.hardware.media@1.0-vts.driver.so"/> + <option name="push" value="DATA/lib/android.hardware.media.omx@1.0-vts.driver.so->/data/local/tmp/32/android.hardware.media.omx@1.0-vts.driver.so"/> + <option name="push" value="DATA/lib64/android.hardware.media.omx@1.0-vts.driver.so->/data/local/tmp/64/android.hardware.media.omx@1.0-vts.driver.so"/> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"/> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-module-name" value="VtsHalMediaOmxStoreV1_0Host"/> + <option name="test-case-path" value="vts/testcases/hal/media/omx/V1_0/host_omxstore/VtsHalMediaOmxStoreV1_0HostTest"/> + <option name="hal-hidl-package-name" value="android.hardware.media.omx@1.0"/> + <option name="precondition-lshal" value="android.hardware.media.omx@1.0"/> + <option name="test-timeout" value="1m"/> + </test> +</configuration> diff --git a/media/omx/V1_0/host_omxstore/VtsHalMediaOmxStoreV1_0HostTest.py b/media/omx/V1_0/host_omxstore/VtsHalMediaOmxStoreV1_0HostTest.py new file mode 100644 index 00000000..a8176d76 --- /dev/null +++ b/media/omx/V1_0/host_omxstore/VtsHalMediaOmxStoreV1_0HostTest.py @@ -0,0 +1,470 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 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 module is for VTS test cases involving IOmxStore and IOmx::listNodes(). + +VtsHalMediaOmxStoreV1_0Host derives from base_test.BaseTestClass. It contains +two independent tests: testListServiceAttributes() and +testQueryCodecInformation(). The first one tests +IOmxStore::listServiceAttributes() while the second one test multiple functions +in IOmxStore as well as check the consistency of the return values with +IOmx::listNodes(). + +""" + +import logging +import re + +from vts.runners.host import asserts +from vts.runners.host import base_test +from vts.runners.host import test_runner +from vts.utils.python.controllers import android_device +from vts.utils.python.precondition import precondition_utils + + +class VtsHalMediaOmxStoreV1_0Host(base_test.BaseTestClass): + """Host test class to run the Media_OmxStore HAL.""" + + def setUpClass(self): + self.dut = self.registerController(android_device)[0] + + self.dut.shell.InvokeTerminal('one') + self.dut.shell.one.Execute('setenforce 0') # SELinux permissive mode + if not precondition_utils.CanRunHidlHalTest( + self, self.dut, self.dut.shell.one): + self._skip_all_testcases = True + return + + self.dut.hal.InitHidlHal( + target_type='media_omx', + target_basepaths=self.dut.libPaths, + target_version=1.0, + target_package='android.hardware.media.omx', + target_component_name='IOmxStore', + bits=int(self.abi_bitness)) + + self.omxstore = self.dut.hal.media_omx + self.vtypes = self.omxstore.GetHidlTypeInterface('types') + + if self.coverage.enabled: + self.coverage.LoadArtifacts() + self.coverage.InitializeDeviceCoverage(self._dut) + + def testListServiceAttributes(self): + """Test IOmxStore::listServiceAttributes(). + + Tests that IOmxStore::listServiceAttributes() can be called + successfully and returns sensible attributes. + + An attribute has a name (key) and a value. Known attributes (represented + by variable "known" below) have certain specifications for valid values. + Unknown attributes that start with 'supports-' should only have '0' or + '1' as their value. Other unknown attributes do not cause the test to + fail, but are reported as warnings in the host log. + + """ + + status, attributes = self.omxstore.listServiceAttributes() + asserts.assertEqual(self.vtypes.Status.OK, status, + 'listServiceAttributes() fails.') + + # known is a dictionary whose keys are the known "key" for a service + # attribute pair (see IOmxStore::Attribute), and whose values are the + # corresponding regular expressions that will have to match with the + # "value" of the attribute pair. If listServiceAttributes() returns an + # attribute that has a matching key but an unmatched value, the test + # will fail. + known = { + 'max-video-encoder-input-buffers': re.compile('0|[1-9][0-9]*'), + 'supports-multiple-secure-codecs': re.compile('0|1'), + 'supports-secure-with-non-secure-codec': re.compile('0|1'), + } + # unknown is a list of pairs of regular expressions. For each attribute + # whose key is not known (i.e., does not match any of the keys in the + # "known" variable defined above), that key will be tried for a match + # with the first element of each pair of the variable "unknown". If a + # match occurs, the value of that same attribute will be tried for a + # match with the second element of the pair. If this second match fails, + # the test will fail. + unknown = [ + (re.compile(r'supports-[a-z0-9\-]*'), re.compile('0|1')), + ] + + # key_set is used to verify that listServiceAttributes() does not return + # duplicate attribute names. + key_set = set() + for attr in attributes: + attr_key = attr['key'] + attr_value = attr['value'] + + # attr_key must not have been seen before. + assert( + attr_key not in key_set, + 'Service attribute "' + attr_key + '" has duplicates.') + key_set.add(attr_key) + + if attr_key in known: + asserts.assertTrue( + known[attr_key].match(attr_value), + 'Service attribute "' + attr_key + '" has ' + + 'invalid value "' + attr_value + '".') + else: + matched = False + for key_re, value_re in unknown: + if key_re.match(attr_key): + asserts.assertTrue( + value_re.match(attr_value), + 'Service attribute "' + attr_key + '" has ' + + 'invalid value "' + attr_value + '".') + matched = True + if not matched: + logging.warning( + 'Unrecognized service attribute "' + attr_key + '" ' + + 'with value "' + attr_value + '".') + + def testQueryCodecInformation(self): + """Query and verify information from IOmxStore and IOmx::listNodes(). + + This function performs three main checks: + 1. Information about roles and nodes returned from + IOmxStore::listRoles() conforms to the specifications in + IOmxStore.hal. + 2. Each node present in the information returned from + IOmxStore::listRoles() must be supported by its owner. A node is + considered "supported" by its owner if the IOmx instance + corresponding to that owner returns that node and all associated + roles when IOmx::listNodes() is called. + 3. The prefix string obtained form IOmxStore::getNodePrefix() must be + sensible, and is indeed a prefix of all the node names. + + In step 1, node attributes are validated in the same manner as how + service attributes are validated in testListServiceAttributes(). + Role names and mime types must be recognized by the function get_role() + defined below. + + """ + + # Basic patterns for matching + class Pattern(object): + toggle = '(0|1)' + string = '(.*)' + num = '(0|([1-9][0-9]*))' + size = '(' + num + 'x' + num + ')' + ratio = '(' + num + ':' + num + ')' + range_num = '((' + num + '-' + num + ')|' + num + ')' + range_size = '((' + size + '-' + size + ')|' + size + ')' + range_ratio = '((' + ratio + '-' + ratio + ')|' + ratio + ')' + list_range_num = '(' + range_num + '(,' + range_num + ')*)' + + # Matching rules for node attributes with fixed keys + attr_re = { + 'alignment' : Pattern.size, + 'bitrate-range' : Pattern.range_num, + 'block-aspect-ratio-range' : Pattern.range_ratio, + 'block-count-range' : Pattern.range_num, + 'block-size' : Pattern.size, + 'blocks-per-second-range' : Pattern.range_num, + 'complexity-default' : Pattern.num, + 'complexity-range' : Pattern.range_num, + 'feature-adaptive-playback' : Pattern.toggle, + 'feature-bitrate-control' : '(VBR|CBR|CQ)[,(VBR|CBR|CQ)]*', + 'feature-can-swap-width-height' : Pattern.toggle, + 'feature-intra-refresh' : Pattern.toggle, + 'feature-partial-frame' : Pattern.toggle, + 'feature-secure-playback' : Pattern.toggle, + 'feature-tunneled-playback' : Pattern.toggle, + 'frame-rate-range' : Pattern.range_num, + 'max-channel-count' : Pattern.num, + 'max-concurrent-instances' : Pattern.num, + 'max-supported-instances' : Pattern.num, + 'pixel-aspect-ratio-range' : Pattern.range_ratio, + 'quality-default' : Pattern.num, + 'quality-range' : Pattern.range_num, + 'quality-scale' : Pattern.string, + 'sample-rate-ranges' : Pattern.list_range_num, + 'size-range' : Pattern.range_size, + } + + # Matching rules for node attributes with key patterns + attr_pattern_re = [ + ('measured-frame-rate-' + Pattern.size + + '-range', Pattern.range_num), + (r'feature-[a-zA-Z0-9_\-]+', Pattern.string), + ] + + # Matching rules for node names and owners + node_name_re = r'[a-zA-Z0-9.\-]+' + node_owner_re = r'[a-zA-Z0-9._\-]+' + + # Compile all regular expressions + for key in attr_re: + attr_re[key] = re.compile(attr_re[key]) + for index, value in enumerate(attr_pattern_re): + attr_pattern_re[index] = (re.compile(value[0]), + re.compile(value[1])) + node_name_re = re.compile(node_name_re) + node_owner_re = re.compile(node_owner_re) + + # Mapping from mime types to roles. + # These values come from MediaDefs.cpp and OMXUtils.cpp + audio_mime_to_role = { + '3gpp' : 'amrnb', + 'ac3' : 'ac3', + 'amr-wb' : 'amrwb', + 'eac3' : 'eac3', + 'flac' : 'flac', + 'g711-alaw' : 'g711alaw', + 'g711-mlaw' : 'g711mlaw', + 'gsm' : 'gsm', + 'mp4a-latm' : 'aac', + 'mpeg' : 'mp3', + 'mpeg-L1' : 'mp1', + 'mpeg-L2' : 'mp2', + 'opus' : 'opus', + 'raw' : 'raw', + 'vorbis' : 'vorbis', + } + video_mime_to_role = { + '3gpp' : 'h263', + 'avc' : 'avc', + 'dolby-vision' : 'dolby-vision', + 'hevc' : 'hevc', + 'mp4v-es' : 'mpeg4', + 'mpeg2' : 'mpeg2', + 'x-vnd.on2.vp8' : 'vp8', + 'x-vnd.on2.vp9' : 'vp9', + } + def get_role(is_encoder, mime): + """Returns the role based on is_encoder and mime. + + The mapping from a pair (is_encoder, mime) to a role string is + defined in frameworks/av/media/libmedia/MediaDefs.cpp and + frameworks/av/media/libstagefright/omx/OMXUtils.cpp. This function + does essentially the same work as GetComponentRole() in + OMXUtils.cpp. + + Args: + is_encoder: A boolean indicating whether the role is for an + encoder or a decoder. + mime: A string of the desired mime type. + + Returns: + A string for the requested role name, or None if mime is not + recognized. + """ + mime_suffix = mime[6:] + middle = 'encoder.' if is_encoder else 'decoder.' + if mime.startswith('audio/'): + if mime_suffix not in audio_mime_to_role: + return None + prefix = 'audio_' + suffix = audio_mime_to_role[mime_suffix] + elif mime.startswith('video/'): + if mime_suffix not in video_mime_to_role: + return None + prefix = 'video_' + suffix = video_mime_to_role[mime_suffix] + else: + return None + return prefix + middle + suffix + + # The test code starts here. + roles = self.omxstore.listRoles() + + # A map from a node name to a set of roles. + node2roles = {} + + # A map from an owner to a set of node names. + owner2nodes = {} + + logging.info('Testing IOmxStore::listRoles()...') + # role_set is used for checking if there are duplicate roles. + role_set = set() + for role in roles: + role_name = role['role'] + mime_type = role['type'] + is_encoder = role['isEncoder'] + nodes = role['nodes'] + + # The role name must not have duplicates. + asserts.assertFalse( + role_name in role_set, + 'Role "' + role_name + '" has duplicates.') + + queried_role = get_role(is_encoder, mime_type) + # type and isEncoder must be known. + asserts.assertTrue( + queried_role, + 'Invalid mime type "' + mime_type + '" for ' + + ('an encoder.' if is_encoder else 'a decoder.')) + # type and isEncoder must be consistent with role. + asserts.assertEqual( + role_name, queried_role, + 'Role "' + role_name + '" does not match ' + + ('an encoder ' if is_encoder else 'a decoder ') + + 'for mime type "' + mime_type + '"') + + # Save the role name to check for duplicates. + role_set.add(role_name) + + # Ignore role.preferPlatformNodes for now. + + # node_set is used for checking if there are duplicate node names + # for each role. + node_set = set() + for node in nodes: + node_name = node['name'] + owner = node['owner'] + attributes = node['attributes'] + + # For each role, the node name must not have duplicates. + asserts.assertFalse( + node_name in node_set, + 'Node "' + node_name + '" has duplicates for the same ' + + 'role "' + queried_role + '".') + + # Check the format of node name + asserts.assertTrue( + node_name_re.match(node_name), + 'Node name "' + node_name + '" is invalid.') + # Check the format of node owner + asserts.assertTrue( + node_owner_re.match(owner), + 'Node owner "' + owner + '" is invalid.') + + attr_map = {} + for attr in attributes: + attr_key = attr['key'] + attr_value = attr['value'] + + # For each node and each role, the attribute key must not + # have duplicates. + asserts.assertFalse( + attr_key in attr_map, + 'Attribute "' + attr_key + + '" for node "' + node_name + + '"has duplicates.') + + # Check the value against the corresponding regular + # expression. + if attr_key in attr_re: + asserts.assertTrue( + attr_re[attr_key].match(attr_value), + 'Attribute "' + attr_key + '" has ' + + 'invalid value "' + attr_value + '".') + else: + key_found = False + for pattern_key, pattern_value in attr_pattern_re: + if pattern_key.match(attr_key): + asserts.assertTrue( + pattern_value.match(attr_value), + 'Attribute "' + attr_key + '" has ' + + 'invalid value "' + attr_value + '".') + key_found = True + break + if not key_found: + logging.warning( + 'Unknown attribute "' + + attr_key + '" with value "' + + attr_value + '".') + + # Store the key-value pair + attr_map[attr_key] = attr_value + + if node_name not in node2roles: + node2roles[node_name] = {queried_role,} + if owner not in owner2nodes: + owner2nodes[owner] = {node_name,} + else: + owner2nodes[owner].add(node_name) + else: + node2roles[node_name].add(queried_role) + + # Verify the information with IOmx::listNodes(). + # IOmxStore::listRoles() and IOmx::listNodes() should give consistent + # information about nodes and roles. + logging.info('Verifying with IOmx::listNodes()...') + for owner in owner2nodes: + # Obtain the IOmx instance for each "owner" + omx = self.omxstore.getOmx(owner) + asserts.assertTrue( + omx, + 'Cannot obtain IOmx instance "' + owner + '".') + + # Invoke IOmx::listNodes() + status, node_info_list = omx.listNodes() + asserts.assertEqual( + self.vtypes.Status.OK, status, + 'IOmx::listNodes() fails for IOmx instance "' + owner + '".') + + # Verify that roles for each node match with the information from + # IOmxStore::listRoles(). + node_set = set() + for node_info in node_info_list: + node = node_info['mName'] + roles = node_info['mRoles'] + + # IOmx::listNodes() should not list duplicate node names. + asserts.assertFalse( + node in node_set, + 'IOmx::listNodes() lists duplicate nodes "' + node + '".') + node_set.add(node) + + # Skip "hidden" nodes, i.e. those that are not advertised by + # IOmxStore::listRoles(). + if node not in owner2nodes[owner]: + logging.warning( + 'IOmx::listNodes() lists unknown node "' + node + + '" for IOmx instance "' + owner + '".') + continue + + # All the roles advertised by IOmxStore::listRoles() for this + # node must be included in role_set. + role_set = set(roles) + asserts.assertTrue( + node2roles[node] <= role_set, + 'IOmx::listNodes() for IOmx instance "' + owner + '" ' + + 'does not report some roles for node "' + node + '": ' + + ', '.join(node2roles[node] - role_set)) + + # Check that all nodes obtained from IOmxStore::listRoles() are + # supported by the their corresponding IOmx instances. + node_set_diff = owner2nodes[owner] - node_set + asserts.assertFalse( + node_set_diff, + 'IOmx::listNodes() for IOmx instance "' + owner + '" ' + + 'does not report some expected nodes: ' + + ', '.join(node_set_diff) + '.') + + # Call IOmxStore::getNodePrefix(). + prefix = self.omxstore.getNodePrefix() + logging.info('Checking node prefix: ' + + 'IOmxStore::getNodePrefix() returns "' + prefix + '".') + + # Check that the prefix is a sensible string. + asserts.assertTrue( + node_name_re.match(prefix), + '"' + prefix + '" is not a valid prefix for node names.') + + # Check that all node names have the said prefix. + for node in node2roles: + asserts.assertTrue( + node.startswith(prefix), + 'Node "' + node + '" does not start with ' + + 'prefix "' + prefix + '".') + +if __name__ == '__main__': + test_runner.main() diff --git a/media/omx/V1_0/host_omxstore/__init__.py b/media/omx/V1_0/host_omxstore/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/media/omx/V1_0/host_omxstore/__init__.py diff --git a/neuralnetworks/V1_0/build/Android.bp b/neuralnetworks/V1_0/build/Android.bp index e0229a9a..c2ca1b39 100644 --- a/neuralnetworks/V1_0/build/Android.bp +++ b/neuralnetworks/V1_0/build/Android.bp @@ -9,8 +9,9 @@ hal2vts { ], out: [ "android/hardware/neuralnetworks/1.0/Device.vts", - "android/hardware/neuralnetworks/1.0/Event.vts", + "android/hardware/neuralnetworks/1.0/ExecutionCallback.vts", "android/hardware/neuralnetworks/1.0/PreparedModel.vts", + "android/hardware/neuralnetworks/1.0/PreparedModelCallback.vts", "android/hardware/neuralnetworks/1.0/types.vts", ], } @@ -25,8 +26,9 @@ genrule { ], out: [ "android/hardware/neuralnetworks/1.0/Device.vts.cpp", - "android/hardware/neuralnetworks/1.0/Event.vts.cpp", + "android/hardware/neuralnetworks/1.0/ExecutionCallback.vts.cpp", "android/hardware/neuralnetworks/1.0/PreparedModel.vts.cpp", + "android/hardware/neuralnetworks/1.0/PreparedModelCallback.vts.cpp", "android/hardware/neuralnetworks/1.0/types.vts.cpp", ], } @@ -40,8 +42,9 @@ genrule { ], out: [ "android/hardware/neuralnetworks/1.0/Device.vts.h", - "android/hardware/neuralnetworks/1.0/Event.vts.h", + "android/hardware/neuralnetworks/1.0/ExecutionCallback.vts.h", "android/hardware/neuralnetworks/1.0/PreparedModel.vts.h", + "android/hardware/neuralnetworks/1.0/PreparedModelCallback.vts.h", "android/hardware/neuralnetworks/1.0/types.vts.h", ], } @@ -94,8 +97,9 @@ genrule { ], out: [ "android/hardware/neuralnetworks/1.0/Device.vts.cpp", - "android/hardware/neuralnetworks/1.0/Event.vts.cpp", + "android/hardware/neuralnetworks/1.0/ExecutionCallback.vts.cpp", "android/hardware/neuralnetworks/1.0/PreparedModel.vts.cpp", + "android/hardware/neuralnetworks/1.0/PreparedModelCallback.vts.cpp", "android/hardware/neuralnetworks/1.0/types.vts.cpp", ], } @@ -109,8 +113,9 @@ genrule { ], out: [ "android/hardware/neuralnetworks/1.0/Device.vts.h", - "android/hardware/neuralnetworks/1.0/Event.vts.h", + "android/hardware/neuralnetworks/1.0/ExecutionCallback.vts.h", "android/hardware/neuralnetworks/1.0/PreparedModel.vts.h", + "android/hardware/neuralnetworks/1.0/PreparedModelCallback.vts.h", "android/hardware/neuralnetworks/1.0/types.vts.h", ], } diff --git a/radio/V1_0/target/AndroidTest.xml b/radio/V1_0/target/AndroidTest.xml index a2493be7..5c7c4993 100644 --- a/radio/V1_0/target/AndroidTest.xml +++ b/radio/V1_0/target/AndroidTest.xml @@ -30,6 +30,7 @@ <option name="binary-test-stop-native-servers" value="true"/> <option name="precondition-lshal" value="android.hardware.radio@1.0"/> <option name="test-timeout" value="15m"/> - <option name="exclude-filter" value="SapHidlTest.transferAtrReq" /> + <!-- The following test is disabled due to b/64734869 --> + <option name="exclude-filter" value="RadioHidlTest.requestShutdown" /> </test> </configuration> diff --git a/treble/vintf/vts_treble_vintf_test.cpp b/treble/vintf/vts_treble_vintf_test.cpp index 5727d009..f9331507 100644 --- a/treble/vintf/vts_treble_vintf_test.cpp +++ b/treble/vintf/vts_treble_vintf_test.cpp @@ -91,6 +91,16 @@ static bool IsGoogleDefinedIface(const FQName &fq_iface_name) { return !PackageRoot(fq_iface_name).empty(); } +// Returns true iff HAL interface is exempt from following rules: +// 1. If an interface is declared in VINTF, it has to be served on the device. +static bool IsExempt(const FQName &fq_iface_name) { + static const set<string> exempt_hals_ = {}; + string hal_name = fq_iface_name.package(); + // Radio-releated and non-Google HAL interfaces are given exemptions. + return exempt_hals_.find(hal_name) != exempt_hals_.end() || + !IsGoogleDefinedIface(fq_iface_name); +} + // Returns the set of released hashes for a given HAL interface. static set<string> ReleasedHashes(const FQName &fq_iface_name) { set<string> released_hashes{}; @@ -168,8 +178,7 @@ sp<android::hidl::base::V1_0::IBase> VtsTrebleVintfTest::GetHalService( fq_name.getPackageMinorVersion()}; string iface_name = fq_name.name(); string fq_iface_name = fq_name.string(); - cout << "Getting service of: " << fq_iface_name << " " << instance_name - << endl; + cout << "Getting service of: " << fq_iface_name << endl; Transport transport = vendor_manifest_->getTransport( hal_name, version, iface_name, instance_name); @@ -234,6 +243,11 @@ TEST_F(VtsTrebleVintfTest, VintfHalsAreServed) { // Verifies that HAL is available through service manager. HalVerifyFn is_available = [this](const FQName &fq_name, const string &instance_name) { + if (IsExempt(fq_name)) { + cout << fq_name.string() << " is exempt." << endl; + return; + } + sp<android::hidl::base::V1_0::IBase> hal_service = GetHalService(fq_name, instance_name); EXPECT_NE(hal_service, nullptr) @@ -253,7 +267,11 @@ TEST_F(VtsTrebleVintfTest, InterfacesAreReleased) { GetHalService(fq_name, instance_name); if (hal_service == nullptr) { - ADD_FAILURE() << fq_name.string() << " not available." << endl; + if (IsExempt(fq_name)) { + cout << fq_name.string() << " is exempt." << endl; + } else { + ADD_FAILURE() << fq_name.package() << " not available." << endl; + } return; } @@ -305,11 +323,15 @@ TEST(CompatiblityTest, VendorFrameworkCompatibility) { *VintfObject::GetDeviceCompatibilityMatrix(), &error)) << error; + // AVB version is not a compliance requirement. EXPECT_TRUE(VintfObject::GetRuntimeInfo()->checkCompatibility( - *VintfObject::GetFrameworkCompatibilityMatrix(), &error)) + *VintfObject::GetFrameworkCompatibilityMatrix(), &error, + ::android::vintf::DISABLE_AVB_CHECK)) << error; - EXPECT_EQ(0, VintfObject::CheckCompatibility({}, &error)) << error; + EXPECT_EQ(0, VintfObject::CheckCompatibility( + {}, &error, ::android::vintf::DISABLE_AVB_CHECK)) + << error; } int main(int argc, char **argv) { diff --git a/wifi/V1_0/host/VtsHalWifiV1_0HostTest.py b/wifi/V1_0/host/VtsHalWifiV1_0HostTest.py index c2c313dd..085014da 100644 --- a/wifi/V1_0/host/VtsHalWifiV1_0HostTest.py +++ b/wifi/V1_0/host/VtsHalWifiV1_0HostTest.py @@ -17,6 +17,7 @@ import logging +from vts.runners.host import asserts from vts.runners.host import const from vts.runners.host import test_runner from vts.testcases.template.hal_hidl_gtest import hal_hidl_gtest @@ -28,6 +29,18 @@ class VtsHalWifiV1_0Host(hal_hidl_gtest.HidlHalGTest): WIFI_AWARE_FEATURE_NAME = "android.hardware.wifi.aware" + def setUpClass(self): + super(VtsHalWifiV1_0Host, self).setUpClass() + results = self.shell.Execute("setprop ctl.stop wpa_supplicant") + asserts.assertEqual(0, results[const.EXIT_CODE][0]) + results = self.shell.Execute("setprop ctl.stop wificond") + asserts.assertEqual(0, results[const.EXIT_CODE][0]) + + def tearDownClass(self): + results = self.shell.Execute("setprop ctl.start wificond") + if results[const.EXIT_CODE][0] != 0: + logging.error('Failed to start wificond') + def CreateTestCases(self): """Get all registered test components and create test case objects.""" pm_list = self.shell.Execute("pm list features") |
