[PATCH] D16000: Add "/dev/console" as a special file name to lit

Yunzhong Gao via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 11:08:27 PST 2016


ygao created this revision.
ygao added subscribers: llvm-commits, rafael, aaron.ballman.

Hi,
This patch adds "/dev/console" as a special output file name for lit tests.
If a lit test has a RUN line that includes a redirection into "/dev/console",
redirection will be disabled for the test, and the test outputs to the console.

This patch is needed to implement a test like PR25717 (due to size limit of
Windows sys call WriteConsole() prior to Windows 8) where the test only
breaks when outputing to the console and won't fail if using a pipe.

It is unfortunate that I had to modify lit in order to implement a clang test.
If anyone has a better idea of how to implement the test, please advise.
Many thanks in advance,

- Gao

http://reviews.llvm.org/D16000

Files:
  utils/lit/lit/TestRunner.py

Index: utils/lit/lit/TestRunner.py
===================================================================
--- utils/lit/lit/TestRunner.py
+++ utils/lit/lit/TestRunner.py
@@ -242,7 +242,7 @@
                     raise InternalShellError(j,"Unsupported redirect on stdout")
                 result = subprocess.PIPE
             else:
-                if r[2] is None:
+                if r[2] is None and r[0] != '/dev/console':
                     if kAvoidDevNull and r[0] == '/dev/null':
                         r[2] = tempfile.TemporaryFile(mode=r[1])
                     else:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16000.44339.patch
Type: text/x-patch
Size: 581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160108/8b8fd676/attachment.bin>


More information about the llvm-commits mailing list