Skip to content

Commit 6bae22d

Browse files
nvlsianpucarlescufi
authored andcommitted
tests/subsys/fs/nvs: extend entry delete test
Extended case for testing deletion of the first entry while it is the most recent one. This extension allow to reproduce issue #18813 and shows that the bugfix works well. Signed-off-by: Andrzej Puzdrowski <[email protected]>
1 parent 6f5dc33 commit 6bae22d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/subsys/fs/nvs/src/main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,18 @@ void test_delete(void)
556556

557557
zassert_true(len == sizeof(filling_id), "nvs_write failed: %d",
558558
len);
559+
560+
if (filling_id != 0) {
561+
continue;
562+
}
563+
564+
/* delete the first entry while it is the most recent one */
565+
err = nvs_delete(&fs, filling_id);
566+
zassert_true(err == 0, "nvs_delete call failure: %d", err);
567+
568+
len = nvs_read(&fs, filling_id, &data_read, sizeof(data_read));
569+
zassert_true(len == -ENOENT,
570+
"nvs_read shouldn't found the entry: %d", len);
559571
}
560572

561573
/* delete existing entry */

0 commit comments

Comments
 (0)