From 1fb69a9e918c3ae1d56b4cb404d823f83831fce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gonz=C3=A1lez?= Date: Thu, 1 Feb 2024 11:12:20 +0000 Subject: [PATCH] tests/ssl_helpers: Check that message queue is popped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mbedtls_test_mock_tcp_recv_msg is currently popping a message queue and does not check if this was done correctly. This extra check makes the test more complete/robust. Signed-off-by: Tomás González --- tests/src/test_helpers/ssl_helpers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/src/test_helpers/ssl_helpers.c b/tests/src/test_helpers/ssl_helpers.c index 255849fdc2..16fa38a172 100644 --- a/tests/src/test_helpers/ssl_helpers.c +++ b/tests/src/test_helpers/ssl_helpers.c @@ -551,7 +551,10 @@ int mbedtls_test_mock_tcp_recv_msg(void *ctx, * happen in test environment, unless forced manually. */ } } - mbedtls_test_ssl_message_queue_pop_info(queue, buf_len); + ret = mbedtls_test_ssl_message_queue_pop_info(queue, buf_len); + if (ret < 0) { + return ret; + } return (msg_len > INT_MAX) ? INT_MAX : (int) msg_len; }