From 97ea867690314be089744a52931b42a7f6a291a1 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 25 Jul 2009 11:27:37 +0000 Subject: MultiTestRunner: Validate '&&' at the end of RUN lines. - This is just to normalize, these will go away soon hopefully. Added all the missing '&&'s that have crept in. :) llvm-svn: 77062 --- clang/utils/test/TestRunner.py | 43 ++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'clang/utils/test') diff --git a/clang/utils/test/TestRunner.py b/clang/utils/test/TestRunner.py index 246a22b4389..5639a378e7b 100755 --- a/clang/utils/test/TestRunner.py +++ b/clang/utils/test/TestRunner.py @@ -122,23 +122,46 @@ def runOneTest(FILENAME, SUBST, OUTPUT, TESTNAME, CLANG, CLANGCC, ('%t',TEMPOUTPUT), (' clang ', ' ' + CLANG + ' '), (' clang-cc ', ' ' + CLANGCC + ' ')] + + # Collect the test lines from the script. scriptLines = [] xfailLines = [] for ln in open(scriptFile): if 'RUN:' in ln: - # Isolate run parameters + # Isolate the command to run. index = ln.index('RUN:') ln = ln[index+4:] - - # Apply substitutions - for a,b in substitutions: - ln = ln.replace(a,b) - - if useDGCompat: - ln = re.sub(r'\{(.*)\}', r'"\1"', ln) - scriptLines.append(ln) + + # Strip whitespace and append. + scriptLines.append(ln.strip()) elif 'XFAIL' in ln: xfailLines.append(ln) + + # FIXME: Support something like END, in case we need to process large + # files. + + # Validate interior lines for '&&', a lovely historical artifact. + for i in range(len(scriptLines) - 1): + ln = scriptLines[i] + + if not ln.endswith('&&'): + print >>output, "MISSING \'&&\': %s" % ln + print >>output, "FOLLOWED BY : %s" % scriptLines[i + 1] + return TestStatus.Fail + + # Strip off '&&' + scriptLines[i] = ln[:-2] + + # Apply substitutions to the script. + def processLine(ln): + # Apply substitutions + for a,b in substitutions: + ln = ln.replace(a,b) + + if useDGCompat: + ln = re.sub(r'\{(.*)\}', r'"\1"', ln) + return ln + scriptLines = map(processLine, scriptLines) if xfailLines: print >>output, "XFAILED '%s':"%(TESTNAME,) @@ -146,7 +169,7 @@ def runOneTest(FILENAME, SUBST, OUTPUT, TESTNAME, CLANG, CLANGCC, # Write script file f = open(SCRIPT,'w') - f.write(''.join(scriptLines)) + f.write(' &&\n'.join(scriptLines)) f.close() outputFile = open(OUTPUT,'w') -- cgit v1.2.3