From 1171416e8d6d496e89a13352c467777e8c227e46 Mon Sep 17 00:00:00 2001 From: "lee.fordyce" Date: Thu, 13 Jun 2024 14:51:31 -0600 Subject: [PATCH] fix: linting, debug flag for tests --- include/packager/live_packager_export.h | 1 - packager/CMakeLists.txt | 5 +++++ packager/live_packager_test.cc | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/packager/live_packager_export.h b/include/packager/live_packager_export.h index 841569cb56..2573ecd46b 100644 --- a/include/packager/live_packager_export.h +++ b/include/packager/live_packager_export.h @@ -138,7 +138,6 @@ typedef enum LogSeverity { FATAL = 3, } LogSeverity_t; - /// Enable general logging void lp_initializeLog(LogSeverity_t sev); /// Capture detailed logging messages diff --git a/packager/CMakeLists.txt b/packager/CMakeLists.txt index 884b9e107c..c74929aeed 100644 --- a/packager/CMakeLists.txt +++ b/packager/CMakeLists.txt @@ -220,6 +220,11 @@ target_link_libraries(packager_test # Disabled by default, otherwise build live packager unit tests if BUILD_LIVE_TEST is on. if(BUILD_LIVE_TEST AND NOT MSVC) + set(IS_DEBUG_BUILD CMAKE_BUILD_TYPE STREQUAL "Debug") + # Indication to the code that this is a debug build + if (${IS_DEBUG_BUILD}) + add_compile_definitions(__DEBUG__) + endif () add_executable(live_packager_test live_packager_test.cc ) diff --git a/packager/live_packager_test.cc b/packager/live_packager_test.cc index bfef17eb94..4145672aa3 100644 --- a/packager/live_packager_test.cc +++ b/packager/live_packager_test.cc @@ -1562,11 +1562,20 @@ TEST(LivePackagerLoggingTest, InvalidDecryptKeyID) { SegmentBuffer out; ASSERT_NE(Status::OK, live_packager.Package(init_seg, media_seg, out)); +#ifdef __DEBUG__ const std::vector expected_errors = { - "(ERROR): Error retrieving decryption key: 14 (INTERNAL_ERROR): Key for key_id=00000000621f2afe7ab2c868d5fd2e2e was not found.", - "(ERROR): Cannot decrypt samples.", - "(ERROR): Error while parsing MP4", + "(ERROR): Error retrieving decryption key: 14 (INTERNAL_ERROR): Key for " + "key_id=00000000621f2afe7ab2c868d5fd2e2e was not found.", + "(ERROR): Cannot decrypt samples.", + "(ERROR): Error while parsing MP4", }; +#else + const std::vector expected_errors = { + "(ERROR): Error retrieving decryption key: 14 (INTERNAL_ERROR): Key for " + "key_id=00000000621f2afe7ab2c868d5fd2e2e was not found.", + "(ERROR): Cannot decrypt samples.", + }; +#endif int num_errors = 0; const auto messages = lp_getErrorMessages(&num_errors);