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 """Convenience script for expect_tests""" | 6 """Convenience script for expect_tests""" |
7 | 7 |
8 assert __name__ == '__main__' | 8 assert __name__ == '__main__' |
9 | 9 |
10 import itertools | 10 import itertools |
(...skipping 28 matching lines...) Expand all Loading... |
39 'infra/libs/buildbot', | 39 'infra/libs/buildbot', |
40 'infra/libs/decorators', | 40 'infra/libs/decorators', |
41 'infra/libs/gitiles', | 41 'infra/libs/gitiles', |
42 'infra/libs/process_invocation', | 42 'infra/libs/process_invocation', |
43 'infra/libs/service_utils', | 43 'infra/libs/service_utils', |
44 'infra/libs/state_machine', | 44 'infra/libs/state_machine', |
45 | 45 |
46 'infra/services/service_manager', | 46 'infra/services/service_manager', |
47 'infra/services/sysmon', | 47 'infra/services/sysmon', |
48 | 48 |
| 49 # TODO(sergeyberezin): remove this section when infra_libs is removed. |
49 'infra_libs/event_mon', | 50 'infra_libs/event_mon', |
50 'infra_libs/infra_types', | 51 'infra_libs/infra_types', |
51 'infra_libs/logs', | 52 'infra_libs/logs', |
52 'infra_libs/time_functions', | 53 'infra_libs/time_functions', |
53 'infra_libs/ts_mon', | 54 'infra_libs/ts_mon', |
| 55 'infra_libs:infra_libs.test.*', |
54 | 56 |
55 'infra_libs:infra_libs.test.*', | 57 'packages/infra_libs/infra_libs/event_mon', |
| 58 'packages/infra_libs/infra_libs/infra_types', |
| 59 'packages/infra_libs/infra_libs/logs', |
| 60 'packages/infra_libs/infra_libs/time_functions', |
| 61 'packages/infra_libs/infra_libs/ts_mon', |
| 62 'packages/infra_libs/infra_libs:infra_libs.test.*', |
56 ] | 63 ] |
57 | 64 |
58 | 65 |
59 # Parse command-line arguments | 66 # Parse command-line arguments |
60 if len(sys.argv) == 1: | 67 if len(sys.argv) == 1: |
61 usage() | 68 usage() |
62 sys.exit(1) | 69 sys.exit(1) |
63 else: | 70 else: |
64 if not sys.argv[1] in ('list', 'train', 'test', 'debug'): | 71 if not sys.argv[1] in ('list', 'train', 'test', 'debug'): |
65 usage() | 72 usage() |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 modules.extend(['appengine_module']) | 104 modules.extend(['appengine_module']) |
98 appengine_dirs = [ | 105 appengine_dirs = [ |
99 os.path.join('appengine', d) | 106 os.path.join('appengine', d) |
100 for d in os.listdir(appengine_dir) | 107 for d in os.listdir(appengine_dir) |
101 ] | 108 ] |
102 # Use relative paths to shorten the command-line | 109 # Use relative paths to shorten the command-line |
103 modules.extend(itertools.chain( | 110 modules.extend(itertools.chain( |
104 [d for d in appengine_dirs if os.path.isfile(os.path.join(d, | 111 [d for d in appengine_dirs if os.path.isfile(os.path.join(d, |
105 '.coveragerc'))] | 112 '.coveragerc'))] |
106 )) | 113 )) |
| 114 packages_dir = os.path.join(INFRA_ROOT, 'packages') |
| 115 if sys.platform != 'win32' and os.path.isdir(packages_dir): |
| 116 packages_dirs = [ |
| 117 os.path.join('packages', d) |
| 118 for d in os.listdir(packages_dir) |
| 119 ] |
| 120 # Use relative paths to shorten the command-line |
| 121 modules.extend(itertools.chain( |
| 122 [d for d in packages_dirs if os.path.isfile(os.path.join(d, |
| 123 '.coveragerc'))] |
| 124 )) |
107 | 125 |
108 os.environ['PYTHONPATH'] = '' | 126 os.environ['PYTHONPATH'] = '' |
109 os.chdir(INFRA_ROOT) | 127 os.chdir(INFRA_ROOT) |
110 if '--help' not in flags and '-h' not in flags: | 128 if '--help' not in flags and '-h' not in flags: |
111 subprocess.check_call( | 129 subprocess.check_call( |
112 [python_bin, os.path.join('bootstrap', 'remove_orphaned_pycs.py')]) | 130 [python_bin, os.path.join('bootstrap', 'remove_orphaned_pycs.py')]) |
113 else: | 131 else: |
114 usage() | 132 usage() |
115 sys.exit(subprocess.call([python_bin, expect_tests_path, command, '--help'])) | 133 sys.exit(subprocess.call([python_bin, expect_tests_path, command, '--help'])) |
116 | 134 |
(...skipping 18 matching lines...) Expand all Loading... |
135 | 153 |
136 if exit_code: | 154 if exit_code: |
137 print 'Tests failed in modules:\n %s' % '\n '.join(failed_modules) | 155 print 'Tests failed in modules:\n %s' % '\n '.join(failed_modules) |
138 if '--html-report' not in flags: | 156 if '--html-report' not in flags: |
139 print '\nFor detailed coverage report and per-line branch coverage,' | 157 print '\nFor detailed coverage report and per-line branch coverage,' |
140 print 'rerun with --html-report <dir>' | 158 print 'rerun with --html-report <dir>' |
141 else: | 159 else: |
142 print 'All tests passed.' | 160 print 'All tests passed.' |
143 | 161 |
144 sys.exit(exit_code) | 162 sys.exit(exit_code) |
OLD | NEW |