Daniel Dunbar | 0b95bd0 | 2012-11-15 20:06:10 +0000 | [diff] [blame] | 1 | // Check that we can operate on files from /dev/fd. |
| 2 | // REQUIRES: dev-fd-fs |
| 3 | |
Daniel Dunbar | 0b95bd0 | 2012-11-15 20:06:10 +0000 | [diff] [blame] | 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 |
Daniel Dunbar | 5564e6c | 2012-11-15 20:24:58 +0000 | [diff] [blame] | 9 | // |
Daniel Dunbar | 0b95bd0 | 2012-11-15 20:06:10 +0000 | [diff] [blame] | 10 | // DEV-FD-INPUT: int x; |
Daniel Dunbar | 5564e6c | 2012-11-15 20:24:58 +0000 | [diff] [blame] | 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 | |
Daniel Dunbar | 0b95bd0 | 2012-11-15 20:06:10 +0000 | [diff] [blame] | 29 | int x; |