Clang Project

clang_source_code/test/Misc/dev-fd-fs.c
1// Check that we can operate on files from /dev/fd.
2// REQUIRES: dev-fd-fs
3// REQUIRES: shell
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
10//
11// DEV-FD-INPUT: int x;
12
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
30int x;
31