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 | |
10 PROD_DIR_ID = '$(PROD_DIR)' | |
11 | |
12 | |
13 def LaunchCommand(command): | |
14 | |
15 cmd_line = [command] | |
16 try: | |
17 results = subprocess.check_output( | |
18 cmd_line, stderr=subprocess.STDOUT, shell=True) | |
19 except subprocess.CalledProcessError, e: | |
20 raise Exception('Exception %s running command %s' % (e, command)) | |
21 else: | |
22 print results | |
23 finally: | |
24 pass | |
25 | |
26 | |
27 def main(): | |
28 | |
29 parser = argparse.ArgumentParser() | |
30 parser.add_argument('-f', '--file', | |
31 help='path to file containing list of command to launch.') | |
weitao
2014/10/17 16:56:49
s/command/commands
| |
32 parser.add_argument('-p', '--prod_dir', | |
33 help='build output folder, i.e., <(PRODUCT_DIR).') | |
weitao
2014/10/17 16:56:49
It doesn't have to be the build output folder. Sug
| |
34 | |
35 args = parser.parse_args() | |
36 | |
37 with open(args.file) as f: | |
38 for line in f: | |
39 # Replace the PROD_DIR value in the command-line with | |
40 # the passed in value. | |
41 line = line.replace(PROD_DIR_ID, args.prod_dir) | |
42 LaunchCommand(line) | |
43 | |
44 if __name__ == '__main__': | |
45 main() | |
OLD | NEW |