blob: e35486ebe29a23581512797a3ee914b49419af6d [file] [log] [blame]
Daniel Dunbar0b95bd02012-11-15 20:06:10 +00001// Check that we can operate on files from /dev/fd.
2// REQUIRES: dev-fd-fs
3
4
5// Check reading from named pipes. We cat the input here instead of redirecting
6// it to ensure that /dev/fd/0 is a named pipe, not just a redirected file.
7//
8// RUN: cat %s | %clang -x c /dev/fd/0 -E > %t
9// RUN: FileCheck --check-prefix DEV-FD-INPUT < %t %s
Daniel Dunbar5564e6c2012-11-15 20:24:58 +000010//
Daniel Dunbar0b95bd02012-11-15 20:06:10 +000011// DEV-FD-INPUT: int x;
Daniel Dunbar5564e6c2012-11-15 20:24:58 +000012
13
14// Check writing to /dev/fd named pipes. We use cat here as before to ensure we
15// get a named pipe.
16//
17// RUN: %clang -x c %s -E -o /dev/fd/1 | cat > %t
18// RUN: FileCheck --check-prefix DEV-FD-FIFO-OUTPUT < %t %s
19//
20// DEV-FD-FIFO-OUTPUT: int x;
21
22
23// Check writing to /dev/fd regular files.
24//
25// RUN: %clang -x c %s -E -o /dev/fd/1 > %t
26// RUN: FileCheck --check-prefix DEV-FD-REG-OUTPUT < %t %s
27//
28// DEV-FD-REG-OUTPUT: int x;
29
Daniel Dunbar0b95bd02012-11-15 20:06:10 +000030int x;