diff options
author | John Levon <john.levon@nutanix.com> | 2021-03-25 16:54:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 16:54:53 +0000 |
commit | 710a0081aa206b319161fac9bbafce14f5045ee8 (patch) | |
tree | fbf91231220be75cd05279c0492f90cf1d5ab669 /lib/tran_sock.h | |
parent | 4f4c378978f0e22ec5b803496e2971adca6a3f8f (diff) | |
download | libvfio-user-710a0081aa206b319161fac9bbafce14f5045ee8.zip libvfio-user-710a0081aa206b319161fac9bbafce14f5045ee8.tar.gz libvfio-user-710a0081aa206b319161fac9bbafce14f5045ee8.tar.bz2 |
re-work unit test mocking (#400)
Instead of trying to use the linker's --wrap, which just led to more problems
when we want to call the real function, we'll add two defines, MOCK_DEFINE() and
MOCK_DECLARE(), that behave differently when building the unit tests, such that
all wrapped functions are picked up from test/mocks.c instead, regardless of
compilation unit.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/tran_sock.h')
-rw-r--r-- | lib/tran_sock.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/tran_sock.h b/lib/tran_sock.h index 754798f..eb7658b 100644 --- a/lib/tran_sock.h +++ b/lib/tran_sock.h @@ -60,9 +60,9 @@ tran_parse_version_json(const char *json_str, int *client_max_fdsp, * Send a message to the other end. The iovecs array should leave the first * entry empty, as it will be used for the header. */ -MOCKED(int, tran_sock_send_iovec, int sock, uint16_t msg_id, bool is_reply, - enum vfio_user_command cmd, struct iovec *iovecs, size_t nr_iovecs, - int *fds, int count, int err); +MOCK_DECLARE(int, tran_sock_send_iovec, int sock, uint16_t msg_id, + bool is_reply, enum vfio_user_command cmd, struct iovec *iovecs, + size_t nr_iovecs, int *fds, int count, int err); /* * Send a message to the other end with the given data. |