diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-07-17 11:28:28 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-07-17 11:28:30 -0700 |
commit | 682fd2d68f78c65beb11437087987c854fc67121 (patch) | |
tree | 0872f13fdf3d990f948bf068628d6b6ce9f498b5 /test | |
parent | ca829158e385c591d4be21c87cc6ab45116a7cce (diff) | |
parent | 6ebb925acd6336760f6f9453e860944e0e314a7b (diff) |
Merge pull request #533 from kevinGC:stub-dev-tty
PiperOrigin-RevId: 258607547
Diffstat (limited to 'test')
-rw-r--r-- | test/syscalls/linux/dev.cc | 10 |
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 |