tests: settings: Add tests for chosen zephyr,settings-partition
Add test cases using settings-partition chosen for both FCB and NVS. Signed-off-by: Alexander Mihajlovic <a@abxy.se>
This commit is contained in:
parent
2888523b68
commit
296d51511d
5 changed files with 41 additions and 1 deletions
13
tests/subsys/settings/functional/fcb/chosen.overlay
Normal file
13
tests/subsys/settings/functional/fcb/chosen.overlay
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&storage_partition {
|
||||
label = "chosen_partition";
|
||||
};
|
|
@ -2,3 +2,7 @@ tests:
|
|||
system.settings.functional.fcb:
|
||||
platform_allow: nrf52840dk_nrf52840 nrf52dk_nrf52832 native_posix native_posix_64
|
||||
tags: settings_fcb
|
||||
system.settings.functional.fcb.chosen:
|
||||
extra_args: DTC_OVERLAY_FILE=./chosen.overlay
|
||||
platform_allow: native_posix native_posix_64
|
||||
tags: settings_fcb
|
||||
|
|
13
tests/subsys/settings/functional/nvs/chosen.overlay
Normal file
13
tests/subsys/settings/functional/nvs/chosen.overlay
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
};
|
||||
|
||||
&storage_partition {
|
||||
label = "chosen_partition";
|
||||
};
|
|
@ -2,6 +2,10 @@ tests:
|
|||
system.settings.functional.nvs:
|
||||
platform_allow: qemu_x86 native_posix native_posix_64
|
||||
tags: settings_nvs
|
||||
system.settings.functional.nvs.chosen:
|
||||
extra_args: DTC_OVERLAY_FILE=./chosen.overlay
|
||||
platform_allow: native_posix native_posix_64
|
||||
tags: settings_nvs
|
||||
system.settings.functional.nvs.dk:
|
||||
extra_args: OVERLAY_CONFIG=mpu.conf
|
||||
platform_allow: nrf52840dk_nrf52840 nrf52dk_nrf52832
|
||||
|
|
|
@ -31,7 +31,13 @@ static void test_clear_settings(void)
|
|||
{
|
||||
#if IS_ENABLED(CONFIG_SETTINGS_FCB) || IS_ENABLED(CONFIG_SETTINGS_NVS)
|
||||
const struct flash_area *fap;
|
||||
int rc = flash_area_open(FLASH_AREA_ID(storage), &fap);
|
||||
int rc;
|
||||
|
||||
#if DT_HAS_CHOSEN(zephyr_settings_partition)
|
||||
rc = flash_area_open(FLASH_AREA_ID(chosen_partition), &fap);
|
||||
#else
|
||||
rc = flash_area_open(FLASH_AREA_ID(storage), &fap);
|
||||
#endif
|
||||
|
||||
if (rc == 0) {
|
||||
rc = flash_area_erase(fap, 0, fap->fa_size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue