git: 8399d764c929 - main - Fix intermittency in the sys.fs.fusefs.symlink.main test
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Oct 2023 21:08:24 UTC
The branch main has been updated by asomers:
URL: https://cgit.FreeBSD.org/src/commit/?id=8399d764c929a4b2fa98dbfae0ca7359810e4668
commit 8399d764c929a4b2fa98dbfae0ca7359810e4668
Author: Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2023-10-06 21:05:41 +0000
Commit: Alan Somers <asomers@FreeBSD.org>
CommitDate: 2023-10-06 21:08:03 +0000
Fix intermittency in the sys.fs.fusefs.symlink.main test
This change is identical to 86885b18689 but for symlink instead of
mknod. The kernel sends a FUSE_FORGET asynchronously with the final
syscall. The lack of an expectation caused this test to occasionally
fail.
Also, remove a sleep that accidentally snuck into a different test.
MFC after: 2 weeks
MFC with: 86885b18689889e9b9142fd31d8c67f21334ba32
Sponsored by: Axcient
---
tests/sys/fs/fusefs/mkdir.cc | 1 -
tests/sys/fs/fusefs/symlink.cc | 8 ++++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/tests/sys/fs/fusefs/mkdir.cc b/tests/sys/fs/fusefs/mkdir.cc
index 48453ff8bb8a..f020feb94ed8 100644
--- a/tests/sys/fs/fusefs/mkdir.cc
+++ b/tests/sys/fs/fusefs/mkdir.cc
@@ -241,7 +241,6 @@ TEST_F(Mkdir, parent_inode)
ASSERT_EQ(-1, mkdir(FULLPATH, mode));
ASSERT_EQ(EIO, errno);
- usleep(100000);
}
TEST_F(Mkdir_7_8, ok)
diff --git a/tests/sys/fs/fusefs/symlink.cc b/tests/sys/fs/fusefs/symlink.cc
index 19286a446fc3..bd355497a8bd 100644
--- a/tests/sys/fs/fusefs/symlink.cc
+++ b/tests/sys/fs/fusefs/symlink.cc
@@ -29,6 +29,7 @@
*/
extern "C" {
+#include <semaphore.h>
#include <unistd.h>
}
@@ -174,15 +175,22 @@ TEST_F(Symlink, parent_ino)
const char PPATH[] = "parent";
const char RELPATH[] = "src";
const char dst[] = "dst";
+ sem_t sem;
const 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_symlink(ino, dst, RELPATH);
+ expect_forget(ino, 1, &sem);
EXPECT_EQ(-1, symlink(dst, FULLPATH));
EXPECT_EQ(EIO, errno);
+
+ sem_wait(&sem);
+ sem_destroy(&sem);
}
TEST_F(Symlink_7_8, ok)