2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2019 The FreeBSD Foundation
6 * This software was developed by BFF Storage Systems, LLC under sponsorship
7 * from the FreeBSD Foundation.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #include <sys/param.h>
36 #include <sys/mount.h>
37 #include <sys/select.h>
50 #include "mntopts.h" // for build_iovec
55 #include <gtest/gtest.h>
59 using namespace testing;
63 const char* opcode2opname(uint32_t opcode)
65 const int NUM_OPS = 39;
66 const char* table[NUM_OPS] = {
86 "Unknown (opcode 19)",
107 if (opcode >= NUM_OPS)
108 return ("Unknown (opcode > max)");
110 return (table[opcode]);
114 ReturnErrno(int error)
116 return([=](auto in, auto &out) {
117 std::unique_ptr<mockfs_buf_out> out0(new mockfs_buf_out);
118 out0->header.unique = in.header.unique;
119 out0->header.error = -error;
120 out0->header.len = sizeof(out0->header);
121 out.push_back(std::move(out0));
125 /* Helper function used for returning negative cache entries for LOOKUP */
127 ReturnNegativeCache(const struct timespec *entry_valid)
129 return([=](auto in, auto &out) {
130 /* nodeid means ENOENT and cache it */
131 std::unique_ptr<mockfs_buf_out> out0(new mockfs_buf_out);
132 out0->body.entry.nodeid = 0;
133 out0->header.unique = in.header.unique;
134 out0->header.error = 0;
135 out0->body.entry.entry_valid = entry_valid->tv_sec;
136 out0->body.entry.entry_valid_nsec = entry_valid->tv_nsec;
137 SET_OUT_HEADER_LEN(*out0, entry);
138 out.push_back(std::move(out0));
143 ReturnImmediate(std::function<void(const mockfs_buf_in& in,
144 struct mockfs_buf_out &out)> f)
146 return([=](auto& in, auto &out) {
147 std::unique_ptr<mockfs_buf_out> out0(new mockfs_buf_out);
148 out0->header.unique = in.header.unique;
150 out.push_back(std::move(out0));
154 void sigint_handler(int __unused sig) {
155 // Don't do anything except interrupt the daemon's read(2) call
158 void MockFS::debug_request(const mockfs_buf_in &in)
160 printf("%-11s ino=%2" PRIu64, opcode2opname(in.header.opcode),
163 printf(" uid=%5u gid=%5u pid=%5u unique=%" PRIu64 " len=%u",
164 in.header.uid, in.header.gid, in.header.pid,
165 in.header.unique, in.header.len);
167 switch (in.header.opcode) {
168 const char *name, *value;
171 printf(" mask=%#x", in.body.access.mask);
174 printf(" block=%" PRIx64 " blocksize=%#x",
175 in.body.bmap.block, in.body.bmap.blocksize);
178 if (m_kernel_minor_version >= 12)
179 name = (const char*)in.body.bytes +
180 sizeof(fuse_create_in);
182 name = (const char*)in.body.bytes +
183 sizeof(fuse_open_in);
184 printf(" flags=%#x name=%s",
185 in.body.open.flags, name);
188 printf(" fh=%#" PRIx64 " lock_owner=%" PRIu64,
190 in.body.flush.lock_owner);
193 printf(" nlookup=%" PRIu64, in.body.forget.nlookup);
196 printf(" flags=%#x", in.body.fsync.fsync_flags);
199 printf(" flags=%#x", in.body.fsyncdir.fsync_flags);
202 printf(" unique=%" PRIu64, in.body.interrupt.unique);
205 printf(" oldnodeid=%" PRIu64, in.body.link.oldnodeid);
208 printf(" %s", in.body.lookup);
211 name = (const char*)in.body.bytes +
212 sizeof(fuse_mkdir_in);
213 printf(" name=%s mode=%#o umask=%#o", name,
214 in.body.mkdir.mode, in.body.mkdir.umask);
217 if (m_kernel_minor_version >= 12)
218 name = (const char*)in.body.bytes +
219 sizeof(fuse_mknod_in);
221 name = (const char*)in.body.bytes +
222 FUSE_COMPAT_MKNOD_IN_SIZE;
223 printf(" mode=%#o rdev=%x umask=%#o name=%s",
224 in.body.mknod.mode, in.body.mknod.rdev,
225 in.body.mknod.umask, name);
228 printf(" flags=%#x", in.body.open.flags);
231 printf(" flags=%#x", in.body.opendir.flags);
234 printf(" offset=%" PRIu64 " size=%u",
238 printf(" flags=%#x", in.body.read.flags);
241 printf(" fh=%#" PRIx64 " offset=%" PRIu64 " size=%u",
242 in.body.readdir.fh, in.body.readdir.offset,
243 in.body.readdir.size);
246 printf(" fh=%#" PRIx64 " flags=%#x lock_owner=%" PRIu64,
248 in.body.release.flags,
249 in.body.release.lock_owner);
252 if (verbosity <= 1) {
253 printf(" valid=%#x", in.body.setattr.valid);
256 if (in.body.setattr.valid & FATTR_MODE)
257 printf(" mode=%#o", in.body.setattr.mode);
258 if (in.body.setattr.valid & FATTR_UID)
259 printf(" uid=%u", in.body.setattr.uid);
260 if (in.body.setattr.valid & FATTR_GID)
261 printf(" gid=%u", in.body.setattr.gid);
262 if (in.body.setattr.valid & FATTR_SIZE)
263 printf(" size=%" PRIu64, in.body.setattr.size);
264 if (in.body.setattr.valid & FATTR_ATIME)
265 printf(" atime=%" PRIu64 ".%u",
266 in.body.setattr.atime,
267 in.body.setattr.atimensec);
268 if (in.body.setattr.valid & FATTR_MTIME)
269 printf(" mtime=%" PRIu64 ".%u",
270 in.body.setattr.mtime,
271 in.body.setattr.mtimensec);
272 if (in.body.setattr.valid & FATTR_FH)
273 printf(" fh=%" PRIu64 "", in.body.setattr.fh);
276 printf(" fh=%#" PRIx64 " owner=%" PRIu64
278 in.body.setlk.fh, in.body.setlk.owner,
279 in.body.setlk.lk.type,
280 in.body.setlk.lk.pid);
281 if (verbosity >= 2) {
282 printf(" range=[%" PRIu64 "-%" PRIu64 "]",
283 in.body.setlk.lk.start,
284 in.body.setlk.lk.end);
289 * In theory neither the xattr name and value need be
290 * ASCII, but in this test suite they always are.
292 name = (const char*)in.body.bytes +
293 sizeof(fuse_setxattr_in);
294 value = name + strlen(name) + 1;
295 printf(" %s=%s", name, value);
298 printf(" fh=%#" PRIx64 " offset=%" PRIu64
299 " size=%u write_flags=%u",
301 in.body.write.offset, in.body.write.size,
302 in.body.write.write_flags);
304 printf(" flags=%#x", in.body.write.flags);
313 * Debug a FUSE response.
315 * This is mostly useful for asynchronous notifications, which don't correspond
318 void MockFS::debug_response(const mockfs_buf_out &out) {
324 switch (out.header.error) {
325 case FUSE_NOTIFY_INVAL_ENTRY:
326 name = (const char*)out.body.bytes +
327 sizeof(fuse_notify_inval_entry_out);
328 printf("<- INVAL_ENTRY parent=%" PRIu64 " %s\n",
329 out.body.inval_entry.parent, name);
331 case FUSE_NOTIFY_INVAL_INODE:
332 printf("<- INVAL_INODE ino=%" PRIu64 " off=%" PRIi64
333 " len=%" PRIi64 "\n",
334 out.body.inval_inode.ino,
335 out.body.inval_inode.off,
336 out.body.inval_inode.len);
338 case FUSE_NOTIFY_STORE:
339 printf("<- STORE ino=%" PRIu64 " off=%" PRIu64
340 " size=%" PRIu32 "\n",
341 out.body.store.nodeid,
342 out.body.store.offset,
343 out.body.store.size);
350 MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions,
351 bool push_symlinks_in, bool ro, enum poll_method pm, uint32_t flags,
352 uint32_t kernel_minor_version, uint32_t max_write, bool async,
353 bool noclusterr, unsigned time_gran, bool nointr)
356 struct iovec *iov = NULL;
359 const bool trueval = true;
362 m_kernel_minor_version = kernel_minor_version;
363 m_maxreadahead = max_readahead;
364 m_maxwrite = max_write;
367 m_time_gran = time_gran;
375 * Kyua sets pwd to a testcase-unique tempdir; no need to use
379 * googletest doesn't allow ASSERT_ in constructors, so we must throw
382 if (mkdir("mountpoint" , 0755) && errno != EEXIST)
383 throw(std::system_error(errno, std::system_category(),
384 "Couldn't make mountpoint directory"));
388 m_fuse_fd = open("/dev/fuse", O_CLOEXEC | O_RDWR);
391 m_fuse_fd = open("/dev/fuse", O_CLOEXEC | O_RDWR | O_NONBLOCK);
395 throw(std::system_error(errno, std::system_category(),
396 "Couldn't open /dev/fuse"));
401 build_iovec(&iov, &iovlen, "fstype", __DECONST(void *, "fusefs"), -1);
402 build_iovec(&iov, &iovlen, "fspath",
403 __DECONST(void *, "mountpoint"), -1);
404 build_iovec(&iov, &iovlen, "from", __DECONST(void *, "/dev/fuse"), -1);
405 sprintf(fdstr, "%d", m_fuse_fd);
406 build_iovec(&iov, &iovlen, "fd", fdstr, -1);
408 build_iovec(&iov, &iovlen, "allow_other",
409 __DECONST(void*, &trueval), sizeof(bool));
411 if (default_permissions) {
412 build_iovec(&iov, &iovlen, "default_permissions",
413 __DECONST(void*, &trueval), sizeof(bool));
415 if (push_symlinks_in) {
416 build_iovec(&iov, &iovlen, "push_symlinks_in",
417 __DECONST(void*, &trueval), sizeof(bool));
420 build_iovec(&iov, &iovlen, "ro",
421 __DECONST(void*, &trueval), sizeof(bool));
424 build_iovec(&iov, &iovlen, "async", __DECONST(void*, &trueval),
428 build_iovec(&iov, &iovlen, "noclusterr",
429 __DECONST(void*, &trueval), sizeof(bool));
432 build_iovec(&iov, &iovlen, "nointr",
433 __DECONST(void*, &trueval), sizeof(bool));
435 build_iovec(&iov, &iovlen, "intr",
436 __DECONST(void*, &trueval), sizeof(bool));
438 if (nmount(iov, iovlen, 0))
439 throw(std::system_error(errno, std::system_category(),
440 "Couldn't mount filesystem"));
442 // Setup default handler
443 ON_CALL(*this, process(_, _))
444 .WillByDefault(Invoke(this, &MockFS::process_default));
447 bzero(&sa, sizeof(sa));
448 sa.sa_handler = sigint_handler;
449 sa.sa_flags = 0; /* Don't set SA_RESTART! */
450 if (0 != sigaction(SIGUSR1, &sa, NULL))
451 throw(std::system_error(errno, std::system_category(),
452 "Couldn't handle SIGUSR1"));
453 if (pthread_create(&m_daemon_id, NULL, service, (void*)this))
454 throw(std::system_error(errno, std::system_category(),
455 "Couldn't Couldn't start fuse thread"));
460 if (m_daemon_id != NULL) {
461 pthread_join(m_daemon_id, NULL);
464 ::unmount("mountpoint", MNT_FORCE);
470 void MockFS::audit_request(const mockfs_buf_in &in) {
471 uint32_t inlen = in.header.len;
472 size_t fih = sizeof(in.header);
473 switch (in.header.opcode) {
478 ASSERT_GT(inlen, fih) << "Missing request filename";
481 ASSERT_EQ(inlen, fih + sizeof(in.body.forget));
484 ASSERT_EQ(inlen, fih + sizeof(in.body.getattr));
487 ASSERT_EQ(inlen, fih + sizeof(in.body.setattr));
490 ASSERT_EQ(inlen, fih) << "Unexpected request body";
495 if (m_kernel_minor_version >= 12)
496 s = sizeof(in.body.mknod);
498 s = FUSE_COMPAT_MKNOD_IN_SIZE;
499 ASSERT_GE(inlen, fih + s) << "Missing request body";
500 ASSERT_GT(inlen, fih + s) << "Missing request filename";
504 ASSERT_GE(inlen, fih + sizeof(in.body.mkdir)) <<
505 "Missing request body";
506 ASSERT_GT(inlen, fih + sizeof(in.body.mkdir)) <<
507 "Missing request filename";
510 ASSERT_GE(inlen, fih + sizeof(in.body.rename)) <<
511 "Missing request body";
512 ASSERT_GT(inlen, fih + sizeof(in.body.rename)) <<
513 "Missing request filename";
516 ASSERT_GE(inlen, fih + sizeof(in.body.link)) <<
517 "Missing request body";
518 ASSERT_GT(inlen, fih + sizeof(in.body.link)) <<
519 "Missing request filename";
522 ASSERT_EQ(inlen, fih + sizeof(in.body.open));
525 ASSERT_EQ(inlen, fih + sizeof(in.body.read));
531 if (m_kernel_minor_version >= 9)
532 s = sizeof(in.body.write);
534 s = FUSE_COMPAT_WRITE_IN_SIZE;
535 ASSERT_GE(inlen, fih + s) << "Missing request body";
536 // I suppose a 0-byte write should be allowed
541 ASSERT_EQ(inlen, fih);
544 ASSERT_EQ(inlen, fih + sizeof(in.body.release));
548 ASSERT_EQ(inlen, fih + sizeof(in.body.fsync));
551 ASSERT_GE(inlen, fih + sizeof(in.body.setxattr)) <<
552 "Missing request body";
553 ASSERT_GT(inlen, fih + sizeof(in.body.setxattr)) <<
554 "Missing request attribute name";
557 ASSERT_GE(inlen, fih + sizeof(in.body.getxattr)) <<
558 "Missing request body";
559 ASSERT_GT(inlen, fih + sizeof(in.body.getxattr)) <<
560 "Missing request attribute name";
563 ASSERT_EQ(inlen, fih + sizeof(in.body.listxattr));
565 case FUSE_REMOVEXATTR:
566 ASSERT_GT(inlen, fih) << "Missing request attribute name";
569 ASSERT_EQ(inlen, fih + sizeof(in.body.flush));
572 ASSERT_EQ(inlen, fih + sizeof(in.body.init));
575 ASSERT_EQ(inlen, fih + sizeof(in.body.opendir));
578 ASSERT_EQ(inlen, fih + sizeof(in.body.readdir));
580 case FUSE_RELEASEDIR:
581 ASSERT_EQ(inlen, fih + sizeof(in.body.releasedir));
584 ASSERT_EQ(inlen, fih + sizeof(in.body.getlk));
588 ASSERT_EQ(inlen, fih + sizeof(in.body.setlk));
591 ASSERT_EQ(inlen, fih + sizeof(in.body.access));
594 ASSERT_GE(inlen, fih + sizeof(in.body.create)) <<
595 "Missing request body";
596 ASSERT_GT(inlen, fih + sizeof(in.body.create)) <<
597 "Missing request filename";
600 ASSERT_EQ(inlen, fih + sizeof(in.body.interrupt));
603 ASSERT_EQ(inlen, fih + sizeof(in.body.bmap));
605 case FUSE_NOTIFY_REPLY:
606 case FUSE_BATCH_FORGET:
610 case FUSE_READDIRPLUS:
611 FAIL() << "Unsupported opcode?";
613 FAIL() << "Unknown opcode " << in.header.opcode;
617 void MockFS::init(uint32_t flags) {
618 std::unique_ptr<mockfs_buf_in> in(new mockfs_buf_in);
619 std::unique_ptr<mockfs_buf_out> out(new mockfs_buf_out);
622 ASSERT_EQ(FUSE_INIT, in->header.opcode);
624 out->header.unique = in->header.unique;
625 out->header.error = 0;
626 out->body.init.major = FUSE_KERNEL_VERSION;
627 out->body.init.minor = m_kernel_minor_version;;
628 out->body.init.flags = in->body.init.flags & flags;
629 out->body.init.max_write = m_maxwrite;
630 out->body.init.max_readahead = m_maxreadahead;
632 if (m_kernel_minor_version < 23) {
633 SET_OUT_HEADER_LEN(*out, init_7_22);
635 out->body.init.time_gran = m_time_gran;
636 SET_OUT_HEADER_LEN(*out, init);
639 write(m_fuse_fd, out.get(), out->header.len);
642 void MockFS::kill_daemon() {
644 if (m_daemon_id != NULL)
645 pthread_kill(m_daemon_id, SIGUSR1);
646 // Closing the /dev/fuse file descriptor first allows unmount to
647 // succeed even if the daemon doesn't correctly respond to commands
648 // during the unmount sequence.
653 void MockFS::loop() {
654 std::vector<std::unique_ptr<mockfs_buf_out>> out;
656 std::unique_ptr<mockfs_buf_in> in(new mockfs_buf_in);
657 ASSERT_TRUE(in != NULL);
659 bzero(in.get(), sizeof(*in));
666 if (pid_ok((pid_t)in->header.pid)) {
670 * Reject any requests from unknown processes. Because
671 * we actually do mount a filesystem, plenty of
672 * unrelated system daemons may try to access it.
675 printf("\tREJECTED (wrong pid %d)\n",
677 process_default(*in, out);
685 int MockFS::notify_inval_entry(ino_t parent, const char *name, size_t namelen)
687 std::unique_ptr<mockfs_buf_out> out(new mockfs_buf_out);
689 out->header.unique = 0; /* 0 means asynchronous notification */
690 out->header.error = FUSE_NOTIFY_INVAL_ENTRY;
691 out->body.inval_entry.parent = parent;
692 out->body.inval_entry.namelen = namelen;
693 strlcpy((char*)&out->body.bytes + sizeof(out->body.inval_entry),
694 name, sizeof(out->body.bytes) - sizeof(out->body.inval_entry));
695 out->header.len = sizeof(out->header) + sizeof(out->body.inval_entry) +
697 debug_response(*out);
698 write_response(*out);
702 int MockFS::notify_inval_inode(ino_t ino, off_t off, ssize_t len)
704 std::unique_ptr<mockfs_buf_out> out(new mockfs_buf_out);
706 out->header.unique = 0; /* 0 means asynchronous notification */
707 out->header.error = FUSE_NOTIFY_INVAL_INODE;
708 out->body.inval_inode.ino = ino;
709 out->body.inval_inode.off = off;
710 out->body.inval_inode.len = len;
711 out->header.len = sizeof(out->header) + sizeof(out->body.inval_inode);
712 debug_response(*out);
713 write_response(*out);
717 int MockFS::notify_store(ino_t ino, off_t off, const void* data, ssize_t size)
719 std::unique_ptr<mockfs_buf_out> out(new mockfs_buf_out);
721 out->header.unique = 0; /* 0 means asynchronous notification */
722 out->header.error = FUSE_NOTIFY_STORE;
723 out->body.store.nodeid = ino;
724 out->body.store.offset = off;
725 out->body.store.size = size;
726 bcopy(data, (char*)&out->body.bytes + sizeof(out->body.store), size);
727 out->header.len = sizeof(out->header) + sizeof(out->body.store) + size;
728 debug_response(*out);
729 write_response(*out);
733 bool MockFS::pid_ok(pid_t pid) {
736 } else if (pid == m_child_pid) {
739 struct kinfo_proc *ki;
742 ki = kinfo_getproc(pid);
746 * Allow access by the aio daemon processes so that our tests
747 * can use aio functions
749 if (0 == strncmp("aiod", ki->ki_comm, 4))
756 void MockFS::process_default(const mockfs_buf_in& in,
757 std::vector<std::unique_ptr<mockfs_buf_out>> &out)
759 std::unique_ptr<mockfs_buf_out> out0(new mockfs_buf_out);
760 out0->header.unique = in.header.unique;
761 out0->header.error = -EOPNOTSUPP;
762 out0->header.len = sizeof(out0->header);
763 out.push_back(std::move(out0));
766 void MockFS::read_request(mockfs_buf_in &in) {
771 struct kevent changes[1];
772 struct kevent events[1];
773 struct timespec timeout_ts;
774 struct timeval timeout_tv;
775 const int timeout_ms = 999;
776 int timeout_int, nfds;
782 timeout_ts.tv_sec = 0;
783 timeout_ts.tv_nsec = timeout_ms * 1'000'000;
784 while (nready == 0) {
785 EV_SET(&changes[0], m_fuse_fd, EVFILT_READ, EV_ADD, 0,
787 nready = kevent(m_kq, &changes[0], 1, &events[0], 1,
792 ASSERT_LE(0, nready) << strerror(errno);
793 ASSERT_EQ(events[0].ident, (uintptr_t)m_fuse_fd);
794 if (events[0].flags & EV_ERROR)
795 FAIL() << strerror(events[0].data);
796 else if (events[0].flags & EV_EOF)
797 FAIL() << strerror(events[0].fflags);
798 m_nready = events[0].data;
801 timeout_int = timeout_ms;
802 fds[0].fd = m_fuse_fd;
803 fds[0].events = POLLIN;
804 while (nready == 0) {
805 nready = poll(fds, 1, timeout_int);
809 ASSERT_LE(0, nready) << strerror(errno);
810 ASSERT_TRUE(fds[0].revents & POLLIN);
813 timeout_tv.tv_sec = 0;
814 timeout_tv.tv_usec = timeout_ms * 1'000;
815 nfds = m_fuse_fd + 1;
816 while (nready == 0) {
818 FD_SET(m_fuse_fd, &readfds);
819 nready = select(nfds, &readfds, NULL, NULL,
824 ASSERT_LE(0, nready) << strerror(errno);
825 ASSERT_TRUE(FD_ISSET(m_fuse_fd, &readfds));
828 FAIL() << "not yet implemented";
830 res = read(m_fuse_fd, &in, sizeof(in));
832 if (res < 0 && !m_quit) {
833 FAIL() << "read: " << strerror(errno);
836 ASSERT_TRUE(res >= static_cast<ssize_t>(sizeof(in.header)) || m_quit);
838 * Inconsistently, fuse_in_header.len is the size of the entire
839 * request,including header, even though fuse_out_header.len excludes
840 * the size of the header.
842 ASSERT_TRUE(res == static_cast<ssize_t>(in.header.len) || m_quit);
845 void MockFS::write_response(const mockfs_buf_out &out) {
853 case KQ: /* EVFILT_WRITE is not supported */
856 fds[0].fd = m_fuse_fd;
857 fds[0].events = POLLOUT;
858 nready = poll(fds, 1, INFTIM);
859 ASSERT_LE(0, nready) << strerror(errno);
860 ASSERT_EQ(1, nready) << "NULL timeout expired?";
861 ASSERT_TRUE(fds[0].revents & POLLOUT);
865 FD_SET(m_fuse_fd, &writefds);
866 nfds = m_fuse_fd + 1;
867 nready = select(nfds, NULL, &writefds, NULL, NULL);
868 ASSERT_LE(0, nready) << strerror(errno);
869 ASSERT_EQ(1, nready) << "NULL timeout expired?";
870 ASSERT_TRUE(FD_ISSET(m_fuse_fd, &writefds));
873 FAIL() << "not yet implemented";
875 r = write(m_fuse_fd, &out, out.header.len);
876 ASSERT_TRUE(r > 0 || errno == EAGAIN) << strerror(errno);
879 void* MockFS::service(void *pthr_data) {
880 MockFS *mock_fs = (MockFS*)pthr_data;
887 void MockFS::unmount() {
888 ::unmount("mountpoint", 0);