34 import time |
34 import time |
35 |
35 |
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 |
42 defaults = { |
43 defaults = { |
43 'jobs': ('HGTEST_JOBS', 1), |
44 'jobs': ('HGTEST_JOBS', 1), |
127 lines.append(last) |
128 lines.append(last) |
128 return lines |
129 return lines |
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): |
140 |
145 line = line.splitlines()[0] |
141 return missing |
146 failed.append(line[len(FAILED_PREFIX):]) |
|
147 |
|
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, |
145 "Expected output", "Test output"): |
152 "Expected output", "Test output"): |
146 sys.stdout.write(line) |
153 sys.stdout.write(line) |