Show More
@@ -201,6 +201,11 b' def run(cmd):' | |||||
201 | return ret, splitnewlines(output) |
|
201 | return ret, splitnewlines(output) | |
202 |
|
202 | |||
203 | def run_one(test): |
|
203 | def run_one(test): | |
|
204 | '''tristate output: | |||
|
205 | None -> skipped | |||
|
206 | True -> passed | |||
|
207 | False -> failed''' | |||
|
208 | ||||
204 | vlog("# Test", test) |
|
209 | vlog("# Test", test) | |
205 | if not verbose: |
|
210 | if not verbose: | |
206 | sys.stdout.write('.') |
|
211 | sys.stdout.write('.') | |
@@ -217,15 +222,28 b' def run_one(test):' | |||||
217 | os.mkdir(tmpd) |
|
222 | os.mkdir(tmpd) | |
218 | os.chdir(tmpd) |
|
223 | os.chdir(tmpd) | |
219 |
|
224 | |||
220 | if test.endswith(".py"): |
|
225 | lctest = test.lower() | |
|
226 | ||||
|
227 | if lctest.endswith('.py'): | |||
221 | cmd = '%s "%s"' % (sys.executable, os.path.join(TESTDIR, test)) |
|
228 | cmd = '%s "%s"' % (sys.executable, os.path.join(TESTDIR, test)) | |
222 | else: |
|
229 | elif lctest.endswith('.bat'): | |
223 | cmd = '"%s"' % (os.path.join(TESTDIR, test)) |
|
230 | # do not run batch scripts on non-windows | |
224 |
|
231 | if os.name != 'nt': | ||
|
232 | print '\nSkipping %s: batch script' % test | |||
|
233 | return None | |||
225 | # To reliably get the error code from batch files on WinXP, |
|
234 | # To reliably get the error code from batch files on WinXP, | |
226 | # the "cmd /c call" prefix is needed. Grrr |
|
235 | # the "cmd /c call" prefix is needed. Grrr | |
227 | if os.name == 'nt' and test.endswith(".bat"): |
|
|||
228 | cmd = 'cmd /c call "%s"' % (os.path.join(TESTDIR, test)) |
|
236 | cmd = 'cmd /c call "%s"' % (os.path.join(TESTDIR, test)) | |
|
237 | else: | |||
|
238 | # do not run shell scripts on windows | |||
|
239 | if os.name == 'nt': | |||
|
240 | print '\nSkipping %s: shell script' % test | |||
|
241 | return None | |||
|
242 | # do not try to run non-executable programs | |||
|
243 | if not os.access(os.path.join(TESTDIR, test), os.X_OK): | |||
|
244 | print '\nSkipping %s: not executable' % test | |||
|
245 | return None | |||
|
246 | cmd = '"%s"' % (os.path.join(TESTDIR, test)) | |||
229 |
|
247 | |||
230 | if options.timeout > 0: |
|
248 | if options.timeout > 0: | |
231 | signal.alarm(options.timeout) |
|
249 | signal.alarm(options.timeout) | |
@@ -330,6 +348,7 b' try:' | |||||
330 |
|
348 | |||
331 | tests = 0 |
|
349 | tests = 0 | |
332 | failed = 0 |
|
350 | failed = 0 | |
|
351 | skipped = 0 | |||
333 |
|
352 | |||
334 | if len(args) == 0: |
|
353 | if len(args) == 0: | |
335 | args = os.listdir(".") |
|
354 | args = os.listdir(".") | |
@@ -337,11 +356,15 b' try:' | |||||
337 | if (test.startswith("test-") and '~' not in test and |
|
356 | if (test.startswith("test-") and '~' not in test and | |
338 | ('.' not in test or test.endswith('.py') or |
|
357 | ('.' not in test or test.endswith('.py') or | |
339 | test.endswith('.bat'))): |
|
358 | test.endswith('.bat'))): | |
340 |
|
|
359 | ret = run_one(test) | |
|
360 | if ret is None: | |||
|
361 | skipped += 1 | |||
|
362 | elif not ret: | |||
341 | failed += 1 |
|
363 | failed += 1 | |
342 | tests += 1 |
|
364 | tests += 1 | |
343 |
|
365 | |||
344 |
print "\n# Ran %d tests, %d failed." % (tests, |
|
366 | print "\n# Ran %d tests, %d skipped, %d failed." % (tests, skipped, | |
|
367 | failed) | |||
345 | if coverage: |
|
368 | if coverage: | |
346 | output_coverage() |
|
369 | output_coverage() | |
347 | except KeyboardInterrupt: |
|
370 | except KeyboardInterrupt: |
General Comments 0
You need to be logged in to leave comments.
Login now