Skip to content

Commit 7b701a4

Browse files
de-nordichenrikbrixandersen
authored andcommitted
tests: fs: fcb: Make fixed endmarker test optional
The commit splits default FCB scenario into one with endmarker enabled, the original one, and one with disabled. This allows to test the FCB in cases when CONFIG_FCB_ALLOW_FIXED_ENDMARKER is set and not set. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 1e5cdb1 commit 7b701a4

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

tests/subsys/fs/fcb/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
55
project(fs_fcb)
66

77
FILE(GLOB app_sources src/*.c)
8+
if(NOT CONFIG_FCB_ALLOW_FIXED_ENDMARKER)
9+
list(REMOVE_ITEM "src/fcb_test_crc_disabled_after_enabled.c")
10+
endif()
811
target_sources(app PRIVATE ${app_sources})
912
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/fs/fcb)

tests/subsys/fs/fcb/src/fcb_test.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ extern "C" {
2424
#define TEST_FCB_FLASH_AREA_ID FIXED_PARTITION_ID(TEST_FCB_FLASH_AREA)
2525

2626
extern struct fcb test_fcb;
27+
#if defined(CONFIG_FCB_ALLOW_FIXED_ENDMARKER)
2728
extern struct fcb test_fcb_crc_disabled;
29+
#endif
2830

2931
extern struct flash_sector test_fcb_sector[];
3032

tests/subsys/fs/fcb/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
#include <zephyr/device.h>
1515

1616
struct fcb test_fcb = {0};
17+
#if defined(CONFIG_FCB_ALLOW_FIXED_ENDMARKER)
1718
struct fcb test_fcb_crc_disabled = { .f_flags = FCB_FLAGS_CRC_DISABLED };
19+
#endif
1820

1921
uint8_t fcb_test_erase_value;
2022

@@ -139,7 +141,11 @@ static void fcb_pretest_4_sectors(void *data)
139141

140142
static void fcb_pretest_crc_disabled(void *data)
141143
{
144+
#if defined(CONFIG_FCB_ALLOW_FIXED_ENDMARKER)
142145
fcb_tc_pretest(2, &test_fcb_crc_disabled);
146+
#else
147+
ztest_test_skip();
148+
#endif
143149
}
144150

145151
/*

tests/subsys/fs/fcb/testcase.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ tests:
1616
filesystem.fcb.native_sim.no_erase:
1717
extra_args: CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n
1818
platform_allow: native_sim
19+
filesystem.fcb.fixed_endmarker:
20+
platform_allow:
21+
- nrf52840dk/nrf52840
22+
- nrf52dk/nrf52832
23+
- nrf51dk/nrf51822
24+
- native_sim
25+
- native_sim/native/64
26+
- mr_canhubk3
27+
tags: flash_circural_buffer
28+
integration_platforms:
29+
- nrf52840dk/nrf52840
30+
extra_args: CONFIG_FCB_ALLOW_FIXED_ENDMARKER=y
1931
filesystem.fcb.native_sim.fcb_0x00:
2032
extra_args: DTC_OVERLAY_FILE=boards/native_sim_ev_0x00.overlay
2133
platform_allow: native_sim

0 commit comments

Comments
 (0)