diff options
author | Ridwan Sharif <ridwanmsharif@google.com> | 2020-06-09 12:35:39 -0400 |
---|---|---|
committer | Ridwan Sharif <ridwanmsharif@google.com> | 2020-06-25 14:22:21 -0400 |
commit | bd5f0e2dc42866f28437f07b1a24e19d1748c3ea (patch) | |
tree | b4407dec1c37e0124d9854d1f279af69fd2afc1d /test/syscalls/linux/dev.cc | |
parent | 00ee5abaa70965b1baad996f53d3dc2a17805fcf (diff) |
Add FUSE character device
This change adds a FUSE character device backed by devtmpfs. This
device will be used to establish a connection between the FUSE
server daemon and fusefs. The FileDescriptionImpl methods will
be implemented as we flesh out fusefs some more. The tests assert
that the device can be opened and used.
Diffstat (limited to 'test/syscalls/linux/dev.cc')
-rw-r--r-- | test/syscalls/linux/dev.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/syscalls/linux/dev.cc b/test/syscalls/linux/dev.cc index 4dd302eed..82b115981 100644 --- a/test/syscalls/linux/dev.cc +++ b/test/syscalls/linux/dev.cc @@ -146,7 +146,27 @@ TEST(DevTest, WriteDevFull) { EXPECT_THAT(WriteFd(fd.get(), "a", 1), SyscallFailsWithErrno(ENOSPC)); } +TEST(DevTest, ReadDevFuse) { + SKIP_IF(IsRunningWithVFS1()); + + const FileDescriptor fd = + ASSERT_NO_ERRNO_AND_VALUE(Open("/dev/fuse", O_RDONLY)); + std::vector<char> buf(1); + EXPECT_THAT(ReadFd(fd.get(), buf.data(), sizeof(buf)), SyscallFailsWithErrno(ENOSYS)); +} + +TEST(DevTest, WriteDevFuse) { + SKIP_IF(IsRunningWithVFS1()); + + const FileDescriptor fd = + ASSERT_NO_ERRNO_AND_VALUE(Open("/dev/fuse", O_WRONLY)); + const char* testStr = "test"; + EXPECT_THAT(WriteFd(fd.get(), testStr, sizeof(testStr)), SyscallFailsWithErrno(ENOSYS)); +} + TEST(DevTest, TTYExists) { + SKIP_IF(!IsRunningWithVFS1()); + struct stat statbuf = {}; ASSERT_THAT(stat("/dev/tty", &statbuf), SyscallSucceeds()); // Check that it's a character device with rw-rw-rw- permissions. |