From e8070514b16182a5b67627a563131ae5c4abfd1e Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Thu, 1 Apr 2021 10:43:01 +0100 Subject: [PATCH] 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. --- .../UNITTESTS/FileSystemStore/moduletest.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/storage/kvstore/filesystemstore/tests/UNITTESTS/FileSystemStore/moduletest.cpp b/storage/kvstore/filesystemstore/tests/UNITTESTS/FileSystemStore/moduletest.cpp index 2896a6a846..3c70b0911e 100644 --- a/storage/kvstore/filesystemstore/tests/UNITTESTS/FileSystemStore/moduletest.cpp +++ b/storage/kvstore/filesystemstore/tests/UNITTESTS/FileSystemStore/moduletest.cpp @@ -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];