blob: be91c38682f9602734ac3e5520c3db8267c6fa17 [file] [log] [blame]
asharif8c227da2013-02-15 04:35:52 +00001#!/usr/bin/python2.6
2#
3# Copyright 2010 Google Inc. All Rights Reserved.
4
5"""Script to wrap run_remote_tests.sh script.
6
7This script calls run_remote_tests.sh with standard tests.
8"""
9
10__author__ = "asharif@google.com (Ahmad Sharif)"
11
12import optparse
13import os
asharif3c3c7ab2013-02-15 04:56:40 +000014import re
asharif8c227da2013-02-15 04:35:52 +000015import sys
raymes01959ae2013-02-15 04:50:07 +000016from utils import command_executer
asharif8c227da2013-02-15 04:35:52 +000017
asharif8c227da2013-02-15 04:35:52 +000018
asharif8697d4e2013-02-15 09:18:09 +000019def Main(argv):
asharif8c227da2013-02-15 04:35:52 +000020 """The main function."""
21 parser = optparse.OptionParser()
22 parser.add_option("-c", "--chromeos_root", dest="chromeos_root",
23 help="ChromeOS root checkout directory.")
24 parser.add_option("-r", "--remote", dest="remote",
25 help="The IP address of the remote ChromeOS machine.")
26 parser.add_option("-b", "--board", dest="board",
27 help="The board of the target.")
28
asharifea33a562013-02-15 04:56:09 +000029 tests = "bvt"
asharif8c227da2013-02-15 04:35:52 +000030
asharif8697d4e2013-02-15 09:18:09 +000031 (options, args) = parser.parse_args(argv)
asharif8c227da2013-02-15 04:35:52 +000032
33 if options.board is None or options.remote is None:
34 parser.print_help()
35 sys.exit()
36
37 if options.chromeos_root is None:
38 options.chromeos_root = "../.."
39
asharifea33a562013-02-15 04:56:09 +000040 if args:
41 tests = " " + " ".join(args)
asharif3c3c7ab2013-02-15 04:56:40 +000042
43 case_insensitive_page = re.compile("page", re.IGNORECASE)
44 tests = case_insensitive_page.sub("Page", tests)
45
asharif8c227da2013-02-15 04:35:52 +000046 return RunRemoteTests(options.chromeos_root, options.remote,
47 options.board, tests)
48
49
50def RunRemoteTests(chromeos_root, remote, board, tests):
51 """Run the remote tests."""
52 command = (chromeos_root + "/src/scripts/run_remote_tests.sh" +
53 " --remote=" + remote +
54 " --board=" + board +
55 " " + tests)
56
asharif967d7002013-02-15 04:51:00 +000057 retval = command_executer.GetCommandExecuter().RunCommand(command)
asharif8c227da2013-02-15 04:35:52 +000058 return retval
59
60if __name__ == "__main__":
asharif2198c512013-02-15 09:21:35 +000061 retval = Main(sys.argv)
62 sys.exit(retval)