From 30e087093752b853c7775602818614b10db124cf Mon Sep 17 00:00:00 2001 From: Pengyu Lv Date: Mon, 10 Jul 2023 10:53:11 +0800 Subject: [PATCH] Add test for hostname getter Signed-off-by: Pengyu Lv --- tests/suites/test_suite_ssl.function | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index d3eecced1c..5f53d8770e 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -1148,13 +1148,19 @@ exit: /* BEGIN_CASE depends_on:MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */ void ssl_set_hostname_twice(char *hostname0, char *hostname1) { + const char *hostname; mbedtls_ssl_context ssl; mbedtls_ssl_init(&ssl); USE_PSA_INIT(); TEST_ASSERT(mbedtls_ssl_set_hostname(&ssl, hostname0) == 0); + hostname = mbedtls_ssl_get_hostname(&ssl); + TEST_ASSERT(strcmp(hostname0, hostname) == 0); + TEST_ASSERT(mbedtls_ssl_set_hostname(&ssl, hostname1) == 0); + hostname = mbedtls_ssl_get_hostname(&ssl); + TEST_ASSERT(strcmp(hostname1, hostname) == 0); exit: mbedtls_ssl_free(&ssl);