From 2bd761bb4cb6766dbd90b637718d7633ef5a9343 Mon Sep 17 00:00:00 2001 From: Ethan Looney Date: Thu, 22 Oct 2020 14:51:07 -0600 Subject: [PATCH 1/6] Added a case for logging.c unit test with debug not enabled --- tests/api.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/api.c b/tests/api.c index d51d17e3c..18dc22b6a 100644 --- a/tests/api.c +++ b/tests/api.c @@ -29171,8 +29171,8 @@ static void Logging_cb(const int logLevel, const char *const logMessage) static int test_wolfSSL_GetLoggingCb (void) { int ret = 0; -#ifdef DEBUG_WOLFSSL printf(testingFmt, "wolfSSL_GetLoggingCb()"); +#ifdef DEBUG_WOLFSSL /* Testing without wolfSSL_SetLoggingCb() */ if (ret == 0) { @@ -29200,8 +29200,23 @@ static int test_wolfSSL_GetLoggingCb (void) wolfSSL_SetLoggingCb(NULL); } } - printf(resultFmt, ret == 0 ? passed : failed); #endif + if (ret == 0) { + //ret = wolfSSL_SetLoggingCb(Logging_cb); + if (ret == 0) { + if (wolfSSL_GetLoggingCb() == NULL) { + ret = 0; + } + if (wolfSSL_GetLoggingCb() != NULL) { + ret = -1; + } + } + } + + + + printf(resultFmt, ret == 0 ? passed : failed); + return ret; }/*End test_wolfSSL_GetLoggingCb*/ From a5f86729f9a95876ea2ccf06affc18bf5b2c35da Mon Sep 17 00:00:00 2001 From: Ethan Looney Date: Fri, 23 Oct 2020 13:52:06 -0600 Subject: [PATCH 2/6] Deleted comment --- tests/api.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/api.c b/tests/api.c index 18dc22b6a..a742b666f 100644 --- a/tests/api.c +++ b/tests/api.c @@ -29202,7 +29202,6 @@ static int test_wolfSSL_GetLoggingCb (void) } #endif if (ret == 0) { - //ret = wolfSSL_SetLoggingCb(Logging_cb); if (ret == 0) { if (wolfSSL_GetLoggingCb() == NULL) { ret = 0; @@ -29213,8 +29212,6 @@ static int test_wolfSSL_GetLoggingCb (void) } } - - printf(resultFmt, ret == 0 ? passed : failed); return ret; From 8728eaf93f03e0ef41cfdef49cd8d20d1be70132 Mon Sep 17 00:00:00 2001 From: Ethan Looney Date: Fri, 30 Oct 2020 13:19:12 -0600 Subject: [PATCH 3/6] Removed duplicate return check and added return check --- tests/api.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/api.c b/tests/api.c index a742b666f..864d999f0 100644 --- a/tests/api.c +++ b/tests/api.c @@ -29202,10 +29202,10 @@ static int test_wolfSSL_GetLoggingCb (void) } #endif if (ret == 0) { + if (wolfSSL_GetLoggingCb() == NULL) { + ret = 0; + } if (ret == 0) { - if (wolfSSL_GetLoggingCb() == NULL) { - ret = 0; - } if (wolfSSL_GetLoggingCb() != NULL) { ret = -1; } From 48073fb678096bd0e9f79fe4d7b93289467640ce Mon Sep 17 00:00:00 2001 From: Ethan Looney Date: Mon, 2 Nov 2020 14:22:01 -0700 Subject: [PATCH 4/6] Removed unnecessary test --- tests/api.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/api.c b/tests/api.c index 864d999f0..6f10cc61b 100644 --- a/tests/api.c +++ b/tests/api.c @@ -29205,11 +29205,6 @@ static int test_wolfSSL_GetLoggingCb (void) if (wolfSSL_GetLoggingCb() == NULL) { ret = 0; } - if (ret == 0) { - if (wolfSSL_GetLoggingCb() != NULL) { - ret = -1; - } - } } printf(resultFmt, ret == 0 ? passed : failed); From 06f1a1870d59d1db2a0f0040c6762e24f97b070b Mon Sep 17 00:00:00 2001 From: Ethan Looney Date: Thu, 5 Nov 2020 13:05:15 -0700 Subject: [PATCH 5/6] Added inverse case --- tests/api.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/api.c b/tests/api.c index 6f10cc61b..591a1a316 100644 --- a/tests/api.c +++ b/tests/api.c @@ -29205,6 +29205,9 @@ static int test_wolfSSL_GetLoggingCb (void) if (wolfSSL_GetLoggingCb() == NULL) { ret = 0; } + if (wolfSSL_GetLoggingCb() != NULL) { + ret = -1; + } } printf(resultFmt, ret == 0 ? passed : failed); From 232ac03bbe3a6d70718761b453eaceadcf66e25c Mon Sep 17 00:00:00 2001 From: Ethan Looney Date: Thu, 5 Nov 2020 14:38:23 -0700 Subject: [PATCH 6/6] Changed it to only the inverse --- tests/api.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/api.c b/tests/api.c index 591a1a316..43142ca97 100644 --- a/tests/api.c +++ b/tests/api.c @@ -29202,9 +29202,6 @@ static int test_wolfSSL_GetLoggingCb (void) } #endif if (ret == 0) { - if (wolfSSL_GetLoggingCb() == NULL) { - ret = 0; - } if (wolfSSL_GetLoggingCb() != NULL) { ret = -1; }