Skip to content

Commit b0c0fc9

Browse files
committed
unittests: Reduce runtime of TDBStoreModuleTest.corrupted_set_deinit_init_get
Instead of performing 10,000 "set, deinit, get" operations, let's just perform 100. This reduces test time from 4.8s to 0.02s.
1 parent 2e75d18 commit b0c0fc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

storage/kvstore/tdbstore/tests/UNITTESTS/TDBStore/moduletest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ TEST_F(TDBStoreModuleTest, corrupted_set_deinit_init_get)
9999

100100
srand(0); // Prefer to have always the same pattern
101101

102-
for (int i = 0; i < 100; ++i) {
102+
for (int i = 0; i < 10; ++i) {
103103
EXPECT_EQ(tdb.deinit(), MBED_SUCCESS);
104104
// Corrupt the first part of the storage
105105
for (int j = 0; j < heap.size() / BLOCK_SIZE / 2; j++) {
@@ -109,7 +109,7 @@ TEST_F(TDBStoreModuleTest, corrupted_set_deinit_init_get)
109109
EXPECT_EQ(heap.program(block, BLOCK_SIZE * j, BLOCK_SIZE), MBED_SUCCESS);
110110
}
111111
EXPECT_EQ(tdb.init(), MBED_SUCCESS);
112-
for (int j = 0; j < 100; ++j) {
112+
for (int j = 0; j < 10; ++j) {
113113
// Use random data, so the data has to be updated
114114
EXPECT_EQ(tdb.set("key", block + j, 50, 0), MBED_SUCCESS);
115115
EXPECT_EQ(tdb.deinit(), MBED_SUCCESS);

0 commit comments

Comments
 (0)