summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/dev.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/syscalls/linux/dev.cc')
-rw-r--r--test/syscalls/linux/dev.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/syscalls/linux/dev.cc b/test/syscalls/linux/dev.cc
index b86ebe233..4dd302eed 100644
--- a/test/syscalls/linux/dev.cc
+++ b/test/syscalls/linux/dev.cc
@@ -13,7 +13,10 @@
// limitations under the License.
#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
+
#include <vector>
#include "gmock/gmock.h"
@@ -143,6 +146,13 @@ TEST(DevTest, WriteDevFull) {
EXPECT_THAT(WriteFd(fd.get(), "a", 1), SyscallFailsWithErrno(ENOSPC));
}
+TEST(DevTest, TTYExists) {
+ struct stat statbuf = {};
+ ASSERT_THAT(stat("/dev/tty", &statbuf), SyscallSucceeds());
+ // Check that it's a character device with rw-rw-rw- permissions.
+ EXPECT_EQ(statbuf.st_mode, S_IFCHR | 0666);
+}
+
} // namespace
} // namespace testing