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

Unified Diff: build/android/pylib/utils/test_environment.py

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/utils/run_tests_helper.py ('k') | build/android/pylib/utils/time_profile.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/utils/test_environment.py
diff --git a/build/android/pylib/utils/test_environment.py b/build/android/pylib/utils/test_environment.py
new file mode 100644
index 0000000000000000000000000000000000000000..e78eb5ce801ffa9185fd5c0b69e5f56a7eaef570
--- /dev/null
+++ b/build/android/pylib/utils/test_environment.py
@@ -0,0 +1,47 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import logging
+import psutil
+import signal
+
+from pylib.device import device_errors
+from pylib.device import device_utils
+
+
+def _KillWebServers():
+ for s in [signal.SIGTERM, signal.SIGINT, signal.SIGQUIT, signal.SIGKILL]:
+ signalled = []
+ for server in ['lighttpd', 'webpagereplay']:
+ for p in psutil.process_iter():
+ try:
+ if not server in ' '.join(p.cmdline):
+ continue
+ logging.info('Killing %s %s %s', s, server, p.pid)
+ p.send_signal(s)
+ signalled.append(p)
+ except Exception as e:
+ logging.warning('Failed killing %s %s %s', server, p.pid, e)
+ for p in signalled:
+ try:
+ p.wait(1)
+ except Exception as e:
+ logging.warning('Failed waiting for %s to die. %s', p.pid, e)
+
+
+def CleanupLeftoverProcesses():
+ """Clean up the test environment, restarting fresh adb and HTTP daemons."""
+ _KillWebServers()
+ device_utils.RestartServer()
+
+ def cleanup_device(d):
+ d.old_interface.RestartAdbdOnDevice()
+ try:
+ d.EnableRoot()
+ except device_errors.CommandFailedError as e:
+ logging.error(str(e))
+ d.WaitUntilFullyBooted()
+
+ device_utils.DeviceUtils.parallel().pMap(cleanup_device)
+
« no previous file with comments | « build/android/pylib/utils/run_tests_helper.py ('k') | build/android/pylib/utils/time_profile.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698