OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 Google Inc. All rights reserved. | 3 # Copyright (c) 2012 Google Inc. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 __doc__ = """ | 7 __doc__ = """ |
8 gyptest.py -- test runner for GYP tests. | 8 gyptest.py -- test runner for GYP tests. |
9 """ | 9 """ |
10 | 10 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 argv = sys.argv | 146 argv = sys.argv |
147 | 147 |
148 usage = "gyptest.py [-ahlnq] [-f formats] [test ...]" | 148 usage = "gyptest.py [-ahlnq] [-f formats] [test ...]" |
149 parser = optparse.OptionParser(usage=usage) | 149 parser = optparse.OptionParser(usage=usage) |
150 parser.add_option("-a", "--all", action="store_true", | 150 parser.add_option("-a", "--all", action="store_true", |
151 help="run all tests") | 151 help="run all tests") |
152 parser.add_option("-C", "--chdir", action="store", default=None, | 152 parser.add_option("-C", "--chdir", action="store", default=None, |
153 help="chdir to the specified directory") | 153 help="chdir to the specified directory") |
154 parser.add_option("-f", "--format", action="store", default='', | 154 parser.add_option("-f", "--format", action="store", default='', |
155 help="run tests with the specified formats") | 155 help="run tests with the specified formats") |
| 156 parser.add_option("-G", '--gyp_option', action="append", default=[], |
| 157 help="Add -G options to the gyp command line") |
156 parser.add_option("-l", "--list", action="store_true", | 158 parser.add_option("-l", "--list", action="store_true", |
157 help="list available tests and exit") | 159 help="list available tests and exit") |
158 parser.add_option("-n", "--no-exec", action="store_true", | 160 parser.add_option("-n", "--no-exec", action="store_true", |
159 help="no execute, just print the command line") | 161 help="no execute, just print the command line") |
160 parser.add_option("--passed", action="store_true", | 162 parser.add_option("--passed", action="store_true", |
161 help="report passed tests") | 163 help="report passed tests") |
162 parser.add_option("--path", action="append", default=[], | 164 parser.add_option("--path", action="append", default=[], |
163 help="additional $PATH directory") | 165 help="additional $PATH directory") |
164 parser.add_option("-q", "--quiet", action="store_true", | 166 parser.add_option("-q", "--quiet", action="store_true", |
165 help="quiet, don't print test command lines") | 167 help="quiet, don't print test command lines") |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 'linux2': ['make', 'ninja'], | 215 'linux2': ['make', 'ninja'], |
214 'linux3': ['make', 'ninja'], | 216 'linux3': ['make', 'ninja'], |
215 'darwin': ['make', 'ninja', 'xcode'], | 217 'darwin': ['make', 'ninja', 'xcode'], |
216 }[sys.platform] | 218 }[sys.platform] |
217 | 219 |
218 for format in format_list: | 220 for format in format_list: |
219 os.environ['TESTGYP_FORMAT'] = format | 221 os.environ['TESTGYP_FORMAT'] = format |
220 if not opts.quiet: | 222 if not opts.quiet: |
221 sys.stdout.write('TESTGYP_FORMAT=%s\n' % format) | 223 sys.stdout.write('TESTGYP_FORMAT=%s\n' % format) |
222 | 224 |
| 225 gyp_options = [] |
| 226 for option in opts.gyp_option: |
| 227 gyp_options += ['-G', option] |
| 228 if gyp_options and not opts.quiet: |
| 229 sys.stdout.write('Extra Gyp options: %s\n' % gyp_options) |
| 230 |
223 for test in tests: | 231 for test in tests: |
224 status = cr.run([sys.executable, test], | 232 status = cr.run([sys.executable, test] + gyp_options, |
225 stdout=sys.stdout, | 233 stdout=sys.stdout, |
226 stderr=sys.stderr) | 234 stderr=sys.stderr) |
227 if status == 2: | 235 if status == 2: |
228 no_result.append(test) | 236 no_result.append(test) |
229 elif status: | 237 elif status: |
230 failed.append(test) | 238 failed.append(test) |
231 else: | 239 else: |
232 passed.append(test) | 240 passed.append(test) |
233 | 241 |
234 if not opts.quiet: | 242 if not opts.quiet: |
(...skipping 12 matching lines...) Expand all Loading... |
247 report("No result from", no_result) | 255 report("No result from", no_result) |
248 | 256 |
249 if failed: | 257 if failed: |
250 return 1 | 258 return 1 |
251 else: | 259 else: |
252 return 0 | 260 return 0 |
253 | 261 |
254 | 262 |
255 if __name__ == "__main__": | 263 if __name__ == "__main__": |
256 sys.exit(main()) | 264 sys.exit(main()) |
OLD | NEW |