From 792e0db5494f8909a839e84d8d9e8b7228819fd6 Mon Sep 17 00:00:00 2001 From: Divya Sampath Kumar Date: Tue, 16 Jan 2024 18:21:40 -0500 Subject: [PATCH] Release build (#237) * Switch to ASSERT_EQ from assert to prevent release build optimization * Fix assert * Cleanup log statements --- CMakeLists.txt | 5 +++++ src/client/src/InputValidator.c | 2 +- tst/client/ClientTestFixture.h | 8 ++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0514f2720..88482fc26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,11 @@ add_definitions(-DSDK_VERSION=\"${GIT_COMMIT_HASH}\") add_definitions(-DDETECTED_GIT_HASH) +if(NOT CMAKE_BUILD_TYPE) + message(STATUS "Setting CMAKE_BUILD_TYPE to Release by default") + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE) +endif() + if(BUILD_SHARED_LIBS) set(LIBTYPE SHARED) elseif() diff --git a/src/client/src/InputValidator.c b/src/client/src/InputValidator.c index 5395c1abd..6a1046e68 100644 --- a/src/client/src/InputValidator.c +++ b/src/client/src/InputValidator.c @@ -372,7 +372,7 @@ VOID fixupClientInfo(PClientInfo pClientInfo, PClientInfo pOrigClientInfo) pClientInfo->offlineBufferAvailabilityTimeout = MAX_BLOCKING_PUT_WAIT; } - if (pClientInfo->loggerLogLevel == 0 || pClientInfo->loggerLogLevel > LOG_LEVEL_SILENT) { + if (pClientInfo->loggerLogLevel == 0 || pClientInfo->loggerLogLevel > LOG_LEVEL_PROFILE) { pClientInfo->loggerLogLevel = LOG_LEVEL_WARN; } diff --git a/tst/client/ClientTestFixture.h b/tst/client/ClientTestFixture.h index 334a245e6..890755c46 100644 --- a/tst/client/ClientTestFixture.h +++ b/tst/client/ClientTestFixture.h @@ -373,9 +373,11 @@ class ClientTestBase : public ::testing::Test { void initTestMembers() { UINT32 logLevel = 0; + STATUS retStatus = STATUS_SUCCESS; auto logLevelStr = GETENV("AWS_KVS_LOG_LEVEL"); if (logLevelStr != NULL) { - assert(STRTOUI32(logLevelStr, NULL, 10, &logLevel) == STATUS_SUCCESS); + retStatus = STRTOUI32(logLevelStr, NULL, 10, &logLevel); + ASSERT_EQ(retStatus, STATUS_SUCCESS); } // Zero things out @@ -924,9 +926,11 @@ class ClientTestBase : public ::testing::Test { virtual void SetUpWithoutClientCreation() { UINT32 logLevel = 0; + STATUS retStatus = STATUS_SUCCESS; auto logLevelStr = GETENV("AWS_KVS_LOG_LEVEL"); if (logLevelStr != NULL) { - assert(STRTOUI32(logLevelStr, NULL, 10, &logLevel) == STATUS_SUCCESS); + retStatus = STRTOUI32(logLevelStr, NULL, 10, &logLevel); + ASSERT_EQ(retStatus, STATUS_SUCCESS); SET_LOGGER_LOG_LEVEL(logLevel); }