mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-19 14:26:01 -04:00
Merge branch 'bugfix/test_nvs_host_cleanup' into 'master'
nvs_flash: Fix the random data test cleanup stage Closes IDFCI-241 See merge request espressif/esp-idf!11659
This commit is contained in:
commit
608f9471cb
@ -24,6 +24,8 @@ test_nvs_coverage:
|
|||||||
script:
|
script:
|
||||||
- cd components/nvs_flash/test_nvs_host
|
- cd components/nvs_flash/test_nvs_host
|
||||||
- make coverage_report
|
- make coverage_report
|
||||||
|
# the 'long' host tests take approx 11 hours on our current runners. Adding some margin here for possible CPU contention
|
||||||
|
timeout: 18 hours
|
||||||
|
|
||||||
test_partition_table_on_host:
|
test_partition_table_on_host:
|
||||||
extends: .host_test_template
|
extends: .host_test_template
|
||||||
|
@ -1220,9 +1220,9 @@ TEST_CASE("nvs api tests, starting with random data in flash", "[nvs][long]")
|
|||||||
nvs_close(handle_2);
|
nvs_close(handle_2);
|
||||||
}
|
}
|
||||||
nvs_close(handle_1);
|
nvs_close(handle_1);
|
||||||
}
|
|
||||||
|
|
||||||
TEST_ESP_OK(nvs_flash_deinit_partition(NVS_DEFAULT_PART_NAME));
|
TEST_ESP_OK(nvs_flash_deinit_partition(f.part.get_partition_name()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
extern "C" void nvs_dump(const char *partName);
|
extern "C" void nvs_dump(const char *partName);
|
||||||
|
|
||||||
@ -1519,17 +1519,16 @@ TEST_CASE("test recovery from sudden poweroff", "[long][nvs][recovery][monkey]")
|
|||||||
gen.seed(seed);
|
gen.seed(seed);
|
||||||
const size_t iter_count = 2000;
|
const size_t iter_count = 2000;
|
||||||
|
|
||||||
PartitionEmulationFixture f(0, 10);
|
|
||||||
|
|
||||||
const uint32_t NVS_FLASH_SECTOR = 2;
|
|
||||||
const uint32_t NVS_FLASH_SECTOR_COUNT_MIN = 8;
|
|
||||||
|
|
||||||
f.emu.setBounds(NVS_FLASH_SECTOR, NVS_FLASH_SECTOR + NVS_FLASH_SECTOR_COUNT_MIN);
|
|
||||||
|
|
||||||
size_t totalOps = 0;
|
size_t totalOps = 0;
|
||||||
int lastPercent = -1;
|
int lastPercent = -1;
|
||||||
for (uint32_t errDelay = 0; ; ++errDelay) {
|
for (uint32_t errDelay = 0; ; ++errDelay) {
|
||||||
INFO(errDelay);
|
INFO(errDelay);
|
||||||
|
|
||||||
|
PartitionEmulationFixture f(0, 10);
|
||||||
|
const uint32_t NVS_FLASH_SECTOR = 2;
|
||||||
|
const uint32_t NVS_FLASH_SECTOR_COUNT_MIN = 8;
|
||||||
|
f.emu.setBounds(NVS_FLASH_SECTOR, NVS_FLASH_SECTOR + NVS_FLASH_SECTOR_COUNT_MIN);
|
||||||
|
|
||||||
f.emu.randomize(seed);
|
f.emu.randomize(seed);
|
||||||
f.emu.clearStats();
|
f.emu.clearStats();
|
||||||
f.emu.failAfter(errDelay);
|
f.emu.failAfter(errDelay);
|
||||||
@ -1550,14 +1549,18 @@ TEST_CASE("test recovery from sudden poweroff", "[long][nvs][recovery][monkey]")
|
|||||||
if (NVSPartitionManager::get_instance()->init_custom(&f.part,
|
if (NVSPartitionManager::get_instance()->init_custom(&f.part,
|
||||||
NVS_FLASH_SECTOR,
|
NVS_FLASH_SECTOR,
|
||||||
NVS_FLASH_SECTOR_COUNT_MIN) == ESP_OK) {
|
NVS_FLASH_SECTOR_COUNT_MIN) == ESP_OK) {
|
||||||
|
auto res = ESP_ERR_FLASH_OP_FAIL;
|
||||||
if (nvs_open("namespace1", NVS_READWRITE, &handle) == ESP_OK) {
|
if (nvs_open("namespace1", NVS_READWRITE, &handle) == ESP_OK) {
|
||||||
if(test.doRandomThings(handle, gen, count) != ESP_ERR_FLASH_OP_FAIL) {
|
res = test.doRandomThings(handle, gen, count);
|
||||||
nvs_close(handle);
|
nvs_close(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_ESP_OK(nvs_flash_deinit_partition(NVS_DEFAULT_PART_NAME));
|
||||||
|
if (res != ESP_ERR_FLASH_OP_FAIL) {
|
||||||
|
// This means we got to the end without an error due to f.emu.failAfter(), therefore errDelay
|
||||||
|
// is high enough that we're not triggering it any more, therefore we're done
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nvs_close(handle);
|
|
||||||
}
|
|
||||||
TEST_ESP_OK(nvs_flash_deinit_partition(NVS_DEFAULT_PART_NAME));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ESP_OK(NVSPartitionManager::get_instance()->init_custom(&f.part,
|
TEST_ESP_OK(NVSPartitionManager::get_instance()->init_custom(&f.part,
|
||||||
@ -1575,6 +1578,7 @@ TEST_CASE("test recovery from sudden poweroff", "[long][nvs][recovery][monkey]")
|
|||||||
TEST_ESP_OK(nvs_flash_deinit_partition(NVS_DEFAULT_PART_NAME));
|
TEST_ESP_OK(nvs_flash_deinit_partition(NVS_DEFAULT_PART_NAME));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("test for memory leaks in open/set", "[leaks]")
|
TEST_CASE("test for memory leaks in open/set", "[leaks]")
|
||||||
{
|
{
|
||||||
PartitionEmulationFixture f(0, 10);
|
PartitionEmulationFixture f(0, 10);
|
||||||
|
Loading…
Reference in New Issue
Block a user