Skip to content

Commit bfbc188

Browse files
committed
KVStore general_tests_phase_1/2: flash simulation no longer required
1 parent 2064ade commit bfbc188

File tree

2 files changed

+2
-40
lines changed
  • storage/kvstore/tests/TESTS/kvstore

2 files changed

+2
-40
lines changed

storage/kvstore/tests/TESTS/kvstore/general_tests_phase_1/main.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "Thread.h"
2121
#endif
2222
#include "mbed_error.h"
23-
#include "FlashSimBlockDevice.h"
2423
#include "SlicingBlockDevice.h"
2524
#include "greentea-client/test_env.h"
2625
#include "unity/unity.h"
@@ -53,7 +52,6 @@ KVStore::iterator_t kvstore_it;
5352
KVStore *kvstore = NULL;
5453
FileSystem *fs = NULL;
5554
BlockDevice *bd = NULL;
56-
FlashSimBlockDevice *flash_bd = NULL;
5755
SlicingBlockDevice *ul_bd = NULL, *rbp_bd = NULL;
5856

5957
enum kv_setup {
@@ -106,12 +104,7 @@ static void kvstore_init()
106104
TEST_SKIP_UNLESS(MBED_CONF_TARGET_INTERNAL_FLASH_UNIFORM_SECTORS ||
107105
(MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE != 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS != 0xFFFFFFFF))
108106
#endif
109-
if (erase_val == -1) {
110-
flash_bd = new FlashSimBlockDevice(bd);
111-
kvstore = new TDBStore(flash_bd);
112-
} else {
113-
kvstore = new TDBStore(bd);
114-
}
107+
kvstore = new TDBStore(bd);
115108
}
116109
if (kv_setup == FSStoreSet) {
117110
fs = FileSystem::get_default_instance();
@@ -127,10 +120,6 @@ static void kvstore_init()
127120
#if SECURESTORE_ENABLED
128121
if (kv_setup == SecStoreSet) {
129122
sec_bd = bd;
130-
if (erase_val == -1) {
131-
flash_bd = new FlashSimBlockDevice(bd);
132-
sec_bd = flash_bd;
133-
}
134123
res = sec_bd->init();
135124
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, res);
136125

@@ -175,21 +164,13 @@ static void kvstore_deinit()
175164
res = kvstore->deinit();
176165
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, res);
177166

178-
if (kv_setup == TDBStoreSet) {
179-
if (erase_val == -1) {
180-
delete flash_bd;
181-
}
182-
}
183167
if (kv_setup == FSStoreSet) {
184168
fs = FileSystem::get_default_instance();
185169
TEST_SKIP_UNLESS(fs != NULL);
186170
res = fs->unmount();
187171
TEST_ASSERT_EQUAL_ERROR_CODE(0, res);
188172
}
189173
if (kv_setup == SecStoreSet) {
190-
if (erase_val == -1) {
191-
delete flash_bd;
192-
}
193174
delete ul_bd;
194175
delete rbp_bd;
195176
}

storage/kvstore/tests/TESTS/kvstore/general_tests_phase_2/main.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "securestore/SecureStore.h"
1818
#include "tdbstore/TDBStore.h"
1919
#include "mbed_error.h"
20-
#include "FlashSimBlockDevice.h"
2120
#include "SlicingBlockDevice.h"
2221
#include "greentea-client/test_env.h"
2322
#include "unity/unity.h"
@@ -48,7 +47,6 @@ KVStore::iterator_t kvstore_it;
4847
KVStore *kvstore = NULL;
4948
FileSystem *fs = NULL;
5049
BlockDevice *bd = NULL;
51-
FlashSimBlockDevice *flash_bd = NULL;
5250
SlicingBlockDevice *ul_bd = NULL, *rbp_bd = NULL;
5351

5452
enum kv_setup {
@@ -102,12 +100,7 @@ static void kvstore_init()
102100
TEST_SKIP_UNLESS(MBED_CONF_TARGET_INTERNAL_FLASH_UNIFORM_SECTORS ||
103101
(MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE != 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS != 0xFFFFFFFF))
104102
#endif
105-
if (erase_val == -1) {
106-
flash_bd = new FlashSimBlockDevice(bd);
107-
kvstore = new TDBStore(flash_bd);
108-
} else {
109-
kvstore = new TDBStore(bd);
110-
}
103+
kvstore = new TDBStore(bd);
111104
}
112105
if (kv_setup == FSStoreSet) {
113106
fs = FileSystem::get_default_instance();
@@ -123,10 +116,6 @@ static void kvstore_init()
123116
#if SECURESTORE_ENABLED
124117
if (kv_setup == SecStoreSet) {
125118
sec_bd = bd;
126-
if (erase_val == -1) {
127-
flash_bd = new FlashSimBlockDevice(bd);
128-
sec_bd = flash_bd;
129-
}
130119
res = sec_bd->init();
131120
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, res);
132121

@@ -174,21 +163,13 @@ static void kvstore_deinit()
174163
res = kvstore->deinit();
175164
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, res);
176165

177-
if (kv_setup == TDBStoreSet) {
178-
if (erase_val == -1) {
179-
delete flash_bd;
180-
}
181-
}
182166
if (kv_setup == FSStoreSet) {
183167
fs = FileSystem::get_default_instance();
184168
TEST_SKIP_UNLESS(fs != NULL);
185169
res = fs->unmount();
186170
TEST_ASSERT_EQUAL_ERROR_CODE(0, res);
187171
}
188172
if (kv_setup == SecStoreSet) {
189-
if (erase_val == -1) {
190-
delete flash_bd;
191-
}
192173
delete ul_bd;
193174
delete rbp_bd;
194175
}

0 commit comments

Comments
 (0)