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

Side by Side Diff: build/android/pylib/utils/test_environment.py

Issue 2198613002: [Android] Get rid of old perf test runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get rid of test_env Created 4 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 | « build/android/pylib/perf/test_runner.py ('k') | build/android/test_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import logging
6 import psutil
7 import signal
8
9 from devil.android import device_errors
10 from devil.android import device_utils
11
12
13 def _KillWebServers():
14 for s in [signal.SIGTERM, signal.SIGINT, signal.SIGQUIT, signal.SIGKILL]:
15 signalled = []
16 for server in ['lighttpd', 'webpagereplay']:
17 for p in psutil.process_iter():
18 try:
19 if not server in ' '.join(p.cmdline):
20 continue
21 logging.info('Killing %s %s %s', s, server, p.pid)
22 p.send_signal(s)
23 signalled.append(p)
24 except Exception: # pylint: disable=broad-except
25 logging.exception('Failed killing %s %s', server, p.pid)
26 for p in signalled:
27 try:
28 p.wait(1)
29 except Exception: # pylint: disable=broad-except
30 logging.exception('Failed waiting for %s to die.', p.pid)
31
32
33 def CleanupLeftoverProcesses(devices):
34 """Clean up the test environment, restarting fresh adb and HTTP daemons.
35
36 Args:
37 devices: The devices to clean.
38 """
39 _KillWebServers()
40 device_utils.RestartServer()
41
42 def cleanup_device(d):
43 try:
44 d.WaitUntilFullyBooted()
45 d.RestartAdbd()
46 d.EnableRoot()
47 d.WaitUntilFullyBooted()
48 except (device_errors.CommandFailedError,
49 device_errors.CommandTimeoutError):
50 logging.exception('Failed to clean up device. Attempting to continue.')
51
52 device_utils.DeviceUtils.parallel(devices).pMap(cleanup_device)
53
OLDNEW
« no previous file with comments | « build/android/pylib/perf/test_runner.py ('k') | build/android/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698