From: Reid Kleckner Date: Fri, 28 Jul 2017 16:13:02 +0000 (+0000) Subject: [lit] Fix shtest-format external_shell failures X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4dce3059d4f9ae9e818932ac705f4d49ab70aeae;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309399 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py index 404b8f6581b..c2fbb84e3ac 100644 --- a/utils/lit/lit/TestRunner.py +++ b/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/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt b/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt index f6157e66c97..12bbfc25b52 100644 --- a/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_bad_encoding.txt +++ b/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/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 index 00000000000..32ff2d81805 --- /dev/null +++ b/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/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 index 6b622cb232e..00000000000 --- a/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: Â."