aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/fs/fusefs/mockfs.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sys/fs/fusefs/mockfs.cc')
-rw-r--r--tests/sys/fs/fusefs/mockfs.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc
index e8081dea9604..b6a32d9b60af 100644
--- a/tests/sys/fs/fusefs/mockfs.cc
+++ b/tests/sys/fs/fusefs/mockfs.cc
@@ -433,7 +433,8 @@ MockFS::MockFS(int max_read, int max_readahead, bool allow_other,
m_child_pid(-1),
m_maxwrite(MIN(max_write, max_max_write)),
m_nready(-1),
- m_quit(false)
+ m_quit(false),
+ m_expect_unmount(false)
{
struct sigaction sa;
struct iovec *iov = NULL;
@@ -827,10 +828,12 @@ void MockFS::loop() {
}
}
-int MockFS::notify_inval_entry(ino_t parent, const char *name, size_t namelen)
+int MockFS::notify_inval_entry(ino_t parent, const char *name, size_t namelen,
+ int expected_errno)
{
std::unique_ptr<mockfs_buf_out> out(new mockfs_buf_out);
+ out->expected_errno = expected_errno;
out->header.unique = 0; /* 0 means asynchronous notification */
out->header.error = FUSE_NOTIFY_INVAL_ENTRY;
out->body.inval_entry.parent = parent;
@@ -977,7 +980,7 @@ void MockFS::read_request(mockfs_buf_in &in, ssize_t &res) {
}
res = read(m_fuse_fd, &in, sizeof(in));
- if (res < 0 && !m_quit) {
+ if (res < 0 && errno != EBADF && !m_quit && !m_expect_unmount) {
m_quit = true;
FAIL() << "read: " << strerror(errno);
}