svn commit: r347432 - projects/fuse2/tests/sys/fs/fusefs

Alan Somers asomers at FreeBSD.org
Fri May 10 15:55:31 UTC 2019


Author: asomers
Date: Fri May 10 15:55:30 2019
New Revision: 347432
URL: https://svnweb.freebsd.org/changeset/base/347432

Log:
  fusefs: fix intermittency in the Interrupt.already_complete test
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  projects/fuse2/tests/sys/fs/fusefs/interrupt.cc

Modified: projects/fuse2/tests/sys/fs/fusefs/interrupt.cc
==============================================================================
--- projects/fuse2/tests/sys/fs/fusefs/interrupt.cc	Fri May 10 15:02:29 2019	(r347431)
+++ projects/fuse2/tests/sys/fs/fusefs/interrupt.cc	Fri May 10 15:55:30 2019	(r347432)
@@ -217,10 +217,13 @@ TEST_F(Interrupt, already_complete)
 	uint64_t ino = 42;
 	pthread_t self;
 	uint64_t mkdir_unique = 0;
+	Sequence seq;
 
 	self = pthread_self();
 
-	EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
+	EXPECT_LOOKUP(1, RELDIRPATH0)
+	.InSequence(seq)
+	.WillOnce(Invoke(ReturnErrno(ENOENT)));
 	expect_mkdir(&mkdir_unique);
 	EXPECT_CALL(*m_mock, process(
 		ResultOf([&](auto in) {
@@ -244,9 +247,22 @@ TEST_F(Interrupt, already_complete)
 		out1->header.len = sizeof(out1->header);
 		out.push_back(out1);
 	}));
+	EXPECT_LOOKUP(1, RELDIRPATH0)
+	.InSequence(seq)
+	.WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto out) {
+		SET_OUT_HEADER_LEN(out, entry);
+		out->body.entry.attr.mode = S_IFDIR | MODE;
+		out->body.entry.nodeid = ino;
+		out->body.entry.attr.nlink = 2;
+	})));
 
 	setup_interruptor(self);
 	EXPECT_EQ(0, mkdir(FULLDIRPATH0, MODE)) << strerror(errno);
+	/* 
+	 * The final syscall simply ensures that the test's main thread doesn't
+	 * end before the daemon finishes responding to the FUSE_INTERRUPT.
+	 */
+	EXPECT_EQ(0, access(FULLDIRPATH0, F_OK)) << strerror(errno);
 }
 
 /*
@@ -278,7 +294,7 @@ TEST_F(Interrupt, enosys)
 		_)
 	).InSequence(seq)
 	.WillOnce(Invoke([&](auto in, auto &out) {
-		// reject FUSE_INTERRUPT and respond to the FUSE_WRITE
+		// reject FUSE_INTERRUPT and respond to the FUSE_MKDIR
 		auto out0 = new mockfs_buf_out;
 		auto out1 = new mockfs_buf_out;
 


More information about the svn-src-projects mailing list