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

Unified Diff: scripts/slave/swarming/get_swarm_results_shim.py

Issue 22909021: Add build slave side support for the new swarming.py script. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: tested to work Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | scripts/slave/swarming/swarming_utils.py » ('j') | scripts/slave/swarming/swarming_utils.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/swarming/get_swarm_results_shim.py
diff --git a/scripts/slave/swarming/get_swarm_results_shim.py b/scripts/slave/swarming/get_swarm_results_shim.py
index 26cb2127b480235550a022e71916574c6a33d8f8..d188dede460ff5e8158edd05f6df22cb85ce5787 100755
--- a/scripts/slave/swarming/get_swarm_results_shim.py
+++ b/scripts/slave/swarming/get_swarm_results_shim.py
@@ -22,6 +22,7 @@ from slave.swarming import swarming_utils
# From depot_tools/
import fix_encoding
+import subprocess2
NO_OUTPUT_FOUND = (
@@ -127,12 +128,45 @@ def v0(client, options, test_name):
return exit_code
+def v0_1(client, options, test_name):
+ """Code starting around r218375.
+
+ TODO(maruel): Put exact revision once committed.
+ """
+ swarming = os.path.join(client, 'swarming.py')
+ cmd = [
+ sys.executable,
+ swarming,
+ 'collect',
+ '--swarming', options.swarming,
+ '--decorate',
+ test_name,
+ ]
+ print('Running: %s' % ' '.join(cmd))
+ proc = subprocess2.Popen(cmd, bufsize=0, stdout=subprocess2.PIPE)
+ gtest_parser = gtest_utils.GTestLogParser()
+ for line in proc.stdout.readlines():
+ line = line.rstrip()
+ print line
+ gtest_parser.ProcessLine(line)
+
+ proc.wait()
+ output, exit_code = gen_summary_output(
+ gtest_parser.FailedTests(),
+ proc.returncode,
+ 0)
+ print output
+ return exit_code
+
+
def determine_version_and_run_handler(client, options, test_name):
"""Executes the proper handler based on the code layout and --version
support.
"""
- # TODO(maruel): Determine version when needed.
- return v0(client, options, test_name)
+ if os.path.isfile(os.path.join(client, 'swarm_get_results.py')):
+ # Oh, that's old.
+ return v0(client, options, test_name)
+ return v0_1(client, options, test_name)
def process_build_properties(options, name):
« no previous file with comments | « no previous file | scripts/slave/swarming/swarming_utils.py » ('j') | scripts/slave/swarming/swarming_utils.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698