[llvm] r258898 - Add "/dev/tty" as a special file name for lit tests.
Yunzhong Gao via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 26 17:48:21 PST 2016
Date: Tue Jan 26 19:48:20 2016
New Revision: 258898
Add "/dev/tty" as a special file name for lit tests.
If a lit test has a RUN line that includes a redirection to "/dev/tty", the
redirection goes to the special device file corresponding to the console. It
is /dev/tty on UNIX-like systems and "CON" on Windows.
This patch is needed to implement a test like PR25717 (caused by the size limit
of the Windows system call WriteConsole() prior to Windows 8) where the test
only breaks when outputing to the console and won't fail if using a pipe.
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Tue Jan 26 19:48:20 2016
@@ -245,6 +245,10 @@ def _executeShCmd(cmd, shenv, results, t
if r is None:
if kAvoidDevNull and r == '/dev/null':
r = tempfile.TemporaryFile(mode=r)
+ elif kIsWindows and r == '/dev/tty':
+ # Simulate /dev/tty on Windows.
+ # "CON" is a special filename for the console.
+ r = open("CON", r)
# Make sure relative paths are relative to the cwd.
redir_filename = os.path.join(cmd_shenv.cwd, r)
More information about the llvm-commits