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

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

Issue 2664873002: Add logdog_helper script. (Closed)
Patch Set: Add logdog_helper script. 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 valgrind_tools.SetChromeTimeoutScale( 279 valgrind_tools.SetChromeTimeoutScale(
279 device, self._test_instance.timeout_scale) 280 device, self._test_instance.timeout_scale)
280 281
281 # TODO(jbudorick): Make instrumentation tests output a JSON so this 282 # TODO(jbudorick): Make instrumentation tests output a JSON so this
282 # doesn't have to parse the output. 283 # doesn't have to parse the output.
283 result_code, result_bundle, statuses = ( 284 result_code, result_bundle, statuses = (
284 self._test_instance.ParseAmInstrumentRawOutput(output)) 285 self._test_instance.ParseAmInstrumentRawOutput(output))
285 results = self._test_instance.GenerateTestResults( 286 results = self._test_instance.GenerateTestResults(
286 result_code, result_bundle, statuses, start_ms, duration_ms) 287 result_code, result_bundle, statuses, start_ms, duration_ms)
287 for result in results: 288 for result in results:
288 result.SetLogcatUrl(logcat_url) 289 result.SetLink('logcat', logcat_url)
289 290
290 # Update the result name if the test used flags. 291 # Update the result name if the test used flags.
291 if flags: 292 if flags:
292 for r in results: 293 for r in results:
293 if r.GetName() == test_name: 294 if r.GetName() == test_name:
294 r.SetName(test_display_name) 295 r.SetName(test_display_name)
295 296
296 # Add UNKNOWN results for any missing tests. 297 # Add UNKNOWN results for any missing tests.
297 iterable_test = test if isinstance(test, list) else [test] 298 iterable_test = test if isinstance(test, list) else [test]
298 test_names = set(self._GetUniqueTestName(t) for t in iterable_test) 299 test_names = set(self._GetUniqueTestName(t) for t in iterable_test)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if result.GetType() == base_test_result.ResultType.CRASH: 351 if result.GetType() == base_test_result.ResultType.CRASH:
351 if not tombstones_url: 352 if not tombstones_url:
352 resolved_tombstones = tombstones.ResolveTombstones( 353 resolved_tombstones = tombstones.ResolveTombstones(
353 device, 354 device,
354 resolve_all_tombstones=True, 355 resolve_all_tombstones=True,
355 include_stack_symbols=False, 356 include_stack_symbols=False,
356 wipe_tombstones=True) 357 wipe_tombstones=True)
357 stream_name = 'tombstones_%s_%s' % ( 358 stream_name = 'tombstones_%s_%s' % (
358 time.strftime('%Y%m%dT%H%M%S', time.localtime()), 359 time.strftime('%Y%m%dT%H%M%S', time.localtime()),
359 device.serial) 360 device.serial)
360 tombstones_url = tombstones.LogdogTombstones(resolved_tombstones, 361 tombstones_url = logdog_helper.text(
jbudorick 2017/01/31 23:15:12 Can you remove tombstones.LogdogTombstones with th
mikecase (-- gone --) 2017/02/01 22:13:45 Yes. And I thought I had done this. But I must hav
361 stream_name) 362 stream_name, resolved_tombstones)
362 result.SetTombstonesUrl(tombstones_url) 363 result.AddLink('tombstones', tombstones_url)
363 return results, None 364 return results, None
364 365
365 #override 366 #override
366 def _ShouldRetry(self, test): 367 def _ShouldRetry(self, test):
367 if 'RetryOnFailure' in test.get('annotations', {}): 368 if 'RetryOnFailure' in test.get('annotations', {}):
368 return True 369 return True
369 370
370 # TODO(jbudorick): Remove this log message once @RetryOnFailure has been 371 # TODO(jbudorick): Remove this log message once @RetryOnFailure has been
371 # enabled for a while. See crbug.com/619055 for more details. 372 # enabled for a while. See crbug.com/619055 for more details.
372 logging.error('Default retries are being phased out. crbug.com/619055') 373 logging.error('Default retries are being phased out. crbug.com/619055')
(...skipping 18 matching lines...) Expand all
391 timeout = v 392 timeout = v
392 break 393 break
393 else: 394 else:
394 logging.warning('Using default 1 minute timeout for %s', test_name) 395 logging.warning('Using default 1 minute timeout for %s', test_name)
395 timeout = 60 396 timeout = 60
396 397
397 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 398 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
398 399
399 return timeout 400 return timeout
400 401
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698