run-tests: move parsehghaveoutput() into TTest
This patch starts a sequence of patches that will try to isolate
everything related to t tests into the TTest class.
--- a/tests/run-tests.py Sun Apr 20 10:11:46 2014 -0700
+++ b/tests/run-tests.py Sun Apr 20 10:14:25 2014 -0700
@@ -283,23 +283,6 @@
shutil.copy(src, dst)
os.remove(src)
-def parsehghaveoutput(lines):
- '''Parse hghave log lines.
- Return tuple of lists (missing, failed):
- * the missing/unknown features
- * the features for which existence check failed'''
- missing = []
- failed = []
- for line in lines:
- if line.startswith(SKIPPED_PREFIX):
- line = line.splitlines()[0]
- missing.append(line[len(SKIPPED_PREFIX):])
- elif line.startswith(FAILED_PREFIX):
- line = line.splitlines()[0]
- failed.append(line[len(FAILED_PREFIX):])
-
- return missing, failed
-
def showdiff(expected, output, ref, err):
print
servefail = False
@@ -472,7 +455,7 @@
missing = ['unknown']
failed = None
else:
- missing, failed = parsehghaveoutput(out)
+ missing, failed = TTest.parsehghaveoutput(out)
if not missing:
missing = ['irrelevant']
@@ -908,6 +891,25 @@
return '+glob'
return False
+ @staticmethod
+ def parsehghaveoutput(lines):
+ '''Parse hghave log lines.
+
+ Return tuple of lists (missing, failed):
+ * the missing/unknown features
+ * the features for which existence check failed'''
+ missing = []
+ failed = []
+ for line in lines:
+ if line.startswith(SKIPPED_PREFIX):
+ line = line.splitlines()[0]
+ missing.append(line[len(SKIPPED_PREFIX):])
+ elif line.startswith(FAILED_PREFIX):
+ line = line.splitlines()[0]
+ failed.append(line[len(FAILED_PREFIX):])
+
+ return missing, failed
+
wifexited = getattr(os, "WIFEXITED", lambda x: False)
def run(cmd, wd, options, replacements, env, abort):
"""Run command in a sub-process, capturing the output (stdout and stderr).