1 // Check that we can operate on files from /dev/fd.
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.
8 // RUN: cat %s | %clang -x c /dev/fd/0 -E > %t
9 // RUN: FileCheck --check-prefix DEV-FD-INPUT < %t %s
11 // RUN: cat %s | %clang -x c %s -E -DINCLUDE_FROM_STDIN > %t
12 // RUN: FileCheck --check-prefix DEV-FD-INPUT \
13 // RUN: --check-prefix DEV-FD-INPUT-INCLUDE < %t %s
15 // DEV-FD-INPUT-INCLUDE: int w;
16 // DEV-FD-INPUT: int x;
17 // DEV-FD-INPUT-INCLUDE: int y;
20 // Check writing to /dev/fd named pipes. We use cat here as before to ensure we
23 // RUN: %clang -x c %s -E -o /dev/fd/1 | cat > %t
24 // RUN: FileCheck --check-prefix DEV-FD-FIFO-OUTPUT < %t %s
26 // DEV-FD-FIFO-OUTPUT: int x;
29 // Check writing to /dev/fd regular files.
31 // RUN: %clang -x c %s -E -o /dev/fd/1 > %t
32 // RUN: FileCheck --check-prefix DEV-FD-REG-OUTPUT < %t %s
34 // DEV-FD-REG-OUTPUT: int x;
36 #ifdef INCLUDE_FROM_STDIN
37 #undef INCLUDE_FROM_STDIN