##// END OF EJS Templates
run-tests: detect when hghave fails to check for a feature and fail test...
Nicolas Dumazet -
r8060:84d0fe34 default
parent child Browse files
Show More
@@ -238,9 +238,15 b" if __name__ == '__main__':"
238 continue
238 continue
239
239
240 check, desc = checks[feature]
240 check, desc = checks[feature]
241 if not negate and not check():
241 try:
242 available = check()
243 except Exception, e:
244 error('hghave check failed: ' + feature)
245 continue
246
247 if not negate and not available:
242 error('skipped: missing feature: ' + desc)
248 error('skipped: missing feature: ' + desc)
243 elif negate and check():
249 elif negate and available:
244 error('skipped: system supports %s' % desc)
250 error('skipped: system supports %s' % desc)
245
251
246 if failures != 0:
252 if failures != 0:
@@ -36,6 +36,7 b' import time'
36 # reserved exit code to skip test (used by hghave)
36 # reserved exit code to skip test (used by hghave)
37 SKIPPED_STATUS = 80
37 SKIPPED_STATUS = 80
38 SKIPPED_PREFIX = 'skipped: '
38 SKIPPED_PREFIX = 'skipped: '
39 FAILED_PREFIX = 'hghave check failed: '
39
40
40 required_tools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
41 required_tools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
41
42
@@ -129,16 +130,22 b' def splitnewlines(text):'
129 lines.append(text[i:n+1])
130 lines.append(text[i:n+1])
130 i = n + 1
131 i = n + 1
131
132
132 def extract_missing_features(lines):
133 def parse_hghave_output(lines):
133 '''Extract missing/unknown features log lines as a list'''
134 '''Parse hghave log lines.
135 Return tuple of lists (missing, failed):
136 * the missing/unknown features
137 * the features for which existence check failed'''
134 missing = []
138 missing = []
139 failed = []
135 for line in lines:
140 for line in lines:
136 if not line.startswith(SKIPPED_PREFIX):
141 if line.startswith(SKIPPED_PREFIX):
137 continue
142 line = line.splitlines()[0]
138 line = line.splitlines()[0]
143 missing.append(line[len(SKIPPED_PREFIX):])
139 missing.append(line[len(SKIPPED_PREFIX):])
144 elif line.startswith(FAILED_PREFIX):
145 line = line.splitlines()[0]
146 failed.append(line[len(FAILED_PREFIX):])
140
147
141 return missing
148 return missing, failed
142
149
143 def show_diff(expected, output):
150 def show_diff(expected, output):
144 for line in difflib.unified_diff(expected, output,
151 for line in difflib.unified_diff(expected, output,
@@ -408,10 +415,14 b' def run_one(test, skips, fails):'
408 ref_out = []
415 ref_out = []
409 if skipped:
416 if skipped:
410 mark = 's'
417 mark = 's'
411 missing = extract_missing_features(out)
418 missing, failed = parse_hghave_output(out)
412 if not missing:
419 if not missing:
413 missing = ['irrelevant']
420 missing = ['irrelevant']
414 skip(missing[-1])
421 if failed:
422 fail("hghave failed checking for %s" % failed[-1])
423 skipped = False
424 else:
425 skip(missing[-1])
415 elif out != ref_out:
426 elif out != ref_out:
416 mark = '!'
427 mark = '!'
417 if ret:
428 if ret:
General Comments 0
You need to be logged in to leave comments. Login now