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 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 import sys | 10 import sys |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 self.device.RunShellCommand('stop') | 156 self.device.RunShellCommand('stop') |
157 self.device.RunShellCommand('start') | 157 self.device.RunShellCommand('start') |
158 | 158 |
159 # We give different default value to launch HTTP server based on shard index | 159 # We give different default value to launch HTTP server based on shard index |
160 # because it may have race condition when multiple processes are trying to | 160 # because it may have race condition when multiple processes are trying to |
161 # launch lighttpd with same port at same time. | 161 # launch lighttpd with same port at same time. |
162 self.LaunchTestHttpServer( | 162 self.LaunchTestHttpServer( |
163 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) | 163 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) |
164 if self.flags: | 164 if self.flags: |
165 self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) | 165 self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) |
| 166 if self.options.device_flags: |
| 167 with open(self.options.device_flags) as device_flags_file: |
| 168 self.flags.AddFlags([flag for flag in device_flags_file]) |
166 | 169 |
167 def TearDown(self): | 170 def TearDown(self): |
168 """Cleans up the test harness and saves outstanding data from test run.""" | 171 """Cleans up the test harness and saves outstanding data from test run.""" |
169 if self.flags: | 172 if self.flags: |
170 self.flags.Restore() | 173 self.flags.Restore() |
171 super(TestRunner, self).TearDown() | 174 super(TestRunner, self).TearDown() |
172 | 175 |
173 def TestSetup(self, test): | 176 def TestSetup(self, test): |
174 """Sets up the test harness for running a particular test. | 177 """Sets up the test harness for running a particular test. |
175 | 178 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 timeout_scale = int(scale_match.group(1)) | 315 timeout_scale = int(scale_match.group(1)) |
313 if self.options.wait_for_debugger: | 316 if self.options.wait_for_debugger: |
314 timeout_scale *= 100 | 317 timeout_scale *= 100 |
315 return timeout_scale | 318 return timeout_scale |
316 | 319 |
317 def _GetIndividualTestTimeoutSecs(self, test): | 320 def _GetIndividualTestTimeoutSecs(self, test): |
318 """Returns the timeout in seconds for the given |test|.""" | 321 """Returns the timeout in seconds for the given |test|.""" |
319 annotations = self.test_pkg.GetTestAnnotations(test) | 322 annotations = self.test_pkg.GetTestAnnotations(test) |
320 if 'Manual' in annotations: | 323 if 'Manual' in annotations: |
321 return 10 * 60 * 60 | 324 return 10 * 60 * 60 |
| 325 if 'IntegrationTest' in annotations: |
| 326 return 30 * 60 |
322 if 'External' in annotations: | 327 if 'External' in annotations: |
323 return 10 * 60 | 328 return 10 * 60 |
324 if 'EnormousTest' in annotations: | 329 if 'EnormousTest' in annotations: |
325 return 10 * 60 | 330 return 10 * 60 |
326 if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations: | 331 if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations: |
327 return 5 * 60 | 332 return 5 * 60 |
328 if 'MediumTest' in annotations: | 333 if 'MediumTest' in annotations: |
329 return 3 * 60 | 334 return 3 * 60 |
330 if 'SmallTest' in annotations: | 335 if 'SmallTest' in annotations: |
331 return 1 * 60 | 336 return 1 * 60 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 duration_ms = 0 | 429 duration_ms = 0 |
425 message = str(e) | 430 message = str(e) |
426 if not message: | 431 if not message: |
427 message = 'No information.' | 432 message = 'No information.' |
428 results.AddResult(test_result.InstrumentationTestResult( | 433 results.AddResult(test_result.InstrumentationTestResult( |
429 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 434 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
430 log=message)) | 435 log=message)) |
431 raw_result = None | 436 raw_result = None |
432 self.TestTeardown(test, raw_result) | 437 self.TestTeardown(test, raw_result) |
433 return (results, None if results.DidRunPass() else test) | 438 return (results, None if results.DidRunPass() else test) |
OLD | NEW |