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 <simon.chopin@canonical.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
This commit is contained in:
Simon Chopin 2021-11-10 14:03:58 +01:00 committed by Frediano Ziglio
parent e2848118bf
commit 3d32295f9e
2 changed files with 6 additions and 0 deletions

View File

@ -84,5 +84,6 @@ Patches also contributed by
Tomasz Kłoczko <kloczek@github.com>
Qiuhao Li <Qiuhao.Li@outlook.com>
Hunter Sezen <orbea@riseup.net>
Simon Chopin <simon.chopin@canonical.com>
....send patches to get your name here...

View File

@ -31,6 +31,7 @@
#include <config.h>
#include <unistd.h>
#include <spice.h>
#include <openssl/ssl.h>
#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);