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:
Angus Gratton 2021-02-23 10:40:17 +00:00
commit 608f9471cb
2 changed files with 19 additions and 13 deletions

View File

@ -24,6 +24,8 @@ test_nvs_coverage:
script:
- cd components/nvs_flash/test_nvs_host
- 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:
extends: .host_test_template

View File

@ -1220,9 +1220,9 @@ TEST_CASE("nvs api tests, starting with random data in flash", "[nvs][long]")
nvs_close(handle_2);
}
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);
@ -1519,17 +1519,16 @@ TEST_CASE("test recovery from sudden poweroff", "[long][nvs][recovery][monkey]")
gen.seed(seed);
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;
int lastPercent = -1;
for (uint32_t errDelay = 0; ; ++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.clearStats();
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,
NVS_FLASH_SECTOR,
NVS_FLASH_SECTOR_COUNT_MIN) == ESP_OK) {
auto res = ESP_ERR_FLASH_OP_FAIL;
if (nvs_open("namespace1", NVS_READWRITE, &handle) == ESP_OK) {
if(test.doRandomThings(handle, gen, count) != ESP_ERR_FLASH_OP_FAIL) {
nvs_close(handle);
break;
}
res = test.doRandomThings(handle, gen, count);
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;
}
}
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_CASE("test for memory leaks in open/set", "[leaks]")
{
PartitionEmulationFixture f(0, 10);