[PATCH] D27747: [lit] Fix shtest-shell tests on Windows
Brian Gesiak via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 21:38:49 PST 2016
modocache created this revision.
modocache added reviewers: ddunbar, echristo, beanz, delcypher.
modocache added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.
Tests in shtest-shell include RUN statements that attempt to
execute .sh shellscript files directly. On Windows, these would fail
with:
Could not create process (C:\path\to\llvm\utils\lit\tests\Inputs\shtest-shell/write-to-stderr.sh)
due to [Error 193] %1 is not a valid Win32 application
Instead of shellscripts, use Python scripts, and execute them with
the Python executable being used to run lit in the first place. This
succeeds on all environments.
https://reviews.llvm.org/D27747
Files:
utils/lit/tests/Inputs/shtest-shell/lit.cfg
utils/lit/tests/Inputs/shtest-shell/redirects.txt
utils/lit/tests/Inputs/shtest-shell/write-to-stderr.py
utils/lit/tests/Inputs/shtest-shell/write-to-stderr.sh
utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.py
utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.sh
Index: utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.sh
===================================================================
--- utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-echo "a line on stdout"
-echo "a line on stderr" 1>&2
Index: utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.py
===================================================================
--- /dev/null
+++ utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+import sys
+
+
+sys.stdout.write('a line on stdout\n')
+sys.stderr.write('a line on stderr\n')
Index: utils/lit/tests/Inputs/shtest-shell/write-to-stderr.sh
===================================================================
--- utils/lit/tests/Inputs/shtest-shell/write-to-stderr.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-echo "a line on stderr" 1>&2
Index: utils/lit/tests/Inputs/shtest-shell/write-to-stderr.py
===================================================================
--- /dev/null
+++ utils/lit/tests/Inputs/shtest-shell/write-to-stderr.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+import sys
+
+
+sys.stderr.write('a line on stderr\n')
Index: utils/lit/tests/Inputs/shtest-shell/redirects.txt
===================================================================
--- utils/lit/tests/Inputs/shtest-shell/redirects.txt
+++ utils/lit/tests/Inputs/shtest-shell/redirects.txt
@@ -17,13 +17,13 @@
# Check stderr redirect (2> and 2>>).
#
# RUN: echo "not-present" > %t.stderr-write
-# RUN: %S/write-to-stderr.sh 2> %t.stderr-write
+# RUN: %{python} %S/write-to-stderr.py 2> %t.stderr-write
# RUN: FileCheck --check-prefix=STDERR-WRITE < %t.stderr-write %s
#
# STDERR-WRITE-NOT: not-present
# STDERR-WRITE: a line on stderr
#
-# RUN: %S/write-to-stderr.sh 2>> %t.stderr-write
+# RUN: %{python} %S/write-to-stderr.py 2>> %t.stderr-write
# RUN: FileCheck --check-prefix=STDERR-APPEND < %t.stderr-write %s
#
# STDERR-APPEND: a line on stderr
@@ -33,7 +33,7 @@
# Check combined redirect (&>).
#
# RUN: echo "not-present" > %t.combined
-# RUN: %S/write-to-stdout-and-stderr.sh &> %t.combined
+# RUN: %{python} %S/write-to-stdout-and-stderr.py &> %t.combined
# RUN: FileCheck --check-prefix=COMBINED-WRITE < %t.combined %s
#
# COMBINED-WRITE-NOT: not-present
Index: utils/lit/tests/Inputs/shtest-shell/lit.cfg
===================================================================
--- utils/lit/tests/Inputs/shtest-shell/lit.cfg
+++ utils/lit/tests/Inputs/shtest-shell/lit.cfg
@@ -4,3 +4,4 @@
config.test_format = lit.formats.ShTest()
config.test_source_root = None
config.test_exec_root = None
+config.substitutions.append(('%{python}', sys.executable))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27747.81346.patch
Type: text/x-patch
Size: 2753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161214/b0426b4b/attachment.bin>
More information about the llvm-commits
mailing list