diff options
author | Simon Chopin <simon.chopin@canonical.com> | 2021-11-10 14:03:58 +0100 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2021-11-11 09:23:51 +0000 |
commit | 3d32295f9e99054ae1a40d220ccef53a176c8aed (patch) | |
tree | 210152170a09dab07534d02ebb776bcab07b1286 | |
parent | e2848118bf7f680633bdab5e31ff6f3804bd14d8 (diff) |
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>
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | server/tests/test-leaks.c | 5 |
2 files changed, 6 insertions, 0 deletions
@@ -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... 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 <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); |