summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit/LitConfig.py
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-10-19 03:54:21 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-10-19 03:54:21 +0000
commit7e8cf910e4a66f2c217dc4ba7c34f1057d7a7d73 (patch)
tree5fa9a10f2b743f117674eb2e4843b815ffdbe172 /llvm/utils/lit/LitConfig.py
parent0eb0378ad8423f15e70173cdf7d4f7ce41676ad0 (diff)
downloadbcm5719-llvm-7e8cf910e4a66f2c217dc4ba7c34f1057d7a7d73.tar.gz
bcm5719-llvm-7e8cf910e4a66f2c217dc4ba7c34f1057d7a7d73.zip
lit: When running Tcl scripts via shell, try harder to find 'bash', but fall
back to running them internally if that fails. PR5240. llvm-svn: 84462
Diffstat (limited to 'llvm/utils/lit/LitConfig.py')
-rw-r--r--llvm/utils/lit/LitConfig.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/utils/lit/LitConfig.py b/llvm/utils/lit/LitConfig.py
index 4fb0ccc0935..c334109e1de 100644
--- a/llvm/utils/lit/LitConfig.py
+++ b/llvm/utils/lit/LitConfig.py
@@ -29,6 +29,7 @@ class LitConfig:
self.noExecute = noExecute
self.debug = debug
self.isWindows = bool(isWindows)
+ self.bashPath = None
self.numErrors = 0
self.numWarnings = 0
@@ -41,6 +42,27 @@ class LitConfig:
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
OpenPOWER on IntegriCloud