summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-07-17 11:28:28 -0700
committergVisor bot <gvisor-bot@google.com>2019-07-17 11:28:30 -0700
commit682fd2d68f78c65beb11437087987c854fc67121 (patch)
tree0872f13fdf3d990f948bf068628d6b6ce9f498b5 /test/syscalls/linux
parentca829158e385c591d4be21c87cc6ab45116a7cce (diff)
parent6ebb925acd6336760f6f9453e860944e0e314a7b (diff)
Merge pull request #533 from kevinGC:stub-dev-tty
PiperOrigin-RevId: 258607547
Diffstat (limited to 'test/syscalls/linux')
-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