diff options
| author | Yuexi Ma <yuexima@google.com> | 2016-12-07 13:41:19 -0800 |
|---|---|---|
| committer | Yuexi Ma <yuexima@google.com> | 2016-12-07 21:45:22 +0000 |
| commit | f031e445332b4712a6396418b9a9967ab988940f (patch) | |
| tree | 66c50a7d58c5404b59834bf5421cbe3350c59d46 /vehicle | |
| parent | 2508e0cbc5ece35347a4a937fc217d851adcc525 (diff) | |
| download | android_hardware_interfaces-f031e445332b4712a6396418b9a9967ab988940f.tar.gz android_hardware_interfaces-f031e445332b4712a6396418b9a9967ab988940f.tar.bz2 android_hardware_interfaces-f031e445332b4712a6396418b9a9967ab988940f.zip | |
Vehicle hal driver in vts
Test: make vts
Change-Id: Ib0b022e257fedebdf8bf952f7ea82479a4b45dad
Diffstat (limited to 'vehicle')
12 files changed, 245 insertions, 0 deletions
diff --git a/vehicle/2.0/vts/functional/Android.mk b/vehicle/2.0/vts/functional/Android.mk new file mode 100644 index 000000000..f9e32763f --- /dev/null +++ b/vehicle/2.0/vts/functional/Android.mk @@ -0,0 +1,19 @@ +# +# 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 $(call all-subdir-makefiles) diff --git a/vehicle/2.0/vts/functional/vts/Android.mk b/vehicle/2.0/vts/functional/vts/Android.mk new file mode 100644 index 000000000..f9e32763f --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/Android.mk @@ -0,0 +1,19 @@ +# +# 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 $(call all-subdir-makefiles) diff --git a/vehicle/2.0/vts/functional/vts/testcases/Android.mk b/vehicle/2.0/vts/functional/vts/testcases/Android.mk new file mode 100644 index 000000000..f9e32763f --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/Android.mk @@ -0,0 +1,19 @@ +# +# 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 $(call all-subdir-makefiles) diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/Android.mk b/vehicle/2.0/vts/functional/vts/testcases/hal/Android.mk new file mode 100644 index 000000000..f9e32763f --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/hal/Android.mk @@ -0,0 +1,19 @@ +# +# 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 $(call all-subdir-makefiles) diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/Android.mk b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/Android.mk new file mode 100644 index 000000000..f9e32763f --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/Android.mk @@ -0,0 +1,19 @@ +# +# 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 $(call all-subdir-makefiles) diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/__init__.py b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/__init__.py diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/Android.mk b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/Android.mk new file mode 100644 index 000000000..f9e32763f --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/Android.mk @@ -0,0 +1,19 @@ +# +# 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 $(call all-subdir-makefiles) diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/__init__.py b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/__init__.py diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/Android.mk b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/Android.mk new file mode 100644 index 000000000..716a41c34 --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/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 := VehicleHidlTest +VTS_CONFIG_SRC_DIR := testcases/hal/vehicle/hidl/host +include test/vts/tools/build/Android.host_config.mk
\ No newline at end of file diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/AndroidTest.xml b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/AndroidTest.xml new file mode 100644 index 000000000..16b7c29bd --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/AndroidTest.xml @@ -0,0 +1,29 @@ +<?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 Vehicle 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/vehicle/2.0/vts/Vehicle.vts->/data/local/tmp/spec/Vehicle.vts" /> + <option name="push" value="spec/hardware/interfaces/vehicle/2.0/vts/VehicleCallback.vts->/data/local/tmp/spec/VehicleCallBack.vts" /> + <option name="push" value="spec/hardware/interfaces/vehicle/2.0/vts/types.vts->/data/local/tmp/spec/types.vts" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" /> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-module-name" value="VehicleHidlTest" /> + <option name="test-case-path" value="vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest" /> + </test> +</configuration> diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py new file mode 100644 index 000000000..bc37e599e --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py @@ -0,0 +1,79 @@ +#!/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 VehicleHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): + """A simple testcase for the VEHICLE HIDL HAL.""" + + def setUpClass(self): + """Creates a mirror and init vehicle hal.""" + self.dut = self.registerController(android_device)[0] + + self.dut.shell.InvokeTerminal("one") + + if self.enable_profiling: + profiling_utils.EnableVTSProfiling(self.dut.shell.one) + + self.dut.hal.InitHidlHal( + target_type="vehicle", + target_basepaths=["/system/lib64"], + target_version=2.0, + target_package="android.hardware.vehicle", + target_component_name="IVehicle", + 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 testEcho1(self): + """A simple testcase which sends a command.""" + self.dut.shell.InvokeTerminal("my_shell1") # creates a remote shell instance. + results = self.dut.shell.my_shell1.Execute("echo hello_world") # runs a shell command. + logging.info(str(results[const.STDOUT])) # prints the stdout + asserts.assertEqual(results[const.STDOUT][0].strip(), "hello_world") # checks the stdout + asserts.assertEqual(results[const.EXIT_CODE][0], 0) # checks the exit code + + def testEcho2(self): + """A simple testcase which sends two commands.""" + self.dut.shell.InvokeTerminal("my_shell2") + my_shell = getattr(self.dut.shell, "my_shell2") + results = my_shell.Execute(["echo hello", "echo world"]) + logging.info(str(results[const.STDOUT])) + asserts.assertEqual(len(results[const.STDOUT]), 2) # check the number of processed commands + asserts.assertEqual(results[const.STDOUT][0].strip(), "hello") + asserts.assertEqual(results[const.STDOUT][1].strip(), "world") + asserts.assertEqual(results[const.EXIT_CODE][0], 0) + asserts.assertEqual(results[const.EXIT_CODE][1], 0) + +if __name__ == "__main__": + test_runner.main() diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/__init__.py b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/__init__.py |
