Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: build/android/pylib/instrumentation/test_runner.py

Issue 701943002: hack to repeat instrumentation test until failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refs/heads/master@{#341335} Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 #override 334 #override
335 def RunTest(self, test): 335 def RunTest(self, test):
336 results = base_test_result.TestRunResults() 336 results = base_test_result.TestRunResults()
337 timeout = (self._GetIndividualTestTimeoutSecs(test) * 337 timeout = (self._GetIndividualTestTimeoutSecs(test) *
338 self._GetIndividualTestTimeoutScale(test) * 338 self._GetIndividualTestTimeoutScale(test) *
339 self.tool.GetTimeoutScale()) 339 self.tool.GetTimeoutScale())
340 340
341 start_ms = 0 341 start_ms = 0
342 duration_ms = 0 342 duration_ms = 0
343 try: 343 try:
344 self.TestSetup(test) 344 while True:
345 self.TestSetup(test)
345 346
346 try: 347 try:
347 self.device.GoHome() 348 self.device.GoHome()
348 except device_errors.CommandTimeoutError: 349 except device_errors.CommandTimeoutError:
349 logging.exception('Failed to focus the launcher.') 350 logging.exception('Failed to focus the launcher.')
350 351
351 time_ms = lambda: int(time.time() * 1000) 352 time_ms = lambda: int(time.time() * 1000)
352 start_ms = time_ms() 353 start_ms = time_ms()
353 raw_output = self._RunTest(test, timeout) 354 raw_output = self._RunTest(test, timeout)
354 duration_ms = time_ms() - start_ms 355 duration_ms = time_ms() - start_ms
355 356
356 # Parse the test output 357 # Parse the test output
357 result_code, result_bundle, statuses = ( 358 result_code, result_bundle, statuses = (
358 instrumentation_test_instance.ParseAmInstrumentRawOutput(raw_output)) 359 instrumentation_test_instance.ParseAmInstrumentRawOutput(raw_outpu t))
359 result = self._GenerateTestResult( 360 result = self._GenerateTestResult(
360 test, result_code, result_bundle, statuses, start_ms, duration_ms) 361 test, result_code, result_bundle, statuses, start_ms, duration_ms)
361 if local_device_instrumentation_test_run.DidPackageCrashOnDevice( 362 if local_device_instrumentation_test_run.DidPackageCrashOnDevice(
362 self.test_pkg.GetPackageName(), self.device): 363 self.test_pkg.GetPackageName(), self.device):
363 result.SetType(base_test_result.ResultType.CRASH) 364 result.SetType(base_test_result.ResultType.CRASH)
364 results.AddResult(result) 365 results.AddResult(result)
366 if result.GetType() not in [base_test_result.ResultType.PASS, base_tes t_result.ResultType.SKIP]:
367 break
365 except device_errors.CommandTimeoutError as e: 368 except device_errors.CommandTimeoutError as e:
366 results.AddResult(test_result.InstrumentationTestResult( 369 results.AddResult(test_result.InstrumentationTestResult(
367 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, 370 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms,
368 log=str(e) or 'No information')) 371 log=str(e) or 'No information'))
369 except device_errors.DeviceUnreachableError as e: 372 except device_errors.DeviceUnreachableError as e:
370 results.AddResult(test_result.InstrumentationTestResult( 373 results.AddResult(test_result.InstrumentationTestResult(
371 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, 374 test, base_test_result.ResultType.CRASH, start_ms, duration_ms,
372 log=str(e) or 'No information')) 375 log=str(e) or 'No information'))
373 self.TestTeardown(test, results) 376 self.TestTeardown(test, results)
374 return (results, None if results.DidRunPass() else test) 377 return (results, None if results.DidRunPass() else test)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698