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

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

Issue 732423002: Update from chromium https://crrev.com/304586 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 def _IsFreTest(self, test): 202 def _IsFreTest(self, test):
203 """Determines whether a test is a first run experience test. 203 """Determines whether a test is a first run experience test.
204 204
205 Args: 205 Args:
206 test: The name of the test to be checked. 206 test: The name of the test to be checked.
207 207
208 Returns: 208 Returns:
209 Whether the feature being tested is FirstRunExperience. 209 Whether the feature being tested is FirstRunExperience.
210 """ 210 """
211 freFeature = 'Feature:FirstRunExperience' 211 annotations = self.test_pkg.GetTestAnnotations(test)
212 return freFeature in self.test_pkg.GetTestAnnotations(test) 212 return ('FirstRunExperience' == annotations.get('Feature', None))
213 213
214 def _IsPerfTest(self, test): 214 def _IsPerfTest(self, test):
215 """Determines whether a test is a performance test. 215 """Determines whether a test is a performance test.
216 216
217 Args: 217 Args:
218 test: The name of the test to be checked. 218 test: The name of the test to be checked.
219 219
220 Returns: 220 Returns:
221 Whether the test is annotated as a performance test. 221 Whether the test is annotated as a performance test.
222 """ 222 """
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 def _SetupIndividualTestTimeoutScale(self, test): 323 def _SetupIndividualTestTimeoutScale(self, test):
324 timeout_scale = self._GetIndividualTestTimeoutScale(test) 324 timeout_scale = self._GetIndividualTestTimeoutScale(test)
325 valgrind_tools.SetChromeTimeoutScale(self.device, timeout_scale) 325 valgrind_tools.SetChromeTimeoutScale(self.device, timeout_scale)
326 326
327 def _GetIndividualTestTimeoutScale(self, test): 327 def _GetIndividualTestTimeoutScale(self, test):
328 """Returns the timeout scale for the given |test|.""" 328 """Returns the timeout scale for the given |test|."""
329 annotations = self.test_pkg.GetTestAnnotations(test) 329 annotations = self.test_pkg.GetTestAnnotations(test)
330 timeout_scale = 1 330 timeout_scale = 1
331 if 'TimeoutScale' in annotations: 331 if 'TimeoutScale' in annotations:
332 for annotation in annotations: 332 try:
333 scale_match = re.match('TimeoutScale:([0-9]+)', annotation) 333 timeout_scale = int(annotations['TimeoutScale'])
334 if scale_match: 334 except ValueError:
335 timeout_scale = int(scale_match.group(1)) 335 logging.warning('Non-integer value of TimeoutScale ignored. (%s)'
336 % annotations['TimeoutScale'])
336 if self.options.wait_for_debugger: 337 if self.options.wait_for_debugger:
337 timeout_scale *= 100 338 timeout_scale *= 100
338 return timeout_scale 339 return timeout_scale
339 340
340 def _GetIndividualTestTimeoutSecs(self, test): 341 def _GetIndividualTestTimeoutSecs(self, test):
341 """Returns the timeout in seconds for the given |test|.""" 342 """Returns the timeout in seconds for the given |test|."""
342 annotations = self.test_pkg.GetTestAnnotations(test) 343 annotations = self.test_pkg.GetTestAnnotations(test)
343 if 'Manual' in annotations: 344 if 'Manual' in annotations:
344 return 10 * 60 * 60 345 return 10 * 60 * 60
345 if 'IntegrationTest' in annotations: 346 if 'IntegrationTest' in annotations:
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 except device_errors.CommandTimeoutError as e: 521 except device_errors.CommandTimeoutError as e:
521 results.AddResult(test_result.InstrumentationTestResult( 522 results.AddResult(test_result.InstrumentationTestResult(
522 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, 523 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms,
523 log=str(e) or 'No information')) 524 log=str(e) or 'No information'))
524 except device_errors.DeviceUnreachableError as e: 525 except device_errors.DeviceUnreachableError as e:
525 results.AddResult(test_result.InstrumentationTestResult( 526 results.AddResult(test_result.InstrumentationTestResult(
526 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, 527 test, base_test_result.ResultType.CRASH, start_ms, duration_ms,
527 log=str(e) or 'No information')) 528 log=str(e) or 'No information'))
528 self.TestTeardown(test, results) 529 self.TestTeardown(test, results)
529 return (results, None if results.DidRunPass() else test) 530 return (results, None if results.DidRunPass() else test)
OLDNEW
« no previous file with comments | « build/android/pylib/instrumentation/test_jar.py ('k') | build/android/pylib/uiautomator/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698