Skip to content

Commit e46f663

Browse files
schwabeJenkins-dev
authored andcommitted
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 <[email protected]>
1 parent 3fe0138 commit e46f663

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

test/unittests/test_acc_certcheck.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ I/+4kAlXuAKdhsXohHeBhC2ijg/kTOMDxEbEVv+SkCIUyM+dB8UtlPKOH9HEL5Xi
241241
+BpDSqO6Bha5+NAVUU7OdDsnzRwSWaD6lwIBAgICAOE=
242242
-----END DH PARAMETERS-----)";
243243

244+
static constexpr int debug_output = 0;
245+
244246
static inline bool xfer_oneway(SslApiBuilder &sender, SslApiBuilder &recv, std::string out)
245247
{
246248
if (sender.get().read_ciphertext_ready())
@@ -283,12 +285,12 @@ static inline void xfer(AccHandshaker &cli, AccHandshaker &serv)
283285

284286
do
285287
{
286-
if (sdata)
288+
if (sdata && debug_output)
287289
std::cout << "CLIENT <-- SERVER: " << sdata->size() << " bytes\n";
288290
cdata = cli.process_msg(sdata);
289291
try
290292
{
291-
if (cdata)
293+
if (cdata && debug_output)
292294
std::cout << "CLIENT --> SERVER: " << cdata->size() << " bytes\n";
293295
sdata = serv.process_msg(cdata);
294296
}
@@ -319,6 +321,8 @@ SSLLib::SSLAPI::Config::Ptr CreateServerConfig(const std::string &pvtKey,
319321
config->load_cert(cert);
320322
config->load_private_key(pvtKey);
321323
config->load_ca(ca, false);
324+
// Do not log extra data during unit test
325+
config->set_debug_level(debug_output);
322326

323327
return config;
324328
}
@@ -344,6 +348,9 @@ SSLLib::SSLAPI::Config::Ptr CreateClientConfig(const std::string &pvtKey,
344348
else
345349
config->load_ca(ca, false);
346350

351+
// Do not log extra data during unit test
352+
config->set_debug_level(debug_output);
353+
347354
return config;
348355
}
349356

test/unittests/test_sslctx.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ I/+4kAlXuAKdhsXohHeBhC2ijg/kTOMDxEbEVv+SkCIUyM+dB8UtlPKOH9HEL5Xi
247247
TEST(sslctx_ut, create_config)
248248
{
249249
SSLLib::SSLAPI::Config::Ptr config = new SSLLib::SSLAPI::Config;
250+
// Do not log extra data during unit test
251+
config->set_debug_level(0);
250252
EXPECT_TRUE(config);
251253
}
252254

@@ -263,6 +265,9 @@ TEST(sslctx_ut, config_new_factory_server)
263265
config->load_private_key(pvt_key_txt);
264266
config->load_ca(cert_txt, false);
265267

268+
// Do not log extra data during unit test
269+
config->set_debug_level(0);
270+
266271
auto factory_server = config->new_factory();
267272
EXPECT_TRUE(factory_server);
268273

@@ -283,6 +288,9 @@ TEST(sslctx_ut, config_new_factory_client)
283288
config->load_private_key(pvt_key_txt);
284289
config->load_ca(cert_txt, false);
285290

291+
// Do not log extra data during unit test
292+
config->set_debug_level(0);
293+
286294
auto factory_client = config->new_factory();
287295
EXPECT_TRUE(factory_client);
288296

0 commit comments

Comments
 (0)