mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
[lit] Only return a found bash executable on Windows if it can understand Windows paths
Some versions of bash.exe, for example WSL's version expect paths in the form /mnt/c/path/to/dir rather than c:\\path\\to\\dir so will cause failures for any tests that require an external shell if used by lit. If we're on Windows and looking for an external shell, check that the found version of bash is able to parse a native path before returning that version. This patch also partially reverts the behaviour of r228221 by restoring the warning if bash cannot be found. This shouldn't pollute the lit stderr anymore as we're now using internal shell by default on Windows. If someone is explicitly specifying to use an external shell, it's probably worth alerting them to the fact that bash could not be found. Differential Revision: https://reviews.llvm.org/D52831 llvm-svn: 345019
This commit is contained in:
parent
76fa961591
commit
d4e97d7b6a
@ -120,6 +120,22 @@ class LitConfig(object):
|
||||
if self.bashPath is None:
|
||||
self.bashPath = ''
|
||||
|
||||
# Check whether the found version of bash is able to cope with paths in
|
||||
# the host path format. If not, don't return it as it can't be used to
|
||||
# run scripts. For example, WSL's bash.exe requires '/mnt/c/foo' rather
|
||||
# than 'C:\\foo' or 'C:/foo'.
|
||||
if self.isWindows and self.bashPath:
|
||||
command = [self.bashPath, '-c',
|
||||
'[[ -f "%s" ]]' % self.bashPath.replace('\\', '\\\\')]
|
||||
_, _, exitCode = lit.util.executeCommand(command)
|
||||
if exitCode:
|
||||
self.note('bash command failed: %s' % (
|
||||
' '.join('"%s"' % c for c in command)))
|
||||
self.bashPath = ''
|
||||
|
||||
if not self.bashPath:
|
||||
self.warning('Unable to find a usable version of bash.')
|
||||
|
||||
return self.bashPath
|
||||
|
||||
def getToolsPath(self, dir, paths, tools):
|
||||
|
Loading…
Reference in New Issue
Block a user