Skip to content

Commit b73fb75

Browse files
committed
[kvdb] fix testcase running error on ci env
1 parent d3eaa54 commit b73fb75

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

tests/fdb_kvdb_tc.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static int iter_all_kv(fdb_kvdb_t db, struct test_kv *kv_tbl)
224224
return index;
225225
}
226226

227-
static void test_fdb_by_kvs(struct test_kv *kv_tbl, size_t len)
227+
static void test_fdb_by_kvs(const struct test_kv *kv_tbl, size_t len)
228228
{
229229
struct fdb_blob blob_obj, * blob = &blob_obj;
230230
static struct test_kv saved_kv_tbl[TEST_KV_NUM] = { 0 };
@@ -274,16 +274,15 @@ static void test_fdb_gc(void)
274274
* | | | | |
275275
* +---------------------------------------------------------+
276276
*/
277-
struct test_kv kv_tbl[TEST_KV_NUM] = {
277+
const struct test_kv kv_tbl[] = {
278278
{"kv0", "0", 0, 0, 1},
279279
{"kv1", "1", 0, 0, 1},
280280
{"kv2", "2", 0, 0, 1},
281281
{"kv3", "3", 1, 0, 1},
282282
};
283283

284-
test_fdb_by_kvs(kv_tbl, sizeof(kv_tbl)/sizeof(kv_tbl[0]));
284+
test_fdb_by_kvs(kv_tbl, sizeof(kv_tbl) / sizeof(kv_tbl[0]));
285285
uassert_true(RT_ALIGN_DOWN(test_kvdb.parent.oldest_addr, TEST_KVDB_SECTOR_SIZE) == TEST_KVDB_SECTOR_SIZE * 0);
286-
287286
}
288287

289288
{
@@ -309,7 +308,7 @@ static void test_fdb_gc(void)
309308
* | | | | |
310309
* +--------------+-------------+--------------+-------------+
311310
*/
312-
struct test_kv kv_tbl[TEST_KV_NUM] = {
311+
const struct test_kv kv_tbl[] = {
313312
{"kv1", "1", 0, 0, 0},
314313
{"kv2", "2", 0, 0, 0},
315314
{"kv0", "00", 1, 0, 1},
@@ -345,7 +344,7 @@ static void test_fdb_gc(void)
345344
* +--------------+-------------+--------------+-------------+
346345
*
347346
* step2.1: change kv3, start GC, only GC 1 sector on FlashDB V1.2
348-
*
347+
*
349348
* +--------------+-------------+--------------+-------------+
350349
* | sector0 | sector1 | sector2 | sector3 |
351350
* | empty | using | using | empty |
@@ -364,9 +363,9 @@ static void test_fdb_gc(void)
364363
* | +----------------------------+ |
365364
* | | | | |
366365
* +--------------+-------------+--------------+-------------+
367-
*
366+
*
368367
* step2.2: change kv3
369-
*
368+
*
370369
* +--------------+-------------+--------------+-------------+
371370
* | sector0 | sector1 | sector2 | sector3 |
372371
* | empty | using | using | using |
@@ -387,7 +386,7 @@ static void test_fdb_gc(void)
387386
* +--------------+-------------+--------------+-------------+
388387
*
389388
*/
390-
struct test_kv kv_tbl[TEST_KV_NUM] = {
389+
const struct test_kv kv_tbl[] = {
391390
{"kv0", "000", 2, 0, 1},
392391
{"kv1", "111", 2, 0, 1},
393392
{"kv2", "222", 2, 0, 1},
@@ -485,7 +484,7 @@ static void test_fdb_gc(void)
485484
* | | | | |
486485
* +--------------+-------------+--------------+-------------+
487486
*/
488-
struct test_kv kv_tbl[TEST_KV_NUM] = {
487+
const struct test_kv kv_tbl[] = {
489488
{"kv0", "0000", 3, 0, 1},
490489
{"kv1", "1111", 3, 0, 1},
491490
{"kv2", "2222", 0, 0, 1},
@@ -496,14 +495,12 @@ static void test_fdb_gc(void)
496495
uassert_true(RT_ALIGN_DOWN(test_kvdb.parent.oldest_addr, TEST_KVDB_SECTOR_SIZE) == TEST_KVDB_SECTOR_SIZE * 2);
497496
}
498497

499-
{
500-
/* check the oldest address is already right when kvdb reinit */
501-
extern void test_fdb_kvdb_deinit(void);
502-
test_fdb_kvdb_deinit();
503-
test_fdb_kvdb_init();
498+
/* check the oldest address is already right when kvdb reinit */
499+
extern void test_fdb_kvdb_deinit(void);
500+
test_fdb_kvdb_deinit();
501+
test_fdb_kvdb_init();
504502

505-
uassert_true(RT_ALIGN_DOWN(test_kvdb.parent.oldest_addr, TEST_KVDB_SECTOR_SIZE) == TEST_KVDB_SECTOR_SIZE * 2);
506-
}
503+
uassert_true(RT_ALIGN_DOWN(test_kvdb.parent.oldest_addr, TEST_KVDB_SECTOR_SIZE) == TEST_KVDB_SECTOR_SIZE * 2);
507504
}
508505

509506
static void test_fdb_kvdb_set_default(void)

0 commit comments

Comments
 (0)