blob: ba286b0e6c72d12951dbcdd292493c45fc14e79d [file] [log] [blame]
Charlie Mooney3cca6ba2014-11-19 16:15:28 -08001# Copyright (c) 2014 The Chromium OS 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
5import optparse
6import sys
7
8from test_suite import TestSuite
9
10
11def parse_arguments():
12 VALID_DUT_TYPES = ['chromeos', 'android']
13
14 parser = optparse.OptionParser()
15
16 # DUT specification information
17 parser.add_option('-a', '--addr', dest='addr', default=None,
18 help=('The address of the DUT (ip for CrOS, Device ID ' +
19 'for Android).'))
20 parser.add_option('-t', '--type', dest='dut_type', default=None,
21 help='The type of DUT (android or chromeos).')
22 parser.add_option('--touchscreen', dest='is_touchscreen',
23 default=False, action='store_true',
24 help=('Use the touchscreen (instead of touchpad) on ' +
25 'the device.'))
26
27 # Lab equipment specification
28 parser.add_option('-r', '--robot', dest='has_robot',
29 default=False, action='store_true',
30 help=('Indicate that you have a Google Touchbot that ' +
31 'will perform your gestures for you.'))
32 parser.add_option('-f', '--fn_gen', dest='has_fn_gen',
33 default=False, action='store_true',
34 help=('Indicate that you have an HP 33120A function ' +
35 'generator to automate the electric noise tests.'))
36
37 # Test suite settings
38 parser.add_option('-i', '--iterations', dest='num_iterations', default=1,
39 type=int, help=('The number of test iterations to run.'))
40
41 (options, args) = parser.parse_args()
42
43 if options.dut_type not in VALID_DUT_TYPES:
44 print 'ERROR: invalid dut type "%s"' % options.dut_type
45 print 'valid dut types are: %s' % str(VALID_DUT_TYPES)
46 sys.exit(1)
47 if options.dut_type == 'chromeos' and not options.addr:
48 print 'ERROR: You must supply an IP address for ChromeOS DUTs'
49 sys.exit(1)
50
51 return options, args
52
53
54def main():
55 # Parse and validate the command line arguments
56 options, args = parse_arguments()
57
58 # Create a test flow object that will run the test step by step
59 test_suite = TestSuite(options, args)
60
61 # Run through the entire test suite in turn
62 while test_suite.RunNextTestAndVariation():
63 pass
64
65 return 0
66
67
68if __name__ == "__main__":
69 sys.exit(main())