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..b811197a10750380bc5c839db48b62ebb89ce2e4 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 |
| @@ -16,6 +16,8 @@ class desktopui_PyAutoPerfTests(chrome_test.ChromeTestBase): |
| Performs all setup and fires off the CHROMEOS_PERF PyAuto suite. |
| """ |
| + _PERF_DATA_FILE = '/usr/local/tmp/perf_data.txt' |
|
Nirnimesh
2011/08/25 00:23:36
use tempfile.tempdir()
dennis_jeffrey
2011/08/25 01:30:35
I no longer use a temp file at all.
|
| + |
| version = 1 |
| def initialize(self): |
| @@ -70,8 +72,27 @@ class desktopui_PyAutoPerfTests(chrome_test.ChromeTestBase): |
| os.path.join(pyautolib_dir, 'chromeos', 'chromeos_utils.py')) |
| utils.system(login_cmd) |
| + # Remove the performance data file if it exists. |
| + if os.path.exists(self._PERF_DATA_FILE): |
| + try: |
|
Nirnimesh
2011/08/25 00:23:36
Do not try
dennis_jeffrey
2011/08/25 01:30:35
This code has been removed.
|
| + os.remove(self._PERF_DATA_FILE) |
| + except OSError, e: |
| + print 'Warning: Could not remove output file "%s": %s' % ( |
| + self._PERF_DATA_FILE, e) |
| + |
| # Run the PyAuto performance tests. |
| 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) |
| + |
| + # Output the performance data from the temporary performance data file |
| + # into a format that can be graphed. |
| + if os.path.exists(self._PERF_DATA_FILE): |
| + try: |
|
Nirnimesh
2011/08/25 00:23:36
Do not try. Just do it. If something bad happens i
dennis_jeffrey
2011/08/25 01:30:35
The try has since been removed.
|
| + with open(self._PERF_DATA_FILE, 'r') as f: |
| + lines = [line for line in f.readlines() if line.strip()] |
| + perf_dict = dict([eval(line) for line in lines]) |
| + self.write_perf_keyval(perf_dict) |
| + except IOError, e: |
| + print 'Warning: could not process performance data file: ' + str(e) |