summaryrefslogtreecommitdiff
path: root/tests/sys_stat_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-10-22 10:54:11 -0700
committerElliott Hughes <enh@google.com>2013-10-22 12:03:19 -0700
commit594b1a4af204aa9de2b4913182f4556e38d71648 (patch)
treeac4ed6a89ff6048205c0af443cc6f882e4499fdf /tests/sys_stat_test.cpp
parent393484ab358040243793375e1525da083008e78e (diff)
Make sure we have a mkfifo symbol.
Bug: https://code.google.com/p/android/issues/detail?id=58888 Change-Id: Ic0a883a5f30beb82cb7be3c4e81b6d693d5fbb4d
Diffstat (limited to 'tests/sys_stat_test.cpp')
-rw-r--r--tests/sys_stat_test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/sys_stat_test.cpp b/tests/sys_stat_test.cpp
index a23100a6c..176d46243 100644
--- a/tests/sys_stat_test.cpp
+++ b/tests/sys_stat_test.cpp
@@ -20,6 +20,8 @@
#include <stdlib.h>
#include <sys/stat.h>
+#include "TemporaryFile.h"
+
TEST(sys_stat, futimens) {
FILE* fp = tmpfile();
ASSERT_TRUE(fp != NULL);
@@ -51,3 +53,18 @@ TEST(sys_stat, futimens_EBADF) {
ASSERT_EQ(-1, futimens(-1, times));
ASSERT_EQ(EBADF, errno);
}
+
+TEST(sys_stat, mkfifo) {
+ // Racy but probably sufficient way to get a suitable filename.
+ std::string path;
+ {
+ TemporaryFile tf;
+ path = tf.filename;
+ }
+
+ ASSERT_EQ(0, mkfifo(path.c_str(), 0666));
+ struct stat sb;
+ ASSERT_EQ(0, stat(path.c_str(), &sb));
+ ASSERT_TRUE(S_ISFIFO(sb.st_mode));
+ unlink(path.c_str());
+}