mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[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().
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <openthread/platform/flash.h>
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
|
||||
#include <openthread/tcat.h>
|
||||
#include <openthread/platform/ble.h>
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user