From 3d32295f9e99054ae1a40d220ccef53a176c8aed Mon Sep 17 00:00:00 2001 From: Simon Chopin Date: Wed, 10 Nov 2021 14:03:58 +0100 Subject: [PATCH] test-leaks: fix the test with OpenSSL3 In OpenSSL3, the SSL_accept call now emits proper errors, which we dump *before* emitting the expected "SSL_accept failed" error message. The g_test_expect_message framework doesn't really allow us to discard messages AFAICT, so instead we add a new expectation with fairly loose criteria. Fixes #63 Signed-off-by: Simon Chopin Acked-by: Frediano Ziglio --- AUTHORS | 1 + server/tests/test-leaks.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/AUTHORS b/AUTHORS index b2914602..a28cdb62 100644 --- a/AUTHORS +++ b/AUTHORS @@ -84,5 +84,6 @@ Patches also contributed by Tomasz Kłoczko Qiuhao Li Hunter Sezen + Simon Chopin ....send patches to get your name here... diff --git a/server/tests/test-leaks.c b/server/tests/test-leaks.c index be9fe2d2..53e15ba8 100644 --- a/server/tests/test-leaks.c +++ b/server/tests/test-leaks.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "test-glib-compat.h" #include "basic-event-loop.h" @@ -68,6 +69,10 @@ static void server_leaks(void) g_assert_cmpint(result, ==, 0); /* spice_server_add_ssl_client should not leak when it's given a disconnected socket */ +#if (OPENSSL_VERSION_NUMBER >= 0x30000000L) + /* Discard the OpenSSL-generated error logs */ + g_test_expect_message(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "*error:*:SSL*"); +#endif g_test_expect_message(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "*SSL_accept failed*"); g_assert_cmpint(socketpair(AF_LOCAL, SOCK_STREAM, 0, sv), ==, 0);