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