Fix VtsFmqPerformanceTest
am: e978d50164

Change-Id: Ia47629a2cec6578d6490cabbf8f03aa3faeda4e6
diff --git a/fmq_benchmark/AndroidTest.xml b/fmq_benchmark/AndroidTest.xml
index b3f5b74..1e32ce4 100644
--- a/fmq_benchmark/AndroidTest.xml
+++ b/fmq_benchmark/AndroidTest.xml
@@ -18,11 +18,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" />
@@ -30,6 +29,6 @@
     </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" />
     </test>
 </configuration>
diff --git a/fmq_benchmark/FmqPerformanceTest.py b/fmq_benchmark/FmqPerformanceTest.py
index 3ea35bf..d8032f1 100644
--- a/fmq_benchmark/FmqPerformanceTest.py
+++ b/fmq_benchmark/FmqPerformanceTest.py
@@ -51,7 +51,8 @@
     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 @@
         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 @@
         binary = "/data/local/tmp/%s/mq_benchmark_client%s" % (bits, bits)
 
         results = self.dut.shell.one.Execute([
-            "chmod 755 %s" % binary, "TREBLE_TESTING_OVERRIDE=true 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 @@
         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 @@
                     "%s ns for %s is longer than the threshold %s ns" % (
                         value, label, self.THRESHOLD[bits][label]))
 
+
 if __name__ == "__main__":
     test_runner.main()