blob: d1f13286aa8e2319d3a3b8203c13390d2ca0e452 [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
Daniel Dunbar0b95bd02012-11-15 20:06:10 +00004// 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 Dunbar5564e6c2012-11-15 20:24:58 +00009//
Daniel Dunbar0b95bd02012-11-15 20:06:10 +000010// DEV-FD-INPUT: int x;
Daniel Dunbar5564e6c2012-11-15 20:24:58 +000011
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 Dunbar0b95bd02012-11-15 20:06:10 +000029int x;