diff options
author | Zyad A. Ali <zyad.ali.me@gmail.com> | 2021-08-03 07:48:24 +0200 |
---|---|---|
committer | Zyad A. Ali <zyad.ali.me@gmail.com> | 2021-09-28 20:43:52 +0200 |
commit | f03dc73f0f46d0ff1ae209fefc98ee3d7fc725d2 (patch) | |
tree | ee84a03ddfd6c96c8be7d2a4050caf2875127fb9 /test/syscalls | |
parent | 9bde727f4f2e5b7cf52211a3a4fe71c7a0e4f1ea (diff) |
Implement stubs for mq_open(2) and mq_unlink(2).
Support mq_open and mq_unlink, and enable syscall tests.
Updates #136
Diffstat (limited to 'test/syscalls')
-rw-r--r-- | test/syscalls/linux/mq.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/test/syscalls/linux/mq.cc b/test/syscalls/linux/mq.cc index 9a4a87dfe..b3cd6d1b9 100644 --- a/test/syscalls/linux/mq.cc +++ b/test/syscalls/linux/mq.cc @@ -121,14 +121,14 @@ PosixError MqClose(mqd_t fd) { // Test simple opening and closing of a message queue. TEST(MqTest, Open) { - GTEST_SKIP(); + SKIP_IF(IsRunningWithVFS1()); EXPECT_THAT(MqOpen(O_RDWR | O_CREAT | O_EXCL, 0777, nullptr), IsPosixErrorOkAndHolds(_)); } // Test mq_open(2) after mq_unlink(2). TEST(MqTest, OpenAfterUnlink) { - GTEST_SKIP(); + SKIP_IF(IsRunningWithVFS1()); PosixQueue queue = ASSERT_NO_ERRNO_AND_VALUE( MqOpen(O_RDWR | O_CREAT | O_EXCL, 0777, nullptr)); @@ -140,7 +140,7 @@ TEST(MqTest, OpenAfterUnlink) { // Test using invalid args with mq_open. TEST(MqTest, OpenInvalidArgs) { - GTEST_SKIP(); + SKIP_IF(IsRunningWithVFS1()); // Name must start with a slash. EXPECT_THAT(MqOpen("test", O_RDWR), PosixErrorIs(EINVAL)); @@ -180,7 +180,7 @@ TEST(MqTest, OpenInvalidArgs) { // Test creating a queue that already exists. TEST(MqTest, CreateAlreadyExists) { - GTEST_SKIP(); + SKIP_IF(IsRunningWithVFS1()); PosixQueue queue = ASSERT_NO_ERRNO_AND_VALUE( MqOpen(O_RDWR | O_CREAT | O_EXCL, 0777, nullptr)); @@ -191,7 +191,7 @@ TEST(MqTest, CreateAlreadyExists) { // Test opening a queue that doesn't exists. TEST(MqTest, NoQueueExists) { - GTEST_SKIP(); + SKIP_IF(IsRunningWithVFS1()); // Choose a name to pass that's unlikely to exist if the test is run locally. EXPECT_THAT(MqOpen("/gvisor-mq-test-nonexistent-queue", O_RDWR), @@ -236,8 +236,8 @@ TEST(MqTest, OpenWriteAccess) { // Test changing IPC namespace. TEST(MqTest, ChangeIpcNamespace) { - GTEST_SKIP(); - SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN))); + SKIP_IF(IsRunningWithVFS1() || + !ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN))); // When changing IPC namespaces, Linux doesn't invalidate or close the // previously opened file descriptions and allows operations to be performed @@ -267,7 +267,6 @@ TEST(MqTest, ChangeIpcNamespace) { // Test mounting the mqueue filesystem. TEST(MqTest, Mount) { - GTEST_SKIP(); SKIP_IF(IsRunningWithVFS1() || !ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN))); @@ -280,7 +279,6 @@ TEST(MqTest, Mount) { // Test mounting the mqueue filesystem to several places. TEST(MqTest, MountSeveral) { - GTEST_SKIP(); SKIP_IF(IsRunningWithVFS1() || !ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN))); @@ -299,7 +297,6 @@ TEST(MqTest, MountSeveral) { // Test mounting mqueue and opening a queue as normal file. TEST(MqTest, OpenAsFile) { - GTEST_SKIP(); SKIP_IF(IsRunningWithVFS1() || !ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN))); @@ -328,7 +325,6 @@ TEST(MqTest, OpenAsFile) { // Test removing a queue using unlink(2). TEST(MqTest, UnlinkAsFile) { - GTEST_SKIP(); SKIP_IF(IsRunningWithVFS1() || !ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN))); @@ -349,7 +345,7 @@ TEST(MqTest, UnlinkAsFile) { // Test read(2) from an empty queue. TEST(MqTest, ReadEmpty) { - GTEST_SKIP(); + SKIP_IF(IsRunningWithVFS1()); PosixQueue queue = ASSERT_NO_ERRNO_AND_VALUE( MqOpen(O_RDWR | O_CREAT | O_EXCL, 0777, nullptr)); @@ -368,7 +364,7 @@ TEST(MqTest, ReadEmpty) { // Test poll(2) on an empty queue. TEST(MqTest, PollEmpty) { - GTEST_SKIP(); + SKIP_IF(IsRunningWithVFS1()); PosixQueue queue = ASSERT_NO_ERRNO_AND_VALUE( MqOpen(O_RDWR | O_CREAT | O_EXCL, 0777, nullptr)); |