Skip to content

Commit

Permalink
Fix intermittency in the sys.fs.fusefs.symlink.main test
Browse files Browse the repository at this point in the history
This change is identical to 86885b1 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:	86885b1
Sponsored by:	Axcient
  • Loading branch information
asomers committed Oct 6, 2023
1 parent a2b2896 commit 8399d76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/sys/fs/fusefs/mkdir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions tests/sys/fs/fusefs/symlink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/

extern "C" {
#include <semaphore.h>
#include <unistd.h>
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8399d76

Please sign in to comment.