diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-01-04 00:13:00 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-01-04 00:13:01 +0000 |
commit | 6e3cb80c19d91cf2072f99bd230fb7719e8c6f1d (patch) | |
tree | b98ec388baf5f178f90226803e1a737c5d23a746 /vr/1.0 | |
parent | 045ff830dea16aa50cba01d4a7056f07475857af (diff) | |
parent | e165cdbf09c298e78f0aafe7877008cf7a2f2869 (diff) | |
download | platform_hardware_interfaces-6e3cb80c19d91cf2072f99bd230fb7719e8c6f1d.tar.gz platform_hardware_interfaces-6e3cb80c19d91cf2072f99bd230fb7719e8c6f1d.tar.bz2 platform_hardware_interfaces-6e3cb80c19d91cf2072f99bd230fb7719e8c6f1d.zip |
Merge "Add VR Hal host test."
Diffstat (limited to 'vr/1.0')
4 files changed, 130 insertions, 0 deletions
diff --git a/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/Android.mk b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/Android.mk new file mode 100644 index 0000000000..9388b8d9b3 --- /dev/null +++ b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/Android.mk @@ -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. +# + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := VrHidlTest +VTS_CONFIG_SRC_DIR := testcases/hal/vr/hidl/host +include test/vts/tools/build/Android.host_config.mk diff --git a/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/AndroidTest.xml b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/AndroidTest.xml new file mode 100644 index 0000000000..1cd2a80ad7 --- /dev/null +++ b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/AndroidTest.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. +--> +<configuration description="Config for VTS HAL VR test cases"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="push-group" value="HidlHalTest.push" /> + <option name="cleanup" value="true" /> + <option name="push" value="spec/hardware/interfaces/vr/1.0/vts/Vr.vts->/data/local/tmp/spec/Vr.vts" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" /> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-module-name" value="VrHidlTest" /> + <option name="test-case-path" value="vts/testcases/hal/vr/hidl/host/VrHidlTest" /> + </test> +</configuration> diff --git a/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/VrHidlTest.py b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/VrHidlTest.py new file mode 100644 index 0000000000..9ed378ffe6 --- /dev/null +++ b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/VrHidlTest.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3.4 +# +# 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. +# + +import logging +import time + +from vts.runners.host import asserts +from vts.runners.host import base_test_with_webdb +from vts.runners.host import test_runner +from vts.utils.python.controllers import android_device +from vts.utils.python.profiling import profiling_utils + + +class VrHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): + """A simple testcase for the VR HIDL HAL.""" + + def setUpClass(self): + """Creates a mirror and turns on the framework-layer VR service.""" + self.dut = self.registerController(android_device)[0] + + self.dut.shell.InvokeTerminal("one") + self.dut.shell.one.Execute("setenforce 0") # SELinux permissive mode + + # Test using the binderized mode + self.dut.shell.one.Execute( + "setprop vts.hal.vts.hidl.get_stub true") + + if self.enable_profiling: + profiling_utils.EnableVTSProfiling(self.dut.shell.one) + + self.dut.hal.InitHidlHal( + target_type="vr", + target_basepaths=["/system/lib64"], + target_version=1.0, + target_package="android.hardware.vr", + target_component_name="IVr", + bits=64) + + def tearDownClass(self): + """ If profiling is enabled for the test, collect the profiling data + and disable profiling after the test is done. + """ + if self.enable_profiling: + profiling_trace_path = getattr( + self, self.VTS_PROFILING_TRACING_PATH, "") + self.ProcessAndUploadTraceData(self.dut, profiling_trace_path) + profiling_utils.DisableVTSProfiling(self.dut.shell.one) + + def testVrBasic(self): + """A simple test case which just calls each registered function.""" + result = self.dut.hal.vr.init() + logging.info("init result: %s", result) + + time.sleep(1) + + result = self.dut.hal.vr.setVrMode(True) + logging.info("setVrMode(true) result: %s", result) + + time.sleep(1) + + result = self.dut.hal.vr.setVrMode(False) + logging.info("setVrMode(false) result: %s", result) + + +if __name__ == "__main__": + test_runner.main() diff --git a/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/__init__.py b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/__init__.py |