FileSystemStore unit test: remove erased_set_get test

The "erased_set_get" test case deinits `FileSystemStore`, erases the
block device, and reinits `FileSystemStore`. This of course fails,
because `BlockDevice::erase()` removes all stored data including the
format of the `FileSystem` (middle layer), unless the particular type
of block device has a no-op erase implementation.

Note: Previously `HeapBlockDevice::erase()` was essentially a no-op
so this test case did not fail. We recently added the freeing of heap
memory and it uncovered the problem.
pull/14483/head
Lingkai Dong 2021-04-01 10:43:01 +01:00
parent 6b5e467f96
commit e8070514b1
1 changed files with 0 additions and 15 deletions

View File

@ -67,21 +67,6 @@ TEST_F(FileSystemStoreModuleTest, set_get)
EXPECT_STREQ("data", buf);
}
TEST_F(FileSystemStoreModuleTest, erased_set_get)
{
EXPECT_EQ(store->deinit(), MBED_SUCCESS);
EXPECT_EQ(heap.init(), MBED_SUCCESS);
EXPECT_EQ(heap.erase(0, heap.size()), MBED_SUCCESS);
EXPECT_EQ(heap.deinit(), MBED_SUCCESS);
EXPECT_EQ(store->init(), MBED_SUCCESS);
char buf[100];
size_t size;
EXPECT_EQ(store->set("key", "data", 5, 0), MBED_SUCCESS);
EXPECT_EQ(store->get("key", buf, 100, &size), MBED_SUCCESS);
EXPECT_EQ(size, 5);
EXPECT_STREQ("data", buf);
}
TEST_F(FileSystemStoreModuleTest, set_deinit_init_get)
{
char buf[100];