Chris Masone | c80af5b | 2012-05-30 14:18:22 -0700 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | # |
| 3 | # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
Alex Miller | 9a1987a | 2013-08-21 15:51:16 -0700 | [diff] [blame] | 7 | """ |
| 8 | Deprecated tool for preprocessing tests to determine their DEPENDENCIES. |
Chris Masone | c80af5b | 2012-05-30 14:18:22 -0700 | [diff] [blame] | 9 | """ |
| 10 | |
| 11 | import optparse, os, sys |
| 12 | import common |
Chris Masone | c80af5b | 2012-05-30 14:18:22 -0700 | [diff] [blame] | 13 | |
Alex Miller | 9979b5a | 2012-11-01 17:36:12 -0700 | [diff] [blame] | 14 | |
Chris Masone | c80af5b | 2012-05-30 14:18:22 -0700 | [diff] [blame] | 15 | def parse_options(): |
beeps | 5cb8f91 | 2013-07-09 21:45:45 -0700 | [diff] [blame] | 16 | """Parse command line arguments.""" |
Chris Masone | c80af5b | 2012-05-30 14:18:22 -0700 | [diff] [blame] | 17 | parser = optparse.OptionParser() |
| 18 | parser.add_option('-a', '--autotest_dir', dest='autotest_dir', |
| 19 | default=os.path.abspath( |
| 20 | os.path.join(os.path.dirname(__file__), '..')), |
| 21 | help="Directory under which to search for tests."\ |
| 22 | " (e.g. /usr/local/autotest). Defaults to '..'") |
| 23 | parser.add_option('-o', '--output_file', dest='output_file', |
| 24 | default=None, |
| 25 | help='File into which to write collected test info.'\ |
| 26 | ' Defaults to stdout.') |
Dan Shi | 7b271d0 | 2016-04-25 23:09:58 -0700 | [diff] [blame] | 27 | parser.add_option('-e', '--extra_autotest_dirs', |
| 28 | dest='extra_autotest_dirs', default=None, |
| 29 | help="A list of directories under which to search for " |
| 30 | "extra Autotest tests. Defaults to None.") |
Chris Masone | c80af5b | 2012-05-30 14:18:22 -0700 | [diff] [blame] | 31 | options, _ = parser.parse_args() |
| 32 | return options |
| 33 | |
| 34 | |
Alex Miller | 9979b5a | 2012-11-01 17:36:12 -0700 | [diff] [blame] | 35 | def main(): |
beeps | 5cb8f91 | 2013-07-09 21:45:45 -0700 | [diff] [blame] | 36 | """Main function.""" |
Alex Miller | 9979b5a | 2012-11-01 17:36:12 -0700 | [diff] [blame] | 37 | options = parse_options() |
| 38 | |
Alex Miller | 9a1987a | 2013-08-21 15:51:16 -0700 | [diff] [blame] | 39 | test_deps = {} |
Chris Masone | c80af5b | 2012-05-30 14:18:22 -0700 | [diff] [blame] | 40 | |
| 41 | if options.output_file: |
beeps | 5cb8f91 | 2013-07-09 21:45:45 -0700 | [diff] [blame] | 42 | with open(options.output_file, 'w') as file_obj: |
| 43 | file_obj.write('%r' % test_deps) |
Chris Masone | c80af5b | 2012-05-30 14:18:22 -0700 | [diff] [blame] | 44 | else: |
| 45 | print '%r' % test_deps |
| 46 | |
Alex Miller | 9979b5a | 2012-11-01 17:36:12 -0700 | [diff] [blame] | 47 | |
Chris Masone | c80af5b | 2012-05-30 14:18:22 -0700 | [diff] [blame] | 48 | if __name__ == "__main__": |
| 49 | sys.exit(main()) |