summaryrefslogtreecommitdiff
path: root/chromium/testing/chromoting/browser_tests_launcher.py
blob: 66b54fedbb1526adf1df0680e4d49458121f1fbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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

PROD_DIR_ID = '$(PROD_DIR)'


def LaunchCommand(command):

  cmd_line = [command]
  try:
    results = subprocess.check_output(
        cmd_line, stderr=subprocess.STDOUT, shell=True)
  except subprocess.CalledProcessError, e:
    raise Exception('Exception %s running command %s' % (e, command))
  else:
    print results
  finally:
    pass


def main():

  parser = argparse.ArgumentParser()
  parser.add_argument('-f', '--file',
                      help='path to file listing commands to be launched.')
  parser.add_argument('-p', '--prod_dir',
                      help='path to folder having product and test binaries.')

  args = parser.parse_args()

  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)

if __name__ == '__main__':
  main()