From 9241137be801d7a30648d1c1dd486a13de327088 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Sun, 17 Dec 2023 22:35:47 -0500 Subject: [PATCH] Fix TestPlatformMgr crash (#31052) - TestPlatformMgr did not set a CommissionableDataProvider. - Recent code changes make that test hit codepaths that try to setup BLE advertisement on Linux platform when default-built. - This PR adds a CommissionableDataProvider instance for the whole test with default test values. Tests now pass. Fixes #30640 --- src/platform/tests/TestPlatformMgr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/platform/tests/TestPlatformMgr.cpp b/src/platform/tests/TestPlatformMgr.cpp index 09acb8a9d046f8..89bad3b4c535f0 100644 --- a/src/platform/tests/TestPlatformMgr.cpp +++ b/src/platform/tests/TestPlatformMgr.cpp @@ -37,6 +37,7 @@ #include #include +#include using namespace chip; using namespace chip::Logging; @@ -277,6 +278,12 @@ int TestPlatformMgr_Setup(void * inContext) CHIP_ERROR error = chip::Platform::MemoryInit(); if (error != CHIP_NO_ERROR) return FAILURE; + + // Setup a fake commissionable data provider since required by internals of several + // Device/SystemLayer components. + static chip::DeviceLayer::TestOnlyCommissionableDataProvider commissionable_data_provider; + chip::DeviceLayer::SetCommissionableDataProvider(&commissionable_data_provider); + return SUCCESS; }