blob: 35e6c868f9c83cb4eca0e7c899337acf9b48f1bd [file] [log] [blame]
asharifbb918502013-02-15 05:15:01 +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 can login to the chromeos machine using the test private key.
8"""
9
10__author__ = "asharif@google.com (Ahmad Sharif)"
11
12import optparse
13import os
14import re
15import sys
16from utils import command_executer
17from utils import utils
18
19
20def Usage(parser, message):
21 print "ERROR: " + message
22 parser.print_help()
23 sys.exit(0)
24
25def Main(argv):
26 parser = optparse.OptionParser()
27 parser.add_option("-c", "--chromeos_root", dest="chromeos_root",
28 help="ChromeOS root checkout directory")
29 parser.add_option("-r", "--remote", dest="remote",
30 help="Remote chromeos device.")
31 options = parser.parse_args(argv)[0]
32 if options.chromeos_root is None:
33 Usage(parser, "chromeos_root must be given")
34
35 if options.remote is None:
36 Usage(parser, "remote must be given")
37
38 options.chromeos_root = os.path.expanduser(options.chromeos_root)
39
40 command = "ls -lt /"
41 ce = command_executer.GetCommandExecuter()
42 ce.CrosRunCommand(command,
43 chromeos_root=options.chromeos_root,
44 machine=options.remote)
45
asharif29775b22013-02-15 05:15:38 +000046 version_dir_path, script_name = utils.GetRoot(sys.argv[0])
47 version_dir = utils.GetRoot(version_dir_path)[1]
48
49 # Tests to copy directories and files to the chromeos box.
50 ce.CopyFiles(version_dir_path,
51 "/tmp/" + version_dir,
asharifbb918502013-02-15 05:15:01 +000052 dest_machine=options.remote,
53 dest_cros=True,
54 chromeos_root=options.chromeos_root)
asharif29775b22013-02-15 05:15:38 +000055 ce.CopyFiles(version_dir_path,
56 "/tmp/" + version_dir + "1",
57 dest_machine=options.remote,
58 dest_cros=True,
59 chromeos_root=options.chromeos_root)
60 ce.CopyFiles(sys.argv[0],
61 "/tmp/" + script_name,
62 recursive=False,
63 dest_machine=options.remote,
64 dest_cros=True,
65 chromeos_root=options.chromeos_root)
66 ce.CopyFiles(sys.argv[0],
67 "/tmp/" + script_name + "1",
68 recursive=False,
69 dest_machine=options.remote,
70 dest_cros=True,
71 chromeos_root=options.chromeos_root)
72
73 # Test to copy directories and files from the chromeos box.
74 ce.CopyFiles("/tmp/" + script_name,
75 "/tmp/hello",
76 recursive=False,
77 src_machine=options.remote,
78 src_cros=True,
79 chromeos_root=options.chromeos_root)
80 ce.CopyFiles("/tmp/" + script_name,
81 "/tmp/" + script_name,
82 recursive=False,
83 src_machine=options.remote,
84 src_cros=True,
85 chromeos_root=options.chromeos_root)
asharif6f4065c2013-02-15 09:04:02 +000086 board = ce.CrosLearnBoard(options.chromeos_root, options.remote)
asharifbb918502013-02-15 05:15:01 +000087 print board
asharif29775b22013-02-15 05:15:38 +000088 return 0
asharifbb918502013-02-15 05:15:01 +000089
90
91if __name__ == "__main__":
92 Main(sys.argv)