From 6ec5b21a815a7bd1a3a233505a550be9b09d18ce Mon Sep 17 00:00:00 2001 From: Zhuoyao Zhang Date: Tue, 17 Jan 2017 18:07:23 -0800 Subject: [PATCH] Update profiling code for host-side tests. * Parse profiling data for each test case. * Merge the profiling data for each test case at the end of test and upload the profiling info to web. Bug:34226555 Test: run vts -m VibratorHidlProfilingTest Change-Id: I9e13eada8e7db338a29c6943868d12e76844e2c4 --- .../vts/testcases/hal/sensors/hidl/host/SensorsHidlTest.py | 13 +++++++++---- .../vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py | 13 +++++++++---- .../testcases/hal/vibrator/hidl/host/VibratorHidlTest.py | 13 +++++++++---- .../functional/vts/testcases/hal/vr/hidl/host/VrHidlTest.py | 13 +++++++++---- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host/SensorsHidlTest.py b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host/SensorsHidlTest.py index 70eca843..db210d9b 100644 --- a/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host/SensorsHidlTest.py +++ b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host/SensorsHidlTest.py @@ -43,9 +43,6 @@ class SensorsHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): 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="sensors", target_basepaths=self.dut.libPaths, @@ -60,9 +57,17 @@ class SensorsHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): and disable profiling after the test is done. """ if self.enable_profiling: + self.ProcessAndUploadTraceData() + + def setUpTest(self): + if self.enable_profiling: + profiling_utils.EnableVTSProfiling(self.dut.shell.one) + + def tearDownTest(self): + if self.enable_profiling: profiling_trace_path = getattr( self, self.VTS_PROFILING_TRACING_PATH, "") - self.ProcessAndUploadTraceData(self.dut, profiling_trace_path) + self.ProcessTraceDataForTestCase(self.dut, profiling_trace_path) profiling_utils.DisableVTSProfiling(self.dut.shell.one) def testSensorsBasic(self): 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 index be070e34..5faf78a2 100644 --- 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 @@ -35,9 +35,6 @@ class VehicleHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): self.dut.shell.InvokeTerminal("one") self.dut.shell.one.Execute("setenforce 0") # SELinux permissive mode - if self.enable_profiling: - profiling_utils.EnableVTSProfiling(self.dut.shell.one) - self.dut.hal.InitHidlHal( target_type="vehicle", target_basepaths=self.dut.libPaths, @@ -58,9 +55,17 @@ class VehicleHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): and disable profiling after the test is done. """ if self.enable_profiling: + self.ProcessAndUploadTraceData() + + def setUpTest(self): + if self.enable_profiling: + profiling_utils.EnableVTSProfiling(self.dut.shell.one) + + def tearDownTest(self): + if self.enable_profiling: profiling_trace_path = getattr( self, self.VTS_PROFILING_TRACING_PATH, "") - self.ProcessAndUploadTraceData(self.dut, profiling_trace_path) + self.ProcessTraceDataForTestCase(self.dut, profiling_trace_path) profiling_utils.DisableVTSProfiling(self.dut.shell.one) def testListProperties(self): diff --git a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host/VibratorHidlTest.py b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host/VibratorHidlTest.py index da70474e..498ea060 100644 --- a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host/VibratorHidlTest.py +++ b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host/VibratorHidlTest.py @@ -39,9 +39,6 @@ class VibratorHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): 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="vibrator", target_basepaths=self.dut.libPaths, @@ -56,9 +53,17 @@ class VibratorHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): and disable profiling after the test is done. """ if self.enable_profiling: + self.ProcessAndUploadTraceData() + + def setUpTest(self): + if self.enable_profiling: + profiling_utils.EnableVTSProfiling(self.dut.shell.one) + + def tearDownTest(self): + if self.enable_profiling: profiling_trace_path = getattr( self, self.VTS_PROFILING_TRACING_PATH, "") - self.ProcessAndUploadTraceData(self.dut, profiling_trace_path) + self.ProcessTraceDataForTestCase(self.dut, profiling_trace_path) profiling_utils.DisableVTSProfiling(self.dut.shell.one) def testVibratorBasic(self): 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 index 933fcdee..d20e9cea 100644 --- 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 @@ -39,9 +39,6 @@ class VrHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): 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"], @@ -56,9 +53,17 @@ class VrHidlTest(base_test_with_webdb.BaseTestWithWebDbClass): and disable profiling after the test is done. """ if self.enable_profiling: + self.ProcessAndUploadTraceData() + + def setUpTest(self): + if self.enable_profiling: + profiling_utils.EnableVTSProfiling(self.dut.shell.one) + + def tearDownTest(self): + if self.enable_profiling: profiling_trace_path = getattr( self, self.VTS_PROFILING_TRACING_PATH, "") - self.ProcessAndUploadTraceData(self.dut, profiling_trace_path) + self.ProcessTraceDataForTestCase(self.dut, profiling_trace_path) profiling_utils.DisableVTSProfiling(self.dut.shell.one) def testVrBasic(self): -- 2.11.0