| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 import logging | 6 import logging |
| 7 import re | 7 import re |
| 8 import os | 8 import os |
| 9 import pexpect | 9 import pexpect |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 dump_debug_info: A debug_info object. | 31 dump_debug_info: A debug_info object. |
| 32 """ | 32 """ |
| 33 | 33 |
| 34 def __init__(self, adb, device, test_suite, timeout, rebaseline, | 34 def __init__(self, adb, device, test_suite, timeout, rebaseline, |
| 35 performance_test, cleanup_test_files, tool, dump_debug_info): | 35 performance_test, cleanup_test_files, tool, dump_debug_info): |
| 36 self.adb = adb | 36 self.adb = adb |
| 37 self.device = device | 37 self.device = device |
| 38 self.test_suite_full = test_suite | 38 self.test_suite_full = test_suite |
| 39 self.test_suite = os.path.splitext(test_suite)[0] | 39 self.test_suite = os.path.splitext(test_suite)[0] |
| 40 self.test_suite_basename = self._GetTestSuiteBaseName() | 40 self.test_suite_basename = self._GetTestSuiteBaseName() |
| 41 self.test_suite_dirname = os.path.dirname(self.test_suite) | 41 self.test_suite_dirname = os.path.dirname( |
| 42 self.test_suite.split(self.test_suite_basename)[0]); |
| 42 self.rebaseline = rebaseline | 43 self.rebaseline = rebaseline |
| 43 self.performance_test = performance_test | 44 self.performance_test = performance_test |
| 44 self.cleanup_test_files = cleanup_test_files | 45 self.cleanup_test_files = cleanup_test_files |
| 45 self.tool = CreateTool(tool, self.adb) | 46 self.tool = CreateTool(tool, self.adb) |
| 46 if timeout == 0: | 47 if timeout == 0: |
| 47 if self.test_suite_basename == 'page_cycler_tests': | 48 if self.test_suite_basename == 'page_cycler_tests': |
| 48 timeout = 900 | 49 timeout = 900 |
| 49 else: | 50 else: |
| 50 timeout = 60 | 51 timeout = 60 |
| 51 # On a VM (e.g. chromium buildbots), this timeout is way too small. | 52 # On a VM (e.g. chromium buildbots), this timeout is way too small. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if test[0] != ' ': | 116 if test[0] != ' ': |
| 116 current = test | 117 current = test |
| 117 continue | 118 continue |
| 118 if 'YOU HAVE' in test: | 119 if 'YOU HAVE' in test: |
| 119 break | 120 break |
| 120 test_name = test[2:] | 121 test_name = test[2:] |
| 121 if not any([test_name.startswith(x) for x in disabled_prefixes]): | 122 if not any([test_name.startswith(x) for x in disabled_prefixes]): |
| 122 ret += [current + test_name] | 123 ret += [current + test_name] |
| 123 return ret | 124 return ret |
| 124 | 125 |
| 126 def PushDataAndPakFiles(self): |
| 127 if self.test_suite_basename == 'ui_unittests': |
| 128 self.adb.PushIfNeeded(self.test_suite_dirname + '/chrome.pak', |
| 129 '/data/local/tmp/paks/chrome.pak') |
| 130 self.adb.PushIfNeeded(self.test_suite_dirname + '/locales/en-US.pak', |
| 131 '/data/local/tmp/paks/en-US.pak') |
| 132 |
| 125 def _WatchTestOutput(self, p): | 133 def _WatchTestOutput(self, p): |
| 126 """Watches the test output. | 134 """Watches the test output. |
| 127 Args: | 135 Args: |
| 128 p: the process generating output as created by pexpect.spawn. | 136 p: the process generating output as created by pexpect.spawn. |
| 129 """ | 137 """ |
| 130 ok_tests = [] | 138 ok_tests = [] |
| 131 failed_tests = [] | 139 failed_tests = [] |
| 132 crashed_tests = [] | 140 crashed_tests = [] |
| 133 timed_out = False | 141 timed_out = False |
| 134 overall_fail = False | 142 overall_fail = False |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if ret_code: | 192 if ret_code: |
| 185 failed_tests += [BaseTestResult('gtest exit code: %d' % ret_code, | 193 failed_tests += [BaseTestResult('gtest exit code: %d' % ret_code, |
| 186 'pexpect.before: %s' | 194 'pexpect.before: %s' |
| 187 '\npexpect.after: %s' | 195 '\npexpect.after: %s' |
| 188 % (p.before, | 196 % (p.before, |
| 189 p.after))] | 197 p.after))] |
| 190 # Create TestResults and return | 198 # Create TestResults and return |
| 191 return TestResults.FromRun(ok=ok_tests, failed=failed_tests, | 199 return TestResults.FromRun(ok=ok_tests, failed=failed_tests, |
| 192 crashed=crashed_tests, timed_out=timed_out, | 200 crashed=crashed_tests, timed_out=timed_out, |
| 193 overall_fail=overall_fail) | 201 overall_fail=overall_fail) |
| OLD | NEW |