From e46f663b0743b32d6a99df363d447ae1a7bf8fc7 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 11 Jul 2024 16:25:50 +0200 Subject: [PATCH] Make ssl related unit tests verbosity not print debug output by default These unit tests are quite nosiy on a normal unit test run. Lower the SSL verbosity for them to avoid a lot of debug output during unit tests. Signed-off-by: Arne Schwabe --- test/unittests/test_acc_certcheck.cpp | 11 +++++++++-- test/unittests/test_sslctx.cpp | 8 ++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/test/unittests/test_acc_certcheck.cpp b/test/unittests/test_acc_certcheck.cpp index 8ae8dcf7e..f51c034c7 100644 --- a/test/unittests/test_acc_certcheck.cpp +++ b/test/unittests/test_acc_certcheck.cpp @@ -241,6 +241,8 @@ I/+4kAlXuAKdhsXohHeBhC2ijg/kTOMDxEbEVv+SkCIUyM+dB8UtlPKOH9HEL5Xi +BpDSqO6Bha5+NAVUU7OdDsnzRwSWaD6lwIBAgICAOE= -----END DH PARAMETERS-----)"; +static constexpr int debug_output = 0; + static inline bool xfer_oneway(SslApiBuilder &sender, SslApiBuilder &recv, std::string out) { if (sender.get().read_ciphertext_ready()) @@ -283,12 +285,12 @@ static inline void xfer(AccHandshaker &cli, AccHandshaker &serv) do { - if (sdata) + if (sdata && debug_output) std::cout << "CLIENT <-- SERVER: " << sdata->size() << " bytes\n"; cdata = cli.process_msg(sdata); try { - if (cdata) + if (cdata && debug_output) std::cout << "CLIENT --> SERVER: " << cdata->size() << " bytes\n"; sdata = serv.process_msg(cdata); } @@ -319,6 +321,8 @@ SSLLib::SSLAPI::Config::Ptr CreateServerConfig(const std::string &pvtKey, config->load_cert(cert); config->load_private_key(pvtKey); config->load_ca(ca, false); + // Do not log extra data during unit test + config->set_debug_level(debug_output); return config; } @@ -344,6 +348,9 @@ SSLLib::SSLAPI::Config::Ptr CreateClientConfig(const std::string &pvtKey, else config->load_ca(ca, false); + // Do not log extra data during unit test + config->set_debug_level(debug_output); + return config; } diff --git a/test/unittests/test_sslctx.cpp b/test/unittests/test_sslctx.cpp index 7f9623856..1396101b9 100644 --- a/test/unittests/test_sslctx.cpp +++ b/test/unittests/test_sslctx.cpp @@ -247,6 +247,8 @@ I/+4kAlXuAKdhsXohHeBhC2ijg/kTOMDxEbEVv+SkCIUyM+dB8UtlPKOH9HEL5Xi TEST(sslctx_ut, create_config) { SSLLib::SSLAPI::Config::Ptr config = new SSLLib::SSLAPI::Config; + // Do not log extra data during unit test + config->set_debug_level(0); EXPECT_TRUE(config); } @@ -263,6 +265,9 @@ TEST(sslctx_ut, config_new_factory_server) config->load_private_key(pvt_key_txt); config->load_ca(cert_txt, false); + // Do not log extra data during unit test + config->set_debug_level(0); + auto factory_server = config->new_factory(); EXPECT_TRUE(factory_server); @@ -283,6 +288,9 @@ TEST(sslctx_ut, config_new_factory_client) config->load_private_key(pvt_key_txt); config->load_ca(cert_txt, false); + // Do not log extra data during unit test + config->set_debug_level(0); + auto factory_client = config->new_factory(); EXPECT_TRUE(factory_client);