summaryrefslogtreecommitdiff
path: root/tests/sys_stat_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-10-23 19:10:23 -0700
committerElliott Hughes <enh@google.com>2014-10-23 19:10:54 -0700
commitca8e84c6ff55640aef94d25a86a25778a542bfc2 (patch)
tree9bb5852afef5b61cf906caee58cfea12d65e0b0b /tests/sys_stat_test.cpp
parent6c5694b6c8343d740c36adbe904442cecd8030a6 (diff)
Add mkfifoat(3).
Looks like I missed one of the *at functions when I added the rest. Change-Id: If16de82dbf6f9a3ea7bfdcba406ca1c74a3f2279
Diffstat (limited to 'tests/sys_stat_test.cpp')
-rw-r--r--tests/sys_stat_test.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/sys_stat_test.cpp b/tests/sys_stat_test.cpp
index 64049ab61..e46577469 100644
--- a/tests/sys_stat_test.cpp
+++ b/tests/sys_stat_test.cpp
@@ -55,6 +55,18 @@ TEST(sys_stat, futimens_EBADF) {
ASSERT_EQ(EBADF, errno);
}
+TEST(sys_stat, mkfifo_failure) {
+ errno = 0;
+ ASSERT_EQ(-1, mkfifo("/", 0666));
+ ASSERT_EQ(EEXIST, errno);
+}
+
+TEST(sys_stat, mkfifoat_failure) {
+ errno = 0;
+ ASSERT_EQ(-1, mkfifoat(-2, "x", 0666));
+ ASSERT_EQ(EBADF, errno);
+}
+
TEST(sys_stat, mkfifo) {
if (getuid() == 0) {
// Racy but probably sufficient way to get a suitable filename.
@@ -70,6 +82,7 @@ TEST(sys_stat, mkfifo) {
ASSERT_TRUE(S_ISFIFO(sb.st_mode));
unlink(path.c_str());
} else {
+ // SELinux policy forbids us from creating FIFOs. http://b/17646702.
GTEST_LOG_(INFO) << "This test only performs a test when run as root.";
}
}