summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-07-28 16:13:02 +0000
committerReid Kleckner <rnk@google.com>2017-07-28 16:13:02 +0000
commit432914bba001c2d381734b1017eeb0bae2d850e5 (patch)
treecd83b0a4f51db496dcf51269a79556e29af0a6f4 /llvm
parent9166ce86e83900d2671b66707461d05e7bf9739a (diff)
downloadbcm5719-llvm-432914bba001c2d381734b1017eeb0bae2d850e5.tar.gz
bcm5719-llvm-432914bba001c2d381734b1017eeb0bae2d850e5.zip
[lit] Fix shtest-format external_shell failures
When using win32 cmd.exe, turn off command echoing at the beginning of the script (@echo off). Replace a bash shell script with a python script for the fail_with_bad_encoding test. llvm-svn: 309399
Diffstat (limited to 'llvm')
-rw-r--r--llvm/utils/lit/lit/TestRunner.py1
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt2
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.py6
-rwxr-xr-xllvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh3
4 files changed, 8 insertions, 4 deletions
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index 404b8f6581b..c2fbb84e3ac 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -711,6 +711,7 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
mode += 'b' # Avoid CRLFs when writing bash scripts.
f = open(script, mode)
if isWin32CMDEXE:
+ f.write('@echo off\n')
f.write('\nif %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands))
else:
if test.config.pipefail:
diff --git a/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt b/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt
index f6157e66c97..12bbfc25b52 100644
--- a/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt
+++ b/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt
@@ -1,5 +1,5 @@
# Run a command that fails with error on stdout.
#
-# RUN: %S/write-bad-encoding.sh
+# RUN: python %S/write-bad-encoding.py
# RUN: false
diff --git a/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.py b/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.py
new file mode 100644
index 00000000000..32ff2d81805
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+import sys
+
+sys.stdout.write(b"a line with bad encoding: \xc2.")
+sys.stdout.flush()
diff --git a/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh b/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh
deleted file mode 100755
index 6b622cb232e..00000000000
--- a/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-echo "a line with bad encoding: Â."
OpenPOWER on IntegriCloud