##// END OF EJS Templates
run-tests.py: add a summary of failed tests at the end
Benoit Boissinot -
r6244:b36774d0 default
parent child Browse files
Show More
@@ -267,7 +267,7 b' def run(cmd):'
267 % options.timeout)
267 % options.timeout)
268 return ret, splitnewlines(output)
268 return ret, splitnewlines(output)
269
269
270 def run_one(test, skips):
270 def run_one(test, skips, fails):
271 '''tristate output:
271 '''tristate output:
272 None -> skipped
272 None -> skipped
273 True -> passed
273 True -> passed
@@ -280,6 +280,11 b' def run_one(test, skips):'
280 print "\nSkipping %s: %s" % (test, msg)
280 print "\nSkipping %s: %s" % (test, msg)
281 return None
281 return None
282
282
283 def fail(msg):
284 fails.append((test, msg))
285 print "\nERROR: %s %s" % (test, msg)
286 return None
287
283 vlog("# Test", test)
288 vlog("# Test", test)
284
289
285 # create a fresh hgrc
290 # create a fresh hgrc
@@ -352,7 +357,7 b' def run_one(test, skips):'
352 ref_out = []
357 ref_out = []
353 if not skipped and out != ref_out:
358 if not skipped and out != ref_out:
354 diffret = 1
359 diffret = 1
355 print "\nERROR: %s output changed" % (test)
360 fail("output changed")
356 show_diff(ref_out, out)
361 show_diff(ref_out, out)
357 if skipped:
362 if skipped:
358 missing = extract_missing_features(out)
363 missing = extract_missing_features(out)
@@ -360,7 +365,7 b' def run_one(test, skips):'
360 missing = ['irrelevant']
365 missing = ['irrelevant']
361 skip(missing[-1])
366 skip(missing[-1])
362 elif ret:
367 elif ret:
363 print "\nERROR: %s failed with error code %d" % (test, ret)
368 fail("returned error code %d" % ret)
364 elif diffret:
369 elif diffret:
365 ret = diffret
370 ret = diffret
366
371
@@ -474,13 +479,17 b' def run_children(tests):'
474 failures = 0
479 failures = 0
475 tested, skipped, failed = 0, 0, 0
480 tested, skipped, failed = 0, 0, 0
476 skips = []
481 skips = []
482 fails = []
477 while fps:
483 while fps:
478 pid, status = os.wait()
484 pid, status = os.wait()
479 fp = fps.pop(pid)
485 fp = fps.pop(pid)
480 l = fp.read().splitlines()
486 l = fp.read().splitlines()
481 test, skip, fail = map(int, l[:3])
487 test, skip, fail = map(int, l[:3])
482 for s in l[3:]:
488 split = -fail or len(l)
489 for s in l[3:split]:
483 skips.append(s.split(" ", 1))
490 skips.append(s.split(" ", 1))
491 for s in l[split:]:
492 fails.append(s.split(" ", 1))
484 tested += test
493 tested += test
485 skipped += skip
494 skipped += skip
486 failed += fail
495 failed += fail
@@ -489,6 +498,8 b' def run_children(tests):'
489 print
498 print
490 for s in skips:
499 for s in skips:
491 print "Skipped %s: %s" % (s[0], s[1])
500 print "Skipped %s: %s" % (s[0], s[1])
501 for s in fails:
502 print "Failed %s: %s" % (s[0], s[1])
492 print "# Ran %d tests, %d skipped, %d failed." % (
503 print "# Ran %d tests, %d skipped, %d failed." % (
493 tested, skipped, failed)
504 tested, skipped, failed)
494 sys.exit(failures != 0)
505 sys.exit(failures != 0)
@@ -526,11 +537,12 b' def run_tests(tests):'
526 tests = orig
537 tests = orig
527
538
528 skips = []
539 skips = []
540 fails = []
529 for test in tests:
541 for test in tests:
530 if options.retest and not os.path.exists(test + ".err"):
542 if options.retest and not os.path.exists(test + ".err"):
531 skipped += 1
543 skipped += 1
532 continue
544 continue
533 ret = run_one(test, skips)
545 ret = run_one(test, skips, fails)
534 if ret is None:
546 if ret is None:
535 skipped += 1
547 skipped += 1
536 elif not ret:
548 elif not ret:
@@ -551,11 +563,15 b' def run_tests(tests):'
551 fp.write('%d\n%d\n%d\n' % (tested, skipped, failed))
563 fp.write('%d\n%d\n%d\n' % (tested, skipped, failed))
552 for s in skips:
564 for s in skips:
553 fp.write("%s %s\n" % s)
565 fp.write("%s %s\n" % s)
566 for s in fails:
567 fp.write("%s %s\n" % s)
554 fp.close()
568 fp.close()
555 else:
569 else:
556 print
570 print
557 for s in skips:
571 for s in skips:
558 print "Skipped %s: %s" % s
572 print "Skipped %s: %s" % s
573 for s in fails:
574 print "Failed %s: %s" % s
559 print "# Ran %d tests, %d skipped, %d failed." % (
575 print "# Ran %d tests, %d skipped, %d failed." % (
560 tested, skipped, failed)
576 tested, skipped, failed)
561
577
General Comments 0
You need to be logged in to leave comments. Login now