[PATCH] [libcxx] Use pseudo-terminal in LIT tests so color output from compiler error messages is captured.

Daniel Dunbar daniel at zuster.org
Tue Oct 28 08:28:10 PDT 2014


Ok, so on the structure of the patch:

1. It would be nice if this functionality wasn't in the Libcxx test format,
but a utility that was part of lit proper.

2. This:
--
+            out = LibcxxTestFormat._read_and_close_pty(out_pty)
+            err = LibcxxTestFormat._read_and_close_pty(err_pty)
--
is not safe, if a command writes enough output to stderr that the pipe is
full it will block, and then the system will be deadlocked since it will
never finish writing to stdout. Also, you probably shouldn't assume that
all data is returned in a single .read() call (even though that is likely
true). See notes in subprocess module, e.g.,
https://docs.python.org/2/library/subprocess.html#subprocess.Popen.communicate
.

 - Daniel


On Mon, Oct 27, 2014 at 8:00 PM, Eric Fiselier <eric at efcs.ca> wrote:

> Only use pseudo-terminal if `sys.stdout.isatty()` is true. Otherwise fall
> back to the old method.
>
> http://reviews.llvm.org/D6010
>
> Files:
>   test/lit.cfg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141028/cb815224/attachment.html>


More information about the cfe-commits mailing list