Skip to content

Commit

Permalink
Added ifdef for when we build unit-tests on efr32
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Nov 19, 2024
1 parent d045a78 commit 9683361
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/platform/tests/TestSilabsTracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@

#include <platform/silabs/tracing/SilabsTracing.h>

#ifdef SILABS_LOG_ENABLED
#include <platform/silabs/silabs_utils.h>
#endif

using namespace chip;
using namespace chip::Logging;
using namespace chip::System;
Expand All @@ -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
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 9683361

Please sign in to comment.