| 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 """Simulate a failing google-test executable. | 6 """Simulate a failing google-test executable. |
| 7 | 7 |
| 8 http://code.google.com/p/googletest/ | 8 http://code.google.com/p/googletest/ |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import optparse | 11 import optparse |
| 12 import sys | 12 import sys |
| 13 | 13 |
| 14 import gtest_fake_base | 14 import gtest_fake_base |
| 15 | 15 |
| 16 | 16 |
| 17 TESTS = { | 17 TESTS = { |
| 18 'Foo': ['Bar1', 'Bar2', 'Bar3'], | 18 'Foo': ['Bar1', 'Bar2', 'Bar3'], |
| 19 'Baz': ['Fail'], | 19 'Baz': ['Fail'], |
| 20 } | 20 } |
| 21 TOTAL = sum(len(v) for v in TESTS.itervalues()) | 21 TOTAL = sum(len(v) for v in TESTS.itervalues()) |
| 22 | 22 |
| 23 | 23 |
| 24 def main(): | 24 def main(): |
| 25 parser = optparse.OptionParser() | 25 parser = optparse.OptionParser() |
| 26 parser.add_option('--gtest_list_tests', action='store_true') | 26 parser.add_option('--gtest_list_tests', action='store_true') |
| 27 parser.add_option('--gtest_print_time', action='store_true') |
| 27 parser.add_option('--gtest_filter') | 28 parser.add_option('--gtest_filter') |
| 28 options, args = parser.parse_args() | 29 options, args = parser.parse_args() |
| 29 if args: | 30 if args: |
| 30 parser.error('Failed to process args %s' % args) | 31 parser.error('Failed to process args %s' % args) |
| 31 | 32 |
| 32 if options.gtest_list_tests: | 33 if options.gtest_list_tests: |
| 33 for fixture, cases in TESTS.iteritems(): | 34 for fixture, cases in TESTS.iteritems(): |
| 34 print '%s.' % fixture | 35 print '%s.' % fixture |
| 35 for case in cases: | 36 for case in cases: |
| 36 print ' ' + case | 37 print ' ' + case |
| (...skipping 11 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 for fixture, cases in TESTS.iteritems(): | 50 for fixture, cases in TESTS.iteritems(): |
| 50 for case in cases: | 51 for case in cases: |
| 51 print gtest_fake_base.get_test_output('%s.%s' % (fixture, case)) | 52 print gtest_fake_base.get_test_output('%s.%s' % (fixture, case)) |
| 52 print gtest_fake_base.get_footer(TOTAL, TOTAL) | 53 print gtest_fake_base.get_footer(TOTAL, TOTAL) |
| 53 return 1 | 54 return 1 |
| 54 | 55 |
| 55 | 56 |
| 56 if __name__ == '__main__': | 57 if __name__ == '__main__': |
| 57 sys.exit(main()) | 58 sys.exit(main()) |
| OLD | NEW |