Skip to content

Commit

Permalink
Add "/dev/tty" as a special file name for lit tests.
Browse files Browse the repository at this point in the history
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-svn: 258898
  • Loading branch information
Yunzhong Gao authored and Yunzhong Gao committed Jan 27, 2016
1 parent 5b46371 commit 192bdf8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/utils/lit/lit/TestRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
if r[2] is None:
if kAvoidDevNull and r[0] == '/dev/null':
r[2] = tempfile.TemporaryFile(mode=r[1])
elif kIsWindows and r[0] == '/dev/tty':
# Simulate /dev/tty on Windows.
# "CON" is a special filename for the console.
r[2] = open("CON", r[1])
else:
# Make sure relative paths are relative to the cwd.
redir_filename = os.path.join(cmd_shenv.cwd, r[0])
Expand Down

0 comments on commit 192bdf8

Please sign in to comment.