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