Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm/utils/lit/lit/builtin_commands/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def run(argv, stdin, stdout, stderr, cwd):

contents = None
is_text = False
if platform.system() == "OS/390":
if filename == "-":
contents = stdin.read()
elif platform.system() == "OS/390":
try:
with open(path, "r") as fileToCat:
contents = fileToCat.read()
Expand Down
12 changes: 12 additions & 0 deletions llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,15 @@
## Test that cat will pipe stdin to stdout if no other files are specified.
# RUN: echo test | cat | FileCheck --check-prefix=CAT-STDIN %s
# CAT-STDIN: test

## Test that cat reads stdin in place of a "-" operand.
# RUN: rm -rf %t
# RUN: mkdir -p %t
# RUN: echo "abcdefgh" > %t/temp1.write
# RUN: echo "mnopqrst" > %t/temp2.write
# RUN: echo "efghijkl" | cat %t/temp1.write - %t/temp2.write | \
# RUN: FileCheck --check-prefix=DASH-CAT-OUTPUT --implicit-check-not={{.}} \
# RUN: --match-full-lines --strict-whitespace %s
# DASH-CAT-OUTPUT:abcdefgh
# DASH-CAT-OUTPUT-NEXT:efghijkl
# DASH-CAT-OUTPUT-NEXT:mnopqrst