diff options
author | Alan Somers <asomers@FreeBSD.org> | 2023-10-06 19:46:42 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2023-10-06 19:57:38 +0000 |
commit | 86885b18689889e9b9142fd31d8c67f21334ba32 (patch) | |
tree | d6b80d476410906aa75d237a69e1c2a9c9066b8c | |
parent | 03205a8cd57feb95752142d899d026ff8f45f3e6 (diff) | |
download | src-86885b18689889e9b9142fd31d8c67f21334ba32.tar.gz src-86885b18689889e9b9142fd31d8c67f21334ba32.zip |
Fix intermittency in the sys.fs.fusefs.mknod.main test
In the Mknod.parent_inode test case, the kernel sends an extra
FUSE_FORGET message. But because it gets sent asynchronously with the
failing syscall, it doesn't always get received before the test ends.
So we never setup an expectation for it. And 90+% of the time the test
would exit successfully.
Fix the intermittency by always waiting to receive the FUSE_FORGET
message.
MFC after: 2 weeks
Sponsored by: Axcient
-rw-r--r-- | tests/sys/fs/fusefs/mknod.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/sys/fs/fusefs/mknod.cc b/tests/sys/fs/fusefs/mknod.cc index 223d38f8acb1..1fb855f44f29 100644 --- a/tests/sys/fs/fusefs/mknod.cc +++ b/tests/sys/fs/fusefs/mknod.cc @@ -32,6 +32,7 @@ extern "C" { #include <fcntl.h> #include <sys/socket.h> #include <sys/un.h> +#include <semaphore.h> } #include "mockfs.hh" @@ -255,14 +256,18 @@ TEST_F(Mknod, parent_inode) const char RELPATH[] = "some_node"; mode_t mode = S_IFSOCK | 0755; struct sockaddr_un sa; + sem_t sem; int fd; dev_t rdev = -1; /* Really it's a don't care */ uint64_t ino = 42; + ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno); + expect_lookup(PPATH, ino, S_IFDIR | 0755, 0, 1); EXPECT_LOOKUP(ino, RELPATH) .WillOnce(Invoke(ReturnErrno(ENOENT))); expect_mknod(ino, RELPATH, ino, mode, rdev); + expect_forget(ino, 1, &sem); fd = socket(AF_UNIX, SOCK_STREAM, 0); ASSERT_LE(0, fd) << strerror(errno); @@ -273,6 +278,8 @@ TEST_F(Mknod, parent_inode) ASSERT_EQ(EIO, errno); leak(fd); + sem_wait(&sem); + sem_destroy(&sem); } /* |