diff options
author | Keun Soo Yim <yim@google.com> | 2016-11-30 17:56:36 -0800 |
---|---|---|
committer | Keun Soo Yim <yim@google.com> | 2016-11-30 17:57:20 -0800 |
commit | 8e83144c0730a4bb5f1b6de0ec22ba2fd8909bb3 (patch) | |
tree | e097f762fc4139adf92c0dbce23bdf327d3ba79a /hidl_trace_recorder | |
parent | 306739e2318691879ed2b0bc288ab1d1b7b642b4 (diff) | |
download | performance-8e83144c0730a4bb5f1b6de0ec22ba2fd8909bb3.tar.gz |
add hidl trace recorder
Test: run vts -m HidlTraceRecorder
Change-Id: If9c4498fba86c3a3a132129a742e628c4329a05b
Diffstat (limited to 'hidl_trace_recorder')
-rw-r--r-- | hidl_trace_recorder/Android.mk | 24 | ||||
-rw-r--r-- | hidl_trace_recorder/AndroidTest.xml | 31 | ||||
-rw-r--r-- | hidl_trace_recorder/HidlTraceRecorder.py | 61 | ||||
-rw-r--r-- | hidl_trace_recorder/__init__.py | 0 |
4 files changed, 116 insertions, 0 deletions
diff --git a/hidl_trace_recorder/Android.mk b/hidl_trace_recorder/Android.mk new file mode 100644 index 0000000..aee9a5c --- /dev/null +++ b/hidl_trace_recorder/Android.mk @@ -0,0 +1,24 @@ +# +# 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) + +include $(CLEAR_VARS) + +LOCAL_MODULE := HidlTraceRecorder +VTS_CONFIG_SRC_DIR := testcases/performance/hidl_trace_recorder +-include test/vts/tools/build/Android.host_config.mk diff --git a/hidl_trace_recorder/AndroidTest.xml b/hidl_trace_recorder/AndroidTest.xml new file mode 100644 index 0000000..4a6daad --- /dev/null +++ b/hidl_trace_recorder/AndroidTest.xml @@ -0,0 +1,31 @@ +<?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 Sensor Module HIDL Trace Recoder test case"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="push-group" value="HostDrivenTest.push" /> + <option name="cleanup" value="true" /> + </target_preparer> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller"> + <!-- TODO(yim): reenable when CtsSensorTestCases.apk is not flaky + <option name="test-file-name" value="DATA/app/CtsSensorTestCases/CtsSensorTestCases.apk" /> --> + <option name="test-file-name" value="DATA/app/CtsAccelerationTestCases/CtsAccelerationTestCases.apk" /> + <option name="cleanup-apks" value="true" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" /> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-case-path" value="vts/testcases/performance/hidl_trace_recorder/HidlTraceRecorder" /> + </test> +</configuration> diff --git a/hidl_trace_recorder/HidlTraceRecorder.py b/hidl_trace_recorder/HidlTraceRecorder.py new file mode 100644 index 0000000..2dd7946 --- /dev/null +++ b/hidl_trace_recorder/HidlTraceRecorder.py @@ -0,0 +1,61 @@ +#!/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 os + +from vts.runners.host import asserts +from vts.runners.host import base_test_with_webdb +from vts.runners.host import const +from vts.runners.host import test_runner +from vts.utils.python.controllers import android_device + + +class HidlTraceRecorder(base_test_with_webdb.BaseTestWithWebDbClass): + """A HIDL HAL API trace recorder. + + This class uses an apk which is packaged as part of VTS. It uses to test the + VTS TF's instrumentation preparer and post-processing modules. Those two + Java TF-side modules are cherry-picked to CTS to collect HIDL traces while + running various CTS test cases without having to package them as part of + VTS. + """ + + CTS_TESTS = [ + {"apk": "CtsAccelerationTestCases.apk", + "package": "android.acceleration.cts", + "runner": "android.support.test.runner.AndroidJUnitRunner"}, + # TODO(yim): reenable once tests in that apk are no more flaky. + # {"apk": "CtsSensorTestCases.apk", + # "package": "android.hardware.sensor.cts", + # "runner": "android.support.test.runner.AndroidJUnitRunner"}, + ] + TMP_DIR = "/data/local/tmp" + + def setUpClass(self): + self.dut = self.registerController(android_device)[0] + + def testRunCtsSensorTestCases(self): + """Runs all test cases in CtsSensorTestCases.apk.""" + for cts_test in self.CTS_TESTS: + logging.info("Run %s", cts_test["apk"]) + self.dut.adb.shell( + "am instrument -w -r %s/%s" % (cts_test["package"], + cts_test["runner"])) + +if __name__ == "__main__": + test_runner.main() diff --git a/hidl_trace_recorder/__init__.py b/hidl_trace_recorder/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/hidl_trace_recorder/__init__.py |