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
commit8755ae8c69ca522a9931aab4b4951443b2f64d26 (patch)
tree273a810195f0f8180089573881921c96eefb5a93
parent93c1fd49d2ca49447e092c4c1c4d5de1005e9e71 (diff)
downloadexternal_llvm-8755ae8c69ca522a9931aab4b4951443b2f64d26.zip
external_llvm-8755ae8c69ca522a9931aab4b4951443b2f64d26.tar.gz
external_llvm-8755ae8c69ca522a9931aab4b4951443b2f64d26.tar.bz2
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177602 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/lit/lit/TestRunner.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py
index 07fb43f..8417699 100644
--- a/utils/lit/lit/TestRunner.py
+++ b/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: