OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 '''A test runner for gtest application tests.''' | 6 '''A test runner for gtest application tests.''' |
7 | 7 |
8 import argparse | 8 import argparse |
9 import json | 9 import json |
10 import logging | 10 import logging |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 if test_type == 'gtest': | 78 if test_type == 'gtest': |
79 print ('WARNING: tests are forced to gtest_isolated until ' | 79 print ('WARNING: tests are forced to gtest_isolated until ' |
80 'http://crbug.com/529487 is fixed') | 80 'http://crbug.com/529487 is fixed') |
81 test_type = 'gtest_isolated' | 81 test_type = 'gtest_isolated' |
82 isolate = test_type == 'gtest_isolated' | 82 isolate = test_type == 'gtest_isolated' |
83 (ran, fail) = gtest.run_apptest(config, shell, test_args, test, isolate) | 83 (ran, fail) = gtest.run_apptest(config, shell, test_args, test, isolate) |
84 # Ignore empty fixture lists when the commandline has a gtest filter flag. | 84 # Ignore empty fixture lists when the commandline has a gtest filter flag. |
85 if gtest_filter and not ran and not fail: | 85 if gtest_filter and not ran and not fail: |
86 print '[ NO TESTS ] ' + (test_name if args.verbose else '') | 86 print '[ NO TESTS ] ' + (test_name if args.verbose else '') |
87 continue | 87 continue |
88 result = (not ran) or (ran and not fail) | 88 # Use the apptest name if the whole suite failed or no fixtures were run. |
89 # Use the apptest name if the whole suite failed. | 89 fail = [test_name] if (not ran and (not fail or fail == [test])) else fail |
90 fail = [test_name] if (not result and fail == [test]) else fail | |
91 tests.extend(ran) | 90 tests.extend(ran) |
92 failed.extend(fail) | 91 failed.extend(fail) |
| 92 result = ran and not fail |
93 print '[ PASSED ]' if result else '[ FAILED ]', | 93 print '[ PASSED ]' if result else '[ FAILED ]', |
94 print test_name if args.verbose or not result else '' | 94 print test_name if args.verbose or not result else '' |
95 # Abort when 3 apptest suites, or a tenth of all, have failed. | 95 # Abort when 3 apptest suites, or a tenth of all, have failed. |
96 # base::TestLauncher does this for timeouts and unknown results. | 96 # base::TestLauncher does this for timeouts and unknown results. |
97 failed_suites += 0 if result else 1 | 97 failed_suites += 0 if result else 1 |
98 if failed_suites >= max(3, len(test_list) / 10): | 98 if failed_suites >= max(3, len(test_list) / 10): |
99 print 'Too many failing suites (%d), exiting now.' % failed_suites | 99 print 'Too many failing suites (%d), exiting now.' % failed_suites |
100 failed.append('Test runner aborted for excessive failures.') | 100 failed.append('Test runner aborted for excessive failures.') |
101 break; | 101 break; |
102 | 102 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 trie[path] = value | 155 trie[path] = value |
156 return | 156 return |
157 directory, rest = path.split('.', 1) | 157 directory, rest = path.split('.', 1) |
158 if directory not in trie: | 158 if directory not in trie: |
159 trie[directory] = {} | 159 trie[directory] = {} |
160 _AddPathToTrie(trie[directory], rest, value) | 160 _AddPathToTrie(trie[directory], rest, value) |
161 | 161 |
162 | 162 |
163 if __name__ == '__main__': | 163 if __name__ == '__main__': |
164 sys.exit(main()) | 164 sys.exit(main()) |
OLD | NEW |