From 968336102651a4f17594946fac5fdd55f2d5b556 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Tue, 19 Nov 2024 08:11:52 -0500 Subject: [PATCH] Added ifdef for when we build unit-tests on efr32 --- src/platform/tests/TestSilabsTracing.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/platform/tests/TestSilabsTracing.cpp b/src/platform/tests/TestSilabsTracing.cpp index d5170ac9eb..f54d77809d 100644 --- a/src/platform/tests/TestSilabsTracing.cpp +++ b/src/platform/tests/TestSilabsTracing.cpp @@ -39,6 +39,10 @@ #include +#ifdef SILABS_LOG_ENABLED +#include +#endif + using namespace chip; using namespace chip::Logging; using namespace chip::System; @@ -49,13 +53,17 @@ using namespace chip::Tracing::Silabs; namespace { chip::System::Clock::Internal::MockClock gMockClock; chip::System::Clock::ClockBase * gRealClock; +#ifndef SILABS_LOG_ENABLED bool logInitialized = false; +#endif } // namespace +#ifndef SILABS_LOG_ENABLED bool isLogInitialized() { return logInitialized; } +#endif class TestSilabsTracing : public ::testing::Test { @@ -610,7 +618,12 @@ TEST_F(TestSilabsTracing, TestLogs) { gMockClock.SetMonotonic(0_ms64); SilabsTracer::Instance().Init(); - logInitialized = true; + +#ifndef SILABS_LOG_ENABLED + logInitialized = true; +#else + silabsInitLog(); +#endif size_t traceCount = 0; // Simulate OTA steps @@ -759,4 +772,4 @@ TEST_F(TestSilabsTracing, TestBufferBusting) // Flush all operations EXPECT_EQ(SilabsTracer::Instance().TraceBufferFlushAll(), CHIP_NO_ERROR); EXPECT_EQ(0u, SilabsTracer::Instance().GetTimeTracesCount()); -} \ No newline at end of file +}