[llvm-commits] [llvm] r105855 - /llvm/trunk/utils/lit/lit/TestRunner.py
Daniel Dunbar
daniel at zuster.org
Fri Jun 11 16:27:45 PDT 2010
Author: ddunbar
Date: Fri Jun 11 18:27:45 2010
New Revision: 105855
URL: http://llvm.org/viewvc/llvm-project?rev=105855&view=rev
Log:
lit: When running Tcl style tests on Windows, substitute slashes to avoid Tcl
quoting problems. Not particularly ideal, but should work ok. Based on a patch by
Michael Spencer!
Modified:
llvm/trunk/utils/lit/lit/TestRunner.py
Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=105855&r1=105854&r2=105855&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Fri Jun 11 18:27:45 2010
@@ -13,11 +13,13 @@
self.command = command
self.message = message
+kIsWindows = platform.system() == 'Windows'
+
# Don't use close_fds on Windows.
-kUseCloseFDs = platform.system() != 'Windows'
+kUseCloseFDs = not kIsWindows
# Use temporary files to replace /dev/null on Windows.
-kAvoidDevNull = platform.system() == 'Windows'
+kAvoidDevNull = kIsWindows
def executeCommand(command, cwd=None, env=None):
p = subprocess.Popen(command, cwd=cwd,
@@ -364,7 +366,7 @@
return True
-def parseIntegratedTestScript(test):
+def parseIntegratedTestScript(test, normalize_slashes):
"""parseIntegratedTestScript - Scan an LLVM/Clang style integrated test
script and extract the lines to 'RUN' as well as 'XFAIL' and 'XTARGET'
information. The RUN lines also will have variable substitution performed.
@@ -375,18 +377,25 @@
#
# FIXME: This should not be here?
sourcepath = test.getSourcePath()
+ sourcedir = os.path.dirname(sourcepath)
execpath = test.getExecPath()
execdir,execbase = os.path.split(execpath)
tmpBase = os.path.join(execdir, 'Output', execbase)
if test.index is not None:
tmpBase += '_%d' % test.index
+ # Normalize slashes, if requested.
+ if normalize_slashes:
+ sourcepath = sourcepath.replace('\\', '/')
+ sourcedir = sourcedir.replace('\\', '/')
+ tmpBase = tmpBase.replace('\\', '/')
+
# We use #_MARKER_# to hide %% while we do the other substitutions.
substitutions = [('%%', '#_MARKER_#')]
substitutions.extend(test.config.substitutions)
substitutions.extend([('%s', sourcepath),
- ('%S', os.path.dirname(sourcepath)),
- ('%p', os.path.dirname(sourcepath)),
+ ('%S', sourcedir),
+ ('%p', sourcedir),
('%t', tmpBase + '.tmp'),
# FIXME: Remove this once we kill DejaGNU.
('%abs_tmp', tmpBase + '.tmp'),
@@ -462,7 +471,9 @@
if test.config.unsupported:
return (Test.UNSUPPORTED, 'Test is unsupported')
- res = parseIntegratedTestScript(test)
+ # Parse the test script, normalizing slashes in substitutions on Windows
+ # (since otherwise Tcl style lexing will treat them as escapes).
+ res = parseIntegratedTestScript(test, normalize_slashes=kIsWindows)
if len(res) == 2:
return res
More information about the llvm-commits
mailing list