]> granicus.if.org Git - llvm/commitdiff
[lit] Fix shtest-format external_shell failures
authorReid Kleckner <rnk@google.com>
Fri, 28 Jul 2017 16:13:02 +0000 (16:13 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 28 Jul 2017 16:13:02 +0000 (16:13 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309399 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/TestRunner.py
utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt
utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.py [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh [deleted file]

index 404b8f6581bb5e5a5a257f0debe7264d1d31b9a1..c2fbb84e3acdbe564b053c628ea901142e5f6be4 100644 (file)
@@ -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:
index f6157e66c97c75b2f4b473cf93049808633c0bfd..12bbfc25b524e3f86818ff5992b436dc4bc9dc17 100644 (file)
@@ -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/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.py b/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.py
new file mode 100644 (file)
index 0000000..32ff2d8
--- /dev/null
@@ -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/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh b/utils/lit/tests/Inputs/shtest-format/external_shell/write-bad-encoding.sh
deleted file mode 100755 (executable)
index 6b622cb..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-echo "a line with bad encoding: Â."