| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 test_name = test_dict.get('name', test) | 68 test_name = test_dict.get('name', test) |
| 69 test_type = test_dict.get('type', 'gtest') | 69 test_type = test_dict.get('type', 'gtest') |
| 70 test_args = test_dict.get('args', []) + commandline_args | 70 test_args = test_dict.get('args', []) + commandline_args |
| 71 if apptest_filter and not set(apptest_filter) & set([test, test_name]): | 71 if apptest_filter and not set(apptest_filter) & set([test, test_name]): |
| 72 continue; | 72 continue; |
| 73 | 73 |
| 74 print 'Running %s...%s' % (test_name, ('\n' if args.verbose else '')), | 74 print 'Running %s...%s' % (test_name, ('\n' if args.verbose else '')), |
| 75 sys.stdout.flush() | 75 sys.stdout.flush() |
| 76 | 76 |
| 77 assert test_type in ('gtest', 'gtest_isolated') | 77 assert test_type in ('gtest', 'gtest_isolated') |
| 78 if test_type == 'gtest': |
| 79 print ('WARNING: tests are forced to gtest_isolated until ' |
| 80 'http://crbug.com/529487 is fixed') |
| 81 test_type = 'gtest_isolated' |
| 78 isolate = test_type == 'gtest_isolated' | 82 isolate = test_type == 'gtest_isolated' |
| 79 (ran, fail) = gtest.run_apptest(config, shell, test_args, test, isolate) | 83 (ran, fail) = gtest.run_apptest(config, shell, test_args, test, isolate) |
| 80 # 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. |
| 81 if gtest_filter and not ran and not fail: | 85 if gtest_filter and not ran and not fail: |
| 82 print '[ NO TESTS ] ' + (test_name if args.verbose else '') | 86 print '[ NO TESTS ] ' + (test_name if args.verbose else '') |
| 83 continue | 87 continue |
| 84 # Use the apptest name if the whole suite failed or no fixtures were run. | 88 # Use the apptest name if the whole suite failed or no fixtures were run. |
| 85 fail = [test_name] if (not ran and (not fail or fail == [test])) else fail | 89 fail = [test_name] if (not ran and (not fail or fail == [test])) else fail |
| 86 tests.extend(ran) | 90 tests.extend(ran) |
| 87 failed.extend(fail) | 91 failed.extend(fail) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 trie[path] = value | 155 trie[path] = value |
| 152 return | 156 return |
| 153 directory, rest = path.split('.', 1) | 157 directory, rest = path.split('.', 1) |
| 154 if directory not in trie: | 158 if directory not in trie: |
| 155 trie[directory] = {} | 159 trie[directory] = {} |
| 156 _AddPathToTrie(trie[directory], rest, value) | 160 _AddPathToTrie(trie[directory], rest, value) |
| 157 | 161 |
| 158 | 162 |
| 159 if __name__ == '__main__': | 163 if __name__ == '__main__': |
| 160 sys.exit(main()) | 164 sys.exit(main()) |
| OLD | NEW |