Chromium Code Reviews| Index: chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoPerfTests/desktopui_PyAutoPerfTests.py |
| diff --git a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoPerfTests/desktopui_PyAutoPerfTests.py b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoPerfTests/desktopui_PyAutoPerfTests.py |
| index ce2e29e005e891dfa8abbe428344b6bd9d447ea4..d2591c5b0a269074f8a90b7f61e6fba9ea8b757a 100644 |
| --- a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoPerfTests/desktopui_PyAutoPerfTests.py |
| +++ b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoPerfTests/desktopui_PyAutoPerfTests.py |
| @@ -4,10 +4,12 @@ |
| import os |
| import pwd |
| +import re |
| import shutil |
| import subprocess |
| from autotest_lib.client.bin import utils |
| +from autotest_lib.client.common_lib import error |
| from autotest_lib.client.cros import constants, chrome_test, cros_ui, login |
| @@ -16,6 +18,9 @@ class desktopui_PyAutoPerfTests(chrome_test.ChromeTestBase): |
| Performs all setup and fires off the CHROMEOS_PERF PyAuto suite. |
| """ |
| + _PERF_MARKER_PRE = '_PERF_PRE_' |
| + _PERF_MARKER_POST = '_PERF_POST_' |
| + |
| version = 1 |
| def initialize(self): |
| @@ -74,4 +79,18 @@ class desktopui_PyAutoPerfTests(chrome_test.ChromeTestBase): |
| functional_cmd = cros_ui.xcommand_as( |
| '%s/chrome_test/test_src/chrome/test/functional/' |
| 'pyauto_functional.py --suite=CHROMEOS_PERF -v' % deps_dir) |
| - utils.system(functional_cmd) |
| + proc = subprocess.Popen( |
| + functional_cmd, shell=True, stdout=subprocess.PIPE, |
| + stderr=subprocess.STDOUT) |
| + output = proc.communicate()[0] |
| + if proc.returncode != 0: |
| + raise error.TestFail('Unexpected return code from ' |
| + 'pyauto_functional.py: %d' % proc.returncode) |
|
truty
2011/08/25 04:25:01
You should consider if you want to tag this TestFa
dennis_jeffrey
2011/08/25 22:33:05
Good idea - I added CHROMEOS_PERF to the failure m
|
| + re_compiled = re.compile('%s(.+)%s' % (self._PERF_MARKER_PRE, |
| + self._PERF_MARKER_POST)) |
| + perf_lines = [line for line in output.split('\n') |
| + if re_compiled.search(line)] |
|
truty
2011/08/25 04:25:01
Based on the way you wrote the perf value line cre
dennis_jeffrey
2011/08/25 22:33:05
That thought did cross my mind, but I decided to b
|
| + if perf_lines: |
| + perf_dict = dict([eval(re_compiled.search(line).group(1)) |
| + for line in perf_lines]) |
| + self.write_perf_keyval(perf_dict) |