summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2013-03-20 23:32:14 +0000
committerReid Kleckner <reid@kleckner.net>2013-03-20 23:32:14 +0000
commite23604da5ff92cdf61312b1ec999600e26d1d8cb (patch)
tree3618598a8e04ae2a290c516c2bf68f813622a983
parent7184d34f9677144dc047c0319b03f22dcbe18a43 (diff)
downloadbcm5719-llvm-e23604da5ff92cdf61312b1ec999600e26d1d8cb.tar.gz
bcm5719-llvm-e23604da5ff92cdf61312b1ec999600e26d1d8cb.zip
[lit] Avoid CRLFs in bash scripts on Windows
Native Windows Python will do line ending translation by default, which we don't want in bash scripts. If we're not native Windows Python, then 'b' is ignored. llvm-svn: 177602
-rw-r--r--llvm/utils/lit/lit/TestRunner.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index 07fb43f840d..84176996a8c 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -277,7 +277,10 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
script += '.bat'
# Write script file
- f = open(script,'w')
+ mode = 'w'
+ if litConfig.isWindows and not isWin32CMDEXE:
+ mode += 'b' # Avoid CRLFs when writing bash scripts.
+ f = open(script, mode)
if isWin32CMDEXE:
f.write('\nif %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands))
else:
OpenPOWER on IntegriCloud