[cfe-commits] r168079 - in /cfe/trunk/test: Misc/dev-fd-fs.c lit.cfg

Daniel Dunbar daniel at zuster.org
Thu Nov 15 12:06:10 PST 2012


Author: ddunbar
Date: Thu Nov 15 14:06:10 2012
New Revision: 168079

URL: http://llvm.org/viewvc/llvm-project?rev=168079&view=rev
Log:
tests: Add a test for reading from named pipes.

 - Realized I could use the /dev/fd filesystem to make a simple portable test.

Added:
    cfe/trunk/test/Misc/dev-fd-fs.c
Modified:
    cfe/trunk/test/lit.cfg

Added: cfe/trunk/test/Misc/dev-fd-fs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/dev-fd-fs.c?rev=168079&view=auto
==============================================================================
--- cfe/trunk/test/Misc/dev-fd-fs.c (added)
+++ cfe/trunk/test/Misc/dev-fd-fs.c Thu Nov 15 14:06:10 2012
@@ -0,0 +1,12 @@
+// Check that we can operate on files from /dev/fd.
+// REQUIRES: dev-fd-fs
+
+
+// Check reading from named pipes. We cat the input here instead of redirecting
+// it to ensure that /dev/fd/0 is a named pipe, not just a redirected file.
+//
+// RUN: cat %s | %clang -x c /dev/fd/0 -E > %t
+// RUN: FileCheck --check-prefix DEV-FD-INPUT < %t %s
+
+// DEV-FD-INPUT: int x;
+int x;

Modified: cfe/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=168079&r1=168078&r2=168079&view=diff
==============================================================================
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Thu Nov 15 14:06:10 2012
@@ -237,6 +237,10 @@
 if is_filesystem_case_insensitive():
     config.available_features.add('case-insensitive-filesystem')
 
+# Tests that require the /dev/fd filesystem.
+if os.path.exists("/dev/fd/0"):
+    config.available_features.add('dev-fd-fs')
+
 # [PR8833] LLP64-incompatible tests
 if not re.match(r'^x86_64.*-(win32|mingw32)$', config.target_triple):
     config.available_features.add('LP64')





More information about the cfe-commits mailing list