Make sure we have a mkfifo symbol.
Bug: https://code.google.com/p/android/issues/detail?id=58888
Change-Id: Ic0a883a5f30beb82cb7be3c4e81b6d693d5fbb4d
diff --git a/tests/sys_stat_test.cpp b/tests/sys_stat_test.cpp
index a23100a..176d462 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 @@
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());
+}