##// END OF EJS Templates
run-tests: change return code of runone
Matt Mackall -
r19248:6a127fa5 default
parent child Browse files
Show More
@@ -825,26 +825,16 b' def run(cmd, wd, options, replacements):'
825 return ret, output.splitlines(True)
825 return ret, output.splitlines(True)
826
826
827 def runone(options, test):
827 def runone(options, test):
828 '''tristate output:
828 '''returns a result element: (code, test, msg)'''
829 None -> skipped
830 True -> passed
831 False -> failed'''
832
829
833 global results, resultslock, iolock
830 global iolock
834
835 def result(l, e):
836 resultslock.acquire()
837 results[l].append(e)
838 resultslock.release()
839
831
840 def skip(msg):
832 def skip(msg):
841 if not options.verbose:
833 if options.verbose:
842 result('s', (test, msg))
843 else:
844 iolock.acquire()
834 iolock.acquire()
845 print "\nSkipping %s: %s" % (testpath, msg)
835 print "\nSkipping %s: %s" % (testpath, msg)
846 iolock.release()
836 iolock.release()
847 return None
837 return 's', test, msg
848
838
849 def fail(msg, ret):
839 def fail(msg, ret):
850 if not options.nodiff:
840 if not options.nodiff:
@@ -862,15 +852,14 b' def runone(options, test):'
862 rename(testpath + ".err", testpath)
852 rename(testpath + ".err", testpath)
863 else:
853 else:
864 rename(testpath + ".err", testpath + ".out")
854 rename(testpath + ".err", testpath + ".out")
865 result('p', test)
855 return 'p', test, ''
866 return
856 return 'f', test, msg
867 result('f', (test, msg))
868
857
869 def success():
858 def success():
870 result('p', test)
859 return 'p', test, ''
871
860
872 def ignore(msg):
861 def ignore(msg):
873 result('i', (test, msg))
862 return 'i', test, msg
874
863
875 def describe(ret):
864 def describe(ret):
876 if ret < 0:
865 if ret < 0:
@@ -882,13 +871,11 b' def runone(options, test):'
882 lctest = test.lower()
871 lctest = test.lower()
883
872
884 if not os.path.exists(testpath):
873 if not os.path.exists(testpath):
885 skip("doesn't exist")
874 return skip("doesn't exist")
886 return None
887
875
888 if not (options.whitelisted and test in options.whitelisted):
876 if not (options.whitelisted and test in options.whitelisted):
889 if options.blacklist and test in options.blacklist:
877 if options.blacklist and test in options.blacklist:
890 skip("blacklisted")
878 return skip("blacklisted")
891 return None
892
879
893 if options.retest and not os.path.exists(test + ".err"):
880 if options.retest and not os.path.exists(test + ".err"):
894 ignore("not retesting")
881 ignore("not retesting")
@@ -982,13 +969,13 b' def runone(options, test):'
982 if not missing:
969 if not missing:
983 missing = ['irrelevant']
970 missing = ['irrelevant']
984 if failed:
971 if failed:
985 fail("hghave failed checking for %s" % failed[-1], ret)
972 result = fail("hghave failed checking for %s" % failed[-1], ret)
986 skipped = False
973 skipped = False
987 else:
974 else:
988 skip(missing[-1])
975 result = skip(missing[-1])
989 elif ret == 'timeout':
976 elif ret == 'timeout':
990 mark = 't'
977 mark = 't'
991 fail("timed out", ret)
978 result = fail("timed out", ret)
992 elif out != refout:
979 elif out != refout:
993 mark = '!'
980 mark = '!'
994 if not options.nodiff:
981 if not options.nodiff:
@@ -999,15 +986,14 b' def runone(options, test):'
999 showdiff(refout, out, ref, err)
986 showdiff(refout, out, ref, err)
1000 iolock.release()
987 iolock.release()
1001 if ret:
988 if ret:
1002 fail("output changed and " + describe(ret), ret)
989 result = fail("output changed and " + describe(ret), ret)
1003 else:
990 else:
1004 fail("output changed", ret)
991 result = fail("output changed", ret)
1005 ret = 1
1006 elif ret:
992 elif ret:
1007 mark = '!'
993 mark = '!'
1008 fail(describe(ret), ret)
994 result = fail(describe(ret), ret)
1009 else:
995 else:
1010 success()
996 result = success()
1011
997
1012 if not options.verbose:
998 if not options.verbose:
1013 iolock.acquire()
999 iolock.acquire()
@@ -1017,9 +1003,7 b' def runone(options, test):'
1017
1003
1018 if not options.keep_tmpdir:
1004 if not options.keep_tmpdir:
1019 shutil.rmtree(testtmp, True)
1005 shutil.rmtree(testtmp, True)
1020 if skipped:
1006 return result
1021 return None
1022 return ret == 0
1023
1007
1024 _hgpath = None
1008 _hgpath = None
1025
1009
@@ -1169,9 +1153,15 b' times = []'
1169 iolock = threading.Lock()
1153 iolock = threading.Lock()
1170
1154
1171 def runqueue(options, tests):
1155 def runqueue(options, tests):
1156 global results, resultslock
1157
1172 for test in tests:
1158 for test in tests:
1173 ret = runone(options, test)
1159 code, test, msg = runone(options, test)
1174 if options.first and ret is not None and not ret:
1160 resultslock.acquire()
1161 results[code].append((test, msg))
1162 resultslock.release()
1163
1164 if options.first and code not in '.si':
1175 break
1165 break
1176
1166
1177 def runtests(options, tests):
1167 def runtests(options, tests):
General Comments 0
You need to be logged in to leave comments. Login now