aboutsummaryrefslogtreecommitdiff
path: root/test/mocks.c
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-12-15 14:56:32 +0000
committerGitHub <noreply@github.com>2020-12-15 14:56:32 +0000
commit8694149b351e3e125aa8f1740f8d5925e7ec112c (patch)
tree55fae56b5280eddd8c5c23d8c846fe36425e7ba2 /test/mocks.c
parent3148a598f4ac0711d2f46ef9186e51a4779f1bf1 (diff)
downloadlibvfio-user-8694149b351e3e125aa8f1740f8d5925e7ec112c.zip
libvfio-user-8694149b351e3e125aa8f1740f8d5925e7ec112c.tar.gz
libvfio-user-8694149b351e3e125aa8f1740f8d5925e7ec112c.tar.bz2
send file descriptors for sparse areas in get region info (#201)
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test/mocks.c')
-rw-r--r--test/mocks.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/mocks.c b/test/mocks.c
index 204ae75..faa8ed4 100644
--- a/test/mocks.c
+++ b/test/mocks.c
@@ -100,8 +100,8 @@ __wrap_get_next_command(vfu_ctx_t *vfu_ctx, struct vfio_user_header *hdr,
int
__wrap_exec_command(vfu_ctx_t *vfu_ctx, struct vfio_user_header *hdr,
- size_t size, int *fds, size_t *nr_fds,
- struct iovec *_iovecs, struct iovec **iovecs,
+ size_t size, int *fds, size_t *nr_fds, size_t **fds_out,
+ int *nr_fds_out, struct iovec *_iovecs, struct iovec **iovecs,
size_t *nr_iovecs, bool *free_iovec_data)
{
check_expected(vfu_ctx);
@@ -109,6 +109,8 @@ __wrap_exec_command(vfu_ctx_t *vfu_ctx, struct vfio_user_header *hdr,
check_expected(size);
check_expected(fds);
check_expected(nr_fds);
+ check_expected(fds_out);
+ check_expected(nr_fds_out);
check_expected(_iovecs);
check_expected(iovecs);
check_expected(nr_iovecs);
@@ -144,7 +146,10 @@ __wrap_vfu_send_iovec(int sock, uint16_t msg_id, bool is_reply,
void
__wrap_free(void *ptr)
{
- assert(false);
+ if (!is_patched(free)) {
+ __real_free(ptr);
+ return;
+ }
check_expected(ptr);
}