Skip to content

Commit 1a5bef6

Browse files
decsnyhenrikbrixandersen
authored andcommitted
tests: flash: Fix disable_spi_nor case
This case was originally made sort of naively due to the fact that the test was prioritizing testing spi nor first, but we wanted to test SOC flash drivers, not the spi flash driver, so we just disabled CONFIG_SPI_NOR. But this caused issues for platform which don't have a storage partition or platform where the storage partition was actually on a spi nor (because then there is no spi device leading to a linking error with no reference to device object) So fix by introducing a config to change the test logic to prioritize the storage partition, which is really what we wanted to do in the first place more directly I think. Signed-off-by: Declan Snyder <[email protected]>
1 parent 66a0f82 commit 1a5bef6

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

tests/drivers/flash/common/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@ config TEST_DRIVER_FLASH_SIZE
1616
support the get_size() API, leave this set as -1 to skip the test.
1717
For the STM32 devices, the flash size is directly given by the soc DTSI.
1818

19+
config TEST_FORCE_STORAGE_PARTITION
20+
bool "Force testing the storage partition area"
21+
default n
22+
help
23+
This test prioritizes testing spi nor flash over
24+
the storage area by default. Set this config to priorize
25+
testing the storage partition instead.
26+
1927
source "Kconfig.zephyr"

tests/drivers/flash/common/src/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#include <zephyr/storage/flash_map.h>
1212
#include <zephyr/drivers/gpio.h>
1313

14-
#if defined(CONFIG_NORDIC_QSPI_NOR)
14+
#if defined(CONFIG_TEST_FORCE_STORAGE_PARTITION)
15+
#define TEST_AREA storage_partition
16+
#elif defined(CONFIG_NORDIC_QSPI_NOR)
1517
#define TEST_AREA_DEV_NODE DT_INST(0, nordic_qspi_nor)
1618
#elif defined(SOC_SERIES_STM32N6X)
1719
#define TEST_AREA_DEV_NODE DT_INST(0, st_stm32_xspi_nor)

tests/drivers/flash/common/testcase.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ tests:
155155
platform_allow:
156156
- nrf52840dk/nrf52840
157157
- nrf5340dk/nrf5340/cpuapp
158-
drivers.flash.common.disable_spi_nor:
159-
filter: dt_compat_enabled("soc-nv-flash") and dt_compat_enabled("jedec,spi-nor")
158+
drivers.flash.common.test_storage_partition:
159+
filter: dt_label_with_parent_compat_enabled("storage_partition", "fixed-partitions")
160160
platform_exclude:
161161
- beagleconnect_freedom/cc1352p7
162162
extra_args:
163-
- CONFIG_SPI_NOR=n
163+
- CONFIG_TEST_FORCE_STORAGE_PARTITION=y
164164
drivers.flash.common.ra_ospi_b_nor:
165165
platform_allow:
166166
- ek_ra8m1

0 commit comments

Comments
 (0)