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

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

Issue 2385673005: [Android] Log instr test start & end. (Closed)
Patch Set: mikecase comments Created 4 years, 2 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 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.base import base_test_result 15 from pylib.base import base_test_result
16 from pylib.local.device import local_device_environment 16 from pylib.local.device import local_device_environment
17 from pylib.local.device import local_device_test_run 17 from pylib.local.device import local_device_test_run
18 import tombstones 18 import tombstones
19 19
20
21 _TAG = 'test_runner_py'
22
20 TIMEOUT_ANNOTATIONS = [ 23 TIMEOUT_ANNOTATIONS = [
21 ('Manual', 10 * 60 * 60), 24 ('Manual', 10 * 60 * 60),
22 ('IntegrationTest', 30 * 60), 25 ('IntegrationTest', 30 * 60),
23 ('External', 10 * 60), 26 ('External', 10 * 60),
24 ('EnormousTest', 10 * 60), 27 ('EnormousTest', 10 * 60),
25 ('LargeTest', 5 * 60), 28 ('LargeTest', 5 * 60),
26 ('MediumTest', 3 * 60), 29 ('MediumTest', 3 * 60),
27 ('SmallTest', 1 * 60), 30 ('SmallTest', 1 * 60),
28 ] 31 ]
29 32
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 device, test_timeout_scale * self._test_instance.timeout_scale) 251 device, test_timeout_scale * self._test_instance.timeout_scale)
249 252
250 logging.info('preparing to run %s: %s', test_display_name, test) 253 logging.info('preparing to run %s: %s', test_display_name, test)
251 254
252 if flags: 255 if flags:
253 self._CreateFlagChangerIfNeeded(device) 256 self._CreateFlagChangerIfNeeded(device)
254 self._flag_changers[str(device)].PushFlags( 257 self._flag_changers[str(device)].PushFlags(
255 add=flags.add, remove=flags.remove) 258 add=flags.add, remove=flags.remove)
256 259
257 try: 260 try:
261 device.RunShellCommand(
262 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name],
263 check_return=True)
258 time_ms = lambda: int(time.time() * 1e3) 264 time_ms = lambda: int(time.time() * 1e3)
259 start_ms = time_ms() 265 start_ms = time_ms()
260 output = device.StartInstrumentation( 266 output = device.StartInstrumentation(
261 target, raw=True, extras=extras, timeout=timeout, retries=0) 267 target, raw=True, extras=extras, timeout=timeout, retries=0)
268 finally:
269 device.RunShellCommand(
270 ['log', '-p', 'i', '-t', _TAG, 'END %s' % test_name],
271 check_return=True)
262 duration_ms = time_ms() - start_ms 272 duration_ms = time_ms() - start_ms
263 finally:
264 if flags: 273 if flags:
265 self._flag_changers[str(device)].Restore() 274 self._flag_changers[str(device)].Restore()
266 if test_timeout_scale: 275 if test_timeout_scale:
267 valgrind_tools.SetChromeTimeoutScale( 276 valgrind_tools.SetChromeTimeoutScale(
268 device, self._test_instance.timeout_scale) 277 device, self._test_instance.timeout_scale)
269 278
270 # TODO(jbudorick): Make instrumentation tests output a JSON so this 279 # TODO(jbudorick): Make instrumentation tests output a JSON so this
271 # doesn't have to parse the output. 280 # doesn't have to parse the output.
272 result_code, result_bundle, statuses = ( 281 result_code, result_bundle, statuses = (
273 self._test_instance.ParseAmInstrumentRawOutput(output)) 282 self._test_instance.ParseAmInstrumentRawOutput(output))
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 timeout = v 380 timeout = v
372 break 381 break
373 else: 382 else:
374 logging.warning('Using default 1 minute timeout for %s', test_name) 383 logging.warning('Using default 1 minute timeout for %s', test_name)
375 timeout = 60 384 timeout = 60
376 385
377 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 386 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
378 387
379 return timeout 388 return timeout
380 389
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