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 passing google-test executable. | 6 """Simulate a passing google-test executable. |
7 | 7 |
8 http://code.google.com/p/googletest/ | 8 http://code.google.com/p/googletest/ |
9 | 9 |
10 The data was generated with: | 10 The data was generated with: |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 # Ignored, exists to fake browser_tests. | 113 # Ignored, exists to fake browser_tests. |
114 parser.add_option('--gtest_print_time') | 114 parser.add_option('--gtest_print_time') |
115 # Ignored, exists to fake browser_tests. | 115 # Ignored, exists to fake browser_tests. |
116 parser.add_option('--lib') | 116 parser.add_option('--lib') |
117 parser.add_option('--trim-xml', action='store_true') | 117 parser.add_option('--trim-xml', action='store_true') |
118 options, args = parser.parse_args() | 118 options, args = parser.parse_args() |
119 if args: | 119 if args: |
120 parser.error('Failed to process args %s' % args) | 120 parser.error('Failed to process args %s' % args) |
121 if options.gtest_output: | 121 if options.gtest_output: |
122 if not options.gtest_output.startswith('xml:'): | 122 if not options.gtest_output.startswith('xml:'): |
123 parser.error('--gtest_output value must start with xm:') | 123 parser.error('--gtest_output value must start with xml:') |
124 options.gtest_output = options.gtest_output[len('xml:'):] | 124 options.gtest_output = options.gtest_output[len('xml:'):] |
| 125 if (not os.path.isabs(options.gtest_output) or |
| 126 not options.gtest_output[-1] == os.path.sep): |
| 127 parser.error('Require strict absolute path ending with %s' % os.path.sep) |
125 | 128 |
126 if options.trim_xml: | 129 if options.trim_xml: |
127 trim_xml() | 130 trim_xml() |
128 return 0 | 131 return 0 |
129 | 132 |
130 if options.gtest_list_tests: | 133 if options.gtest_list_tests: |
131 for fixture, cases in TESTS.iteritems(): | 134 for fixture, cases in TESTS.iteritems(): |
132 print '%s.' % fixture | 135 print '%s.' % fixture |
133 for case in cases: | 136 for case in cases: |
134 print ' ' + case | 137 print ' ' + case |
(...skipping 26 matching lines...) Expand all Loading... |
161 else: | 164 else: |
162 filename = case + '.xml' | 165 filename = case + '.xml' |
163 out = os.path.join(options.gtest_output, filename) | 166 out = os.path.join(options.gtest_output, filename) |
164 shutil.copyfile(os.path.join(ROOT_DIR, filename), out) | 167 shutil.copyfile(os.path.join(ROOT_DIR, filename), out) |
165 return 0 | 168 return 0 |
166 return 2 | 169 return 2 |
167 | 170 |
168 | 171 |
169 if __name__ == '__main__': | 172 if __name__ == '__main__': |
170 sys.exit(main()) | 173 sys.exit(main()) |
OLD | NEW |