Index: testing/chromoting/browser_tests_launcher.py |
diff --git a/testing/chromoting/browser_tests_launcher.py b/testing/chromoting/browser_tests_launcher.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..296187d5b577b1e5975585e8a7abd44ec993d07c |
--- /dev/null |
+++ b/testing/chromoting/browser_tests_launcher.py |
@@ -0,0 +1,53 @@ |
+# Copyright (c) 2014 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. |
+ |
+ |
+"""Utility script to launch browser-tests on the Chromoting bot.""" |
+import argparse |
+import subprocess |
+import sys |
+ |
+PROD_DIR_ID = '$(PROD_DIR)' |
+ |
+ |
+def LaunchCommand(command, cwd): |
+ |
+ cmd_line = [command] |
+ try: |
+ results = subprocess.check_output( |
+ cmd_line, cwd=cwd, stderr=subprocess.STDOUT, shell=True) |
+ except subprocess.CalledProcessError, e: |
+ print 'Failed to run command %s; %s' % (command, e) |
+ else: |
+ print results |
+ finally: |
+ pass |
+ |
+ |
+def main(): |
+ |
+ parser = argparse.ArgumentParser() |
+ parser.add_argument('-f', '--file', |
+ help='path to file containing list of command to launch.') |
+ parser.add_argument('-c', '--cwd', |
Lei Lei
2014/10/14 01:58:37
Not sure how can you get cwd.
anandc
2014/10/14 16:53:00
Hmmm. Good point. I was using cwd just to make sur
|
+ help='folder from where to launch the commands.') |
+ parser.add_argument('-p', '--prod_dir', |
+ help='build output folder, i.e., <(PRODUCT_DIR).') |
+ |
+ if len(sys.argv) != 7: |
+ parser.print_help() |
+ sys.exit(1) |
+ |
+ # Use input json file if specified on command line. |
+ args = parser.parse_args() |
+ if args.file: |
+ with open(args.file) as f: |
+ for line in f: |
+ # Replace the PROD_DIR value in the command-line with |
+ # the passed in value. |
+ line = line.replace(PROD_DIR_ID, args.prod_dir) |
+ LaunchCommand(line, args.cwd) |
+ |
+if __name__ == '__main__': |
+ main() |