diff options
Diffstat (limited to 'hidl_trace_recorder/HidlTraceRecorder.py')
-rw-r--r-- | hidl_trace_recorder/HidlTraceRecorder.py | 61 |
1 files changed, 61 insertions, 0 deletions
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() |