Skip to content
Permalink
Browse files

tests/subsys/settings/fcb: add check for target compatibility

Added tests of flash driver compatibility with fcb-backend.

For flash drivers which support write-block-size bigger than 1 B
test of unaligned data access uses native write-block-size
as it is dedicated to check whether settings works well on platform
which has 1 B access which is native on the current DUT.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
  • Loading branch information...
nvlsianpu authored and MaureenHelm committed Mar 4, 2019
1 parent 16c1db9 commit 27109e637898098071749cf75f6996b25dadf9fb
@@ -341,6 +341,20 @@ int c3_handle_export(int (*cb)(const char *name,
return 0;
}

void tests_settings_check_target(void)
{
const struct flash_area *fap;
int rc;
u8_t wbs;

rc = flash_area_open(DT_FLASH_AREA_STORAGE_ID, &fap);
zassert_true(rc == 0, "Can't open storage flash area");

wbs = flash_area_align(fap);
zassert_true(wbs <= 16,
"Flash driver is not compatible with the settings fcb-backend");
}

void test_settings_encode(void);
void config_empty_lookups(void);
void test_config_insert(void);
@@ -378,6 +392,7 @@ void test_main(void)
ztest_unit_test(test_config_getset_int64),
ztest_unit_test(test_config_commit),
/* FCB as backing storage*/
ztest_unit_test(tests_settings_check_target),
ztest_unit_test(test_config_save_fcb_unaligned),
ztest_unit_test(test_config_empty_fcb),
ztest_unit_test(test_config_save_1_fcb),
@@ -22,8 +22,11 @@ void test_config_save_fcb_unaligned(void)
rc = settings_fcb_src(&cf);
zassert_true(rc == 0, "can't register FCB as configuration source");

/* override flash driver alignment */
cf.cf_fcb.f_align = 4;
if (cf.cf_fcb.f_align == 1) {
/* override flash driver alignment */
cf.cf_fcb.f_align = 4;
}

settings_mount_fcb_backend(&cf);

rc = settings_fcb_dst(&cf);

0 comments on commit 27109e6

Please sign in to comment.
You can’t perform that action at this time.