OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 """List all the test cases for a google test. | |
7 | |
8 See more info at http://code.google.com/p/googletest/. | |
9 """ | |
10 | |
11 import sys | |
12 | |
13 import run_test_cases | |
14 | |
15 | |
16 def main(): | |
17 """CLI frontend to validate arguments.""" | |
18 parser = run_test_cases.OptionParserWithTestSharding( | |
19 usage='%prog <options> [gtest]') | |
20 parser.add_option( | |
21 '-d', '--disabled', | |
22 action='store_true', | |
23 help='Include DISABLED_ tests') | |
24 parser.add_option( | |
25 '-f', '--fails', | |
26 action='store_true', | |
27 help='Include FAILS_ tests') | |
28 parser.add_option( | |
29 '-F', '--flaky', | |
30 action='store_true', | |
31 help='Include FLAKY_ tests') | |
32 options, args = parser.parse_args() | |
33 if not args: | |
34 parser.error('Please provide the executable to run') | |
35 | |
36 cmd = run_test_cases.fix_python_path(args) | |
37 try: | |
38 tests = run_test_cases.list_test_cases( | |
39 cmd, | |
40 options.index, | |
41 options.shards, | |
42 options.disabled, | |
43 options.fails, | |
44 options.flaky) | |
45 for test in tests: | |
46 print test | |
47 except run_test_cases.Failure, e: | |
48 print e.args[0] | |
49 return e.args[1] | |
50 return 0 | |
51 | |
52 | |
53 if __name__ == '__main__': | |
54 sys.exit(main()) | |
OLD | NEW |