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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 test: Test class/method. | 311 test: Test class/method. |
312 timeout: Timeout time in seconds. | 312 timeout: Timeout time in seconds. |
313 | 313 |
314 Returns: | 314 Returns: |
315 The raw output of am instrument as a list of lines. | 315 The raw output of am instrument as a list of lines. |
316 """ | 316 """ |
317 extras = self._GetInstrumentationArgs() | 317 extras = self._GetInstrumentationArgs() |
318 extras['class'] = test | 318 extras['class'] = test |
319 return self.device.StartInstrumentation( | 319 return self.device.StartInstrumentation( |
320 '%s/%s' % (self.test_pkg.GetPackageName(), self.options.test_runner), | 320 '%s/%s' % (self.test_pkg.GetPackageName(), self.options.test_runner), |
321 raw=True, extras=extras, timeout=timeout, retries=0) | 321 raw=True, extras=extras, timeout=timeout, retries=3) |
322 | 322 |
323 def _GenerateTestResult(self, test, instr_statuses, start_ms, duration_ms): | 323 def _GenerateTestResult(self, test, instr_statuses, start_ms, duration_ms): |
324 return instrumentation_test_instance.GenerateTestResult( | 324 return instrumentation_test_instance.GenerateTestResult( |
325 test, instr_statuses, start_ms, duration_ms) | 325 test, instr_statuses, start_ms, duration_ms) |
326 | 326 |
327 #override | 327 #override |
328 def RunTest(self, test): | 328 def RunTest(self, test): |
329 results = base_test_result.TestRunResults() | 329 results = base_test_result.TestRunResults() |
330 timeout = (self._GetIndividualTestTimeoutSecs(test) * | 330 timeout = (self._GetIndividualTestTimeoutSecs(test) * |
331 self._GetIndividualTestTimeoutScale(test) * | 331 self._GetIndividualTestTimeoutScale(test) * |
(...skipping 23 matching lines...) Expand all Loading... |
355 except device_errors.CommandTimeoutError as e: | 355 except device_errors.CommandTimeoutError as e: |
356 results.AddResult(test_result.InstrumentationTestResult( | 356 results.AddResult(test_result.InstrumentationTestResult( |
357 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, | 357 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, |
358 log=str(e) or 'No information')) | 358 log=str(e) or 'No information')) |
359 except device_errors.DeviceUnreachableError as e: | 359 except device_errors.DeviceUnreachableError as e: |
360 results.AddResult(test_result.InstrumentationTestResult( | 360 results.AddResult(test_result.InstrumentationTestResult( |
361 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, | 361 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, |
362 log=str(e) or 'No information')) | 362 log=str(e) or 'No information')) |
363 self.TestTeardown(test, results) | 363 self.TestTeardown(test, results) |
364 return (results, None if results.DidRunPass() else test) | 364 return (results, None if results.DidRunPass() else test) |
OLD | NEW |