diff options
37 files changed, 700 insertions, 52 deletions
diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..6027082 --- /dev/null +++ b/.clang-format @@ -0,0 +1,13 @@ +--- +Language: Cpp +BasedOnStyle: Google +ColumnLimit: 80 +IndentWidth: 2 +ContinuationIndentWidth: 4 +--- +Language: Java +BasedOnStyle: Google +ColumnLimit: 100 +IndentWidth: 4 +ContinuationIndentWidth: 8 +... @@ -0,0 +1,3 @@ +yim@google.com +zhuoyao@google.com +yuexima@google.com diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg new file mode 100644 index 0000000..6be6e5f --- /dev/null +++ b/PREUPLOAD.cfg @@ -0,0 +1,6 @@ +[Builtin Hooks] +clang_format = true + +[Builtin Hooks Options] +clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp,java + diff --git a/audio_loopback_test/Android.mk b/audio_loopback_test/Android.mk new file mode 100644 index 0000000..75eac6a --- /dev/null +++ b/audio_loopback_test/Android.mk @@ -0,0 +1,22 @@ +# +# 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 := AudioLoopbackTest +VTS_CONFIG_SRC_DIR := testcases/performance/audio_loopback_test +-include test/vts/tools/build/Android.host_config.mk diff --git a/audio_loopback_test/AndroidTest.xml b/audio_loopback_test/AndroidTest.xml new file mode 100644 index 0000000..89a67d7 --- /dev/null +++ b/audio_loopback_test/AndroidTest.xml @@ -0,0 +1,27 @@ +<?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 Sensor Module HIDL Audio Loopback test case"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="push-group" value="HostDrivenTest.push" /> + <option name="cleanup" value="true" /> + <option name="push" value="DATA/performance/res/Loopback.apk->/data/local/tmp/Loopback.apk" /> + </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/audio_loopback_test/AudioLoopbackTest" /> + <option name="test-timeout" value="10m"/> + </test> +</configuration> diff --git a/audio_loopback_test/AudioLoopbackTest.py b/audio_loopback_test/AudioLoopbackTest.py new file mode 100644 index 0000000..10c1b51 --- /dev/null +++ b/audio_loopback_test/AudioLoopbackTest.py @@ -0,0 +1,132 @@ +#!/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. +# + +import logging +import math +import os + +from time import sleep +from vts.runners.host import asserts +from vts.runners.host import base_test +from vts.runners.host import const +from vts.runners.host import test_runner +from vts.utils.python.controllers import android_device + + +class AudioLoopbackTest(base_test.BaseTestClass): + """A test module for the Audio Loopback Benchmark.""" + + # Threshold for average latency and standard deviation. + THRESHOLD = {"MAX_LATENCY": 20000000, } + + TEST_DATA_DIR = "audiotest" + FULL_DATA_DIR_PATH = os.path.join("/mnt/sdcard/", TEST_DATA_DIR) + TEST_FILE_PREFIX = "out" + TEST_FILE_NAME = os.path.join(FULL_DATA_DIR_PATH, + TEST_FILE_PREFIX + ".txt") + ITERATION = 100 + + def setUpClass(self): + self.dut = self.registerController(android_device)[0] + self.dut.shell.InvokeTerminal("one") + self.dut.adb.shell("mkdir -p %s" % self.FULL_DATA_DIR_PATH) + # install Loopback.apk + self.dut.adb.shell("pm install -r -g /data/local/tmp/Loopback.apk") + + def tearDown(self): + self.dut.adb.shell("rm -rf %s" % self.FULL_DATA_DIR_PATH) + + def ProcessTestResults(self, latencies, confidences): + """Process test results and upload to web dashboard. + + Calculate the average and standard deviation of latencies from all test run. + Only test results with confidence = 1.0 are counted. + + Args: + latencies: List of latency (in ns) get from each run. e.g.[8040000] + confidences: List of confidence get from each run. e.g. [0.98, 1.0] + """ + total_latency = 0 + total_run = 0 + for latency, confidence in zip(latencies, confidences): + # filter test runs with confidence < 1.0 + if confidence < 1.0: + latencies.remove(latency) + else: + total_latency += latency + total_run += 1 + asserts.assertLess(0, total_run, "No valid runs.") + self.web.AddProfilingDataUnlabeledVector( + "AVG_LATENCY", + latencies, + x_axis_label="AVG Roundtrip latency (ns)", + y_axis_label="Frequency") + # calculate the average latency. + avg_latency = total_latency / total_run + logging.info("avg_latency: %s", avg_latency) + asserts.assertLess(avg_latency, self.THRESHOLD["MAX_LATENCY"], + "avg latency exceeds threshold") + # calculate the standard deviation of latencies. + sd = 0.0 + for latency in latencies: + sd += (latency - avg_latency) * (latency - avg_latency) + sd = int(math.sqrt(sd / total_run)) + logging.info("standard_deviation: %s", sd) + self.web.AddProfilingDataUnlabeledVector( + "STANDARD_DEVIATION", [sd], + x_axis_label="Standard deviation", + y_axis_label="Frequency") + + def testRun(self): + """Runs test in audio Loopback.apk and process the test results.""" + latencies = [] + confidences = [] + for i in range(0, self.ITERATION): + self.dut.shell.one.Execute( + ["rm -f %s/*" % self.FULL_DATA_DIR_PATH]) + self.dut.shell.one.Execute([ + "am start -n org.drrickorang.loopback/.LoopbackActivity " + "--es FileName %s/%s --ei AudioLevel 11 --ei TestType 222;" % + (self.TEST_DATA_DIR, self.TEST_FILE_PREFIX) + ]) + # wait until the test finished. + results = self.dut.shell.one.Execute( + ["ls %s" % self.TEST_FILE_NAME]) + while results[const.EXIT_CODE][0]: + logging.info("Test is running...") + sleep(1) + results = self.dut.shell.one.Execute( + ["ls %s" % self.TEST_FILE_NAME]) + + results = self.dut.shell.one.Execute( + ["cat %s" % self.TEST_FILE_NAME]) + asserts.assertFalse(results[const.EXIT_CODE][0], + "Fail to get the test output") + stdout_lines = results[const.STDOUT][0].split("\n") + for line in stdout_lines: + if line.startswith("LatencyMs"): + latencies.append( + int( + float(line.replace("LatencyMs = ", "")) * 1000000)) + if line.startswith("LatencyConfidence"): + confidences.append( + float(line.replace("LatencyConfidence = ", ""))) + self.ProcessTestResults(latencies, confidences) + + +if __name__ == "__main__": + test_runner.main() diff --git a/audio_loopback_test/README.md b/audio_loopback_test/README.md new file mode 100644 index 0000000..35a2596 --- /dev/null +++ b/audio_loopback_test/README.md @@ -0,0 +1,18 @@ +The AudioLoopbackTest is used to test round-trip audio performance over headset jack and USB. +It is based on the Loopback.apk run with Loopback dongle: https://source.android.com/devices/audio/loopback + +* How to run the test? + 1. plug in the Loopback dongle to your device. + 2. `make vts` + 3. `vts-tradefed run vts -m AudioLoopbackTest` + +* What metrics this test report? + 1. Average round-trip latency. + 2. Standard deviation of round-trip latency. + +* Which version of Loopback.apk is used in the test? + The Loopback.apk used in this test is Loopback-v17 copied from https://tradefed.teams.x20web.corp.google.com/testdata/media/apps/ + +* Where can I get the source code for the Loopback.apk? + Internal developer: https://googleplex-android.git.corp.google.com/platform/vendor/google_toolbox/+/master/user/rago/studio/LoopbackApp/ + Open source: https://github.com/gkasten/drrickorang
\ No newline at end of file diff --git a/audio_loopback_test/__init__.py b/audio_loopback_test/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/audio_loopback_test/__init__.py diff --git a/binder_benchmark/BinderPerformanceTest.py b/binder_benchmark/BinderPerformanceTest.py index 919225a..8003512 100644 --- a/binder_benchmark/BinderPerformanceTest.py +++ b/binder_benchmark/BinderPerformanceTest.py @@ -124,12 +124,14 @@ class BinderPerformanceTest(base_test.BaseTestClass): "BinderPerformanceTest failed.") parser = benchmark_parser.GoogleBenchmarkJsonParser( results[const.STDOUT][1]) - label_result = parser.getArguments() - value_result = parser.getRealTime() + label_result = parser.GetArguments() + value_result = parser.GetRealTime() + table_name = "binder_vector_roundtrip_latency_benchmark_%sbits" % bits + self.addTableToResult(table_name, parser.ToTable()) # To upload to the web DB. self.web.AddProfilingDataLabeledVector( - "binder_vector_roundtrip_latency_benchmark_%sbits" % bits, + table_name, label_result, value_result, x_axis_label="Message Size (Bytes)", diff --git a/fmq_benchmark/AndroidTest.xml b/fmq_benchmark/AndroidTest.xml index a5a090a..63d8ee4 100644 --- a/fmq_benchmark/AndroidTest.xml +++ b/fmq_benchmark/AndroidTest.xml @@ -19,11 +19,10 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/lib/android.hardware.tests.msgq@1.0.so->/data/local/tmp/32/android.hardware.tests.msgq@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.msgq@1.0.so->/data/local/tmp/64/android.hardware.tests.msgq@1.0.so" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.msgq@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.msgq@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.msgq@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.msgq@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.msgq@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.msgq@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.msgq@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.msgq@1.0-impl.so" /> <option name="push" value="DATA/nativetest/android.hardware.tests.msgq@1.0-service-benchmark/android.hardware.tests.msgq@1.0-service-benchmark->/data/local/tmp/32/mq_benchmark_service32" /> <option name="push" value="DATA/nativetest64/android.hardware.tests.msgq@1.0-service-benchmark/android.hardware.tests.msgq@1.0-service-benchmark->/data/local/tmp/64/mq_benchmark_service64" /> <option name="push" value="DATA/nativetest/mq_benchmark_client/mq_benchmark_client->/data/local/tmp/32/mq_benchmark_client32" /> @@ -31,6 +30,7 @@ </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/fmq_benchmark/FmqPerformanceTest" /> + <option name="test-case-path" value="vts/testcases/performance/fmq_benchmark/FmqPerformanceTest" /> + <option name="test-timeout" value="1m"/> </test> </configuration> diff --git a/fmq_benchmark/FmqPerformanceTest.py b/fmq_benchmark/FmqPerformanceTest.py index 4013a1e..d8032f1 100644 --- a/fmq_benchmark/FmqPerformanceTest.py +++ b/fmq_benchmark/FmqPerformanceTest.py @@ -51,7 +51,8 @@ class FmqPerformanceTest(base_test.BaseTestClass): def setUpClass(self): self.dut = self.registerController(android_device)[0] self.dut.shell.InvokeTerminal("one") - self._cpu_freq = cpu_frequency_scaling.CpuFrequencyScalingController(self.dut) + self._cpu_freq = cpu_frequency_scaling.CpuFrequencyScalingController( + self.dut) self._cpu_freq.DisableCpuScaling() def tearDownClass(self): @@ -82,11 +83,14 @@ class FmqPerformanceTest(base_test.BaseTestClass): logging.info("Start the benchmark service(%s bit mode)", bits) binary = "/data/local/tmp/%s/mq_benchmark_service%s" % (bits, bits) results = self.dut.shell.one.Execute([ - "chmod 755 %s" % binary, "LD_LIBRARY_PATH=/data/local/tmp/%s:" + "chmod 755 %s" % binary, + "VTS_ROOT_PATH=/data/local/tmp TREBLE_TESTING_OVERRIDE=true " \ + "LD_LIBRARY_PATH=/data/local/tmp/%s:" "$LD_LIBRARY_PATH %s&" % (bits, binary) ]) asserts.assertEqual(len(results[const.STDOUT]), 2) - asserts.assertFalse(any(results[const.EXIT_CODE]), + asserts.assertFalse( + any(results[const.EXIT_CODE]), "Failed to start the benchmark service.") # Runs the benchmark. @@ -94,17 +98,19 @@ class FmqPerformanceTest(base_test.BaseTestClass): binary = "/data/local/tmp/%s/mq_benchmark_client%s" % (bits, bits) results = self.dut.shell.one.Execute([ - "chmod 755 %s" % binary, "LD_LIBRARY_PATH=/data/local/tmp/%s:" + "chmod 755 %s" % binary, + "TREBLE_TESTING_OVERRIDE=true LD_LIBRARY_PATH=/data/local/tmp/%s:" "$LD_LIBRARY_PATH %s" % (bits, binary) ]) # Stop the benchmark service. - self.dut.shell.one.Execute("kill -9 `pidof mq_benchmark_service%s`" % bits) + self.dut.shell.one.Execute("kill -9 `pidof mq_benchmark_service%s`" % + bits) # Parses the result. asserts.assertEqual(len(results[const.STDOUT]), 2) - asserts.assertFalse(any(results[const.EXIT_CODE]), - "FmqPerformanceTest failed.") + asserts.assertFalse( + any(results[const.EXIT_CODE]), "FmqPerformanceTest failed.") read_label = [] read_latency = [] write_label = [] @@ -112,16 +118,15 @@ class FmqPerformanceTest(base_test.BaseTestClass): stdout_lines = results[const.STDOUT][1].split("\n") for line in stdout_lines: if line.startswith("Average time to read"): - read_result = line.replace( - "Average time to read", "").replace( + read_result = line.replace("Average time to read", "").replace( "bytes", "").replace("ns", "") (label, value) = read_result.split(": ") read_label.append(label) read_latency.append(int(value)) if line.startswith("Average time to write"): - write_result = line.replace( - "Average time to write ", "").replace( - "bytes", "").replace("ns", "") + write_result = line.replace("Average time to write ", + "").replace("bytes", + "").replace("ns", "") (label, value) = write_result.split(": ") write_label.append(label) write_latency.append(int(value)) @@ -156,5 +161,6 @@ class FmqPerformanceTest(base_test.BaseTestClass): "%s ns for %s is longer than the threshold %s ns" % ( value, label, self.THRESHOLD[bits][label])) + if __name__ == "__main__": test_runner.main() diff --git a/hwbinder_benchmark/HwBinderPerformanceTest.py b/hwbinder_benchmark/HwBinderPerformanceTest.py index bc5aade..4fc0842 100644 --- a/hwbinder_benchmark/HwBinderPerformanceTest.py +++ b/hwbinder_benchmark/HwBinderPerformanceTest.py @@ -115,6 +115,7 @@ class HwBinderPerformanceTest(base_test.BaseTestClass): results = self.dut.shell.one.Execute([ "chmod 755 %s" % binary, + "VTS_ROOT_PATH=/data/local/tmp " \ "LD_LIBRARY_PATH=/system/lib%s:/data/local/tmp/%s/hw:" "/data/local/tmp/%s:$LD_LIBRARY_PATH " "%s -m %s --benchmark_format=json" % @@ -130,12 +131,14 @@ class HwBinderPerformanceTest(base_test.BaseTestClass): "HwBinderPerformanceTest failed.") parser = benchmark_parser.GoogleBenchmarkJsonParser( results[const.STDOUT][1]) - label_result = parser.getArguments() - value_result = parser.getRealTime() + label_result = parser.GetArguments() + value_result = parser.GetRealTime() + table_name = "hwbinder_vector_roundtrip_latency_benchmark_%sbits" % bits + self.addTableToResult(table_name, parser.ToTable()) # To upload to the web DB. self.web.AddProfilingDataLabeledVector( - "hwbinder_vector_roundtrip_latency_benchmark_%sbits" % bits, + table_name, label_result, value_result, x_axis_label="Message Size (Bytes)", diff --git a/hwbinder_benchmark/binderize/AndroidTest.xml b/hwbinder_benchmark/binderize/AndroidTest.xml index 041d3b1..aee5c55 100644 --- a/hwbinder_benchmark/binderize/AndroidTest.xml +++ b/hwbinder_benchmark/binderize/AndroidTest.xml @@ -19,13 +19,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/benchmarktest/libhwbinder_benchmark/libhwbinder_benchmark32->/data/local/tmp/32/libhwbinder_benchmark32" /> <option name="push" value="DATA/benchmarktest64/libhwbinder_benchmark/libhwbinder_benchmark64->/data/local/tmp/64/libhwbinder_benchmark64" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> @@ -33,5 +32,6 @@ <option name="test-module-name" value="HwBinderBinderizePerformanceTest" /> <option name="test-case-path" value="vts/testcases/performance/hwbinder_benchmark/HwBinderPerformanceTest" /> <option name="test-config-path" value="vts/testcases/performance/hwbinder_benchmark/binderize/HwBinderBinderizePerformanceTest.config" /> + <option name="test-timeout" value="5m"/> </test> </configuration> diff --git a/hwbinder_benchmark/binderize_systrace/AndroidTest.xml b/hwbinder_benchmark/binderize_systrace/AndroidTest.xml index a117000..dd956e3 100644 --- a/hwbinder_benchmark/binderize_systrace/AndroidTest.xml +++ b/hwbinder_benchmark/binderize_systrace/AndroidTest.xml @@ -19,13 +19,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/benchmarktest/libhwbinder_benchmark/libhwbinder_benchmark32->/data/local/tmp/32/libhwbinder_benchmark32" /> <option name="push" value="DATA/benchmarktest64/libhwbinder_benchmark/libhwbinder_benchmark64->/data/local/tmp/64/libhwbinder_benchmark64" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> @@ -34,5 +33,6 @@ <option name="test-case-path" value="vts/testcases/performance/hwbinder_benchmark/HwBinderPerformanceTest" /> <option name="test-config-path" value="vts/testcases/performance/hwbinder_benchmark/binderize/HwBinderBinderizePerformanceTest.config" /> <option name="enable-systrace" value="true" /> + <option name="test-timeout" value="5m"/> </test> </configuration> diff --git a/hwbinder_benchmark/passthrough/AndroidTest.xml b/hwbinder_benchmark/passthrough/AndroidTest.xml index 559a58f..aaa9a2a 100644 --- a/hwbinder_benchmark/passthrough/AndroidTest.xml +++ b/hwbinder_benchmark/passthrough/AndroidTest.xml @@ -19,13 +19,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/benchmarktest/libhwbinder_benchmark/libhwbinder_benchmark32->/data/local/tmp/32/libhwbinder_benchmark32" /> <option name="push" value="DATA/benchmarktest64/libhwbinder_benchmark/libhwbinder_benchmark64->/data/local/tmp/64/libhwbinder_benchmark64" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> @@ -33,5 +32,6 @@ <option name="test-module-name" value="HwBinderPassthroughPerformanceTest" /> <option name="test-case-path" value="vts/testcases/performance/hwbinder_benchmark/HwBinderPerformanceTest" /> <option name="test-config-path" value="vts/testcases/performance/hwbinder_benchmark/passthrough/HwBinderPassthroughPerformanceTest.config" /> + <option name="test-timeout" value="5m"/> </test> </configuration> diff --git a/hwbinder_benchmark/passthrough_systrace/AndroidTest.xml b/hwbinder_benchmark/passthrough_systrace/AndroidTest.xml index df489e4..9c7d335 100644 --- a/hwbinder_benchmark/passthrough_systrace/AndroidTest.xml +++ b/hwbinder_benchmark/passthrough_systrace/AndroidTest.xml @@ -19,13 +19,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/benchmarktest/libhwbinder_benchmark/libhwbinder_benchmark32->/data/local/tmp/32/libhwbinder_benchmark32" /> <option name="push" value="DATA/benchmarktest64/libhwbinder_benchmark/libhwbinder_benchmark64->/data/local/tmp/64/libhwbinder_benchmark64" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> @@ -34,5 +33,6 @@ <option name="test-case-path" value="vts/testcases/performance/hwbinder_benchmark/HwBinderPerformanceTest" /> <option name="test-config-path" value="vts/testcases/performance/hwbinder_benchmark/passthrough/HwBinderPassthroughPerformanceTest.config" /> <option name="enable-systrace" value="true" /> + <option name="test-timeout" value="5m"/> </test> </configuration> diff --git a/hwbinder_benchmark_adb/HwBinderPerformanceAdbTest.py b/hwbinder_benchmark_adb/HwBinderPerformanceAdbTest.py index 1a125ab..18051e3 100644 --- a/hwbinder_benchmark_adb/HwBinderPerformanceAdbTest.py +++ b/hwbinder_benchmark_adb/HwBinderPerformanceAdbTest.py @@ -108,6 +108,7 @@ class HwBinderPerformanceAdbTest(base_test.BaseTestClass): try: result = self.dut.adb.shell( + "VTS_ROOT_PATH=/data/local/tmp " \ "LD_LIBRARY_PATH=/system/lib%s:/data/local/tmp/%s/hw:" "/data/local/tmp/%s:" "$LD_LIBRARY_PATH %s -m %s" % diff --git a/hwbinder_benchmark_adb/binderize/AndroidTest.xml b/hwbinder_benchmark_adb/binderize/AndroidTest.xml index 9411b19..c2c24c0 100644 --- a/hwbinder_benchmark_adb/binderize/AndroidTest.xml +++ b/hwbinder_benchmark_adb/binderize/AndroidTest.xml @@ -19,13 +19,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/benchmarktest/libhwbinder_benchmark/libhwbinder_benchmark32->/data/local/tmp/32/libhwbinder_benchmark32" /> <option name="push" value="DATA/benchmarktest64/libhwbinder_benchmark/libhwbinder_benchmark64->/data/local/tmp/64/libhwbinder_benchmark64" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> diff --git a/hwbinder_benchmark_adb/binderize_systrace/AndroidTest.xml b/hwbinder_benchmark_adb/binderize_systrace/AndroidTest.xml index 0823007..328c332 100644 --- a/hwbinder_benchmark_adb/binderize_systrace/AndroidTest.xml +++ b/hwbinder_benchmark_adb/binderize_systrace/AndroidTest.xml @@ -18,13 +18,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/benchmarktest/libhwbinder_benchmark/libhwbinder_benchmark32->/data/local/tmp/32/libhwbinder_benchmark32" /> <option name="push" value="DATA/benchmarktest64/libhwbinder_benchmark/libhwbinder_benchmark64->/data/local/tmp/64/libhwbinder_benchmark64" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> diff --git a/hwbinder_latency_test/HwBinderLatencyTest.py b/hwbinder_latency_test/HwBinderLatencyTest.py new file mode 100644 index 0000000..0cb2f0b --- /dev/null +++ b/hwbinder_latency_test/HwBinderLatencyTest.py @@ -0,0 +1,176 @@ +#!/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. +# + +import json +import logging + +from vts.runners.host import asserts +from vts.runners.host import base_test +from vts.runners.host import const +from vts.runners.host import test_runner +from vts.utils.python.controllers import android_device +from vts.utils.python.cpu import cpu_frequency_scaling + + +class HwBinderLatencyTest(base_test.BaseTestClass): + """A test case for the hwbinder latency benchmarking. + + Sample output of libhwbinder_latency + { + "cfg":{"pair":6,"iterations":166,"deadline_us":2500,"passthrough":1}, + "fifo_0_data": [15052, ...], + "fifo_1_data": [...], + ... + "ALL":{"SYNC":"GOOD","S":1992,"I":1992,"R":1, + "other_ms":{ "avg":0.0048, "wst":0.32, "bst":0.0022, "miss":0, "meetR":1}, + "fifo_ms": { "avg":0.0035, "wst":0.037, "bst":0.0021, "miss":0, "meetR":1}, + "otherdis":{ "p50":0.19531, "p90":0.19531, "p95":0.19531, "p99": 0.19531}, + "fifodis": { "p50":0.19531, "p90":0.19531, "p95":0.19531, "p99": 0.19531} + }, + "P0":{... + }, + ... + "inheritance": "PASS" + } + """ + # The order of the columns in the output table + _MS_COLUMNS = ["avg", "wst", "bst", "miss", "meetR"] + _DIS_COLUMNS = ["p50", "p90", "p95", "p99"] + # The keys in the JSON object + _CFG = "cfg" + _PAIR = "pair" + _ALL = "ALL" + _OTHER_MS = "other_ms" + _FIFO_MS = "fifo_ms" + _OTHERDIS = "otherdis" + _FIFODIS = "fifodis" + _INHERITANCE = "inheritance" + + def setUpClass(self): + required_params = ["hidl_hal_mode"] + self.getUserParams(required_params) + self.dut = self.registerController(android_device)[0] + self.dut.shell.InvokeTerminal("one") + self._cpu_freq = cpu_frequency_scaling.CpuFrequencyScalingController(self.dut) + self._cpu_freq.DisableCpuScaling() + + def setUp(self): + self._cpu_freq.SkipIfThermalThrottling(retry_delay_secs=30) + + def tearDown(self): + self._cpu_freq.SkipIfThermalThrottling() + + def tearDownClass(self): + self._cpu_freq.EnableCpuScaling() + + def testRunBenchmark32Bit(self): + result = self._runBenchmark(32) + self._addBenchmarkTableToResult(result, 32) + self._uploadResult(result, 32) + + def testRunBenchmark64Bit(self): + result = self._runBenchmark(64) + self._addBenchmarkTableToResult(result, 64) + self._uploadResult(result, 64) + + def _runBenchmark(self, bits): + """Runs the native binary and parses its result. + + Args: + bits: integer (32 or 64), the bitness of the binary to run. + + Returns: + dict, the benchmarking result converted from native binary's JSON + output. + """ + logging.info("Start %d-bit hwbinder latency test with HIDL mode=%s", + bits, self.hidl_hal_mode) + binary = "/data/local/tmp/%s/libhwbinder_latency%s" % (bits, bits) + min_cpu, max_cpu = self._cpu_freq.GetMinAndMaxCpuNo() + iterations = 1000 // (max_cpu - min_cpu) + results = self.dut.shell.one.Execute([ + "chmod 755 %s" % binary, + "VTS_ROOT_PATH=/data/local/tmp " \ + "LD_LIBRARY_PATH=/system/lib%s:/data/local/tmp/%s/hw:" + "/data/local/tmp/%s:$LD_LIBRARY_PATH " + "%s -raw_data -pair %d -i %d -m %s" % (bits, bits, bits, + binary, max_cpu - min_cpu, iterations, + self.hidl_hal_mode.encode("utf-8"))]) + # Parses the result. + asserts.assertEqual(len(results[const.STDOUT]), 2) + logging.info("stderr: %s", results[const.STDERR][1]) + logging.info("stdout: %s", results[const.STDOUT][1]) + asserts.assertFalse( + any(results[const.EXIT_CODE]), + "testRunBenchmark%sBit failed." % (bits)) + json_result = json.loads(results[const.STDOUT][1]); + asserts.assertTrue(json_result[self._INHERITANCE] == "PASS", + "Scheduler does not support priority inheritance."); + return json_result + + def _createRow(self, pair_name, ms_result, dis_result): + """Creates a row from the JSON output. + + Args: + pair_name: string, the pair name in the first column. + ms_result: dict, the fifo_ms or other_ms object. + dis_result: dict, the fifodis or otherdis object. + + Returns: + the list containing pair_name and the values in the objects. + """ + row = [pair_name] + row.extend([ms_result[x] for x in self._MS_COLUMNS]) + row.extend([dis_result[x] for x in self._DIS_COLUMNS]) + return row + + def _addBenchmarkTableToResult(self, result, bits): + pair_cnt = result[self._CFG][self._PAIR] + row_names = ["P" + str(i) for i in range(pair_cnt)] + [self._ALL] + col_names = ["pair"] + self._MS_COLUMNS + self._DIS_COLUMNS + fifo_table = [col_names] + other_table = [col_names] + for row_name in row_names: + pair_result = result[row_name] + fifo_table.append(self._createRow(row_name, + pair_result[self._FIFO_MS], pair_result[self._FIFODIS])) + other_table.append(self._createRow(row_name, + pair_result[self._OTHER_MS], pair_result[self._OTHERDIS])) + self.addTableToResult( + "hwbinder_latency_%sbits_fifo" % bits,fifo_table) + self.addTableToResult( + "hwbinder_latency_%sbits_other" % bits, other_table) + + def _uploadResult(self, result, bits): + """Uploads the output of benchmark program to web DB. + + Args: + result: dict which is the benchmarking result. + bits: integer (32 or 64). + """ + opts = ["hidl_hal_mode=%s" % self.hidl_hal_mode.encode("utf-8")]; + min_cpu, max_cpu = self._cpu_freq.GetMinAndMaxCpuNo() + for i in range(max_cpu - min_cpu): + self.web.AddProfilingDataUnlabeledVector( + "hwbinder_latency_%sbits" % bits, + result["fifo_%d_data" % i], options=opts, + x_axis_label="hwbinder latency", + y_axis_label="Frequency") + + +if __name__ == "__main__": + test_runner.main() diff --git a/hwbinder_latency_test/__init__.py b/hwbinder_latency_test/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/hwbinder_latency_test/__init__.py diff --git a/hwbinder_latency_test/binderize/Android.mk b/hwbinder_latency_test/binderize/Android.mk new file mode 100644 index 0000000..9c440a4 --- /dev/null +++ b/hwbinder_latency_test/binderize/Android.mk @@ -0,0 +1,22 @@ +# +# 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 := HwBinderBinderizeLatencyTest +VTS_CONFIG_SRC_DIR := testcases/performance/hwbinder_latency_test/binderize +include test/vts/tools/build/Android.host_config.mk diff --git a/hwbinder_latency_test/binderize/AndroidTest.xml b/hwbinder_latency_test/binderize/AndroidTest.xml new file mode 100644 index 0000000..6e5e5db --- /dev/null +++ b/hwbinder_latency_test/binderize/AndroidTest.xml @@ -0,0 +1,36 @@ +<?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 libhwbinder latency tests"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="abort-on-push-failure" value="false" /> + <option name="push-group" value="HostDrivenTest.push" /> + <option name="cleanup" value="true" /> + <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> + <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> + <option name="push" value="DATA/nativetest/libhwbinder_latency/libhwbinder_latency->/data/local/tmp/32/libhwbinder_latency32" /> + <option name="push" value="DATA/nativetest64/libhwbinder_latency/libhwbinder_latency->/data/local/tmp/64/libhwbinder_latency64" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> + </target_preparer> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-module-name" value="HwBinderBinderizeLatencyTest" /> + <option name="test-case-path" value="vts/testcases/performance/hwbinder_latency_test/HwBinderLatencyTest" /> + <option name="test-config-path" value="vts/testcases/performance/hwbinder_latency_test/binderize/HwBinderBinderizeLatencyTest.config" /> + <option name="test-timeout" value="5m"/> + </test> +</configuration> diff --git a/hwbinder_latency_test/binderize/HwBinderBinderizeLatencyTest.config b/hwbinder_latency_test/binderize/HwBinderBinderizeLatencyTest.config new file mode 100644 index 0000000..fc792a7 --- /dev/null +++ b/hwbinder_latency_test/binderize/HwBinderBinderizeLatencyTest.config @@ -0,0 +1,3 @@ +{ + "hidl_hal_mode": "BINDERIZE" +} diff --git a/hwbinder_latency_test/binderize_systrace/Android.mk b/hwbinder_latency_test/binderize_systrace/Android.mk new file mode 100644 index 0000000..e716aa7 --- /dev/null +++ b/hwbinder_latency_test/binderize_systrace/Android.mk @@ -0,0 +1,22 @@ +# +# 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 := HwBinderBinderizeLatencySystraceTest +VTS_CONFIG_SRC_DIR := testcases/performance/hwbinder_latency_test/binderize_systrace +include test/vts/tools/build/Android.host_config.mk diff --git a/hwbinder_latency_test/binderize_systrace/AndroidTest.xml b/hwbinder_latency_test/binderize_systrace/AndroidTest.xml new file mode 100644 index 0000000..dd3c4b8 --- /dev/null +++ b/hwbinder_latency_test/binderize_systrace/AndroidTest.xml @@ -0,0 +1,37 @@ +<?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 libhwbinder latency tests with systrace"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="abort-on-push-failure" value="false" /> + <option name="push-group" value="HostDrivenTest.push" /> + <option name="cleanup" value="true" /> + <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> + <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> + <option name="push" value="DATA/nativetest/libhwbinder_latency/libhwbinder_latency->/data/local/tmp/32/libhwbinder_latency32" /> + <option name="push" value="DATA/nativetest64/libhwbinder_latency/libhwbinder_latency->/data/local/tmp/64/libhwbinder_latency64" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> + </target_preparer> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-module-name" value="HwBinderBinderizeLatencySystraceTest" /> + <option name="test-case-path" value="vts/testcases/performance/hwbinder_latency_test/HwBinderLatencyTest" /> + <option name="test-config-path" value="vts/testcases/performance/hwbinder_latency_test/binderize/HwBinderBinderizeLatencyTest.config" /> + <option name="enable-systrace" value="true" /> + <option name="test-timeout" value="5m"/> + </test> +</configuration> diff --git a/hwbinder_latency_test/passthrough/Android.mk b/hwbinder_latency_test/passthrough/Android.mk new file mode 100644 index 0000000..12ca61f --- /dev/null +++ b/hwbinder_latency_test/passthrough/Android.mk @@ -0,0 +1,22 @@ +# +# 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 := HwBinderPassthroughLatencyTest +VTS_CONFIG_SRC_DIR := testcases/performance/hwbinder_latency_test/passthrough +include test/vts/tools/build/Android.host_config.mk diff --git a/hwbinder_latency_test/passthrough/AndroidTest.xml b/hwbinder_latency_test/passthrough/AndroidTest.xml new file mode 100644 index 0000000..4078bf0 --- /dev/null +++ b/hwbinder_latency_test/passthrough/AndroidTest.xml @@ -0,0 +1,36 @@ +<?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 libhwbinder latency tests"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="abort-on-push-failure" value="false" /> + <option name="push-group" value="HostDrivenTest.push" /> + <option name="cleanup" value="true" /> + <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> + <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> + <option name="push" value="DATA/nativetest/libhwbinder_latency/libhwbinder_latency->/data/local/tmp/32/libhwbinder_latency32" /> + <option name="push" value="DATA/nativetest64/libhwbinder_latency/libhwbinder_latency->/data/local/tmp/64/libhwbinder_latency64" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> + </target_preparer> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-module-name" value="HwBinderPassthroughLatencyTest" /> + <option name="test-case-path" value="vts/testcases/performance/hwbinder_latency_test/HwBinderLatencyTest" /> + <option name="test-config-path" value="vts/testcases/performance/hwbinder_latency_test/passthrough/HwBinderPassthroughLatencyTest.config" /> + <option name="test-timeout" value="5m"/> + </test> +</configuration> diff --git a/hwbinder_latency_test/passthrough/HwBinderPassthroughLatencyTest.config b/hwbinder_latency_test/passthrough/HwBinderPassthroughLatencyTest.config new file mode 100644 index 0000000..54d9875 --- /dev/null +++ b/hwbinder_latency_test/passthrough/HwBinderPassthroughLatencyTest.config @@ -0,0 +1,3 @@ +{ + "hidl_hal_mode": "PASSTHROUGH" +} diff --git a/hwbinder_latency_test/passthrough_systrace/Android.mk b/hwbinder_latency_test/passthrough_systrace/Android.mk new file mode 100644 index 0000000..3a619e0 --- /dev/null +++ b/hwbinder_latency_test/passthrough_systrace/Android.mk @@ -0,0 +1,22 @@ +# +# 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 := HwBinderPassthroughLatencySystraceTest +VTS_CONFIG_SRC_DIR := testcases/performance/hwbinder_latency_test/passthrough_systrace +include test/vts/tools/build/Android.host_config.mk diff --git a/hwbinder_latency_test/passthrough_systrace/AndroidTest.xml b/hwbinder_latency_test/passthrough_systrace/AndroidTest.xml new file mode 100644 index 0000000..e8075bd --- /dev/null +++ b/hwbinder_latency_test/passthrough_systrace/AndroidTest.xml @@ -0,0 +1,37 @@ +<?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 libhwbinder latency tests with systrace"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="abort-on-push-failure" value="false" /> + <option name="push-group" value="HostDrivenTest.push" /> + <option name="cleanup" value="true" /> + <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> + <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> + <option name="push" value="DATA/nativetest/libhwbinder_latency/libhwbinder_latency->/data/local/tmp/32/libhwbinder_latency32" /> + <option name="push" value="DATA/nativetest64/libhwbinder_latency/libhwbinder_latency->/data/local/tmp/64/libhwbinder_latency64" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> + </target_preparer> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-module-name" value="HwBinderPassthroughLatencySystraceTest" /> + <option name="test-case-path" value="vts/testcases/performance/hwbinder_latency_test/HwBinderLatencyTest" /> + <option name="test-config-path" value="vts/testcases/performance/hwbinder_latency_test/passthrough/HwBinderPassthroughLatencyTest.config" /> + <option name="enable-systrace" value="true" /> + <option name="test-timeout" value="5m"/> + </test> +</configuration> diff --git a/hwbinder_throughput_test/HwBinderThroughputBenchmark.py b/hwbinder_throughput_test/HwBinderThroughputBenchmark.py index d0aacf4..588c37f 100644 --- a/hwbinder_throughput_test/HwBinderThroughputBenchmark.py +++ b/hwbinder_throughput_test/HwBinderThroughputBenchmark.py @@ -155,6 +155,7 @@ class HwBinderThroughputBenchmark(base_test.BaseTestClass): results = self.dut.shell.one.Execute( ["chmod 755 %s" % binary, + "VTS_ROOT_PATH=/data/local/tmp " \ "LD_LIBRARY_PATH=/system/lib%s:/data/local/tmp/%s/hw:" "/data/local/tmp/%s:" "$LD_LIBRARY_PATH %s -m %s -w %s" % (bits, bits, bits, binary, self.hidl_hal_mode.encode("utf-8"), threads)]) diff --git a/hwbinder_throughput_test/binderize/AndroidTest.xml b/hwbinder_throughput_test/binderize/AndroidTest.xml index b22bf78..8b65b69 100644 --- a/hwbinder_throughput_test/binderize/AndroidTest.xml +++ b/hwbinder_throughput_test/binderize/AndroidTest.xml @@ -19,13 +19,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/nativetest/hwbinderThroughputTest/hwbinderThroughputTest->/data/local/tmp/32/hwbinderThroughputTest32" /> <option name="push" value="DATA/nativetest64/hwbinderThroughputTest/hwbinderThroughputTest->/data/local/tmp/64/hwbinderThroughputTest64" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> @@ -33,5 +32,6 @@ <option name="test-module-name" value="HwBinderBinderizeThroughputTest" /> <option name="test-case-path" value="vts/testcases/performance/hwbinder_throughput_test/HwBinderThroughputBenchmark" /> <option name="test-config-path" value="vts/testcases/performance/hwbinder_throughput_test/binderize/HwBinderBinderizeThroughputTest.config" /> + <option name="test-timeout" value="5m"/> </test> </configuration> diff --git a/hwbinder_throughput_test/binderize_systrace/AndroidTest.xml b/hwbinder_throughput_test/binderize_systrace/AndroidTest.xml index 0dc67bd..e0075c8 100644 --- a/hwbinder_throughput_test/binderize_systrace/AndroidTest.xml +++ b/hwbinder_throughput_test/binderize_systrace/AndroidTest.xml @@ -19,13 +19,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/nativetest/hwbinderThroughputTest/hwbinderThroughputTest->/data/local/tmp/32/hwbinderThroughputTest32" /> <option name="push" value="DATA/nativetest64/hwbinderThroughputTest/hwbinderThroughputTest->/data/local/tmp/64/hwbinderThroughputTest64" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> @@ -34,5 +33,6 @@ <option name="test-case-path" value="vts/testcases/performance/hwbinder_throughput_test/HwBinderThroughputBenchmark" /> <option name="test-config-path" value="vts/testcases/performance/hwbinder_throughput_test/binderize/HwBinderBinderizeThroughputTest.config" /> <option name="enable-systrace" value="true" /> + <option name="test-timeout" value="5m"/> </test> </configuration> diff --git a/hwbinder_throughput_test/passthrough/AndroidTest.xml b/hwbinder_throughput_test/passthrough/AndroidTest.xml index 181b831..b42235f 100644 --- a/hwbinder_throughput_test/passthrough/AndroidTest.xml +++ b/hwbinder_throughput_test/passthrough/AndroidTest.xml @@ -19,13 +19,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/nativetest/hwbinderThroughputTest/hwbinderThroughputTest->/data/local/tmp/32/hwbinderThroughputTest32" /> <option name="push" value="DATA/nativetest64/hwbinderThroughputTest/hwbinderThroughputTest->/data/local/tmp/64/hwbinderThroughputTest64" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> @@ -33,5 +32,6 @@ <option name="test-module-name" value="HwBinderPassthroughThroughputTest" /> <option name="test-case-path" value="vts/testcases/performance/hwbinder_throughput_test/HwBinderThroughputBenchmark" /> <option name="test-config-path" value="vts/testcases/performance/hwbinder_throughput_test/passthrough/HwBinderPassthroughThroughputTest.config" /> + <option name="test-timeout" value="5m"/> </test> </configuration> diff --git a/hwbinder_throughput_test/passthrough_systrace/AndroidTest.xml b/hwbinder_throughput_test/passthrough_systrace/AndroidTest.xml index 7e0c471..d7eaa83 100644 --- a/hwbinder_throughput_test/passthrough_systrace/AndroidTest.xml +++ b/hwbinder_throughput_test/passthrough_systrace/AndroidTest.xml @@ -19,13 +19,12 @@ <option name="abort-on-push-failure" value="false" /> <option name="push-group" value="HostDrivenTest.push" /> <option name="cleanup" value="true" /> - <option name="remount-system" value="true" /> <option name="push" value="DATA/lib/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/32/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/lib64/android.hardware.tests.libhwbinder@1.0.so->/data/local/tmp/64/android.hardware.tests.libhwbinder@1.0.so" /> <option name="push" value="DATA/nativetest/hwbinderThroughputTest/hwbinderThroughputTest->/data/local/tmp/32/hwbinderThroughputTest32" /> <option name="push" value="DATA/nativetest64/hwbinderThroughputTest/hwbinderThroughputTest->/data/local/tmp/64/hwbinderThroughputTest64" /> - <option name="push" value="DATA/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> - <option name="push" value="DATA/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/vendor/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> + <option name="push" value="DATA/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.libhwbinder@1.0-impl.so" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"> </target_preparer> @@ -34,5 +33,6 @@ <option name="test-case-path" value="vts/testcases/performance/hwbinder_throughput_test/HwBinderThroughputBenchmark" /> <option name="test-config-path" value="vts/testcases/performance/hwbinder_throughput_test/passthrough/HwBinderPassthroughThroughputTest.config" /> <option name="enable-systrace" value="true" /> + <option name="test-timeout" value="5m"/> </test> </configuration> diff --git a/res/Loopback.apk b/res/Loopback.apk Binary files differnew file mode 100644 index 0000000..589a4b7 --- /dev/null +++ b/res/Loopback.apk |