Commit f25bef2766 for openssl.org
commit f25bef2766e2652d92542174ed6d6b5a28f2fbcc
Author: Richard Levitte <levitte@openssl.foundation>
Date: Tue Nov 17 09:11:32 2026 +0100
test/unit: migrate to the cmocka 2.x expectation API
cmocka 2.x deprecates expect_value() and check_expected() in favour
of explicitly signed or unsigned variants, so building
with --strict-warnings enable-unit-tests fails against cmocka 2.0.2
(shipped by Ubuntu 26.04) with -Werror=deprecated-declarations.
The old macros compare as uintmax_t, which makes the unsigned
variants the semantics-preserving replacement. Pointer-valued
expectations go through the uintmax cast helpers, as the 2.x typed
macros no longer accept pointers.
cmocka 1.x lacks the new names, so a compatibility header maps them
back onto the old ones; it is the single revert point once cmocka
1.x no longer needs to be supported.
Assisted-by: Pi:moonshotai/kimi-k3
Signed-off-by: Richard Levitte <levitte@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Merge-date: Wed Nov 18 06:24:06 2026
Merged-from: https://github.com/openssl/openssl/pull/33789
diff --git a/test/unit/cmocka_compat.h b/test/unit/cmocka_compat.h
new file mode 100644
index 0000000000..2a3a56cec5
--- /dev/null
+++ b/test/unit/cmocka_compat.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2026 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef OSSL_TEST_UNIT_CMOCKA_COMPAT_H
+#define OSSL_TEST_UNIT_CMOCKA_COMPAT_H
+
+#include <cmocka.h>
+
+/* cmocka 2.x ships the version macros in a separate header; 1.x has none */
+#if defined(__has_include)
+#if __has_include(<cmocka_version.h>)
+#include <cmocka_version.h>
+#endif
+#endif
+
+/*
+ * cmocka 2.x deprecated expect_value() and check_expected() in favour of
+ * explicitly signed or unsigned variants. The unsigned variants keep
+ * the old semantics exactly (the old macros cast to uintmax_t), so the
+ * test sources use them; when building against cmocka 1.x, which lacks
+ * them, map them back onto the old names. This header is the single
+ * revert point once cmocka 1.x no longer needs supporting.
+ */
+#if !defined(expect_uint_value)
+#define expect_uint_value(function, parameter, value) \
+ expect_value(function, parameter, value)
+#define expect_int_value(function, parameter, value) \
+ expect_value(function, parameter, value)
+#endif
+#if !defined(check_expected_uint)
+#define check_expected_uint(parameter) check_expected(parameter)
+#define check_expected_int(parameter) check_expected(parameter)
+#endif
+
+/* cmocka 2.x renamed this cast helper */
+#if !defined(cast_ptr_to_uintmax_type)
+#define cast_ptr_to_uintmax_type(value) \
+ ((uintmax_t)(uintptr_t)(value))
+#endif
+
+/*
+ * Checking a function pointer parameter: with cmocka 2.x,
+ * check_expected_ptr() trips -pedantic (it stores into a void * field)
+ * and the uint variants reject pointers, so neither accepts a function
+ * pointer. This checks by uintmax_t representation on both versions;
+ * the parameter must appear bare, as its name is stringified for
+ * cmocka's parameter lookup.
+ */
+#if defined(CMOCKA_VERSION_MAJOR) && CMOCKA_VERSION_MAJOR >= 2
+#define check_expected_fnptr(parameter) \
+ _check_expected(__func__, #parameter, __FILE__, __LINE__, \
+ (CMockaValueData) { .uint_val = (uintmax_t)(parameter) })
+#else
+#define check_expected_fnptr(parameter) \
+ _check_expected(__func__, #parameter, __FILE__, __LINE__, \
+ (uintmax_t)(parameter))
+#endif
+
+#endif /* OSSL_TEST_UNIT_CMOCKA_COMPAT_H */
diff --git a/test/unit/crypto/bio/test_bf_buff.c b/test/unit/crypto/bio/test_bf_buff.c
index 963a419555..bba7171d9d 100644
--- a/test/unit/crypto/bio/test_bf_buff.c
+++ b/test/unit/crypto/bio/test_bf_buff.c
@@ -18,7 +18,7 @@
#include <setjmp.h>
#include <string.h>
#include <limits.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#ifndef OPENSSL_NO_SOCK
#include <netinet/in.h>
#endif
@@ -67,7 +67,7 @@ static void expect_BIO_ADDR_new(int ok)
static void expect_BIO_ADDR_copy(const BIO_ADDR *src, int rc)
{
expect_function_call(__wrap_BIO_ADDR_copy);
- expect_value(__wrap_BIO_ADDR_copy, src, src);
+ expect_uint_value(__wrap_BIO_ADDR_copy, src, cast_ptr_to_uintmax_type(src));
will_return(__wrap_BIO_ADDR_copy, rc);
}
@@ -83,8 +83,8 @@ static int fake_next_write(BIO *b, const char *data, size_t datal,
int rc;
function_called();
- check_expected(datal);
- check_expected(data);
+ check_expected_uint(datal);
+ check_expected_ptr(data);
BIO_clear_retry_flags(b);
rc = mock_type(int);
if (rc < 0 && mock_type(int))
@@ -102,7 +102,7 @@ static int fake_next_read(BIO *b, char *data, size_t datal, size_t *readbytes)
int rc;
function_called();
- check_expected(datal);
+ check_expected_uint(datal);
BIO_clear_retry_flags(b);
*readbytes = 0;
rc = mock_type(int);
@@ -127,7 +127,7 @@ static long fake_next_ctrl(BIO *b, int cmd, long num, void *ptr)
if (cmd == BIO_CTRL_EOF)
return fake_next_eof;
function_called();
- check_expected(cmd);
+ check_expected_int(cmd);
return mock_type(long);
}
@@ -135,8 +135,9 @@ static long fake_next_cb_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
{
(void)b;
function_called();
- check_expected(cmd);
- check_expected_ptr(fp);
+ check_expected_int(cmd);
+ /* fp is a function pointer; check_expected_ptr() trips -pedantic */
+ check_expected_fnptr(fp);
return mock_type(long);
}
@@ -152,10 +153,10 @@ static int fake_next_sendmmsg(BIO *b, BIO_MSG *msg, size_t stride,
(void)stride;
(void)flags;
function_called();
- check_expected(num_msg);
- check_expected(data_len);
- check_expected(data);
- check_expected(peer_family);
+ check_expected_uint(num_msg);
+ check_expected_uint(data_len);
+ check_expected_ptr(data);
+ check_expected_int(peer_family);
*msgs_processed = mock_type(size_t);
return mock_type(int);
}
@@ -165,7 +166,7 @@ static void expect_next_write(const void *content, size_t len, int rc,
int retry)
{
expect_function_call(fake_next_write);
- expect_value(fake_next_write, datal, len);
+ expect_uint_value(fake_next_write, datal, len);
if (content != NULL)
expect_memory(fake_next_write, data, content, len);
else
@@ -179,7 +180,7 @@ static void expect_next_read(size_t len, const void *payload, int rc,
int retry)
{
expect_function_call(fake_next_read);
- expect_value(fake_next_read, datal, len);
+ expect_uint_value(fake_next_read, datal, len);
will_return(fake_next_read, rc);
if (rc > 0)
will_return(fake_next_read, payload);
@@ -190,15 +191,15 @@ static void expect_next_read(size_t len, const void *payload, int rc,
static void expect_next_ctrl(int cmd, long rc)
{
expect_function_call(fake_next_ctrl);
- expect_value(fake_next_ctrl, cmd, cmd);
+ expect_int_value(fake_next_ctrl, cmd, cmd);
will_return(fake_next_ctrl, rc);
}
static void expect_next_cb_ctrl(int cmd, BIO_info_cb *fp, long rc)
{
expect_function_call(fake_next_cb_ctrl);
- expect_value(fake_next_cb_ctrl, cmd, cmd);
- expect_value(fake_next_cb_ctrl, fp, fp);
+ expect_int_value(fake_next_cb_ctrl, cmd, cmd);
+ expect_uint_value(fake_next_cb_ctrl, fp, cast_ptr_to_uintmax_type(fp));
will_return(fake_next_cb_ctrl, rc);
}
@@ -207,10 +208,10 @@ static void expect_next_sendmmsg(const void *content, size_t len, int family,
size_t processed, int rc)
{
expect_function_call(fake_next_sendmmsg);
- expect_value(fake_next_sendmmsg, num_msg, 1);
- expect_value(fake_next_sendmmsg, data_len, len);
+ expect_uint_value(fake_next_sendmmsg, num_msg, 1);
+ expect_uint_value(fake_next_sendmmsg, data_len, len);
expect_memory(fake_next_sendmmsg, data, content, len);
- expect_value(fake_next_sendmmsg, peer_family, family);
+ expect_int_value(fake_next_sendmmsg, peer_family, family);
will_return(fake_next_sendmmsg, processed);
will_return(fake_next_sendmmsg, rc);
}
diff --git a/test/unit/crypto/bio/test_bio_addr.c b/test/unit/crypto/bio/test_bio_addr.c
index 334cac8fa9..9f501b99ca 100644
--- a/test/unit/crypto/bio/test_bio_addr.c
+++ b/test/unit/crypto/bio/test_bio_addr.c
@@ -26,7 +26,7 @@ int main(void)
#include <stddef.h>
#include <setjmp.h>
#include <string.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include "bio_local.h"
@@ -57,8 +57,8 @@ int __wrap_getnameinfo(const struct sockaddr *sa, socklen_t salen,
function_called();
check_expected_ptr(sa);
- check_expected(salen);
- check_expected(flags);
+ check_expected_uint(salen);
+ check_expected_int(flags);
rc = mock_type(int);
if (rc == 0) {
if (host != NULL)
@@ -90,9 +90,9 @@ static void expect_getnameinfo(const struct sockaddr *sa, socklen_t salen,
const char *host_out, const char *serv_out)
{
expect_function_call(__wrap_getnameinfo);
- expect_value(__wrap_getnameinfo, sa, sa);
- expect_value(__wrap_getnameinfo, salen, salen);
- expect_value(__wrap_getnameinfo, flags, flags);
+ expect_uint_value(__wrap_getnameinfo, sa, cast_ptr_to_uintmax_type(sa));
+ expect_uint_value(__wrap_getnameinfo, salen, salen);
+ expect_int_value(__wrap_getnameinfo, flags, flags);
will_return(__wrap_getnameinfo, rc);
if (rc == 0) {
will_return(__wrap_getnameinfo, host_out);
@@ -103,7 +103,7 @@ static void expect_getnameinfo(const struct sockaddr *sa, socklen_t salen,
static void expect_freeaddrinfo(const struct addrinfo *res)
{
expect_function_call(__wrap_freeaddrinfo);
- expect_value(__wrap_freeaddrinfo, res, res);
+ expect_uint_value(__wrap_freeaddrinfo, res, cast_ptr_to_uintmax_type(res));
}
#endif /* AI_PASSIVE */
diff --git a/test/unit/crypto/bio/test_bio_sock.c b/test/unit/crypto/bio/test_bio_sock.c
index b41f9ed011..7d36b4f421 100644
--- a/test/unit/crypto/bio/test_bio_sock.c
+++ b/test/unit/crypto/bio/test_bio_sock.c
@@ -14,7 +14,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include "bio_local.h"
#include <openssl/bio.h>
@@ -58,9 +58,9 @@ int __wrap_getsockopt(int fd, int level, int optname, void *optval,
int rc;
function_called();
- check_expected(fd);
- check_expected(level);
- check_expected(optname);
+ check_expected_int(fd);
+ check_expected_int(level);
+ check_expected_int(optname);
(void)optlen;
rc = mock_type(int);
if (rc == 0) {
@@ -78,10 +78,10 @@ int __wrap_setsockopt(int fd, int level, int optname, const void *optval,
int on = (optval != NULL) ? *(const int *)optval : 0;
function_called();
- check_expected(fd);
- check_expected(level);
- check_expected(optname);
- check_expected(on);
+ check_expected_int(fd);
+ check_expected_int(level);
+ check_expected_int(optname);
+ check_expected_int(on);
(void)optlen;
return mock_type(int);
}
@@ -91,7 +91,7 @@ int __wrap_getsockname(int fd, struct sockaddr *addr, socklen_t *slen)
int rc;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
(void)addr;
rc = mock_type(int);
if (rc == 0 && slen != NULL)
@@ -102,8 +102,8 @@ int __wrap_getsockname(int fd, struct sockaddr *addr, socklen_t *slen)
int __wrap_ioctl(int fd, unsigned long request, void *arg)
{
function_called();
- check_expected(fd);
- check_expected(request);
+ check_expected_int(fd);
+ check_expected_uint(request);
(void)arg;
return mock_type(int);
}
@@ -114,8 +114,8 @@ int __wrap_poll(struct pollfd *fds, nfds_t nfds, int timeout)
int events = fds[0].events;
function_called();
- check_expected(pfd);
- check_expected(events);
+ check_expected_int(pfd);
+ check_expected_int(events);
(void)nfds;
(void)timeout;
return mock_type(int);
@@ -135,9 +135,9 @@ int __wrap_BIO_lookup(const char *host, const char *service,
int rc;
function_called();
- check_expected(family);
- check_expected(socktype);
- check_expected(lookup_type);
+ check_expected_int(family);
+ check_expected_int(socktype);
+ check_expected_int(lookup_type);
(void)host;
(void)service;
rc = mock_type(int);
@@ -153,9 +153,9 @@ int __wrap_BIO_lookup(const char *host, const char *service,
int __wrap_BIO_socket(int domain, int socktype, int protocol, int options)
{
function_called();
- check_expected(domain);
- check_expected(socktype);
- check_expected(protocol);
+ check_expected_int(domain);
+ check_expected_int(socktype);
+ check_expected_int(protocol);
(void)options;
return mock_type(int);
}
@@ -163,8 +163,8 @@ int __wrap_BIO_socket(int domain, int socktype, int protocol, int options)
int __wrap_BIO_listen(int sock, const BIO_ADDR *ba, int options)
{
function_called();
- check_expected(sock);
- check_expected(options);
+ check_expected_int(sock);
+ check_expected_int(options);
(void)ba;
return mock_type(int);
}
@@ -172,7 +172,7 @@ int __wrap_BIO_listen(int sock, const BIO_ADDR *ba, int options)
int __wrap_BIO_closesocket(int sock)
{
function_called();
- check_expected(sock);
+ check_expected_int(sock);
return mock_type(int);
}
@@ -185,8 +185,8 @@ void __wrap_BIO_ADDRINFO_free(BIO_ADDRINFO *bai)
int __wrap_BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options)
{
function_called();
- check_expected(accept_sock);
- check_expected(options);
+ check_expected_int(accept_sock);
+ check_expected_int(options);
(void)addr;
return mock_type(int);
}
@@ -194,14 +194,14 @@ int __wrap_BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options)
int __wrap_BIO_sock_should_retry(int i)
{
function_called();
- check_expected(i);
+ check_expected_int(i);
return mock_type(int);
}
char *__wrap_BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric)
{
function_called();
- check_expected(numeric);
+ check_expected_int(numeric);
(void)ap;
return mock_ptr_type(char *);
}
@@ -209,7 +209,7 @@ char *__wrap_BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric)
char *__wrap_BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric)
{
function_called();
- check_expected(numeric);
+ check_expected_int(numeric);
(void)ap;
return mock_ptr_type(char *);
}
@@ -219,9 +219,9 @@ char *__wrap_BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric)
static void expect_getsockopt(int fd, int rc, int value)
{
expect_function_call(__wrap_getsockopt);
- expect_value(__wrap_getsockopt, fd, fd);
- expect_value(__wrap_getsockopt, level, SOL_SOCKET);
- expect_value(__wrap_getsockopt, optname, SO_ERROR);
+ expect_int_value(__wrap_getsockopt, fd, fd);
+ expect_int_value(__wrap_getsockopt, level, SOL_SOCKET);
+ expect_int_value(__wrap_getsockopt, optname, SO_ERROR);
will_return(__wrap_getsockopt, rc);
will_return(__wrap_getsockopt, value);
}
@@ -230,10 +230,10 @@ static void expect_getsockopt(int fd, int rc, int value)
static void expect_setsockopt(int fd, int on, int rc)
{
expect_function_call(__wrap_setsockopt);
- expect_value(__wrap_setsockopt, fd, fd);
- expect_value(__wrap_setsockopt, level, TEST_TCP_LEVEL);
- expect_value(__wrap_setsockopt, optname, TCP_NODELAY);
- expect_value(__wrap_setsockopt, on, on);
+ expect_int_value(__wrap_setsockopt, fd, fd);
+ expect_int_value(__wrap_setsockopt, level, TEST_TCP_LEVEL);
+ expect_int_value(__wrap_setsockopt, optname, TCP_NODELAY);
+ expect_int_value(__wrap_setsockopt, on, on);
will_return(__wrap_setsockopt, rc);
}
#endif
@@ -241,7 +241,7 @@ static void expect_setsockopt(int fd, int on, int rc)
static void expect_getsockname(int fd, int rc, socklen_t outlen)
{
expect_function_call(__wrap_getsockname);
- expect_value(__wrap_getsockname, fd, fd);
+ expect_int_value(__wrap_getsockname, fd, fd);
will_return(__wrap_getsockname, rc);
if (rc == 0)
will_return(__wrap_getsockname, (int)outlen);
@@ -251,8 +251,8 @@ static void expect_getsockname(int fd, int rc, socklen_t outlen)
static void expect_ioctl(int fd, unsigned long request, int rc)
{
expect_function_call(__wrap_ioctl);
- expect_value(__wrap_ioctl, fd, fd);
- expect_value(__wrap_ioctl, request, request);
+ expect_int_value(__wrap_ioctl, fd, fd);
+ expect_uint_value(__wrap_ioctl, request, request);
will_return(__wrap_ioctl, rc);
}
#endif
@@ -260,8 +260,8 @@ static void expect_ioctl(int fd, unsigned long request, int rc)
static void expect_poll(int fd, int events, int rc)
{
expect_function_call(__wrap_poll);
- expect_value(__wrap_poll, pfd, fd);
- expect_value(__wrap_poll, events, events);
+ expect_int_value(__wrap_poll, pfd, fd);
+ expect_int_value(__wrap_poll, events, events);
will_return(__wrap_poll, rc);
}
diff --git a/test/unit/crypto/bio/test_bio_sock2.c b/test/unit/crypto/bio/test_bio_sock2.c
index 96f63e59cf..5b404ec408 100644
--- a/test/unit/crypto/bio/test_bio_sock2.c
+++ b/test/unit/crypto/bio/test_bio_sock2.c
@@ -14,7 +14,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include "bio_local.h"
#include "internal/bio_tfo.h"
@@ -42,16 +42,16 @@ int __wrap_BIO_sock_should_retry(int i);
int __wrap_socket(int domain, int type, int protocol)
{
function_called();
- check_expected(domain);
- check_expected(type);
- check_expected(protocol);
+ check_expected_int(domain);
+ check_expected_int(type);
+ check_expected_int(protocol);
return mock_type(int);
}
int __wrap_connect(int fd, const struct sockaddr *addr, socklen_t addrlen)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
(void)addr;
(void)addrlen;
return mock_type(int);
@@ -60,7 +60,7 @@ int __wrap_connect(int fd, const struct sockaddr *addr, socklen_t addrlen)
int __wrap_bind(int fd, const struct sockaddr *addr, socklen_t addrlen)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
(void)addr;
(void)addrlen;
return mock_type(int);
@@ -69,7 +69,7 @@ int __wrap_bind(int fd, const struct sockaddr *addr, socklen_t addrlen)
int __wrap_listen(int fd, int backlog)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
(void)backlog;
return mock_type(int);
}
@@ -77,7 +77,7 @@ int __wrap_listen(int fd, int backlog)
int __wrap_accept(int fd, struct sockaddr *addr, socklen_t *addrlen)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
(void)addr;
(void)addrlen;
return mock_type(int);
@@ -86,7 +86,7 @@ int __wrap_accept(int fd, struct sockaddr *addr, socklen_t *addrlen)
int __wrap_close(int fd)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
return mock_type(int);
}
@@ -96,9 +96,9 @@ int __wrap_getsockopt(int fd, int level, int optname, void *optval,
int rc;
function_called();
- check_expected(fd);
- check_expected(level);
- check_expected(optname);
+ check_expected_int(fd);
+ check_expected_int(level);
+ check_expected_int(optname);
rc = mock_type(int);
if (rc == 0) {
if (optval != NULL)
@@ -115,10 +115,10 @@ int __wrap_setsockopt(int fd, int level, int optname, const void *optval,
int on = (optval != NULL) ? *(const int *)optval : 0;
function_called();
- check_expected(fd);
- check_expected(level);
- check_expected(optname);
- check_expected(on);
+ check_expected_int(fd);
+ check_expected_int(level);
+ check_expected_int(optname);
+ check_expected_int(on);
(void)optlen;
return mock_type(int);
}
@@ -126,15 +126,15 @@ int __wrap_setsockopt(int fd, int level, int optname, const void *optval,
int __wrap_BIO_socket_nbio(int fd, int mode)
{
function_called();
- check_expected(fd);
- check_expected(mode);
+ check_expected_int(fd);
+ check_expected_int(mode);
return mock_type(int);
}
int __wrap_BIO_sock_should_retry(int i)
{
function_called();
- check_expected(i);
+ check_expected_int(i);
return mock_type(int);
}
@@ -143,44 +143,44 @@ int __wrap_BIO_sock_should_retry(int i)
static void expect_socket(int domain, int type, int protocol, int rc)
{
expect_function_call(__wrap_socket);
- expect_value(__wrap_socket, domain, domain);
- expect_value(__wrap_socket, type, type);
- expect_value(__wrap_socket, protocol, protocol);
+ expect_int_value(__wrap_socket, domain, domain);
+ expect_int_value(__wrap_socket, type, type);
+ expect_int_value(__wrap_socket, protocol, protocol);
will_return(__wrap_socket, rc);
}
static void expect_connect(int fd, int rc)
{
expect_function_call(__wrap_connect);
- expect_value(__wrap_connect, fd, fd);
+ expect_int_value(__wrap_connect, fd, fd);
will_return(__wrap_connect, rc);
}
static void expect_bind(int fd, int rc)
{
expect_function_call(__wrap_bind);
- expect_value(__wrap_bind, fd, fd);
+ expect_int_value(__wrap_bind, fd, fd);
will_return(__wrap_bind, rc);
}
static void expect_listen(int fd, int rc)
{
expect_function_call(__wrap_listen);
- expect_value(__wrap_listen, fd, fd);
+ expect_int_value(__wrap_listen, fd, fd);
will_return(__wrap_listen, rc);
}
static void expect_accept(int fd, int rc)
{
expect_function_call(__wrap_accept);
- expect_value(__wrap_accept, fd, fd);
+ expect_int_value(__wrap_accept, fd, fd);
will_return(__wrap_accept, rc);
}
static void expect_close(int fd, int rc)
{
expect_function_call(__wrap_close);
- expect_value(__wrap_close, fd, fd);
+ expect_int_value(__wrap_close, fd, fd);
will_return(__wrap_close, rc);
}
@@ -188,9 +188,9 @@ static void expect_getsockopt(int fd, int level, int optname, int rc,
int value, socklen_t outlen)
{
expect_function_call(__wrap_getsockopt);
- expect_value(__wrap_getsockopt, fd, fd);
- expect_value(__wrap_getsockopt, level, level);
- expect_value(__wrap_getsockopt, optname, optname);
+ expect_int_value(__wrap_getsockopt, fd, fd);
+ expect_int_value(__wrap_getsockopt, level, level);
+ expect_int_value(__wrap_getsockopt, optname, optname);
will_return(__wrap_getsockopt, rc);
if (rc == 0) {
will_return(__wrap_getsockopt, value);
@@ -201,25 +201,25 @@ static void expect_getsockopt(int fd, int level, int optname, int rc,
static void expect_setsockopt(int fd, int level, int optname, int on, int rc)
{
expect_function_call(__wrap_setsockopt);
- expect_value(__wrap_setsockopt, fd, fd);
- expect_value(__wrap_setsockopt, level, level);
- expect_value(__wrap_setsockopt, optname, optname);
- expect_value(__wrap_setsockopt, on, on);
+ expect_int_value(__wrap_setsockopt, fd, fd);
+ expect_int_value(__wrap_setsockopt, level, level);
+ expect_int_value(__wrap_setsockopt, optname, optname);
+ expect_int_value(__wrap_setsockopt, on, on);
will_return(__wrap_setsockopt, rc);
}
static void expect_nbio(int fd, int mode, int rc)
{
expect_function_call(__wrap_BIO_socket_nbio);
- expect_value(__wrap_BIO_socket_nbio, fd, fd);
- expect_value(__wrap_BIO_socket_nbio, mode, mode);
+ expect_int_value(__wrap_BIO_socket_nbio, fd, fd);
+ expect_int_value(__wrap_BIO_socket_nbio, mode, mode);
will_return(__wrap_BIO_socket_nbio, rc);
}
static void expect_should_retry(int i, int rc)
{
expect_function_call(__wrap_BIO_sock_should_retry);
- expect_value(__wrap_BIO_sock_should_retry, i, i);
+ expect_int_value(__wrap_BIO_sock_should_retry, i, i);
will_return(__wrap_BIO_sock_should_retry, rc);
}
diff --git a/test/unit/crypto/bio/test_bss_acpt.c b/test/unit/crypto/bio/test_bss_acpt.c
index 1ee6aa8da5..ed63fdf02f 100644
--- a/test/unit/crypto/bio/test_bss_acpt.c
+++ b/test/unit/crypto/bio/test_bss_acpt.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <time.h>
#include <netinet/in.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include "bio_local.h"
#define FAKE_SOCKET 42
@@ -59,11 +59,11 @@ int __wrap_BIO_lookup(const char *host, const char *service,
int rc;
function_called();
- check_expected(host);
- check_expected(service);
- check_expected(lookup_type);
- check_expected(family);
- check_expected(socktype);
+ check_expected_ptr(host);
+ check_expected_ptr(service);
+ check_expected_int(lookup_type);
+ check_expected_int(family);
+ check_expected_int(socktype);
rc = mock_type(int);
if (rc == 1)
*res = mock_ptr_type(BIO_ADDRINFO *);
@@ -73,28 +73,28 @@ int __wrap_BIO_lookup(const char *host, const char *service,
int __wrap_BIO_socket(int domain, int socktype, int protocol, int options)
{
function_called();
- check_expected(domain);
- check_expected(socktype);
- check_expected(protocol);
- check_expected(options);
+ check_expected_int(domain);
+ check_expected_int(socktype);
+ check_expected_int(protocol);
+ check_expected_int(options);
return mock_type(int);
}
int __wrap_BIO_listen(int sock, const BIO_ADDR *addr, int options)
{
function_called();
- check_expected(sock);
+ check_expected_int(sock);
check_expected_ptr(addr);
- check_expected(options);
+ check_expected_int(options);
return mock_type(int);
}
int __wrap_BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options)
{
function_called();
- check_expected(accept_sock);
+ check_expected_int(accept_sock);
check_expected_ptr(addr);
- check_expected(options);
+ check_expected_int(options);
return mock_type(int);
}
@@ -102,8 +102,8 @@ int __wrap_BIO_sock_info(int sock, enum BIO_sock_info_type type,
union BIO_sock_info_u *info)
{
function_called();
- check_expected(sock);
- check_expected(type);
+ check_expected_int(sock);
+ check_expected_int(type);
(void)info; /* addr field left untouched; cache addr is zeroed already */
return mock_type(int);
}
@@ -111,14 +111,14 @@ int __wrap_BIO_sock_info(int sock, enum BIO_sock_info_type type,
int __wrap_BIO_sock_should_retry(int i)
{
function_called();
- check_expected(i);
+ check_expected_int(i);
return mock_type(int);
}
int __wrap_BIO_closesocket(int sock)
{
function_called();
- check_expected(sock);
+ check_expected_int(sock);
return mock_type(int);
}
@@ -166,7 +166,7 @@ static int fake_sink_read(BIO *b, char *buf, size_t size, size_t *readbytes)
function_called();
check_expected_ptr(buf);
- check_expected(size);
+ check_expected_uint(size);
BIO_clear_retry_flags(b);
ret = mock_type(int);
if (ret > 0) {
@@ -186,7 +186,7 @@ static int fake_sink_write(BIO *b, const char *buf, size_t size,
function_called();
check_expected_ptr(buf);
- check_expected(size);
+ check_expected_uint(size);
BIO_clear_retry_flags(b);
ret = mock_type(int);
if (ret > 0) {
@@ -238,7 +238,7 @@ static void expect_BIO_lookup(BIO_ADDRINFO *res, int rc)
expect_function_call(__wrap_BIO_lookup);
expect_any(__wrap_BIO_lookup, host);
expect_any(__wrap_BIO_lookup, service);
- expect_value(__wrap_BIO_lookup, lookup_type, BIO_LOOKUP_SERVER);
+ expect_int_value(__wrap_BIO_lookup, lookup_type, BIO_LOOKUP_SERVER);
expect_any(__wrap_BIO_lookup, family);
expect_any(__wrap_BIO_lookup, socktype);
will_return(__wrap_BIO_lookup, rc);
@@ -251,10 +251,10 @@ static void expect_BIO_socket(int domain, int socktype, int protocol,
int options, int rc)
{
expect_function_call(__wrap_BIO_socket);
- expect_value(__wrap_BIO_socket, domain, domain);
- expect_value(__wrap_BIO_socket, socktype, socktype);
- expect_value(__wrap_BIO_socket, protocol, protocol);
- expect_value(__wrap_BIO_socket, options, options);
+ expect_int_value(__wrap_BIO_socket, domain, domain);
+ expect_int_value(__wrap_BIO_socket, socktype, socktype);
+ expect_int_value(__wrap_BIO_socket, protocol, protocol);
+ expect_int_value(__wrap_BIO_socket, options, options);
will_return(__wrap_BIO_socket, rc);
}
@@ -262,40 +262,40 @@ static void expect_BIO_listen(int sock, const BIO_ADDR *addr, int options,
int rc)
{
expect_function_call(__wrap_BIO_listen);
- expect_value(__wrap_BIO_listen, sock, sock);
- expect_value(__wrap_BIO_listen, addr, addr);
- expect_value(__wrap_BIO_listen, options, options);
+ expect_int_value(__wrap_BIO_listen, sock, sock);
+ expect_uint_value(__wrap_BIO_listen, addr, cast_ptr_to_uintmax_type(addr));
+ expect_int_value(__wrap_BIO_listen, options, options);
will_return(__wrap_BIO_listen, rc);
}
static void expect_BIO_accept_ex(int sock, int options, int rc)
{
expect_function_call(__wrap_BIO_accept_ex);
- expect_value(__wrap_BIO_accept_ex, accept_sock, sock);
+ expect_int_value(__wrap_BIO_accept_ex, accept_sock, sock);
expect_any(__wrap_BIO_accept_ex, addr);
- expect_value(__wrap_BIO_accept_ex, options, options);
+ expect_int_value(__wrap_BIO_accept_ex, options, options);
will_return(__wrap_BIO_accept_ex, rc);
}
static void expect_BIO_sock_info(int sock, int rc)
{
expect_function_call(__wrap_BIO_sock_info);
- expect_value(__wrap_BIO_sock_info, sock, sock);
- expect_value(__wrap_BIO_sock_info, type, BIO_SOCK_INFO_ADDRESS);
+ expect_int_value(__wrap_BIO_sock_info, sock, sock);
+ expect_int_value(__wrap_BIO_sock_info, type, BIO_SOCK_INFO_ADDRESS);
will_return(__wrap_BIO_sock_info, rc);
}
static void expect_BIO_sock_should_retry(int i, int rc)
{
expect_function_call(__wrap_BIO_sock_should_retry);
- expect_value(__wrap_BIO_sock_should_retry, i, i);
+ expect_int_value(__wrap_BIO_sock_should_retry, i, i);
will_return(__wrap_BIO_sock_should_retry, rc);
}
static void expect_BIO_closesocket(int sock, int rc)
{
expect_function_call(__wrap_BIO_closesocket);
- expect_value(__wrap_BIO_closesocket, sock, sock);
+ expect_int_value(__wrap_BIO_closesocket, sock, sock);
will_return(__wrap_BIO_closesocket, rc);
}
@@ -322,8 +322,8 @@ static void expect_fake_sink_read(const void *buf, size_t size, int rc,
int retry)
{
expect_function_call(fake_sink_read);
- expect_value(fake_sink_read, buf, buf);
- expect_value(fake_sink_read, size, size);
+ expect_uint_value(fake_sink_read, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(fake_sink_read, size, size);
will_return(fake_sink_read, rc);
if (rc <= 0)
will_return(fake_sink_read, retry);
@@ -333,8 +333,8 @@ static void expect_fake_sink_write(const void *buf, size_t size, int rc,
int retry)
{
expect_function_call(fake_sink_write);
- expect_value(fake_sink_write, buf, buf);
- expect_value(fake_sink_write, size, size);
+ expect_uint_value(fake_sink_write, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(fake_sink_write, size, size);
will_return(fake_sink_write, rc);
if (rc <= 0)
will_return(fake_sink_write, retry);
diff --git a/test/unit/crypto/bio/test_bss_conn.c b/test/unit/crypto/bio/test_bss_conn.c
index f6eef6241b..2904121638 100644
--- a/test/unit/crypto/bio/test_bss_conn.c
+++ b/test/unit/crypto/bio/test_bss_conn.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <time.h>
#include <netinet/in.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include "bio_local.h"
#define FAKE_SOCKET 42
@@ -54,18 +54,18 @@ int __wrap_BIO_sock_error(int sock);
ssize_t __wrap_read(int fd, void *buf, size_t count)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
check_expected_ptr(buf);
- check_expected(count);
+ check_expected_uint(count);
return mock_type(ssize_t);
}
ssize_t __wrap_write(int fd, const void *buf, size_t count)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
check_expected_ptr(buf);
- check_expected(count);
+ check_expected_uint(count);
return mock_type(ssize_t);
}
@@ -76,11 +76,11 @@ int __wrap_BIO_lookup(const char *host, const char *service,
int rc;
function_called();
- check_expected(host);
- check_expected(service);
- check_expected(lookup_type);
- check_expected(family);
- check_expected(socktype);
+ check_expected_ptr(host);
+ check_expected_ptr(service);
+ check_expected_int(lookup_type);
+ check_expected_int(family);
+ check_expected_int(socktype);
rc = mock_type(int);
if (rc == 1)
*res = mock_ptr_type(BIO_ADDRINFO *);
@@ -90,41 +90,41 @@ int __wrap_BIO_lookup(const char *host, const char *service,
int __wrap_BIO_socket(int domain, int socktype, int protocol, int options)
{
function_called();
- check_expected(domain);
- check_expected(socktype);
- check_expected(protocol);
- check_expected(options);
+ check_expected_int(domain);
+ check_expected_int(socktype);
+ check_expected_int(protocol);
+ check_expected_int(options);
return mock_type(int);
}
int __wrap_BIO_connect(int sock, const BIO_ADDR *addr, int options)
{
function_called();
- check_expected(sock);
+ check_expected_int(sock);
check_expected_ptr(addr);
- check_expected(options);
+ check_expected_int(options);
return mock_type(int);
}
int __wrap_BIO_sock_should_retry(int i)
{
function_called();
- check_expected(i);
+ check_expected_int(i);
return mock_type(int);
}
int __wrap_BIO_closesocket(int sock)
{
function_called();
- check_expected(sock);
+ check_expected_int(sock);
return mock_type(int);
}
int __wrap_BIO_socket_wait(int fd, int for_write, time_t max_time)
{
function_called();
- check_expected(fd);
- check_expected(for_write);
+ check_expected_int(fd);
+ check_expected_int(for_write);
(void)max_time; /* derived from time(NULL): not checked */
return mock_type(int);
}
@@ -132,7 +132,7 @@ int __wrap_BIO_socket_wait(int fd, int for_write, time_t max_time)
int __wrap_BIO_sock_error(int sock)
{
function_called();
- check_expected(sock);
+ check_expected_int(sock);
return mock_type(int);
}
@@ -159,7 +159,7 @@ static int fake_dgram_read(BIO *b, char *buf, size_t size, size_t *readbytes)
(void)b;
function_called();
check_expected_ptr(buf);
- check_expected(size);
+ check_expected_uint(size);
ret = mock_type(int);
if (ret > 0) {
*readbytes = (size_t)ret;
@@ -177,7 +177,7 @@ static int fake_dgram_write(BIO *b, const char *buf, size_t size,
(void)b;
function_called();
check_expected_ptr(buf);
- check_expected(size);
+ check_expected_uint(size);
ret = mock_type(int);
if (ret > 0) {
*written = (size_t)ret;
@@ -203,9 +203,9 @@ static int fake_dgram_sendmmsg(BIO *b, BIO_MSG *m, size_t s, size_t n,
(void)b;
function_called();
check_expected_ptr(m);
- check_expected(s);
- check_expected(n);
- check_expected(f);
+ check_expected_uint(s);
+ check_expected_uint(n);
+ check_expected_uint(f);
*mp = mock_type(size_t);
return mock_type(int);
}
@@ -216,9 +216,9 @@ static int fake_dgram_recvmmsg(BIO *b, BIO_MSG *m, size_t s, size_t n,
(void)b;
function_called();
check_expected_ptr(m);
- check_expected(s);
- check_expected(n);
- check_expected(f);
+ check_expected_uint(s);
+ check_expected_uint(n);
+ check_expected_uint(f);
*mp = mock_type(size_t);
return mock_type(int);
}
@@ -252,18 +252,18 @@ static BIO *make_fake_dgram(void)
static void expect_read(int fd, const void *buf, size_t count, ssize_t rc)
{
expect_function_call(__wrap_read);
- expect_value(__wrap_read, fd, fd);
- expect_value(__wrap_read, buf, buf);
- expect_value(__wrap_read, count, count);
+ expect_int_value(__wrap_read, fd, fd);
+ expect_uint_value(__wrap_read, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(__wrap_read, count, count);
will_return(__wrap_read, rc);
}
static void expect_write(int fd, const void *buf, size_t count, ssize_t rc)
{
expect_function_call(__wrap_write);
- expect_value(__wrap_write, fd, fd);
- expect_value(__wrap_write, buf, buf);
- expect_value(__wrap_write, count, count);
+ expect_int_value(__wrap_write, fd, fd);
+ expect_uint_value(__wrap_write, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(__wrap_write, count, count);
will_return(__wrap_write, rc);
}
@@ -285,10 +285,10 @@ static void expect_BIO_socket(int domain, int socktype, int protocol,
int options, int rc)
{
expect_function_call(__wrap_BIO_socket);
- expect_value(__wrap_BIO_socket, domain, domain);
- expect_value(__wrap_BIO_socket, socktype, socktype);
- expect_value(__wrap_BIO_socket, protocol, protocol);
- expect_value(__wrap_BIO_socket, options, options);
+ expect_int_value(__wrap_BIO_socket, domain, domain);
+ expect_int_value(__wrap_BIO_socket, socktype, socktype);
+ expect_int_value(__wrap_BIO_socket, protocol, protocol);
+ expect_int_value(__wrap_BIO_socket, options, options);
will_return(__wrap_BIO_socket, rc);
}
@@ -296,54 +296,54 @@ static void expect_BIO_connect(int sock, const BIO_ADDR *addr, int options,
int rc)
{
expect_function_call(__wrap_BIO_connect);
- expect_value(__wrap_BIO_connect, sock, sock);
- expect_value(__wrap_BIO_connect, addr, addr);
- expect_value(__wrap_BIO_connect, options, options);
+ expect_int_value(__wrap_BIO_connect, sock, sock);
+ expect_uint_value(__wrap_BIO_connect, addr, cast_ptr_to_uintmax_type(addr));
+ expect_int_value(__wrap_BIO_connect, options, options);
will_return(__wrap_BIO_connect, rc);
}
static void expect_BIO_sock_should_retry(int i, int rc)
{
expect_function_call(__wrap_BIO_sock_should_retry);
- expect_value(__wrap_BIO_sock_should_retry, i, i);
+ expect_int_value(__wrap_BIO_sock_should_retry, i, i);
will_return(__wrap_BIO_sock_should_retry, rc);
}
static void expect_BIO_closesocket(int sock, int rc)
{
expect_function_call(__wrap_BIO_closesocket);
- expect_value(__wrap_BIO_closesocket, sock, sock);
+ expect_int_value(__wrap_BIO_closesocket, sock, sock);
will_return(__wrap_BIO_closesocket, rc);
}
static void expect_BIO_socket_wait(int fd, int for_write, int rc)
{
expect_function_call(__wrap_BIO_socket_wait);
- expect_value(__wrap_BIO_socket_wait, fd, fd);
- expect_value(__wrap_BIO_socket_wait, for_write, for_write);
+ expect_int_value(__wrap_BIO_socket_wait, fd, fd);
+ expect_int_value(__wrap_BIO_socket_wait, for_write, for_write);
will_return(__wrap_BIO_socket_wait, rc);
}
static void expect_BIO_sock_error(int sock, int rc)
{
expect_function_call(__wrap_BIO_sock_error);
- expect_value(__wrap_BIO_sock_error, sock, sock);
+ expect_int_value(__wrap_BIO_sock_error, sock, sock);
will_return(__wrap_BIO_sock_error, rc);
}
static void expect_fake_dgram_read(const void *buf, size_t size, int rc)
{
expect_function_call(fake_dgram_read);
- expect_value(fake_dgram_read, buf, buf);
- expect_value(fake_dgram_read, size, size);
+ expect_uint_value(fake_dgram_read, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(fake_dgram_read, size, size);
will_return(fake_dgram_read, rc);
}
static void expect_fake_dgram_write(const void *buf, size_t size, int rc)
{
expect_function_call(fake_dgram_write);
- expect_value(fake_dgram_write, buf, buf);
- expect_value(fake_dgram_write, size, size);
+ expect_uint_value(fake_dgram_write, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(fake_dgram_write, size, size);
will_return(fake_dgram_write, rc);
}
@@ -351,10 +351,10 @@ static void expect_fake_dgram_sendmmsg(const BIO_MSG *m, size_t s, size_t n,
uint64_t f, size_t processed, int rc)
{
expect_function_call(fake_dgram_sendmmsg);
- expect_value(fake_dgram_sendmmsg, m, m);
- expect_value(fake_dgram_sendmmsg, s, s);
- expect_value(fake_dgram_sendmmsg, n, n);
- expect_value(fake_dgram_sendmmsg, f, f);
+ expect_uint_value(fake_dgram_sendmmsg, m, cast_ptr_to_uintmax_type(m));
+ expect_uint_value(fake_dgram_sendmmsg, s, s);
+ expect_uint_value(fake_dgram_sendmmsg, n, n);
+ expect_uint_value(fake_dgram_sendmmsg, f, f);
will_return(fake_dgram_sendmmsg, processed);
will_return(fake_dgram_sendmmsg, rc);
}
@@ -363,10 +363,10 @@ static void expect_fake_dgram_recvmmsg(const BIO_MSG *m, size_t s, size_t n,
uint64_t f, size_t processed, int rc)
{
expect_function_call(fake_dgram_recvmmsg);
- expect_value(fake_dgram_recvmmsg, m, m);
- expect_value(fake_dgram_recvmmsg, s, s);
- expect_value(fake_dgram_recvmmsg, n, n);
- expect_value(fake_dgram_recvmmsg, f, f);
+ expect_uint_value(fake_dgram_recvmmsg, m, cast_ptr_to_uintmax_type(m));
+ expect_uint_value(fake_dgram_recvmmsg, s, s);
+ expect_uint_value(fake_dgram_recvmmsg, n, n);
+ expect_uint_value(fake_dgram_recvmmsg, f, f);
will_return(fake_dgram_recvmmsg, processed);
will_return(fake_dgram_recvmmsg, rc);
}
diff --git a/test/unit/crypto/bio/test_bss_dgram.c b/test/unit/crypto/bio/test_bss_dgram.c
index 8abfe0fa42..0c4a407ed1 100644
--- a/test/unit/crypto/bio/test_bss_dgram.c
+++ b/test/unit/crypto/bio/test_bss_dgram.c
@@ -26,7 +26,7 @@ int main(void)
#include <string.h>
#include <errno.h>
#include <netinet/in.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include "bio_local.h"
#include <openssl/bio.h>
@@ -60,10 +60,10 @@ ssize_t __wrap_recvfrom(int fd, void *buf, size_t len, int flags,
ssize_t rc;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
check_expected_ptr(buf);
- check_expected(len);
- check_expected(flags);
+ check_expected_uint(len);
+ check_expected_int(flags);
rc = mock_type(ssize_t);
if (rc >= 0 && src != NULL && slen != NULL) {
const struct sockaddr *sa = mock_ptr_type(const struct sockaddr *);
@@ -84,11 +84,11 @@ ssize_t __wrap_sendto(int fd, const void *buf, size_t len, int flags,
ssize_t rc;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
check_expected_ptr(buf);
- check_expected(len);
- check_expected(flags);
- check_expected(slen);
+ check_expected_uint(len);
+ check_expected_int(flags);
+ check_expected_uint(slen);
(void)dst;
rc = mock_type(ssize_t);
if (rc < 0)
@@ -99,9 +99,9 @@ ssize_t __wrap_sendto(int fd, const void *buf, size_t len, int flags,
ssize_t __wrap_write(int fd, const void *buf, size_t count)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
check_expected_ptr(buf);
- check_expected(count);
+ check_expected_uint(count);
return mock_type(ssize_t);
}
@@ -110,7 +110,7 @@ int __wrap_getsockname(int fd, struct sockaddr *addr, socklen_t *slen)
int rc;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
rc = mock_type(int);
if (rc == 0 && addr != NULL && slen != NULL) {
const struct sockaddr *sa = mock_ptr_type(const struct sockaddr *);
@@ -129,7 +129,7 @@ int __wrap_getpeername(int fd, struct sockaddr *addr, socklen_t *slen)
int rc;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
rc = mock_type(int);
if (rc == 0 && addr != NULL && slen != NULL && *slen >= sizeof(g_sin)) {
memcpy(addr, &g_sin, sizeof(g_sin));
@@ -141,15 +141,15 @@ int __wrap_getpeername(int fd, struct sockaddr *addr, socklen_t *slen)
int __wrap_BIO_closesocket(int fd)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
return mock_type(int);
}
int __wrap_BIO_socket_nbio(int fd, int mode)
{
function_called();
- check_expected(fd);
- check_expected(mode);
+ check_expected_int(fd);
+ check_expected_int(mode);
return mock_type(int);
}
@@ -159,10 +159,10 @@ static void expect_recvfrom(int fd, const void *buf, size_t len, int flags,
ssize_t rc, const struct sockaddr *src, int errnoval)
{
expect_function_call(__wrap_recvfrom);
- expect_value(__wrap_recvfrom, fd, fd);
- expect_value(__wrap_recvfrom, buf, buf);
- expect_value(__wrap_recvfrom, len, len);
- expect_value(__wrap_recvfrom, flags, flags);
+ expect_int_value(__wrap_recvfrom, fd, fd);
+ expect_uint_value(__wrap_recvfrom, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(__wrap_recvfrom, len, len);
+ expect_int_value(__wrap_recvfrom, flags, flags);
will_return(__wrap_recvfrom, rc);
if (rc >= 0)
will_return(__wrap_recvfrom, src);
@@ -174,11 +174,11 @@ static void expect_sendto(int fd, const void *buf, size_t len, int flags,
socklen_t slen, ssize_t rc, int errnoval)
{
expect_function_call(__wrap_sendto);
- expect_value(__wrap_sendto, fd, fd);
- expect_value(__wrap_sendto, buf, buf);
- expect_value(__wrap_sendto, len, len);
- expect_value(__wrap_sendto, flags, flags);
- expect_value(__wrap_sendto, slen, slen);
+ expect_int_value(__wrap_sendto, fd, fd);
+ expect_uint_value(__wrap_sendto, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(__wrap_sendto, len, len);
+ expect_int_value(__wrap_sendto, flags, flags);
+ expect_uint_value(__wrap_sendto, slen, slen);
will_return(__wrap_sendto, rc);
if (rc < 0)
will_return(__wrap_sendto, errnoval);
@@ -187,16 +187,16 @@ static void expect_sendto(int fd, const void *buf, size_t len, int flags,
static void expect_write(int fd, const void *buf, size_t count, ssize_t rc)
{
expect_function_call(__wrap_write);
- expect_value(__wrap_write, fd, fd);
- expect_value(__wrap_write, buf, buf);
- expect_value(__wrap_write, count, count);
+ expect_int_value(__wrap_write, fd, fd);
+ expect_uint_value(__wrap_write, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(__wrap_write, count, count);
will_return(__wrap_write, rc);
}
static void expect_getsockname(int fd, int rc)
{
expect_function_call(__wrap_getsockname);
- expect_value(__wrap_getsockname, fd, fd);
+ expect_int_value(__wrap_getsockname, fd, fd);
will_return(__wrap_getsockname, rc);
if (rc == 0) {
will_return(__wrap_getsockname, (const struct sockaddr *)&g_sin);
@@ -207,22 +207,22 @@ static void expect_getsockname(int fd, int rc)
static void expect_getpeername(int fd, int rc)
{
expect_function_call(__wrap_getpeername);
- expect_value(__wrap_getpeername, fd, fd);
+ expect_int_value(__wrap_getpeername, fd, fd);
will_return(__wrap_getpeername, rc);
}
static void expect_BIO_closesocket(int fd, int rc)
{
expect_function_call(__wrap_BIO_closesocket);
- expect_value(__wrap_BIO_closesocket, fd, fd);
+ expect_int_value(__wrap_BIO_closesocket, fd, fd);
will_return(__wrap_BIO_closesocket, rc);
}
static void expect_BIO_socket_nbio(int fd, int mode, int rc)
{
expect_function_call(__wrap_BIO_socket_nbio);
- expect_value(__wrap_BIO_socket_nbio, fd, fd);
- expect_value(__wrap_BIO_socket_nbio, mode, mode);
+ expect_int_value(__wrap_BIO_socket_nbio, fd, fd);
+ expect_int_value(__wrap_BIO_socket_nbio, mode, mode);
will_return(__wrap_BIO_socket_nbio, rc);
}
diff --git a/test/unit/crypto/bio/test_bss_dgram_win.c b/test/unit/crypto/bio/test_bss_dgram_win.c
index abdbef4efc..bfffd4548b 100644
--- a/test/unit/crypto/bio/test_bss_dgram_win.c
+++ b/test/unit/crypto/bio/test_bss_dgram_win.c
@@ -26,7 +26,7 @@ int main(void) { return 0; }
#include <stddef.h>
#include <setjmp.h>
#include <string.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include <detours/detours.h>
#include "internal/sockets.h"
@@ -235,7 +235,7 @@ static void expect_recvfrom_error(char *buf, int len, int flags, int wsaerr)
{
expect_function_call(mock_recvfrom);
expect_uint_value(mock_recvfrom, s, FAKE_SOCKET);
- expect_value(mock_recvfrom, buf, buf);
+ expect_uint_value(mock_recvfrom, buf, cast_ptr_to_uintmax_type(buf));
expect_int_value(mock_recvfrom, len, len);
expect_int_value(mock_recvfrom, flags, flags);
will_return_int(mock_recvfrom, SOCKET_ERROR);
diff --git a/test/unit/crypto/bio/test_bss_fd.c b/test/unit/crypto/bio/test_bss_fd.c
index 3bb6b7d714..14fa9a1b16 100644
--- a/test/unit/crypto/bio/test_bss_fd.c
+++ b/test/unit/crypto/bio/test_bss_fd.c
@@ -20,7 +20,7 @@ int main(void)
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include "bio_local.h"
@@ -40,9 +40,9 @@ ssize_t __wrap_read(int fd, void *buf, size_t count)
ssize_t rc;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
check_expected_ptr(buf);
- check_expected(count);
+ check_expected_uint(count);
rc = mock_type(ssize_t);
if (rc <= 0)
errno = mock_type(int);
@@ -54,9 +54,9 @@ ssize_t __wrap_write(int fd, const void *buf, size_t count)
ssize_t rc;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
check_expected_ptr(buf);
- check_expected(count);
+ check_expected_uint(count);
rc = mock_type(ssize_t);
if (rc <= 0)
errno = mock_type(int);
@@ -66,9 +66,9 @@ ssize_t __wrap_write(int fd, const void *buf, size_t count)
off_t __wrap_lseek(int fd, off_t offset, int whence)
{
function_called();
- check_expected(fd);
- check_expected(offset);
- check_expected(whence);
+ check_expected_int(fd);
+ check_expected_int(offset);
+ check_expected_int(whence);
return mock_type(off_t);
}
@@ -76,7 +76,7 @@ off_t __wrap_lseek(int fd, off_t offset, int whence)
int __wrap_close(int fd)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
return mock_type(int);
}
@@ -91,9 +91,9 @@ static void expect_read(int fd, const void *buf, size_t count, ssize_t rc,
int errnoval)
{
expect_function_call(__wrap_read);
- expect_value(__wrap_read, fd, fd);
- expect_value(__wrap_read, buf, buf);
- expect_value(__wrap_read, count, count);
+ expect_int_value(__wrap_read, fd, fd);
+ expect_uint_value(__wrap_read, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(__wrap_read, count, count);
will_return(__wrap_read, rc);
if (rc <= 0)
will_return(__wrap_read, errnoval);
@@ -103,9 +103,9 @@ static void expect_write(int fd, const void *buf, size_t count, ssize_t rc,
int errnoval)
{
expect_function_call(__wrap_write);
- expect_value(__wrap_write, fd, fd);
- expect_value(__wrap_write, buf, buf);
- expect_value(__wrap_write, count, count);
+ expect_int_value(__wrap_write, fd, fd);
+ expect_uint_value(__wrap_write, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(__wrap_write, count, count);
will_return(__wrap_write, rc);
if (rc <= 0)
will_return(__wrap_write, errnoval);
@@ -114,16 +114,16 @@ static void expect_write(int fd, const void *buf, size_t count, ssize_t rc,
static void expect_lseek(int fd, off_t offset, int whence, off_t rc)
{
expect_function_call(__wrap_lseek);
- expect_value(__wrap_lseek, fd, fd);
- expect_value(__wrap_lseek, offset, offset);
- expect_value(__wrap_lseek, whence, whence);
+ expect_int_value(__wrap_lseek, fd, fd);
+ expect_int_value(__wrap_lseek, offset, offset);
+ expect_int_value(__wrap_lseek, whence, whence);
will_return(__wrap_lseek, rc);
}
static void expect_close(int fd, int rc)
{
expect_function_call(__wrap_close);
- expect_value(__wrap_close, fd, fd);
+ expect_int_value(__wrap_close, fd, fd);
will_return(__wrap_close, rc);
}
diff --git a/test/unit/crypto/bio/test_bss_file.c b/test/unit/crypto/bio/test_bss_file.c
index ccfa88d687..4cdd83140a 100644
--- a/test/unit/crypto/bio/test_bss_file.c
+++ b/test/unit/crypto/bio/test_bss_file.c
@@ -21,7 +21,7 @@ int main(void)
#include <stddef.h>
#include <setjmp.h>
#include <string.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include "bio_local.h"
@@ -76,8 +76,8 @@ FILE *__wrap_openssl_fopen(const char *filename, const char *mode)
FILE *fp;
function_called();
- check_expected(filename);
- check_expected(mode);
+ check_expected_ptr(filename);
+ check_expected_ptr(mode);
fp = mock_ptr_type(FILE *);
if (fp == NULL)
errno = mock_type(int);
@@ -90,8 +90,8 @@ size_t __wrap_fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
return __real_fread(ptr, size, nmemb, stream);
function_called();
check_expected_ptr(ptr);
- check_expected(size);
- check_expected(nmemb);
+ check_expected_uint(size);
+ check_expected_uint(nmemb);
check_expected_ptr(stream);
return mock_type(size_t);
}
@@ -102,8 +102,8 @@ size_t __wrap_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
return __real_fwrite(ptr, size, nmemb, stream);
function_called();
check_expected_ptr(ptr);
- check_expected(size);
- check_expected(nmemb);
+ check_expected_uint(size);
+ check_expected_uint(nmemb);
check_expected_ptr(stream);
return mock_type(size_t);
}
@@ -114,8 +114,8 @@ int __wrap_fseek(FILE *stream, long offset, int whence)
return __real_fseek(stream, offset, whence);
function_called();
check_expected_ptr(stream);
- check_expected(offset);
- check_expected(whence);
+ check_expected_int(offset);
+ check_expected_int(whence);
return mock_type(int);
}
@@ -172,7 +172,7 @@ char *__wrap_fgets(char *s, int size, FILE *stream)
return __real_fgets(s, size, stream);
function_called();
check_expected_ptr(s);
- check_expected(size);
+ check_expected_int(size);
check_expected_ptr(stream);
data = mock_ptr_type(const char *);
if (data == NULL)
@@ -199,10 +199,10 @@ static void expect_openssl_fopen(const char *filename, const char *mode,
static void expect_fread(void *ptr, size_t nmemb, FILE *stream, size_t rc)
{
expect_function_call(__wrap_fread);
- expect_value(__wrap_fread, ptr, ptr);
- expect_value(__wrap_fread, size, 1);
- expect_value(__wrap_fread, nmemb, nmemb);
- expect_value(__wrap_fread, stream, stream);
+ expect_uint_value(__wrap_fread, ptr, cast_ptr_to_uintmax_type(ptr));
+ expect_uint_value(__wrap_fread, size, 1);
+ expect_uint_value(__wrap_fread, nmemb, nmemb);
+ expect_uint_value(__wrap_fread, stream, cast_ptr_to_uintmax_type(stream));
will_return(__wrap_fread, rc);
}
@@ -210,54 +210,54 @@ static void expect_fwrite(const void *ptr, size_t nmemb, FILE *stream,
size_t rc)
{
expect_function_call(__wrap_fwrite);
- expect_value(__wrap_fwrite, ptr, ptr);
- expect_value(__wrap_fwrite, size, 1);
- expect_value(__wrap_fwrite, nmemb, nmemb);
- expect_value(__wrap_fwrite, stream, stream);
+ expect_uint_value(__wrap_fwrite, ptr, cast_ptr_to_uintmax_type(ptr));
+ expect_uint_value(__wrap_fwrite, size, 1);
+ expect_uint_value(__wrap_fwrite, nmemb, nmemb);
+ expect_uint_value(__wrap_fwrite, stream, cast_ptr_to_uintmax_type(stream));
will_return(__wrap_fwrite, rc);
}
static void expect_fseek(FILE *stream, long offset, int whence, int rc)
{
expect_function_call(__wrap_fseek);
- expect_value(__wrap_fseek, stream, stream);
- expect_value(__wrap_fseek, offset, offset);
- expect_value(__wrap_fseek, whence, whence);
+ expect_uint_value(__wrap_fseek, stream, cast_ptr_to_uintmax_type(stream));
+ expect_int_value(__wrap_fseek, offset, offset);
+ expect_int_value(__wrap_fseek, whence, whence);
will_return(__wrap_fseek, rc);
}
static void expect_ftell(FILE *stream, long rc)
{
expect_function_call(__wrap_ftell);
- expect_value(__wrap_ftell, stream, stream);
+ expect_uint_value(__wrap_ftell, stream, cast_ptr_to_uintmax_type(stream));
will_return(__wrap_ftell, rc);
}
static void expect_feof(FILE *stream, int rc)
{
expect_function_call(__wrap_feof);
- expect_value(__wrap_feof, stream, stream);
+ expect_uint_value(__wrap_feof, stream, cast_ptr_to_uintmax_type(stream));
will_return(__wrap_feof, rc);
}
static void expect_ferror(FILE *stream, int rc)
{
expect_function_call(__wrap_ferror);
- expect_value(__wrap_ferror, stream, stream);
+ expect_uint_value(__wrap_ferror, stream, cast_ptr_to_uintmax_type(stream));
will_return(__wrap_ferror, rc);
}
static void expect_fclose(FILE *stream, int rc)
{
expect_function_call(__wrap_fclose);
- expect_value(__wrap_fclose, stream, stream);
+ expect_uint_value(__wrap_fclose, stream, cast_ptr_to_uintmax_type(stream));
will_return(__wrap_fclose, rc);
}
static void expect_fflush(FILE *stream, int rc)
{
expect_function_call(__wrap_fflush);
- expect_value(__wrap_fflush, stream, stream);
+ expect_uint_value(__wrap_fflush, stream, cast_ptr_to_uintmax_type(stream));
will_return(__wrap_fflush, rc);
}
@@ -265,9 +265,9 @@ static void expect_fflush(FILE *stream, int rc)
static void expect_fgets(char *s, int size, FILE *stream, const char *data)
{
expect_function_call(__wrap_fgets);
- expect_value(__wrap_fgets, s, s);
- expect_value(__wrap_fgets, size, size);
- expect_value(__wrap_fgets, stream, stream);
+ expect_uint_value(__wrap_fgets, s, cast_ptr_to_uintmax_type(s));
+ expect_int_value(__wrap_fgets, size, size);
+ expect_uint_value(__wrap_fgets, stream, cast_ptr_to_uintmax_type(stream));
will_return(__wrap_fgets, data);
}
diff --git a/test/unit/crypto/bio/test_bss_file_win.c b/test/unit/crypto/bio/test_bss_file_win.c
index 3d77512fb9..a9d384044f 100644
--- a/test/unit/crypto/bio/test_bss_file_win.c
+++ b/test/unit/crypto/bio/test_bss_file_win.c
@@ -52,7 +52,7 @@ int main(void)
#include <stddef.h>
#include <setjmp.h>
#include <string.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include <detours/detours.h>
#include "internal/sockets.h"
@@ -171,8 +171,8 @@ static size_t __cdecl mock_fread(void *ptr, size_t size, size_t nmemb,
g_mocks_armed = 0;
function_called();
check_expected_ptr(ptr);
- check_expected(size);
- check_expected(nmemb);
+ check_expected_uint(size);
+ check_expected_uint(nmemb);
check_expected_ptr(stream);
rc = mock_type(size_t);
g_mocks_armed = 1;
@@ -190,8 +190,8 @@ static size_t __cdecl mock_fwrite(const void *ptr, size_t size, size_t nmemb,
g_mocks_armed = 0;
function_called();
check_expected_ptr(ptr);
- check_expected(size);
- check_expected(nmemb);
+ check_expected_uint(size);
+ check_expected_uint(nmemb);
check_expected_ptr(stream);
rc = mock_type(size_t);
g_mocks_armed = 1;
@@ -237,8 +237,8 @@ static int __cdecl mock_setmode(int fd, int mode)
g_mocks_armed = 0;
function_called();
- check_expected(fd);
- check_expected(mode);
+ check_expected_int(fd);
+ check_expected_int(mode);
rc = mock_type(int);
g_mocks_armed = 1;
return rc;
@@ -253,7 +253,7 @@ static intptr_t __cdecl mock_get_osfhandle(int fd)
g_mocks_armed = 0;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
rc = mock_type(intptr_t);
g_mocks_armed = 1;
return rc;
@@ -306,7 +306,7 @@ static DWORD WINAPI mock_GetFileType(HANDLE h)
static void expect_feof(FILE *stream, int rc, int errnoval)
{
expect_function_call(mock_feof);
- expect_value(mock_feof, stream, stream);
+ expect_uint_value(mock_feof, stream, cast_ptr_to_uintmax_type(stream));
will_return(mock_feof, rc);
will_return(mock_feof, errnoval);
}
@@ -314,17 +314,17 @@ static void expect_feof(FILE *stream, int rc, int errnoval)
static void expect_ftell(FILE *stream, long rc)
{
expect_function_call(mock_ftell);
- expect_value(mock_ftell, stream, stream);
+ expect_uint_value(mock_ftell, stream, cast_ptr_to_uintmax_type(stream));
will_return(mock_ftell, rc);
}
static void expect_fread(void *ptr, size_t nmemb, FILE *stream, size_t rc)
{
expect_function_call(mock_fread);
- expect_value(mock_fread, ptr, ptr);
- expect_value(mock_fread, size, 1);
- expect_value(mock_fread, nmemb, nmemb);
- expect_value(mock_fread, stream, stream);
+ expect_uint_value(mock_fread, ptr, cast_ptr_to_uintmax_type(ptr));
+ expect_uint_value(mock_fread, size, 1);
+ expect_uint_value(mock_fread, nmemb, nmemb);
+ expect_uint_value(mock_fread, stream, cast_ptr_to_uintmax_type(stream));
will_return(mock_fread, rc);
}
@@ -332,39 +332,39 @@ static void expect_fwrite(const void *ptr, size_t nmemb, FILE *stream,
size_t rc)
{
expect_function_call(mock_fwrite);
- expect_value(mock_fwrite, ptr, ptr);
- expect_value(mock_fwrite, size, 1);
- expect_value(mock_fwrite, nmemb, nmemb);
- expect_value(mock_fwrite, stream, stream);
+ expect_uint_value(mock_fwrite, ptr, cast_ptr_to_uintmax_type(ptr));
+ expect_uint_value(mock_fwrite, size, 1);
+ expect_uint_value(mock_fwrite, nmemb, nmemb);
+ expect_uint_value(mock_fwrite, stream, cast_ptr_to_uintmax_type(stream));
will_return(mock_fwrite, rc);
}
static void expect_fclose(FILE *stream, int rc)
{
expect_function_call(mock_fclose);
- expect_value(mock_fclose, stream, stream);
+ expect_uint_value(mock_fclose, stream, cast_ptr_to_uintmax_type(stream));
will_return(mock_fclose, rc);
}
static void expect_fileno(FILE *stream, int rc)
{
expect_function_call(mock_fileno);
- expect_value(mock_fileno, stream, stream);
+ expect_uint_value(mock_fileno, stream, cast_ptr_to_uintmax_type(stream));
will_return(mock_fileno, rc);
}
static void expect_setmode(int fd, int mode, int rc)
{
expect_function_call(mock_setmode);
- expect_value(mock_setmode, fd, fd);
- expect_value(mock_setmode, mode, mode);
+ expect_int_value(mock_setmode, fd, fd);
+ expect_int_value(mock_setmode, mode, mode);
will_return(mock_setmode, rc);
}
static void expect_get_osfhandle(int fd, intptr_t rc)
{
expect_function_call(mock_get_osfhandle);
- expect_value(mock_get_osfhandle, fd, fd);
+ expect_int_value(mock_get_osfhandle, fd, fd);
will_return(mock_get_osfhandle, rc);
}
@@ -382,7 +382,7 @@ static void expect_wfopen(const wchar_t *filename, const wchar_t *mode,
static void expect_GetFileType(intptr_t h, DWORD rc)
{
expect_function_call(mock_GetFileType);
- expect_value(mock_GetFileType, h, (HANDLE)h);
+ expect_uint_value(mock_GetFileType, h, cast_ptr_to_uintmax_type((HANDLE)h));
will_return(mock_GetFileType, rc);
}
diff --git a/test/unit/crypto/bio/test_bss_sock.c b/test/unit/crypto/bio/test_bss_sock.c
index b6d7148fc0..2f90d98744 100644
--- a/test/unit/crypto/bio/test_bss_sock.c
+++ b/test/unit/crypto/bio/test_bss_sock.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <errno.h>
#include <netinet/in.h>
-#include <cmocka.h>
+#include "../../cmocka_compat.h"
#include "bio_local.h"
#include "internal/bio_tfo.h"
#include <openssl/bio.h>
@@ -40,9 +40,9 @@ ssize_t __wrap_read(int fd, void *buf, size_t count)
ssize_t rc;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
check_expected_ptr(buf);
- check_expected(count);
+ check_expected_uint(count);
rc = mock_type(ssize_t);
if (rc < 0)
errno = mock_type(int);
@@ -54,9 +54,9 @@ ssize_t __wrap_write(int fd, const void *buf, size_t count)
ssize_t rc;
function_called();
- check_expected(fd);
+ check_expected_int(fd);
check_expected_ptr(buf);
- check_expected(count);
+ check_expected_uint(count);
rc = mock_type(ssize_t);
if (rc < 0)
errno = mock_type(int);
@@ -66,7 +66,7 @@ ssize_t __wrap_write(int fd, const void *buf, size_t count)
int __wrap_BIO_closesocket(int fd)
{
function_called();
- check_expected(fd);
+ check_expected_int(fd);
return mock_type(int);
}
@@ -76,9 +76,9 @@ static void expect_read(int fd, const void *buf, size_t count, ssize_t rc,
int errnoval)
{
expect_function_call(__wrap_read);
- expect_value(__wrap_read, fd, fd);
- expect_value(__wrap_read, buf, buf);
- expect_value(__wrap_read, count, count);
+ expect_int_value(__wrap_read, fd, fd);
+ expect_uint_value(__wrap_read, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(__wrap_read, count, count);
will_return(__wrap_read, rc);
if (rc < 0)
will_return(__wrap_read, errnoval);
@@ -88,9 +88,9 @@ static void expect_write(int fd, const void *buf, size_t count, ssize_t rc,
int errnoval)
{
expect_function_call(__wrap_write);
- expect_value(__wrap_write, fd, fd);
- expect_value(__wrap_write, buf, buf);
- expect_value(__wrap_write, count, count);
+ expect_int_value(__wrap_write, fd, fd);
+ expect_uint_value(__wrap_write, buf, cast_ptr_to_uintmax_type(buf));
+ expect_uint_value(__wrap_write, count, count);
will_return(__wrap_write, rc);
if (rc < 0)
will_return(__wrap_write, errnoval);
@@ -99,7 +99,7 @@ static void expect_write(int fd, const void *buf, size_t count, ssize_t rc,
static void expect_BIO_closesocket(int fd, int rc)
{
expect_function_call(__wrap_BIO_closesocket);
- expect_value(__wrap_BIO_closesocket, fd, fd);
+ expect_int_value(__wrap_BIO_closesocket, fd, fd);
will_return(__wrap_BIO_closesocket, rc);
}
diff --git a/test/unit/ssl/test_ssl_sess.c b/test/unit/ssl/test_ssl_sess.c
index 7a7c7d4cc3..fd8cb38152 100644
--- a/test/unit/ssl/test_ssl_sess.c
+++ b/test/unit/ssl/test_ssl_sess.c
@@ -12,7 +12,7 @@
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
-#include <cmocka.h>
+#include "../cmocka_compat.h"
#include <openssl/crypto.h>
#include <openssl/err.h>