##// END OF EJS Templates
tests: tidy up reporting of skipped tests...
Matt Mackall -
r5470:8374f3f0 default
parent child Browse files
Show More
@@ -257,16 +257,22 b' def run(cmd):'
257 257 % options.timeout)
258 258 return ret, splitnewlines(output)
259 259
260 def run_one(test):
260 def run_one(test, skips):
261 261 '''tristate output:
262 262 None -> skipped
263 263 True -> passed
264 264 False -> failed'''
265 265
266 def skip(msg):
267 if not verbose:
268 skips.append((test, msg))
269 sys.stdout.write('s')
270 sys.stdout.flush()
271 else:
272 print "\nSkipping %s: %s" % (test, msg)
273 return None
274
266 275 vlog("# Test", test)
267 if not verbose:
268 sys.stdout.write('.')
269 sys.stdout.flush()
270 276
271 277 # create a fresh hgrc
272 278 hgrc = file(HGRCPATH, 'w+')
@@ -299,20 +305,17 b' def run_one(test):'
299 305 elif lctest.endswith('.bat'):
300 306 # do not run batch scripts on non-windows
301 307 if os.name != 'nt':
302 print '\nSkipping %s: batch script' % test
303 return None
308 return skip("batch script")
304 309 # To reliably get the error code from batch files on WinXP,
305 310 # the "cmd /c call" prefix is needed. Grrr
306 311 cmd = 'cmd /c call "%s"' % testpath
307 312 else:
308 313 # do not run shell scripts on windows
309 314 if os.name == 'nt':
310 print '\nSkipping %s: shell script' % test
311 return None
315 return skip("shell script")
312 316 # do not try to run non-executable programs
313 317 if not os.access(testpath, os.X_OK):
314 print '\nSkipping %s: not executable' % test
315 return None
318 return skip("not executable")
316 319 cmd = '"%s"' % testpath
317 320
318 321 if options.timeout > 0:
@@ -342,12 +345,16 b' def run_one(test):'
342 345 missing = extract_missing_features(out)
343 346 if not missing:
344 347 missing = ['irrelevant']
345 print '\nSkipping %s: %s' % (test, missing[-1])
348 skip(missing[-1])
346 349 elif ret:
347 350 print "\nERROR: %s failed with error code %d" % (test, ret)
348 351 elif diffret:
349 352 ret = diffret
350 353
354 if not verbose:
355 sys.stdout.write('.')
356 sys.stdout.flush()
357
351 358 if ret != 0 and not skipped:
352 359 # Save errors to a file for diagnosis
353 360 f = open(err, "wb")
@@ -453,16 +460,23 b' def run_children(tests):'
453 460 os.close(wfd)
454 461 failures = 0
455 462 tested, skipped, failed = 0, 0, 0
463 skips = []
456 464 while fps:
457 465 pid, status = os.wait()
458 466 fp = fps.pop(pid)
459 test, skip, fail = map(int, fp.read().splitlines())
467 l = fp.read().splitlines()
468 test, skip, fail = map(int, l[:3])
469 for s in l[3:]:
470 skips.append(s.split(" ", 1))
460 471 tested += test
461 472 skipped += skip
462 473 failed += fail
463 474 vlog('pid %d exited, status %d' % (pid, status))
464 475 failures |= status
465 print "\n# Ran %d tests, %d skipped, %d failed." % (
476 print
477 for s in skips:
478 print "Skipped %s: %s" % (s[0], s[1])
479 print "# Ran %d tests, %d skipped, %d failed." % (
466 480 tested, skipped, failed)
467 481 sys.exit(failures != 0)
468 482
@@ -498,11 +512,12 b' def run_tests(tests):'
498 512 print "running all tests"
499 513 tests = orig
500 514
515 skips = []
501 516 for test in tests:
502 517 if options.retest and not os.path.exists(test + ".err"):
503 518 skipped += 1
504 519 continue
505 ret = run_one(test)
520 ret = run_one(test, skips)
506 521 if ret is None:
507 522 skipped += 1
508 523 elif not ret:
@@ -521,9 +536,14 b' def run_tests(tests):'
521 536 if options.child:
522 537 fp = os.fdopen(options.child, 'w')
523 538 fp.write('%d\n%d\n%d\n' % (tested, skipped, failed))
539 for s in skips:
540 fp.write("%s %s\n" % s)
524 541 fp.close()
525 542 else:
526 print "\n# Ran %d tests, %d skipped, %d failed." % (
543 print
544 for s in skips:
545 print "Skipped %s: %s" % s
546 print "# Ran %d tests, %d skipped, %d failed." % (
527 547 tested, skipped, failed)
528 548
529 549 if coverage:
General Comments 0
You need to be logged in to leave comments. Login now