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 +}