comparison tests/run-tests.py @ 6982:9fc5bf4adbcf

imported patch test-check
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Wed, 03 Sep 2008 19:01:35 +0200
parents 6a6ef726a2b3
children 0b72836b0384
comparison
equal deleted inserted replaced
6969:d76f64cd4cb2 6982:9fc5bf4adbcf
200 else: 200 else:
201 pythonpath = pydir 201 pythonpath = pydir
202 os.environ["PYTHONPATH"] = pythonpath 202 os.environ["PYTHONPATH"] = pythonpath
203 203
204 use_correct_python() 204 use_correct_python()
205 global hgpkg
206 hgpkg = _hgpath()
205 207
206 if coverage: 208 if coverage:
207 vlog("# Installing coverage wrapper") 209 vlog("# Installing coverage wrapper")
208 os.environ['COVERAGE_FILE'] = COVERAGE_FILE 210 os.environ['COVERAGE_FILE'] = COVERAGE_FILE
209 if os.path.exists(COVERAGE_FILE): 211 if os.path.exists(COVERAGE_FILE):
453 else: 455 else:
454 INST = os.path.join(HGTMP, "install") 456 INST = os.path.join(HGTMP, "install")
455 BINDIR = os.path.join(INST, "bin") 457 BINDIR = os.path.join(INST, "bin")
456 PYTHONDIR = os.path.join(INST, "lib", "python") 458 PYTHONDIR = os.path.join(INST, "lib", "python")
457 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage") 459 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
460
461 def _hgpath():
462 cmd = '%s -c "import mercurial; print mercurial.__path__[0]"'
463 hgpath = os.popen(cmd % python)
464 path = hgpath.read().strip()
465 hgpath.close()
466 return path
467
468 expecthg = os.path.join(HGTMP, 'install', 'lib', 'python', 'mercurial')
469 hgpkg = None
458 470
459 def run_children(tests): 471 def run_children(tests):
460 if not options.with_hg: 472 if not options.with_hg:
461 install_hg() 473 install_hg()
462 474
510 print 522 print
511 for s in skips: 523 for s in skips:
512 print "Skipped %s: %s" % (s[0], s[1]) 524 print "Skipped %s: %s" % (s[0], s[1])
513 for s in fails: 525 for s in fails:
514 print "Failed %s: %s" % (s[0], s[1]) 526 print "Failed %s: %s" % (s[0], s[1])
527
528 if hgpkg != expecthg:
529 print '# Tested unexpected mercurial: %s' % hgpkg
515 print "# Ran %d tests, %d skipped, %d failed." % ( 530 print "# Ran %d tests, %d skipped, %d failed." % (
516 tested, skipped, failed) 531 tested, skipped, failed)
517 sys.exit(failures != 0) 532 sys.exit(failures != 0)
518 533
519 def run_tests(tests): 534 def run_tests(tests):
522 HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc') 537 HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
523 538
524 try: 539 try:
525 if not options.with_hg: 540 if not options.with_hg:
526 install_hg() 541 install_hg()
542
543 if hgpkg != expecthg:
544 print '# Testing unexpected mercurial: %s' % hgpkg
527 545
528 if options.timeout > 0: 546 if options.timeout > 0:
529 try: 547 try:
530 signal.signal(signal.SIGALRM, alarmed) 548 signal.signal(signal.SIGALRM, alarmed)
531 vlog('# Running tests with %d-second timeout' % 549 vlog('# Running tests with %d-second timeout' %
583 print 601 print
584 for s in skips: 602 for s in skips:
585 print "Skipped %s: %s" % s 603 print "Skipped %s: %s" % s
586 for s in fails: 604 for s in fails:
587 print "Failed %s: %s" % s 605 print "Failed %s: %s" % s
606 if hgpkg != expecthg:
607 print '# Tested unexpected mercurial: %s' % hgpkg
588 print "# Ran %d tests, %d skipped, %d failed." % ( 608 print "# Ran %d tests, %d skipped, %d failed." % (
589 tested, skipped, failed) 609 tested, skipped, failed)
590 610
591 if coverage: 611 if coverage:
592 output_coverage() 612 output_coverage()