asharif | 8c227da | 2013-02-15 04:35:52 +0000 | [diff] [blame] | 1 | #!/usr/bin/python2.6 |
| 2 | # |
| 3 | # Copyright 2010 Google Inc. All Rights Reserved. |
| 4 | |
| 5 | """Script to wrap run_remote_tests.sh script. |
| 6 | |
| 7 | This script calls run_remote_tests.sh with standard tests. |
| 8 | """ |
| 9 | |
| 10 | __author__ = "asharif@google.com (Ahmad Sharif)" |
| 11 | |
| 12 | import optparse |
| 13 | import os |
asharif | 3c3c7ab | 2013-02-15 04:56:40 +0000 | [diff] [blame] | 14 | import re |
asharif | 8c227da | 2013-02-15 04:35:52 +0000 | [diff] [blame] | 15 | import sys |
raymes | 01959ae | 2013-02-15 04:50:07 +0000 | [diff] [blame] | 16 | from utils import command_executer |
asharif | 8c227da | 2013-02-15 04:35:52 +0000 | [diff] [blame] | 17 | |
asharif | 8c227da | 2013-02-15 04:35:52 +0000 | [diff] [blame] | 18 | |
asharif | 8697d4e | 2013-02-15 09:18:09 +0000 | [diff] [blame^] | 19 | def Main(argv): |
asharif | 8c227da | 2013-02-15 04:35:52 +0000 | [diff] [blame] | 20 | """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 | |
asharif | ea33a56 | 2013-02-15 04:56:09 +0000 | [diff] [blame] | 29 | tests = "bvt" |
asharif | 8c227da | 2013-02-15 04:35:52 +0000 | [diff] [blame] | 30 | |
asharif | 8697d4e | 2013-02-15 09:18:09 +0000 | [diff] [blame^] | 31 | (options, args) = parser.parse_args(argv) |
asharif | 8c227da | 2013-02-15 04:35:52 +0000 | [diff] [blame] | 32 | |
| 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 | |
asharif | ea33a56 | 2013-02-15 04:56:09 +0000 | [diff] [blame] | 40 | if args: |
| 41 | tests = " " + " ".join(args) |
asharif | 3c3c7ab | 2013-02-15 04:56:40 +0000 | [diff] [blame] | 42 | |
| 43 | case_insensitive_page = re.compile("page", re.IGNORECASE) |
| 44 | tests = case_insensitive_page.sub("Page", tests) |
| 45 | |
asharif | 8c227da | 2013-02-15 04:35:52 +0000 | [diff] [blame] | 46 | return RunRemoteTests(options.chromeos_root, options.remote, |
| 47 | options.board, tests) |
| 48 | |
| 49 | |
| 50 | def 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 | |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 57 | retval = command_executer.GetCommandExecuter().RunCommand(command) |
asharif | 8c227da | 2013-02-15 04:35:52 +0000 | [diff] [blame] | 58 | return retval |
| 59 | |
| 60 | if __name__ == "__main__": |
asharif | 8697d4e | 2013-02-15 09:18:09 +0000 | [diff] [blame^] | 61 | Main(sys.argv) |