Skip to content

Commit cd53261

Browse files
committed
mtdconfig: modify config names for mtdconfig testcases 2
change nvs module testcase name TESTING_MTD_CONFIG_FAIL_SAFE to TESTING_MTD_CONFIG_NVS and modify the configuration names related to mtdconfig testing. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
1 parent 52a914f commit cd53261

File tree

5 files changed

+53
-53
lines changed

5 files changed

+53
-53
lines changed

testing/fs/mtd_config_fs/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
#
2121
# ##############################################################################
2222

23-
if(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE)
23+
if(CONFIG_TESTING_MTD_CONFIG_NVS)
2424
nuttx_add_application(
2525
NAME
26-
${CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_PROGNAME}
26+
${CONFIG_TESTING_MTD_CONFIG_PROGNAME}
2727
PRIORITY
28-
${CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_PRIORITY}
28+
${CONFIG_TESTING_MTD_CONFIG_PRIORITY}
2929
STACKSIZE
30-
${CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_STACKSIZE}
30+
${CONFIG_TESTING_MTD_CONFIG_STACKSIZE}
3131
MODULE
32-
${CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE}
32+
${CONFIG_TESTING_MTD_CONFIG_NVS}
3333
SRCS
3434
mtd_config_fs_test_main.c)
3535
endif()

testing/fs/mtd_config_fs/Kconfig

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,48 @@
33
# see the file kconfig-language.txt in the NuttX tools repository.
44
#
55

6-
config TESTING_MTD_CONFIG_FAIL_SAFE
6+
config TESTING_MTD_CONFIG_NVS
77
tristate "MTD Config fail-safe storage test"
88
default n
99
depends on MTD_CONFIG_NVS
1010
select MTD_CONFIG_NAMED
1111
---help---
1212
Enable the fail-safe storage test
1313

14-
if TESTING_MTD_CONFIG_FAIL_SAFE
14+
if TESTING_MTD_CONFIG_NVS
1515

16-
config TESTING_MTD_CONFIG_FAIL_SAFE_PROGNAME
16+
config TESTING_MTD_CONFIG_PROGNAME
1717
string "Program name"
1818
default "mtdconfig_fs_test"
1919
---help---
2020
This is the name of the program that will be used when the NSH ELF
2121
program is installed.
2222

23-
config TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME
23+
config TESTING_MTD_CONFIG_MOUNTPT_NAME
2424
string "MTD driver mount pt"
2525
default "/dev/mtdnvs_flash"
2626

27-
config TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_MAXNAME
27+
config TESTING_MTD_CONFIG_MOUNTPT_MAXNAME
2828
int "MTD driver mount pt path len"
2929
default 64
3030

31-
config TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
31+
config TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
3232
int "MTD flash section size"
3333
default 4096
3434

35-
config TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_COUNT
35+
config TESTING_MTD_CONFIG_FLASH_SECTION_COUNT
3636
int "MTD flash section count"
3737
default 3
3838

39-
config TESTING_MTD_CONFIG_FAIL_SAFE_PRIORITY
39+
config TESTING_MTD_CONFIG_PRIORITY
4040
int "MTD nvs test task priority"
4141
default 100
4242

43-
config TESTING_MTD_CONFIG_FAIL_SAFE_STACKSIZE
43+
config TESTING_MTD_CONFIG_STACKSIZE
4444
int "MTD nvs test stack size"
4545
default 4096
4646

47-
config TESTING_MTD_CONFIG_FAIL_SAFE_VERBOSE
47+
config TESTING_MTD_CONFIG_VERBOSE
4848
bool "Verbose output"
4949
default n
5050

testing/fs/mtd_config_fs/Make.defs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
#
2121
############################################################################
2222

23-
ifneq ($(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE),)
23+
ifneq ($(CONFIG_TESTING_MTD_CONFIG_NVS),)
2424
CONFIGURED_APPS += $(APPDIR)/testing/fs/mtd_config_fs
2525
endif

testing/fs/mtd_config_fs/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ include $(APPDIR)/Make.defs
2424

2525
# MTD nvs test application info
2626

27-
PROGNAME = $(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_PROGNAME)
28-
PRIORITY = $(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_PRIORITY)
29-
STACKSIZE = $(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_STACKSIZE)
30-
MODULE = $(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE)
27+
PROGNAME = $(CONFIG_TESTING_MTD_CONFIG_PROGNAME)
28+
PRIORITY = $(CONFIG_TESTING_MTD_CONFIG_PRIORITY)
29+
STACKSIZE = $(CONFIG_TESTING_MTD_CONFIG_STACKSIZE)
30+
MODULE = $(CONFIG_TESTING_MTD_CONFIG_NVS)
3131

3232
# MTD nvs test
3333

testing/fs/mtd_config_fs/mtd_config_fs_test_main.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ begin_packed_struct struct nvs_ate
8181

8282
struct mtdnvs_ctx_s
8383
{
84-
char mountdir[CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_MAXNAME];
84+
char mountdir[CONFIG_TESTING_MTD_CONFIG_MOUNTPT_MAXNAME];
8585
struct mallinfo mmbefore;
8686
struct mallinfo mmprevious;
8787
struct mallinfo mmafter;
@@ -351,7 +351,7 @@ static void show_useage(void)
351351
printf("Usage : mtdconfig_fs_test [OPTION [ARG]] ...\n");
352352
printf("-h show this help statement\n");
353353
printf("-m mount point to be tested e.g. [%s]\n",
354-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME);
354+
CONFIG_TESTING_MTD_CONFIG_MOUNTPT_NAME);
355355
}
356356

357357
/****************************************************************************
@@ -402,12 +402,12 @@ static int setup(struct mtdnvs_ctx_s *ctx)
402402
int ret;
403403
FAR struct inode *sys_node;
404404

405-
ret = find_mtddriver(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME,
405+
ret = find_mtddriver(CONFIG_TESTING_MTD_CONFIG_MOUNTPT_NAME,
406406
&sys_node);
407407
if (ret < 0)
408408
{
409409
printf("ERROR: open %s failed: %d\n",
410-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME, ret);
410+
CONFIG_TESTING_MTD_CONFIG_MOUNTPT_NAME, ret);
411411
return -errno;
412412
}
413413

@@ -608,7 +608,7 @@ static void test_nvs_corrupt_expire(struct mtdnvs_ctx_s *ctx)
608608

609609
printf("%s: test begin\n", __func__);
610610

611-
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME, O_RDWR);
611+
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_MOUNTPT_NAME, O_RDWR);
612612
if (mtd_fd < 0)
613613
{
614614
printf("%s:mtdnvs_register failed, ret=%d\n", __func__, mtd_fd);
@@ -662,7 +662,7 @@ static void test_nvs_corrupt_expire(struct mtdnvs_ctx_s *ctx)
662662
/* set unused flash to 0xff */
663663

664664
for (i = 2 * (strlen(TEST_KEY1) + strlen(TEST_DATA1) + 2) + padding_size;
665-
i < CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
665+
i < CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
666666
- 4 * ate_size; i++)
667667
{
668668
ret = write(mtd_fd, &erase_value, sizeof(erase_value));
@@ -699,7 +699,7 @@ static void test_nvs_corrupt_expire(struct mtdnvs_ctx_s *ctx)
699699
/* write close ate, mark section 0 as closed */
700700

701701
ret = write_close_ate(mtd_fd, ctx,
702-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
702+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
703703
- 4 * ate_size);
704704
if (ret < 0)
705705
{
@@ -798,7 +798,7 @@ static void test_nvs_corrupted_write(struct mtdnvs_ctx_s *ctx)
798798

799799
printf("%s: test begin\n", __func__);
800800

801-
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME, O_RDWR);
801+
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_MOUNTPT_NAME, O_RDWR);
802802
if (mtd_fd < 0)
803803
{
804804
printf("%s:mtdnvs_register failed, ret=%d\n", __func__, mtd_fd);
@@ -854,7 +854,7 @@ static void test_nvs_corrupted_write(struct mtdnvs_ctx_s *ctx)
854854
/* set unused flash to 0xff */
855855

856856
for (i = 2 * (sizeof(key1) + sizeof(wr_buf_1)) + padding_size;
857-
i < CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
857+
i < CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
858858
- 3 * nvs_ate_size(ctx); i++)
859859
{
860860
ret = write(mtd_fd, &erase_value, sizeof(erase_value));
@@ -966,7 +966,7 @@ static void test_nvs_gc(struct mtdnvs_ctx_s *ctx)
966966

967967
size_t kv_size = nvs_align_up(ctx, 44 + 4) + ate_size;
968968
size_t block_max_write_size =
969-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE - ate_size;
969+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE - ate_size;
970970
uint16_t block_max_write_nums = block_max_write_size / kv_size;
971971

972972
const uint16_t max_writes = block_max_write_nums + 1;
@@ -1235,9 +1235,9 @@ static void test_nvs_gc_3sectors(struct mtdnvs_ctx_s *ctx)
12351235

12361236
size_t kv_size = nvs_align_up(ctx, 44 + 4) + ate_size;
12371237
uint16_t max_id =
1238-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE / kv_size;
1238+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE / kv_size;
12391239
const uint16_t max_writes =
1240-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE * 2 / kv_size + 1;
1240+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE * 2 / kv_size + 1;
12411241
const uint16_t max_writes_2 = max_writes + max_id;
12421242
const uint16_t max_writes_3 = max_writes_2 + max_id;
12431243
const uint16_t max_writes_4 = max_writes_3 + max_id;
@@ -1435,7 +1435,7 @@ static void test_nvs_corrupted_sector_close(struct mtdnvs_ctx_s *ctx)
14351435

14361436
printf("%s: test begin\n", __func__);
14371437

1438-
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME, O_RDWR);
1438+
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_MOUNTPT_NAME, O_RDWR);
14391439
if (mtd_fd < 0)
14401440
{
14411441
printf("%s:mtdnvs_register failed, ret=%d\n", __func__, mtd_fd);
@@ -1446,7 +1446,7 @@ static void test_nvs_corrupted_sector_close(struct mtdnvs_ctx_s *ctx)
14461446

14471447
for (loop_section = 0;
14481448
loop_section <
1449-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_COUNT - 1;
1449+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_COUNT - 1;
14501450
loop_section++)
14511451
{
14521452
/* write valid data */
@@ -1474,7 +1474,7 @@ static void test_nvs_corrupted_sector_close(struct mtdnvs_ctx_s *ctx)
14741474
/* set unused flash to 0xff */
14751475

14761476
for (i = 2 * (sizeof(key1) + sizeof(wr_buf));
1477-
i < CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
1477+
i < CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
14781478
- 4 * ate_size; i++)
14791479
{
14801480
ret = write(mtd_fd, &erase_value, sizeof(erase_value));
@@ -1490,7 +1490,7 @@ static void test_nvs_corrupted_sector_close(struct mtdnvs_ctx_s *ctx)
14901490
ret = write_ate(mtd_fd, ctx, key1, sizeof(wr_buf),
14911491
sizeof(wr_buf) + sizeof(key1),
14921492
(loop_section ==
1493-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_COUNT - 2)
1493+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_COUNT - 2)
14941494
? false : true);
14951495
if (ret < 0)
14961496
{
@@ -1512,14 +1512,14 @@ static void test_nvs_corrupted_sector_close(struct mtdnvs_ctx_s *ctx)
15121512
}
15131513

15141514
if (loop_section ==
1515-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_COUNT - 2)
1515+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_COUNT - 2)
15161516
{
15171517
ret = write_corrupted_close_ate(mtd_fd, ctx);
15181518
}
15191519
else
15201520
{
15211521
ret = write_close_ate(mtd_fd, ctx,
1522-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
1522+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
15231523
- 4 * ate_size);
15241524
}
15251525

@@ -1787,7 +1787,7 @@ static void test_nvs_gc_corrupt_close_ate(struct mtdnvs_ctx_s *ctx)
17871787

17881788
printf("%s: test begin\n", __func__);
17891789

1790-
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME, O_RDWR);
1790+
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_MOUNTPT_NAME, O_RDWR);
17911791
if (mtd_fd < 0)
17921792
{
17931793
printf("%s:mtdnvs_register failed, ret=%d\n", __func__, mtd_fd);
@@ -1813,7 +1813,7 @@ static void test_nvs_gc_corrupt_close_ate(struct mtdnvs_ctx_s *ctx)
18131813
/* set unused flash to 0xff */
18141814

18151815
for (i = strlen(TEST_KEY1) + strlen(TEST_DATA1) + 2;
1816-
i < CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
1816+
i < CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
18171817
- 6 * ate_size; i++)
18181818
{
18191819
ret = write(mtd_fd, &erase_value, sizeof(erase_value));
@@ -1834,9 +1834,9 @@ static void test_nvs_gc_corrupt_close_ate(struct mtdnvs_ctx_s *ctx)
18341834

18351835
/* set unused flash to 0xff */
18361836

1837-
for (i = CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
1837+
for (i = CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
18381838
- 5 * ate_size;
1839-
i < CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
1839+
i < CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
18401840
- 2 * ate_size; i++)
18411841
{
18421842
ret = write(mtd_fd, &erase_value, sizeof(erase_value));
@@ -1865,8 +1865,8 @@ static void test_nvs_gc_corrupt_close_ate(struct mtdnvs_ctx_s *ctx)
18651865

18661866
/* set unused flash to 0xff in section 1 */
18671867

1868-
for (i = CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE;
1869-
i < CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
1868+
for (i = CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE;
1869+
i < CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
18701870
- ate_size; i++)
18711871
{
18721872
ret = write(mtd_fd, &erase_value, sizeof(erase_value));
@@ -1964,7 +1964,7 @@ static void test_nvs_gc_corrupt_ate(struct mtdnvs_ctx_s *ctx)
19641964

19651965
printf("%s: test begin\n", __func__);
19661966

1967-
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME, O_RDWR);
1967+
mtd_fd = open(CONFIG_TESTING_MTD_CONFIG_MOUNTPT_NAME, O_RDWR);
19681968
if (mtd_fd < 0)
19691969
{
19701970
printf("%s:mtdnvs_register failed, ret=%d\n", __func__, mtd_fd);
@@ -1974,7 +1974,7 @@ static void test_nvs_gc_corrupt_ate(struct mtdnvs_ctx_s *ctx)
19741974
/* set unused flash to 0xff */
19751975

19761976
for (i = 0 ;
1977-
i < CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE / 2; i++)
1977+
i < CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE / 2; i++)
19781978
{
19791979
ret = write(mtd_fd, &erase_value, sizeof(erase_value));
19801980
if (ret != sizeof(erase_value))
@@ -1992,9 +1992,9 @@ static void test_nvs_gc_corrupt_ate(struct mtdnvs_ctx_s *ctx)
19921992
goto test_fail;
19931993
}
19941994

1995-
for (i = CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE / 2
1995+
for (i = CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE / 2
19961996
+ ate_size;
1997-
i < CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
1997+
i < CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
19981998
- 2 * ate_size; i++)
19991999
{
20002000
ret = write(mtd_fd, &erase_value, sizeof(erase_value));
@@ -2016,7 +2016,7 @@ static void test_nvs_gc_corrupt_ate(struct mtdnvs_ctx_s *ctx)
20162016
/* write close ate, mark section 0 as closed */
20172017

20182018
ret = write_close_ate(mtd_fd, ctx,
2019-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE / 2);
2019+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE / 2);
20202020
if (ret < 0)
20212021
{
20222022
printf("%s:write gc_done ate failed, ret=%d\n", __func__, ret);
@@ -2025,8 +2025,8 @@ static void test_nvs_gc_corrupt_ate(struct mtdnvs_ctx_s *ctx)
20252025

20262026
/* set unused flash to 0xff in section 1 */
20272027

2028-
for (i = CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE;
2029-
i < CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE
2028+
for (i = CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE;
2029+
i < CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE
20302030
- ate_size; i++)
20312031
{
20322032
ret = write(mtd_fd, &erase_value, sizeof(erase_value));
@@ -2040,7 +2040,7 @@ static void test_nvs_gc_corrupt_ate(struct mtdnvs_ctx_s *ctx)
20402040
/* write close ate, mark section 1 as closed */
20412041

20422042
ret = write_close_ate(mtd_fd, ctx,
2043-
CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_FLASH_SECTION_SIZE / 2);
2043+
CONFIG_TESTING_MTD_CONFIG_FLASH_SECTION_SIZE / 2);
20442044
if (ret < 0)
20452045
{
20462046
printf("%s:write gc_done ate failed, ret=%d\n", __func__, ret);
@@ -2582,7 +2582,7 @@ int main(int argc, FAR char *argv[])
25822582

25832583
memset(ctx, 0, sizeof(struct mtdnvs_ctx_s));
25842584

2585-
strlcpy(ctx->mountdir, CONFIG_TESTING_MTD_CONFIG_FAIL_SAFE_MOUNTPT_NAME,
2585+
strlcpy(ctx->mountdir, CONFIG_TESTING_MTD_CONFIG_MOUNTPT_NAME,
25862586
sizeof(ctx->mountdir));
25872587

25882588
/* Opt Parse */

0 commit comments

Comments
 (0)