| 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 flaky google-test executable. | 6 """Simulate a flaky 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 os | 12 import os |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 import gtest_fake_base | 15 import gtest_fake_base |
| 16 | 16 |
| 17 | 17 |
| 18 TESTS = { | 18 TESTS = { |
| 19 'Foo': [ | 19 'Foo': [ |
| 20 'Bar1', 'Bar2', 'Bar3', 'Bar4', 'Bar5', 'Bar6', 'Bar7', 'Bar8', 'Bar9', | 20 'Bar1', 'Bar2', 'Bar3', 'Bar4', 'Bar5', 'Bar6', 'Bar7', 'Bar8', 'Bar9', |
| 21 ], | 21 ], |
| 22 } | 22 } |
| 23 TOTAL = sum(len(v) for v in TESTS.itervalues()) | 23 TOTAL = sum(len(v) for v in TESTS.itervalues()) |
| 24 | 24 |
| 25 | 25 |
| 26 def main(): | 26 def main(): |
| 27 parser = optparse.OptionParser() | 27 parser = optparse.OptionParser() |
| 28 parser.add_option('--gtest_list_tests', action='store_true') | 28 parser.add_option('--gtest_list_tests', action='store_true') |
| 29 parser.add_option('--gtest_print_time', action='store_true') |
| 29 parser.add_option('--gtest_filter') | 30 parser.add_option('--gtest_filter') |
| 30 options, args = parser.parse_args() | 31 options, args = parser.parse_args() |
| 31 if len(args) != 1: | 32 if len(args) != 1: |
| 32 parser.error('Need to pass a temporary directory path') | 33 parser.error('Need to pass a temporary directory path') |
| 33 | 34 |
| 34 temp_dir = args[0] | 35 temp_dir = args[0] |
| 35 | 36 |
| 36 if options.gtest_list_tests: | 37 if options.gtest_list_tests: |
| 37 for fixture, cases in TESTS.iteritems(): | 38 for fixture, cases in TESTS.iteritems(): |
| 38 print '%s.' % fixture | 39 print '%s.' % fixture |
| (...skipping 19 matching lines...) Expand all Loading... |
| 58 | 59 |
| 59 for fixture, cases in TESTS.iteritems(): | 60 for fixture, cases in TESTS.iteritems(): |
| 60 for case in cases: | 61 for case in cases: |
| 61 print gtest_fake_base.get_test_output('%s.%s' % (fixture, case)) | 62 print gtest_fake_base.get_test_output('%s.%s' % (fixture, case)) |
| 62 print gtest_fake_base.get_footer(TOTAL, TOTAL) | 63 print gtest_fake_base.get_footer(TOTAL, TOTAL) |
| 63 return 1 | 64 return 1 |
| 64 | 65 |
| 65 | 66 |
| 66 if __name__ == '__main__': | 67 if __name__ == '__main__': |
| 67 sys.exit(main()) | 68 sys.exit(main()) |
| OLD | NEW |