Make sure we have a mkfifo symbol.

Bug: https://code.google.com/p/android/issues/detail?id=58888
Change-Id: Ic0a883a5f30beb82cb7be3c4e81b6d693d5fbb4d
This commit is contained in:
Elliott Hughes
2013-10-22 10:54:11 -07:00
parent 393484ab35
commit 594b1a4af2
4 changed files with 52 additions and 4 deletions

View File

@@ -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());
}