From 68ab3a55a139d35e75062cba1e61eb5b99f40d6d Mon Sep 17 00:00:00 2001 From: Esko Dijk Date: Fri, 10 Apr 2026 12:16:27 +0200 Subject: [PATCH] [tests] prevent settings/flash retaining between unit tests (#12875) Issue: state was retained between OT instances in the unit test platform, across tests. This commit adds settings and flash clearing as part of testInitInstance(). --- tests/unit/test_platform.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/unit/test_platform.cpp b/tests/unit/test_platform.cpp index 055693af9..7079db9d7 100644 --- a/tests/unit/test_platform.cpp +++ b/tests/unit/test_platform.cpp @@ -33,6 +33,8 @@ #include #include +#include + #ifdef OPENTHREAD_CONFIG_BLE_TCAT_ENABLE #include #include @@ -50,6 +52,12 @@ ot::Instance *testInitInstance(void) { otInstance *instance = nullptr; + settings.clear(); + for (uint8_t idx = 0; idx < FLASH_SWAP_NUM; idx++) + { + otPlatFlashErase(nullptr, idx); + } + #if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE #if OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE instance = otInstanceInitMultiple(0);