comparison tests/run-tests.py @ 10088:ec8304e66ea5

run-tests.py: Show paths to failing tests, .err and .out I think this is very convenient when investigating and fixing test failures, but perhaps it must be tweaked further to show paths if and only if it is appropriate.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 16 Dec 2009 12:09:25 +0100
parents cbc93d8ed46a
children df7fc77533fb 5d92fe90be84
comparison
equal deleted inserted replaced
10087:b1982715c435 10088:ec8304e66ea5
249 line = line.splitlines()[0] 249 line = line.splitlines()[0]
250 failed.append(line[len(FAILED_PREFIX):]) 250 failed.append(line[len(FAILED_PREFIX):])
251 251
252 return missing, failed 252 return missing, failed
253 253
254 def showdiff(expected, output): 254 def showdiff(expected, output, ref, err):
255 for line in difflib.unified_diff(expected, output, 255 for line in difflib.unified_diff(expected, output, ref, err):
256 "Expected output", "Test output"):
257 sys.stdout.write(line) 256 sys.stdout.write(line)
258 257
259 def findprogram(program): 258 def findprogram(program):
260 """Search PATH for a executable program""" 259 """Search PATH for a executable program"""
261 for p in os.environ.get('PATH', os.defpath).split(os.pathsep): 260 for p in os.environ.get('PATH', os.defpath).split(os.pathsep):
450 449
451 def skip(msg): 450 def skip(msg):
452 if not options.verbose: 451 if not options.verbose:
453 skips.append((test, msg)) 452 skips.append((test, msg))
454 else: 453 else:
455 print "\nSkipping %s: %s" % (test, msg) 454 print "\nSkipping %s: %s" % (testpath, msg)
456 return None 455 return None
457 456
458 def fail(msg): 457 def fail(msg):
459 fails.append((test, msg)) 458 fails.append((test, msg))
460 if not options.nodiff: 459 if not options.nodiff:
461 print "\nERROR: %s %s" % (test, msg) 460 print "\nERROR: %s %s" % (testpath, msg)
462 return None 461 return None
463 462
464 vlog("# Test", test) 463 vlog("# Test", test)
465 464
466 # create a fresh hgrc 465 # create a fresh hgrc
563 if ret: 562 if ret:
564 fail("output changed and returned error code %d" % ret) 563 fail("output changed and returned error code %d" % ret)
565 else: 564 else:
566 fail("output changed") 565 fail("output changed")
567 if not options.nodiff: 566 if not options.nodiff:
568 showdiff(refout, out) 567 showdiff(refout, out, ref, err)
569 ret = 1 568 ret = 1
570 elif ret: 569 elif ret:
571 mark = '!' 570 mark = '!'
572 fail("returned error code %d" % ret) 571 fail("returned error code %d" % ret)
573 572