From 1343d2859eb03229b0b427c09f6e305abc6a19be Mon Sep 17 00:00:00 2001 From: Divya Sampath Kumar Date: Tue, 16 Jan 2024 12:25:46 -0800 Subject: [PATCH 1/3] Switch to ASSERT_EQ from assert to prevent release build optimization --- .github/workflows/ci.yml | 1 + CMakeLists.txt | 5 +++++ src/client/src/InputValidator.c | 2 +- tst/client/ClientTestFixture.h | 11 +++++++++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c743e5adf..c8cd4636a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: - develop - master + - release_build pull_request: branches: - develop 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..0025ca16c 100644 --- a/tst/client/ClientTestFixture.h +++ b/tst/client/ClientTestFixture.h @@ -373,11 +373,15 @@ 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); } + printf("Log string in init: %s\n", logLevelStr); + // Zero things out mClientHandle = INVALID_CLIENT_HANDLE_VALUE; MEMSET(&mDeviceInfo, 0x00, SIZEOF(DeviceInfo)); @@ -598,6 +602,7 @@ class ClientTestBase : public ::testing::Test { // Set the random number generator seed for reproducibility SRAND(12345); // Create the client + DLOGW("In set up: log level: %d", mDeviceInfo.clientInfo.loggerLogLevel); STATUS status = createKinesisVideoClient(&mDeviceInfo, &mClientCallbacks, &mClientHandle); DLOGI("Create client returned status code is %08x\n", status); @@ -924,9 +929,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); } From 902e47926fd54f61824d1700d09e128daa658602 Mon Sep 17 00:00:00 2001 From: Divya Sampath Kumar Date: Tue, 16 Jan 2024 12:46:44 -0800 Subject: [PATCH 2/3] Fix assert --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8cd4636a..c743e5adf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,6 @@ on: branches: - develop - master - - release_build pull_request: branches: - develop From bde4c79b30c0d26a637634b79de691958f203a03 Mon Sep 17 00:00:00 2001 From: Divya Sampath Kumar Date: Tue, 16 Jan 2024 13:05:29 -0800 Subject: [PATCH 3/3] Cleanup log statements --- tst/client/ClientTestFixture.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/tst/client/ClientTestFixture.h b/tst/client/ClientTestFixture.h index 0025ca16c..890755c46 100644 --- a/tst/client/ClientTestFixture.h +++ b/tst/client/ClientTestFixture.h @@ -380,8 +380,6 @@ class ClientTestBase : public ::testing::Test { ASSERT_EQ(retStatus, STATUS_SUCCESS); } - printf("Log string in init: %s\n", logLevelStr); - // Zero things out mClientHandle = INVALID_CLIENT_HANDLE_VALUE; MEMSET(&mDeviceInfo, 0x00, SIZEOF(DeviceInfo)); @@ -602,7 +600,6 @@ class ClientTestBase : public ::testing::Test { // Set the random number generator seed for reproducibility SRAND(12345); // Create the client - DLOGW("In set up: log level: %d", mDeviceInfo.clientInfo.loggerLogLevel); STATUS status = createKinesisVideoClient(&mDeviceInfo, &mClientCallbacks, &mClientHandle); DLOGI("Create client returned status code is %08x\n", status);