equal
deleted
inserted
replaced
637 '''tristate output: |
637 '''tristate output: |
638 None -> skipped |
638 None -> skipped |
639 True -> passed |
639 True -> passed |
640 False -> failed''' |
640 False -> failed''' |
641 |
641 |
|
642 testpath = os.path.join(TESTDIR, test) |
|
643 |
642 def skip(msg): |
644 def skip(msg): |
643 if not options.verbose: |
645 if not options.verbose: |
644 skips.append((test, msg)) |
646 skips.append((test, msg)) |
645 else: |
647 else: |
646 print "\nSkipping %s: %s" % (testpath, msg) |
648 print "\nSkipping %s: %s" % (testpath, msg) |
657 rename(test + ".err", test) |
659 rename(test + ".err", test) |
658 else: |
660 else: |
659 rename(test + ".err", test + ".out") |
661 rename(test + ".err", test + ".out") |
660 return |
662 return |
661 fails.append((test, msg)) |
663 fails.append((test, msg)) |
|
664 |
|
665 if (test.startswith("test-") and '~' not in test and |
|
666 ('.' not in test or test.endswith('.py') or |
|
667 test.endswith('.bat') or test.endswith('.t'))): |
|
668 if not os.path.exists(test): |
|
669 skip("doesn't exist") |
|
670 return None |
|
671 else: |
|
672 return None # not a supported test, don't record |
662 |
673 |
663 vlog("# Test", test) |
674 vlog("# Test", test) |
664 |
675 |
665 # create a fresh hgrc |
676 # create a fresh hgrc |
666 hgrc = open(HGRCPATH, 'w+') |
677 hgrc = open(HGRCPATH, 'w+') |
676 hgrc.write('[inotify]\n') |
687 hgrc.write('[inotify]\n') |
677 hgrc.write('pidfile=%s\n' % DAEMON_PIDS) |
688 hgrc.write('pidfile=%s\n' % DAEMON_PIDS) |
678 hgrc.write('appendpid=True\n') |
689 hgrc.write('appendpid=True\n') |
679 hgrc.close() |
690 hgrc.close() |
680 |
691 |
681 testpath = os.path.join(TESTDIR, test) |
|
682 ref = os.path.join(TESTDIR, test+".out") |
692 ref = os.path.join(TESTDIR, test+".out") |
683 err = os.path.join(TESTDIR, test+".err") |
693 err = os.path.join(TESTDIR, test+".err") |
684 if os.path.exists(err): |
694 if os.path.exists(err): |
685 os.remove(err) # Remove any previous output files |
695 os.remove(err) # Remove any previous output files |
686 try: |
696 try: |
942 if options.retest and not os.path.exists(test + ".err"): |
952 if options.retest and not os.path.exists(test + ".err"): |
943 skipped += 1 |
953 skipped += 1 |
944 continue |
954 continue |
945 |
955 |
946 if options.keywords: |
956 if options.keywords: |
947 fp = open(test) |
957 try: |
|
958 fp = open(test) |
|
959 except IOError: |
|
960 continue |
948 t = fp.read().lower() + test.lower() |
961 t = fp.read().lower() + test.lower() |
949 fp.close() |
962 fp.close() |
950 for k in options.keywords.lower().split(): |
963 for k in options.keywords.lower().split(): |
951 if k in t: |
964 if k in t: |
952 break |
965 break |
999 |
1012 |
1000 if len(args) == 0: |
1013 if len(args) == 0: |
1001 args = os.listdir(".") |
1014 args = os.listdir(".") |
1002 args.sort() |
1015 args.sort() |
1003 |
1016 |
1004 tests = [] |
1017 tests = args |
1005 skipped = [] |
|
1006 for test in args: |
|
1007 if (test.startswith("test-") and '~' not in test and |
|
1008 ('.' not in test or test.endswith('.py') or |
|
1009 test.endswith('.bat') or test.endswith('.t'))): |
|
1010 if not os.path.exists(test): |
|
1011 skipped.append(test) |
|
1012 else: |
|
1013 tests.append(test) |
|
1014 if not tests: |
|
1015 for test in skipped: |
|
1016 print 'Skipped %s: does not exist' % test |
|
1017 print "# Ran 0 tests, %d skipped, 0 failed." % len(skipped) |
|
1018 return |
|
1019 tests = tests + skipped |
|
1020 |
1018 |
1021 # Reset some environment variables to well-known values so that |
1019 # Reset some environment variables to well-known values so that |
1022 # the tests produce repeatable output. |
1020 # the tests produce repeatable output. |
1023 os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C' |
1021 os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C' |
1024 os.environ['TZ'] = 'GMT' |
1022 os.environ['TZ'] = 'GMT' |