[llvm-commits] [llvm] r84462 - in /llvm/trunk/utils/lit: LitConfig.py TestRunner.py
Daniel Dunbar
daniel at zuster.org
Sun Oct 18 20:54:22 PDT 2009
Author: ddunbar
Date: Sun Oct 18 22:54:21 2009
New Revision: 84462
URL: http://llvm.org/viewvc/llvm-project?rev=84462&view=rev
Log:
lit: When running Tcl scripts via shell, try harder to find 'bash', but fall
back to running them internally if that fails. PR5240.
Modified:
llvm/trunk/utils/lit/LitConfig.py
llvm/trunk/utils/lit/TestRunner.py
Modified: llvm/trunk/utils/lit/LitConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/LitConfig.py?rev=84462&r1=84461&r2=84462&view=diff
==============================================================================
--- llvm/trunk/utils/lit/LitConfig.py (original)
+++ llvm/trunk/utils/lit/LitConfig.py Sun Oct 18 22:54:21 2009
@@ -29,6 +29,7 @@
self.noExecute = noExecute
self.debug = debug
self.isWindows = bool(isWindows)
+ self.bashPath = None
self.numErrors = 0
self.numWarnings = 0
@@ -41,6 +42,27 @@
mustExist = True,
config = config)
+ def getBashPath(self):
+ """getBashPath - Get the path to 'bash'"""
+ import os, Util
+
+ if self.bashPath is not None:
+ return self.bashPath
+
+ self.bashPath = Util.which('bash', os.pathsep.join(self.path))
+ if self.bashPath is None:
+ # Check some known paths.
+ for path in ('/bin/bash', '/usr/bin/bash'):
+ if os.path.exists(path):
+ self.bashPath = path
+ break
+
+ if self.bashPath is None:
+ self.warning("Unable to find 'bash', running Tcl tests internally.")
+ self.bashPath = ''
+
+ return self.bashPath
+
def _write_message(self, kind, message):
import inspect, os, sys
Modified: llvm/trunk/utils/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestRunner.py?rev=84462&r1=84461&r2=84462&view=diff
==============================================================================
--- llvm/trunk/utils/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/TestRunner.py Sun Oct 18 22:54:21 2009
@@ -237,7 +237,9 @@
for c in cmds[1:]:
cmd = ShUtil.Seq(cmd, '&&', c)
- if litConfig.useTclAsSh:
+ # FIXME: This is lame, we shouldn't need bash. See PR5240.
+ bashPath = litConfig.getBashPath()
+ if litConfig.useTclAsSh and bashPath:
script = tmpBase + '.script'
# Write script file
@@ -252,7 +254,7 @@
print >>sys.stdout
return '', '', 0
- command = ['/bin/bash', script]
+ command = [litConfig.getBashPath(), script]
out,err,exitCode = executeCommand(command, cwd=cwd,
env=test.config.environment)
More information about the llvm-commits
mailing list