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

Side by Side Diff: build/android/pylib/local/device/local_device_instrumentation_test_run.py

Issue 2664873002: Add logdog_helper script. (Closed)
Patch Set: Update one use of AddLink to SetLink I missed Created 3 years, 10 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 import logging 5 import logging
6 import os 6 import os
7 import posixpath 7 import posixpath
8 import re 8 import re
9 import time 9 import time
10 10
11 from devil.android import device_errors 11 from devil.android import device_errors
12 from devil.android import flag_changer 12 from devil.android import flag_changer
13 from devil.utils import reraiser_thread 13 from devil.utils import reraiser_thread
14 from pylib import valgrind_tools 14 from pylib import valgrind_tools
15 from pylib.android import logdog_logcat_monitor 15 from pylib.android import logdog_logcat_monitor
16 from pylib.base import base_test_result 16 from pylib.base import base_test_result
17 from pylib.instrumentation import instrumentation_test_instance 17 from pylib.instrumentation import instrumentation_test_instance
18 from pylib.local.device import local_device_environment 18 from pylib.local.device import local_device_environment
19 from pylib.local.device import local_device_test_run 19 from pylib.local.device import local_device_test_run
20 from pylib.utils import logdog_helper
20 from py_trace_event import trace_event 21 from py_trace_event import trace_event
21 from py_utils import contextlib_ext 22 from py_utils import contextlib_ext
22 import tombstones 23 import tombstones
23 24
24 _TAG = 'test_runner_py' 25 _TAG = 'test_runner_py'
25 26
26 TIMEOUT_ANNOTATIONS = [ 27 TIMEOUT_ANNOTATIONS = [
27 ('Manual', 10 * 60 * 60), 28 ('Manual', 10 * 60 * 60),
28 ('IntegrationTest', 30 * 60), 29 ('IntegrationTest', 30 * 60),
29 ('External', 10 * 60), 30 ('External', 10 * 60),
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 valgrind_tools.SetChromeTimeoutScale( 286 valgrind_tools.SetChromeTimeoutScale(
286 device, self._test_instance.timeout_scale) 287 device, self._test_instance.timeout_scale)
287 288
288 # TODO(jbudorick): Make instrumentation tests output a JSON so this 289 # TODO(jbudorick): Make instrumentation tests output a JSON so this
289 # doesn't have to parse the output. 290 # doesn't have to parse the output.
290 result_code, result_bundle, statuses = ( 291 result_code, result_bundle, statuses = (
291 self._test_instance.ParseAmInstrumentRawOutput(output)) 292 self._test_instance.ParseAmInstrumentRawOutput(output))
292 results = self._test_instance.GenerateTestResults( 293 results = self._test_instance.GenerateTestResults(
293 result_code, result_bundle, statuses, start_ms, duration_ms) 294 result_code, result_bundle, statuses, start_ms, duration_ms)
294 for result in results: 295 for result in results:
295 result.SetLogcatUrl(logcat_url) 296 result.SetLink('logcat', logcat_url)
296 297
297 # Update the result name if the test used flags. 298 # Update the result name if the test used flags.
298 if flags: 299 if flags:
299 for r in results: 300 for r in results:
300 if r.GetName() == test_name: 301 if r.GetName() == test_name:
301 r.SetName(test_display_name) 302 r.SetName(test_display_name)
302 303
303 # Add UNKNOWN results for any missing tests. 304 # Add UNKNOWN results for any missing tests.
304 iterable_test = test if isinstance(test, list) else [test] 305 iterable_test = test if isinstance(test, list) else [test]
305 test_names = set(self._GetUniqueTestName(t) for t in iterable_test) 306 test_names = set(self._GetUniqueTestName(t) for t in iterable_test)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 if result.GetType() == base_test_result.ResultType.CRASH: 358 if result.GetType() == base_test_result.ResultType.CRASH:
358 if not tombstones_url: 359 if not tombstones_url:
359 resolved_tombstones = tombstones.ResolveTombstones( 360 resolved_tombstones = tombstones.ResolveTombstones(
360 device, 361 device,
361 resolve_all_tombstones=True, 362 resolve_all_tombstones=True,
362 include_stack_symbols=False, 363 include_stack_symbols=False,
363 wipe_tombstones=True) 364 wipe_tombstones=True)
364 stream_name = 'tombstones_%s_%s' % ( 365 stream_name = 'tombstones_%s_%s' % (
365 time.strftime('%Y%m%dT%H%M%S', time.localtime()), 366 time.strftime('%Y%m%dT%H%M%S', time.localtime()),
366 device.serial) 367 device.serial)
367 tombstones_url = tombstones.LogdogTombstones(resolved_tombstones, 368 tombstones_url = logdog_helper.text(
368 stream_name) 369 stream_name, resolved_tombstones)
369 result.SetTombstonesUrl(tombstones_url) 370 result.SetLink('tombstones', tombstones_url)
370 return results, None 371 return results, None
371 372
372 #override 373 #override
373 def _ShouldRetry(self, test): 374 def _ShouldRetry(self, test):
374 if 'RetryOnFailure' in test.get('annotations', {}): 375 if 'RetryOnFailure' in test.get('annotations', {}):
375 return True 376 return True
376 377
377 # TODO(jbudorick): Remove this log message once @RetryOnFailure has been 378 # TODO(jbudorick): Remove this log message once @RetryOnFailure has been
378 # enabled for a while. See crbug.com/619055 for more details. 379 # enabled for a while. See crbug.com/619055 for more details.
379 logging.error('Default retries are being phased out. crbug.com/619055') 380 logging.error('Default retries are being phased out. crbug.com/619055')
(...skipping 18 matching lines...) Expand all
398 timeout = v 399 timeout = v
399 break 400 break
400 else: 401 else:
401 logging.warning('Using default 1 minute timeout for %s', test_name) 402 logging.warning('Using default 1 minute timeout for %s', test_name)
402 timeout = 60 403 timeout = 60
403 404
404 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 405 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
405 406
406 return timeout 407 return timeout
407 408
OLDNEW
« no previous file with comments | « build/android/pylib/local/device/local_device_gtest_run.py ('k') | build/android/pylib/results/json_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698