From b582e152ea6bba65f124def4d6c67803d270657e Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 4 Oct 2021 14:52:05 -0600 Subject: [PATCH] add test case max error queue size --- tests/api.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/api.c b/tests/api.c index 49544720d..56bc3f5e6 100644 --- a/tests/api.c +++ b/tests/api.c @@ -36022,6 +36022,19 @@ static THREAD_RETURN WOLFSSL_THREAD test_logging(void* args) } AssertIntEQ(errorCount, ERROR_COUNT); + /* test max queue behavior, trying to add an arbitrary 3 errors over */ + errorCount = 0; + for (i = 0; i < ERROR_QUEUE_MAX + 3; i++) + ERR_put_error(ERR_LIB_PEM, SYS_F_ACCEPT, -990 - i, __FILE__, __LINE__); + + while ((err = ERR_get_error_line(&file, &line))) { + AssertIntEQ(err, 990 + errorCount); + errorCount++; + } + + /* test that the 3 errors over the max were dropped */ + AssertIntEQ(errorCount, ERROR_QUEUE_MAX); + return 0; } #endif