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

Unified Diff: build/android/test_wrapper/logdog_wrapper.py

Issue 2451273005: [android] Pass SIGTERM from logdog_wrapper to its wrapped test command. (Closed)
Patch Set: bpastene comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/test_wrapper/logdog_wrapper.py
diff --git a/build/android/test_wrapper/logdog_wrapper.py b/build/android/test_wrapper/logdog_wrapper.py
index 6daea499d4341a039b92aad50467317d6d7ed6fd..dea12a97ff7afc1a0fcffe80318a7451426a7d82 100755
--- a/build/android/test_wrapper/logdog_wrapper.py
+++ b/build/android/test_wrapper/logdog_wrapper.py
@@ -8,6 +8,7 @@
import argparse
import logging
import os
+import signal
import subprocess
import sys
import urllib
@@ -39,13 +40,27 @@ def CreateUrl(server, project, prefix, name):
return 'https://%s/v/?s=%s' % (server, urllib.quote_plus(stream_name))
+def CreateSignalForwarder(proc):
+ def handler(signum, _frame):
+ logging.error('Forwarding signal %s to test process', str(signum))
+ proc.send_signal(signum)
+
+ return handler
+
+
def main():
parser = CommandParser()
args, test_cmd = parser.parse_known_args(sys.argv[1:])
logging.basicConfig(level=logging.INFO)
if not test_cmd:
parser.error('Must specify command to run after the logdog flags')
- result = subprocess.call(test_cmd)
+ test_proc = subprocess.Popen(test_cmd)
+ original_sigterm_handler = signal.signal(
+ signal.SIGTERM, CreateSignalForwarder(test_proc))
+ try:
+ result = test_proc.wait()
+ finally:
+ signal.signal(signal.SIGTERM, original_sigterm_handler)
if '${SWARMING_TASK_ID}' in args.prefix:
args.prefix = args.prefix.replace('${SWARMING_TASK_ID}',
os.environ.get('SWARMING_TASK_ID'))
« 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