Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2014 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 | |
| 6 """Utility script to launch browser-tests on the Chromoting bot.""" | |
| 7 import argparse | |
| 8 import subprocess | |
| 9 import sys | |
| 10 | |
| 11 PROD_DIR_ID = '$(PROD_DIR)' | |
| 12 | |
| 13 | |
| 14 def LaunchCommand(command): | |
| 15 | |
| 16 cmd_line = [command] | |
| 17 try: | |
| 18 results = subprocess.check_output( | |
| 19 cmd_line, stderr=subprocess.STDOUT, shell=True) | |
| 20 except subprocess.CalledProcessError, e: | |
| 21 print 'Failed to run command %s; %s' % (command, e) | |
|
Lei Lei
2014/10/15 01:09:44
You should not swallow the exception, otherwise it
anandc
2014/10/16 02:06:15
Done.
| |
| 22 else: | |
| 23 print results | |
| 24 finally: | |
| 25 pass | |
| 26 | |
| 27 | |
| 28 def main(): | |
| 29 | |
| 30 parser = argparse.ArgumentParser() | |
| 31 parser.add_argument('-f', '--file', | |
| 32 help='path to file containing list of command to launch.') | |
| 33 parser.add_argument('-p', '--prod_dir', | |
| 34 help='build output folder, i.e., <(PRODUCT_DIR).') | |
| 35 | |
| 36 args = parser.parse_args() | |
| 37 if not args.file or not args.prod_dir: | |
| 38 parser.print_help() | |
| 39 sys.exit(1) | |
| 40 | |
| 41 with open(args.file) as f: | |
| 42 for line in f: | |
| 43 # Replace the PROD_DIR value in the command-line with | |
| 44 # the passed in value. | |
| 45 line = line.replace(PROD_DIR_ID, args.prod_dir) | |
| 46 LaunchCommand(line) | |
| 47 | |
| 48 if __name__ == '__main__': | |
| 49 main() | |
| OLD | NEW |