dev-fd-fs.c 803 B

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