From 1038b22d74a27d9111d12fc8d737c413f2e39ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 5 Mar 2025 11:53:09 +0100 Subject: [PATCH] Reduce the level of logging used in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should avoid running into a bug with printf format specifiers one windows. It's also a logical move for actual tests: I used the highest debug level for discovery, but we don't need that all the time. Signed-off-by: Manuel Pégourié-Gonnard --- library/ssl_tls13_server.c | 2 +- tests/suites/test_suite_ssl.function | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c index acb65e38d2..1dde4ab3c9 100644 --- a/library/ssl_tls13_server.c +++ b/library/ssl_tls13_server.c @@ -91,7 +91,7 @@ static void ssl_tls13_select_ciphersuite( return; } - MBEDTLS_SSL_DEBUG_MSG(2, ("No matched ciphersuite, psk_ciphersuite_id=%x, psk_hash_alg=%lx", + MBEDTLS_SSL_DEBUG_MSG(1, ("No matched ciphersuite, psk_ciphersuite_id=%x, psk_hash_alg=%lx", (unsigned) psk_ciphersuite_id, (unsigned long) psk_hash_alg)); } diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index 993ae55b41..c365fd674f 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -5046,7 +5046,7 @@ void inject_client_content_on_the_wire(int pk_alg, srv_pattern.pattern = log_pattern; options.srv_log_obj = &srv_pattern; options.srv_log_fun = mbedtls_test_ssl_log_analyzer; - mbedtls_debug_set_threshold(5); + mbedtls_debug_set_threshold(1); options.pk_alg = pk_alg; @@ -5078,7 +5078,11 @@ void inject_client_content_on_the_wire(int pk_alg, ret = mbedtls_ssl_handshake_step(&server.ssl); } while (ret == 0 && server.ssl.state == state); TEST_EQUAL(ret, expected_ret); - TEST_EQUAL(srv_pattern.counter, 1); + /* If we're expected to suceeed and we do, that's enough. + * If we're expected to fail, also check it was in the expected way. */ + if (expected_ret != 0) { + TEST_EQUAL(srv_pattern.counter, 1); + } exit: mbedtls_test_free_handshake_options(&options); @@ -5123,7 +5127,7 @@ void send_large_fragmented_hello(int hs_len_int, int first_frag_content_len_int, srv_pattern.pattern = log_pattern; options.srv_log_obj = &srv_pattern; options.srv_log_fun = mbedtls_test_ssl_log_analyzer; - mbedtls_debug_set_threshold(5); + mbedtls_debug_set_threshold(1); // Does't really matter but we want to know to declare dependencies. options.pk_alg = MBEDTLS_PK_ECDSA;