svn commit: r351039 - head/tests/sys/fs/fusefs

Alan Somers asomers at FreeBSD.org
Wed Aug 14 18:04:05 UTC 2019


Author: asomers
Date: Wed Aug 14 18:04:04 2019
New Revision: 351039
URL: https://svnweb.freebsd.org/changeset/base/351039

Log:
  fusefs: fix intermittency in the default_permissions.Unlink.ok test
  
  The test needs to expect a FUSE_FORGET operation. Most of the time the test
  would pass anyway, because by chance FUSE_FORGET would arrive after the
  unmount.
  
  MFC after:	2 weeks
  MFC-With:	350665
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/tests/sys/fs/fusefs/default_permissions.cc

Modified: head/tests/sys/fs/fusefs/default_permissions.cc
==============================================================================
--- head/tests/sys/fs/fusefs/default_permissions.cc	Wed Aug 14 17:36:26 2019	(r351038)
+++ head/tests/sys/fs/fusefs/default_permissions.cc	Wed Aug 14 18:04:04 2019	(r351039)
@@ -40,6 +40,7 @@ extern "C" {
 #include <sys/extattr.h>
 
 #include <fcntl.h>
+#include <semaphore.h>
 #include <unistd.h>
 }
 
@@ -1157,12 +1158,19 @@ TEST_F(Unlink, ok)
 	const char FULLPATH[] = "mountpoint/some_file.txt";
 	const char RELPATH[] = "some_file.txt";
 	uint64_t ino = 42;
+	sem_t sem;
 
+	ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno);
+
 	expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1);
 	expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
 	expect_unlink(FUSE_ROOT_ID, RELPATH, 0);
+	expect_forget(ino, 1, &sem);
 
 	ASSERT_EQ(0, unlink(FULLPATH)) << strerror(errno);
+
+	sem_wait(&sem);
+	sem_destroy(&sem);
 }
 
 /*


More information about the svn-src-all mailing list