From b6fd982edd5cc86fc493554bf555a26dd5c340a3 Mon Sep 17 00:00:00 2001 From: Krzysztof Taborowski Date: Mon, 9 Dec 2024 10:12:38 +0100 Subject: [PATCH] tests: refactor tests [KRKNWK-14886] * Move crypto test to new location * Move crypto keys test to new location * Move delay test to new location * Move critical_region test to new location * Move interrupts test to new location * Move storage test to new location * Move spi test to new location * Move time test to new location * Add native_sim board support * Port to ztest * Remove sanity tests Signed-off-by: Krzysztof Taborowski --- Kconfig.dependencies | 4 +- tests/functional/critical_region/prj.conf | 9 --- tests/functional/critical_region/src/main.c | 62 ---------------- .../functional/critical_region/testcase.yaml | 15 ---- .../boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf | 21 ------ tests/functional/spi_bus/testcase.yaml | 19 ----- tests/functional/storage/Kconfig | 24 ------- tests/functional/storage/testcase.yaml | 16 ----- tests/functional/time/prj.conf | 14 ---- tests/functional/time/testcase.yaml | 16 ----- .../critical_region}/CMakeLists.txt | 2 +- .../integration}/critical_region/Kconfig | 5 +- .../integration/critical_region}/prj.conf | 1 - .../integration/critical_region/src/main.c | 69 ++++++++++++++++++ .../integration/critical_region/testcase.yaml | 18 +++++ .../integration}/crypto/CMakeLists.txt | 3 +- .../integration}/crypto/Kconfig | 6 -- .../integration}/crypto/Kconfig.defconfig | 0 .../integration/crypto/boards/native_sim.conf | 7 ++ .../boards/nrf5340dk_nrf5340_cpuapp_ns.conf | 0 .../integration}/crypto/prj.conf | 4 +- .../integration}/crypto/src/main.c | 0 .../integration}/crypto/testcase.yaml | 2 +- .../integration}/crypto_keys/CMakeLists.txt | 0 .../integration}/crypto_keys/Kconfig | 6 ++ .../crypto_keys/Kconfig.defconfig | 0 .../boards/nrf52840dk_nrf52840.conf | 0 .../boards/nrf5340dk_nrf5340_cpuapp_ns.conf | 0 .../integration/crypto_keys}/prj.conf | 1 - .../integration}/crypto_keys/src/main.c | 0 .../integration/crypto_keys/testcase.yaml | 16 +++++ .../integration/delay}/CMakeLists.txt | 2 +- .../integration/delay}/Kconfig | 1 + .../integration/delay/boards/native_sim.conf | 9 +++ .../integration/delay}/prj.conf | 3 - .../integration/delay}/src/main.c | 6 -- .../integration/delay}/testcase.yaml | 4 +- .../integration}/interrupts/CMakeLists.txt | 2 +- .../integration}/interrupts/Kconfig | 1 + .../integration}/interrupts/prj.conf | 0 .../integration}/interrupts/src/main.c | 0 .../integration/interrupts/testcase.yaml | 18 +++++ .../integration/spi}/CMakeLists.txt | 11 +-- .../integration/spi}/Kconfig | 16 ++--- .../spi}/boards/nrf52840dk_nrf52840.overlay | 0 .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 0 .../boards/nrf54l15dk_nrf54l10_cpuapp.overlay | 70 +++++++++++++++++++ .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 31 -------- .../boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf | 9 +++ .../nrf54l15dk_nrf54l15_cpuapp_ns.overlay | 26 ------- .../integration/spi}/prj.conf | 1 - .../integration/spi}/src/main.c | 16 ++--- .../integration/spi}/testcase.yaml | 4 +- .../integration}/storage/CMakeLists.txt | 4 +- tests_new/integration/storage/Kconfig | 16 +++++ .../nrf54l15dk_nrf54l15_cpuapp_ns.overlay | 0 tests_new/integration/storage/prj.conf | 7 ++ .../integration}/storage/src/main.c | 49 ++++++------- tests_new/integration/storage/testcase.yaml | 18 +++++ .../integration}/time/CMakeLists.txt | 2 +- .../integration}/time/Kconfig | 0 tests_new/integration/time/prj.conf | 7 ++ .../integration}/time/src/main.c | 5 -- .../integration}/time/src/sid_timer_stub.c | 0 .../integration/time}/testcase.yaml | 4 +- 65 files changed, 340 insertions(+), 342 deletions(-) delete mode 100644 tests/functional/critical_region/prj.conf delete mode 100644 tests/functional/critical_region/src/main.c delete mode 100644 tests/functional/critical_region/testcase.yaml delete mode 100644 tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf delete mode 100644 tests/functional/spi_bus/testcase.yaml delete mode 100644 tests/functional/storage/Kconfig delete mode 100644 tests/functional/storage/testcase.yaml delete mode 100644 tests/functional/time/prj.conf delete mode 100644 tests/functional/time/testcase.yaml rename {tests/functional/spi_bus => tests_new/integration/critical_region}/CMakeLists.txt (89%) rename {tests/functional => tests_new/integration}/critical_region/Kconfig (68%) rename {tests/functional/pal_delay => tests_new/integration/critical_region}/prj.conf (99%) create mode 100644 tests_new/integration/critical_region/src/main.c create mode 100644 tests_new/integration/critical_region/testcase.yaml rename {tests/functional => tests_new/integration}/crypto/CMakeLists.txt (60%) rename {tests/functional => tests_new/integration}/crypto/Kconfig (87%) rename {tests/functional => tests_new/integration}/crypto/Kconfig.defconfig (100%) create mode 100644 tests_new/integration/crypto/boards/native_sim.conf rename {tests/functional => tests_new/integration}/crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf (100%) rename {tests/functional => tests_new/integration}/crypto/prj.conf (75%) rename {tests/functional => tests_new/integration}/crypto/src/main.c (100%) rename {tests/functional => tests_new/integration}/crypto/testcase.yaml (92%) rename {tests/functional => tests_new/integration}/crypto_keys/CMakeLists.txt (100%) rename {tests/functional => tests_new/integration}/crypto_keys/Kconfig (90%) rename {tests/functional => tests_new/integration}/crypto_keys/Kconfig.defconfig (100%) rename {tests/functional => tests_new/integration}/crypto_keys/boards/nrf52840dk_nrf52840.conf (100%) rename {tests/functional => tests_new/integration}/crypto_keys/boards/nrf5340dk_nrf5340_cpuapp_ns.conf (100%) rename {tests/functional/storage => tests_new/integration/crypto_keys}/prj.conf (91%) rename {tests/functional => tests_new/integration}/crypto_keys/src/main.c (100%) create mode 100644 tests_new/integration/crypto_keys/testcase.yaml rename {tests/functional/pal_delay => tests_new/integration/delay}/CMakeLists.txt (90%) rename {tests/functional/pal_delay => tests_new/integration/delay}/Kconfig (80%) create mode 100644 tests_new/integration/delay/boards/native_sim.conf rename {tests/functional/spi_bus => tests_new/integration/delay}/prj.conf (84%) rename {tests/functional/pal_delay => tests_new/integration/delay}/src/main.c (93%) rename {tests/functional/interrupts => tests_new/integration/delay}/testcase.yaml (85%) rename {tests/functional => tests_new/integration}/interrupts/CMakeLists.txt (87%) rename {tests/functional => tests_new/integration}/interrupts/Kconfig (85%) rename {tests/functional => tests_new/integration}/interrupts/prj.conf (100%) rename {tests/functional => tests_new/integration}/interrupts/src/main.c (100%) create mode 100644 tests_new/integration/interrupts/testcase.yaml rename {tests/functional/critical_region => tests_new/integration/spi}/CMakeLists.txt (58%) rename {tests/functional/spi_bus => tests_new/integration/spi}/Kconfig (81%) rename {tests/functional/spi_bus => tests_new/integration/spi}/boards/nrf52840dk_nrf52840.overlay (100%) rename {tests/functional/spi_bus => tests_new/integration/spi}/boards/nrf5340dk_nrf5340_cpuapp.overlay (100%) create mode 100644 tests_new/integration/spi/boards/nrf54l15dk_nrf54l10_cpuapp.overlay rename {tests/functional/spi_bus => tests_new/integration/spi}/boards/nrf54l15dk_nrf54l15_cpuapp.overlay (76%) create mode 100644 tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf rename {tests/functional/spi_bus => tests_new/integration/spi}/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay (83%) rename {tests/functional/crypto_keys => tests_new/integration/spi}/prj.conf (84%) rename {tests/functional/spi_bus => tests_new/integration/spi}/src/main.c (94%) rename {tests/functional/pal_delay => tests_new/integration/spi}/testcase.yaml (92%) rename {tests/functional => tests_new/integration}/storage/CMakeLists.txt (93%) create mode 100644 tests_new/integration/storage/Kconfig rename {tests/functional => tests_new/integration}/storage/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay (100%) create mode 100644 tests_new/integration/storage/prj.conf rename {tests/functional => tests_new/integration}/storage/src/main.c (87%) create mode 100644 tests_new/integration/storage/testcase.yaml rename {tests/functional => tests_new/integration}/time/CMakeLists.txt (90%) rename {tests/functional => tests_new/integration}/time/Kconfig (100%) create mode 100644 tests_new/integration/time/prj.conf rename {tests/functional => tests_new/integration}/time/src/main.c (99%) rename {tests/functional => tests_new/integration}/time/src/sid_timer_stub.c (100%) rename {tests/functional/crypto_keys => tests_new/integration/time}/testcase.yaml (85%) diff --git a/Kconfig.dependencies b/Kconfig.dependencies index 16ddd9fdb9..be4cd91270 100644 --- a/Kconfig.dependencies +++ b/Kconfig.dependencies @@ -16,7 +16,7 @@ config SIDEWALK_DEFAULTS imply REBOOT config SIDEWALK_BUILD - bool + bool "Sidewalk build test" default SIDEWALK help An internal config to build the NCS Sidewalk Sources. @@ -61,7 +61,7 @@ config SIDEWALK_ASSERT If the assertion fails, program will trigger a fatal error. config SIDEWALK_CRYPTO - bool + bool "sidewalk crypto test" default SIDEWALK imply NRF_SECURITY imply HW_CC3XX diff --git a/tests/functional/critical_region/prj.conf b/tests/functional/critical_region/prj.conf deleted file mode 100644 index 3ef526ea9c..0000000000 --- a/tests/functional/critical_region/prj.conf +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -CONFIG_UNITY=y -CONFIG_MAIN_THREAD_PRIORITY=14 -CONFIG_NO_OPTIMIZATIONS=y -CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/tests/functional/critical_region/src/main.c b/tests/functional/critical_region/src/main.c deleted file mode 100644 index fb1d9cd333..0000000000 --- a/tests/functional/critical_region/src/main.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include -#include -#include - -#if defined(CONFIG_CPU_CORTEX_M) -#include -#else -#error "Architecture not supported" -#endif - -#define TEST_IRQ (30) -#define TEST_IRQ_PRIO (2) -#define TEST_IRQ_FLAGS (0) - -#define UNCHANGED 0 -#define CHANGED 1 -static volatile int resource; - -static void irq_cb(void) -{ - resource = CHANGED; -} - -static void trigger_irq(int irq) -{ - NVIC_SetPendingIRQ(irq); -} - -void test_sid_pal_critical_region_with_timer(void) -{ - IRQ_CONNECT(TEST_IRQ, TEST_IRQ_PRIO, irq_cb, NULL, TEST_IRQ_FLAGS); - irq_enable(TEST_IRQ); - - resource = UNCHANGED; - trigger_irq(TEST_IRQ); - TEST_ASSERT_EQUAL_UINT32(CHANGED, resource); - - sid_pal_enter_critical_region(); - resource = UNCHANGED; - trigger_irq(TEST_IRQ); - TEST_ASSERT_EQUAL_UINT32(UNCHANGED, resource); - sid_pal_exit_critical_region(); - - trigger_irq(TEST_IRQ); - TEST_ASSERT_EQUAL_UINT32(CHANGED, resource); -} - -/* It is required to be added to each test. That is because unity is using - * different main signature (returns int) and zephyr expects main which does - * not return value. - */ -extern int unity_main(void); - -int main(void) -{ - return unity_main(); -} diff --git a/tests/functional/critical_region/testcase.yaml b/tests/functional/critical_region/testcase.yaml deleted file mode 100644 index 27ac7968aa..0000000000 --- a/tests/functional/critical_region/testcase.yaml +++ /dev/null @@ -1,15 +0,0 @@ -tests: - sidewalk.functional.critical_region: - sysbuild: true - platform_allow: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuapp/ns - - nrf54l15dk/nrf54l10/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuapp/ns - - nrf54l15dk/nrf54l10/cpuapp diff --git a/tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf b/tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf deleted file mode 100644 index f46f9a650b..0000000000 --- a/tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -# Multirole is the only currently supported role by SoftDevice. -CONFIG_BT_LL_SOFTDEVICE_MULTIROLE=y - -# nRF54L15 requires bigger stack sizes than nRF52/nRF53 families -CONFIG_MPSL_WORK_STACK_SIZE=2048 - -# Not supported for 54L15 _NS -CONFIG_FPROTECT=n - -# Set the ZMS sector count to match the settings partition size that is 40 kB for this application. -CONFIG_SETTINGS_ZMS_SECTOR_COUNT=10 - -# Disable tf-m uart to reuse pins for semtech -CONFIG_TFM_LOG_LEVEL_SILENCE=y -CONFIG_TFM_SECURE_UART=n diff --git a/tests/functional/spi_bus/testcase.yaml b/tests/functional/spi_bus/testcase.yaml deleted file mode 100644 index 65fac9d01c..0000000000 --- a/tests/functional/spi_bus/testcase.yaml +++ /dev/null @@ -1,19 +0,0 @@ -tests: - sidewalk.functional.spi_bus: - sysbuild: true - platform_allow: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuapp/ns - - nrf54l15dk/nrf54l10/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuapp/ns - - nrf54l15dk/nrf54l10/cpuapp - tags: Sidewalk - harness: ztest - harness_config: - fixture: semtech_shield diff --git a/tests/functional/storage/Kconfig b/tests/functional/storage/Kconfig deleted file mode 100644 index 1f788caa4f..0000000000 --- a/tests/functional/storage/Kconfig +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -config SIDEWALK_BUILD - default y - -config SIDEWALK_STORAGE - default y - imply NVS if !SOC_FLASH_NRF_RRAM - imply NVS_LOOKUP_CACHE if !SOC_FLASH_NRF_RRAM - imply NVS_LOOKUP_CACHE_FOR_SETTINGS if !SOC_FLASH_NRF_RRAM - imply ZMS if SOC_FLASH_NRF_RRAM - imply ZMS_LOOKUP_CACHE if SOC_FLASH_NRF_RRAM - imply ZMS_LOOKUP_CACHE_FOR_SETTINGS if SOC_FLASH_NRF_RRAM - imply FLASH_MAP - imply FLASH - imply SETTINGS - -config SIDEWALK_LOG_LEVEL - default 0 - -source "Kconfig.zephyr" diff --git a/tests/functional/storage/testcase.yaml b/tests/functional/storage/testcase.yaml deleted file mode 100644 index b49f883356..0000000000 --- a/tests/functional/storage/testcase.yaml +++ /dev/null @@ -1,16 +0,0 @@ -tests: - sidewalk.functional.storage: - sysbuild: true - tags: Sidewalk - platform_allow: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuapp/ns - - nrf54l15dk/nrf54l10/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuapp/ns - - nrf54l15dk/nrf54l10/cpuapp diff --git a/tests/functional/time/prj.conf b/tests/functional/time/prj.conf deleted file mode 100644 index c003000614..0000000000 --- a/tests/functional/time/prj.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -CONFIG_TEST=y -CONFIG_ZTEST=y - -CONFIG_MAIN_THREAD_PRIORITY=14 - -# Llibraries -CONFIG_NEWLIB_LIBC=y -CONFIG_FPU=y diff --git a/tests/functional/time/testcase.yaml b/tests/functional/time/testcase.yaml deleted file mode 100644 index 7a1eeb6a39..0000000000 --- a/tests/functional/time/testcase.yaml +++ /dev/null @@ -1,16 +0,0 @@ -tests: - sidewalk.functional.time: - sysbuild: true - tags: Sidewalk - platform_allow: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuapp/ns - - nrf54l15dk/nrf54l10/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuapp/ns - - nrf54l15dk/nrf54l10/cpuapp diff --git a/tests/functional/spi_bus/CMakeLists.txt b/tests_new/integration/critical_region/CMakeLists.txt similarity index 89% rename from tests/functional/spi_bus/CMakeLists.txt rename to tests_new/integration/critical_region/CMakeLists.txt index a908c40594..df11303c62 100644 --- a/tests/functional/spi_bus/CMakeLists.txt +++ b/tests_new/integration/critical_region/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(sidewalk_functional_test) +project(sidewalk_critical_region_test) # add test file FILE(GLOB app_sources src/*.c) diff --git a/tests/functional/critical_region/Kconfig b/tests_new/integration/critical_region/Kconfig similarity index 68% rename from tests/functional/critical_region/Kconfig rename to tests_new/integration/critical_region/Kconfig index 60a5c6f59a..d978c521b0 100644 --- a/tests/functional/critical_region/Kconfig +++ b/tests_new/integration/critical_region/Kconfig @@ -9,7 +9,8 @@ config SIDEWALK_BUILD config SIDEWALK_CRITICAL_REGION default y -config SIDEWALK_CRITICAL_REGION_RE_ENTRY_MAX - default 2 +config SIDEWALK_LOG_LEVEL + default 0 source "Kconfig.zephyr" +source "${ZEPHYR_BASE}/../sidewalk/Kconfig.dependencies" diff --git a/tests/functional/pal_delay/prj.conf b/tests_new/integration/critical_region/prj.conf similarity index 99% rename from tests/functional/pal_delay/prj.conf rename to tests_new/integration/critical_region/prj.conf index 4c3e852a78..9320387007 100644 --- a/tests/functional/pal_delay/prj.conf +++ b/tests_new/integration/critical_region/prj.conf @@ -3,6 +3,5 @@ # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # - CONFIG_ZTEST=y CONFIG_MAIN_THREAD_PRIORITY=14 diff --git a/tests_new/integration/critical_region/src/main.c b/tests_new/integration/critical_region/src/main.c new file mode 100644 index 0000000000..8fba14f5b0 --- /dev/null +++ b/tests_new/integration/critical_region/src/main.c @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +#include +#include +#include +#include + +#if defined(CONFIG_SOC_FAMILY_NORDIC_NRF) +#include +#elif defined(CONFIG_SOC_POSIX) +#include +#else +#error "Architecture not supported" +#endif /* CONFIG_SOC */ + +#define TEST_IRQ (30) +#define TEST_IRQ_PRIO (2) +#define TEST_IRQ_FLAGS (0) + +#define UNCHANGED 0 +#define CHANGED 1 +static volatile uint32_t resource; + +static void irq_cb(const void *arg) +{ + resource = CHANGED; +} + +static void soc_irq_enable(int irq) +{ +#if defined(CONFIG_SOC_FAMILY_NORDIC_NRF) + irq_enable(irq); +#elif defined(CONFIG_SOC_POSIX) + posix_irq_enable(irq); +#endif /* CONFIG_SOC */ +} + +static void soc_irq_trigger(int irq) +{ +#if defined(CONFIG_SOC_FAMILY_NORDIC_NRF) + NVIC_SetPendingIRQ(irq); +#elif defined(CONFIG_SOC_POSIX) + posix_sw_set_pending_IRQ(irq); +#endif /* CONFIG_SOC */ +} + +ZTEST(sid_pal_suite, test_critical_region_with_timer) +{ + IRQ_CONNECT(TEST_IRQ, TEST_IRQ_PRIO, irq_cb, NULL, TEST_IRQ_FLAGS); + soc_irq_enable(TEST_IRQ); + + resource = UNCHANGED; + soc_irq_trigger(TEST_IRQ); + zassert_equal(resource, CHANGED, "IRQ should change resource"); + + sid_pal_enter_critical_region(); + resource = UNCHANGED; + soc_irq_trigger(TEST_IRQ); + zassert_equal(resource, UNCHANGED, "Resource should not change in critical section"); + sid_pal_exit_critical_region(); + + soc_irq_trigger(TEST_IRQ); + zassert_equal(resource, CHANGED, "IRQ should change resource after critical section"); +} + +ZTEST_SUITE(sid_pal_suite, NULL, NULL, NULL, NULL, NULL); diff --git a/tests_new/integration/critical_region/testcase.yaml b/tests_new/integration/critical_region/testcase.yaml new file mode 100644 index 0000000000..ad9ec1788f --- /dev/null +++ b/tests_new/integration/critical_region/testcase.yaml @@ -0,0 +1,18 @@ +tests: + sidewalk.test.integration.critical_region: + sysbuild: true + tags: Sidewalk + platform_allow: + - native_sim + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp/ns + - nrf54l15dk/nrf54l10/cpuapp + integration_platforms: + - native_sim + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp/ns + - nrf54l15dk/nrf54l10/cpuapp diff --git a/tests/functional/crypto/CMakeLists.txt b/tests_new/integration/crypto/CMakeLists.txt similarity index 60% rename from tests/functional/crypto/CMakeLists.txt rename to tests_new/integration/crypto/CMakeLists.txt index a908c40594..674c037b1f 100644 --- a/tests/functional/crypto/CMakeLists.txt +++ b/tests_new/integration/crypto/CMakeLists.txt @@ -9,7 +9,8 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(sidewalk_functional_test) +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/../modules/crypto/mbedtls/include) # add test file FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) -target_include_directories(app PRIVATE .) +# zephyr_library_sources_ifdef(CONFIG_SIDEWALK_CRYPTO $ENV{ZEPHYR_BASE}/../sidewalk/subsys/sal/sid_pal/src/sid_crypto.c) diff --git a/tests/functional/crypto/Kconfig b/tests_new/integration/crypto/Kconfig similarity index 87% rename from tests/functional/crypto/Kconfig rename to tests_new/integration/crypto/Kconfig index 44408fb68c..e9951b9f0f 100644 --- a/tests/functional/crypto/Kconfig +++ b/tests_new/integration/crypto/Kconfig @@ -3,12 +3,6 @@ # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -config SIDEWALK_BUILD - default y - -config SIDEWALK_CRYPTO - default y - config SIDEWALK_CRYPTO_LOG_LEVEL default 0 diff --git a/tests/functional/crypto/Kconfig.defconfig b/tests_new/integration/crypto/Kconfig.defconfig similarity index 100% rename from tests/functional/crypto/Kconfig.defconfig rename to tests_new/integration/crypto/Kconfig.defconfig diff --git a/tests_new/integration/crypto/boards/native_sim.conf b/tests_new/integration/crypto/boards/native_sim.conf new file mode 100644 index 0000000000..3407565e6b --- /dev/null +++ b/tests_new/integration/crypto/boards/native_sim.conf @@ -0,0 +1,7 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y diff --git a/tests/functional/crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf b/tests_new/integration/crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf similarity index 100% rename from tests/functional/crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf rename to tests_new/integration/crypto/boards/nrf5340dk_nrf5340_cpuapp_ns.conf diff --git a/tests/functional/crypto/prj.conf b/tests_new/integration/crypto/prj.conf similarity index 75% rename from tests/functional/crypto/prj.conf rename to tests_new/integration/crypto/prj.conf index be62f3c8fa..b2633d40fd 100644 --- a/tests/functional/crypto/prj.conf +++ b/tests_new/integration/crypto/prj.conf @@ -5,4 +5,6 @@ # CONFIG_ZTEST=y CONFIG_MAIN_THREAD_PRIORITY=14 -CONFIG_CONSOLE_PUTCHAR_BUFSIZE=512 + +CONFIG_SIDEWALK_BUILD=y +CONFIG_SIDEWALK_CRYPTO=y diff --git a/tests/functional/crypto/src/main.c b/tests_new/integration/crypto/src/main.c similarity index 100% rename from tests/functional/crypto/src/main.c rename to tests_new/integration/crypto/src/main.c diff --git a/tests/functional/crypto/testcase.yaml b/tests_new/integration/crypto/testcase.yaml similarity index 92% rename from tests/functional/crypto/testcase.yaml rename to tests_new/integration/crypto/testcase.yaml index 9ee76969b1..9e9339c787 100644 --- a/tests/functional/crypto/testcase.yaml +++ b/tests_new/integration/crypto/testcase.yaml @@ -1,5 +1,5 @@ tests: - sidewalk.functional.crypto: + sidewalk.test.integration.crypto: sysbuild: true tags: Sidewalk platform_allow: diff --git a/tests/functional/crypto_keys/CMakeLists.txt b/tests_new/integration/crypto_keys/CMakeLists.txt similarity index 100% rename from tests/functional/crypto_keys/CMakeLists.txt rename to tests_new/integration/crypto_keys/CMakeLists.txt diff --git a/tests/functional/crypto_keys/Kconfig b/tests_new/integration/crypto_keys/Kconfig similarity index 90% rename from tests/functional/crypto_keys/Kconfig rename to tests_new/integration/crypto_keys/Kconfig index 7ea11a2dc4..2ecbb007a4 100644 --- a/tests/functional/crypto_keys/Kconfig +++ b/tests_new/integration/crypto_keys/Kconfig @@ -24,6 +24,12 @@ config SIDEWALK_CRYPTO_LOG_LEVEL config SIDEWALK_LOG_LEVEL default 0 +config NVS_LOG_LEVEL + default 0 + +config ZMS_LOG_LEVEL + default 0 + # Stacks config MAIN_STACK_SIZE default 8192 diff --git a/tests/functional/crypto_keys/Kconfig.defconfig b/tests_new/integration/crypto_keys/Kconfig.defconfig similarity index 100% rename from tests/functional/crypto_keys/Kconfig.defconfig rename to tests_new/integration/crypto_keys/Kconfig.defconfig diff --git a/tests/functional/crypto_keys/boards/nrf52840dk_nrf52840.conf b/tests_new/integration/crypto_keys/boards/nrf52840dk_nrf52840.conf similarity index 100% rename from tests/functional/crypto_keys/boards/nrf52840dk_nrf52840.conf rename to tests_new/integration/crypto_keys/boards/nrf52840dk_nrf52840.conf diff --git a/tests/functional/crypto_keys/boards/nrf5340dk_nrf5340_cpuapp_ns.conf b/tests_new/integration/crypto_keys/boards/nrf5340dk_nrf5340_cpuapp_ns.conf similarity index 100% rename from tests/functional/crypto_keys/boards/nrf5340dk_nrf5340_cpuapp_ns.conf rename to tests_new/integration/crypto_keys/boards/nrf5340dk_nrf5340_cpuapp_ns.conf diff --git a/tests/functional/storage/prj.conf b/tests_new/integration/crypto_keys/prj.conf similarity index 91% rename from tests/functional/storage/prj.conf rename to tests_new/integration/crypto_keys/prj.conf index 364699b23a..9320387007 100644 --- a/tests/functional/storage/prj.conf +++ b/tests_new/integration/crypto_keys/prj.conf @@ -3,6 +3,5 @@ # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -CONFIG_UNITY=y CONFIG_ZTEST=y CONFIG_MAIN_THREAD_PRIORITY=14 diff --git a/tests/functional/crypto_keys/src/main.c b/tests_new/integration/crypto_keys/src/main.c similarity index 100% rename from tests/functional/crypto_keys/src/main.c rename to tests_new/integration/crypto_keys/src/main.c diff --git a/tests_new/integration/crypto_keys/testcase.yaml b/tests_new/integration/crypto_keys/testcase.yaml new file mode 100644 index 0000000000..c6f38d8853 --- /dev/null +++ b/tests_new/integration/crypto_keys/testcase.yaml @@ -0,0 +1,16 @@ +tests: + sidewalk.test.integration.crypto_keys: + sysbuild: true + tags: Sidewalk + platform_allow: + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp/ns + - nrf54l15dk/nrf54l10/cpuapp + integration_platforms: + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp/ns + - nrf54l15dk/nrf54l10/cpuapp \ No newline at end of file diff --git a/tests/functional/pal_delay/CMakeLists.txt b/tests_new/integration/delay/CMakeLists.txt similarity index 90% rename from tests/functional/pal_delay/CMakeLists.txt rename to tests_new/integration/delay/CMakeLists.txt index 59c3e0df98..80fba35bb9 100644 --- a/tests/functional/pal_delay/CMakeLists.txt +++ b/tests_new/integration/delay/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(sidewalk_test_delay) +project(sidewalk_delay_test) # add test file FILE(GLOB app_sources src/*.c) diff --git a/tests/functional/pal_delay/Kconfig b/tests_new/integration/delay/Kconfig similarity index 80% rename from tests/functional/pal_delay/Kconfig rename to tests_new/integration/delay/Kconfig index a70eb951c3..5600a47316 100644 --- a/tests/functional/pal_delay/Kconfig +++ b/tests_new/integration/delay/Kconfig @@ -13,3 +13,4 @@ config SIDEWALK_LOG_LEVEL default 0 source "Kconfig.zephyr" +source "${ZEPHYR_BASE}/../sidewalk/Kconfig.dependencies" diff --git a/tests_new/integration/delay/boards/native_sim.conf b/tests_new/integration/delay/boards/native_sim.conf new file mode 100644 index 0000000000..04ac040d42 --- /dev/null +++ b/tests_new/integration/delay/boards/native_sim.conf @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Changed emulator default tick rate from 100 Hz to 10 kHz +# Test requires millisecond precision in timing +CONFIG_SYS_CLOCK_TICKS_PER_SEC=10000 diff --git a/tests/functional/spi_bus/prj.conf b/tests_new/integration/delay/prj.conf similarity index 84% rename from tests/functional/spi_bus/prj.conf rename to tests_new/integration/delay/prj.conf index 500cf51632..9320387007 100644 --- a/tests/functional/spi_bus/prj.conf +++ b/tests_new/integration/delay/prj.conf @@ -3,8 +3,5 @@ # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # - -# Sidewalk -CONFIG_UNITY=y CONFIG_ZTEST=y CONFIG_MAIN_THREAD_PRIORITY=14 diff --git a/tests/functional/pal_delay/src/main.c b/tests_new/integration/delay/src/main.c similarity index 93% rename from tests/functional/pal_delay/src/main.c rename to tests_new/integration/delay/src/main.c index 4e598a064e..c881ee0e6d 100644 --- a/tests/functional/pal_delay/src/main.c +++ b/tests_new/integration/delay/src/main.c @@ -20,7 +20,6 @@ ZTEST(pal_delay, test_sid_pal_delay) { uint64_t timestamp = TIMESTAMP_US_GET(); - sid_pal_delay_us(MIN_DELAY_US); uint64_t delta = TIMESTAMP_US_GET() - timestamp; @@ -31,9 +30,4 @@ ZTEST(pal_delay, test_sid_pal_delay) zassert_true(abs((int)(DELAY_US - delta)) <= MAX_DELAY_US_THRESHOLD); } -ZTEST(pal_delay, test_sanity) -{ - zassert_equal(true, true); -} - ZTEST_SUITE(pal_delay, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/functional/interrupts/testcase.yaml b/tests_new/integration/delay/testcase.yaml similarity index 85% rename from tests/functional/interrupts/testcase.yaml rename to tests_new/integration/delay/testcase.yaml index 2b464b3548..172be83d12 100644 --- a/tests/functional/interrupts/testcase.yaml +++ b/tests_new/integration/delay/testcase.yaml @@ -1,14 +1,16 @@ tests: - unity.sidewalk.functional.interrupts: + sidewalk.test.integration.delay: sysbuild: true tags: Sidewalk platform_allow: + - native_sim - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuapp/ns - nrf54l15dk/nrf54l10/cpuapp integration_platforms: + - native_sim - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp diff --git a/tests/functional/interrupts/CMakeLists.txt b/tests_new/integration/interrupts/CMakeLists.txt similarity index 87% rename from tests/functional/interrupts/CMakeLists.txt rename to tests_new/integration/interrupts/CMakeLists.txt index 98173588af..ee13ebc357 100644 --- a/tests/functional/interrupts/CMakeLists.txt +++ b/tests_new/integration/interrupts/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(sidewalk_test_critical_region) +project(sidewalk_interrupts_test) target_sources(app PRIVATE src/main.c) target_include_directories(app PRIVATE .) diff --git a/tests/functional/interrupts/Kconfig b/tests_new/integration/interrupts/Kconfig similarity index 85% rename from tests/functional/interrupts/Kconfig rename to tests_new/integration/interrupts/Kconfig index 8889051f45..dcee9eb012 100644 --- a/tests/functional/interrupts/Kconfig +++ b/tests_new/integration/interrupts/Kconfig @@ -21,3 +21,4 @@ config SIDEWALK_LOG_LEVEL default 0 source "Kconfig.zephyr" +source "${ZEPHYR_BASE}/../sidewalk/Kconfig.dependencies" diff --git a/tests/functional/interrupts/prj.conf b/tests_new/integration/interrupts/prj.conf similarity index 100% rename from tests/functional/interrupts/prj.conf rename to tests_new/integration/interrupts/prj.conf diff --git a/tests/functional/interrupts/src/main.c b/tests_new/integration/interrupts/src/main.c similarity index 100% rename from tests/functional/interrupts/src/main.c rename to tests_new/integration/interrupts/src/main.c diff --git a/tests_new/integration/interrupts/testcase.yaml b/tests_new/integration/interrupts/testcase.yaml new file mode 100644 index 0000000000..24d92b2bbe --- /dev/null +++ b/tests_new/integration/interrupts/testcase.yaml @@ -0,0 +1,18 @@ +tests: + sidewalk.test.integration.interrupts: + sysbuild: true + tags: Sidewalk + platform_allow: + - native_sim + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp/ns + - nrf54l15dk/nrf54l10/cpuapp + integration_platforms: + - native_sim + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp/ns + - nrf54l15dk/nrf54l10/cpuapp diff --git a/tests/functional/critical_region/CMakeLists.txt b/tests_new/integration/spi/CMakeLists.txt similarity index 58% rename from tests/functional/critical_region/CMakeLists.txt rename to tests_new/integration/spi/CMakeLists.txt index bf903d06fb..3e34a2204a 100644 --- a/tests/functional/critical_region/CMakeLists.txt +++ b/tests_new/integration/spi/CMakeLists.txt @@ -7,12 +7,15 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(sidewalk_test_critical_region) +project(sidewalk_spi_test) # add test file -FILE(GLOB app_sources src/*.c) +FILE(GLOB app_sources src/main.c) +FILE(GLOB emul_sources src/spi_emul.c) target_sources(app PRIVATE ${app_sources}) target_include_directories(app PRIVATE .) -# generate runner for the test -test_runner_generate(${app_sources}) +zephyr_include_directories_ifdef(CONFIG_SPI_EMUL src) +zephyr_library_sources_ifdef(CONFIG_SPI_EMUL + src/spi_emul.c +) diff --git a/tests/functional/spi_bus/Kconfig b/tests_new/integration/spi/Kconfig similarity index 81% rename from tests/functional/spi_bus/Kconfig rename to tests_new/integration/spi/Kconfig index 3c4ce35a2e..618b39690c 100644 --- a/tests/functional/spi_bus/Kconfig +++ b/tests_new/integration/spi/Kconfig @@ -9,22 +9,22 @@ config SIDEWALK_BUILD config SIDEWALK_SUBGHZ_SUPPORT default y +config SIDEWALK_TEMPERATURE + default n + config SIDEWALK_SUBGHZ_TRIM_CAP_VAL hex "value for trim cap used by subGHz radio" range 0x0 0xFFFF default 0x1212 - help - The value of the trim cap. Default value works for Semtech SX1262 shield config SIDEWALK_SPI_BUS default y - imply SPI - imply PM - imply PM_DEVICE config SIDEWALK_GPIO default y - imply GPIO + +config SIDEWALK_GPIO_MAX + default 6 config SIDEWALK_GPIO_IRQ_PRIORITY default 1 @@ -38,7 +38,5 @@ config SIDEWALK_LOG_LEVEL config SPI_BUS_LOG_LEVEL default 0 -config SIDEWALK_GPIO_MAX - default 6 - source "Kconfig.zephyr" +source "${ZEPHYR_BASE}/../sidewalk/Kconfig.dependencies" diff --git a/tests/functional/spi_bus/boards/nrf52840dk_nrf52840.overlay b/tests_new/integration/spi/boards/nrf52840dk_nrf52840.overlay similarity index 100% rename from tests/functional/spi_bus/boards/nrf52840dk_nrf52840.overlay rename to tests_new/integration/spi/boards/nrf52840dk_nrf52840.overlay diff --git a/tests/functional/spi_bus/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests_new/integration/spi/boards/nrf5340dk_nrf5340_cpuapp.overlay similarity index 100% rename from tests/functional/spi_bus/boards/nrf5340dk_nrf5340_cpuapp.overlay rename to tests_new/integration/spi/boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/tests_new/integration/spi/boards/nrf54l15dk_nrf54l10_cpuapp.overlay b/tests_new/integration/spi/boards/nrf54l15dk_nrf54l10_cpuapp.overlay new file mode 100644 index 0000000000..ecbeb1a16b --- /dev/null +++ b/tests_new/integration/spi/boards/nrf54l15dk_nrf54l10_cpuapp.overlay @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + + /{ + semtech_sx1262_gpios{ + compatible = "gpio-keys"; + semtech_sx1262_reset_gpios: reset { + gpios = <&gpio2 8 (GPIO_ACTIVE_LOW|GPIO_PULL_UP)>; + label = "semtech_sx1262 Reset"; + }; + semtech_sx1262_busy_gpios: busy { + gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH)>; + label = "semtech_sx1262 Busy"; + }; + semtech_sx1262_antenna_enable_gpios: antena_enable { + gpios = <&gpio2 10 (GPIO_ACTIVE_HIGH)>; + label = "semtech_sx1262 Antena Enable"; + }; + semtech_sx1262_dio1_gpios: dio1 { + gpios = <&gpio1 11 (GPIO_ACTIVE_HIGH|GPIO_PULL_DOWN)>; + label = "semtech_sx1262 DIO1"; + }; + }; +}; + +sid_semtech: &spi30 { + compatible = "nordic,nrf-spim"; + status = "okay"; + cs-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&spi30_default_alt>; + pinctrl-1 = <&spi30_sleep_alt>; + pinctrl-names = "default", "sleep"; + clock-frequency = ; +}; + +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(1524)>; +}; + +&cpuapp_sram { + reg = <0x20000000 DT_SIZE_K(256)>; + ranges = <0x0 0x20000000 0x40000>; +}; + +&pinctrl { + spi30_default_alt: spi30_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi30_sleep_alt: spi30_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; + +// TODO: re-enable HWFC once it's fixed +&uart20 { + /delete-property/ hw-flow-control; +}; diff --git a/tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp.overlay similarity index 76% rename from tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp.overlay rename to tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index b8809f5cad..ecbeb1a16b 100644 --- a/tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -5,13 +5,6 @@ */ /{ - aliases { - state-notifier-connected = &led0; - state-notifier-time-sync = &led1; - state-notifier-registered = &led2; - state-notifier-working = &led3; - }; - semtech_sx1262_gpios{ compatible = "gpio-keys"; semtech_sx1262_reset_gpios: reset { @@ -31,9 +24,6 @@ label = "semtech_sx1262 DIO1"; }; }; - - // Use watchdog wdt31 as the application watchdog - watchdog0 = &wdt31; }; sid_semtech: &spi30 { @@ -46,7 +36,6 @@ sid_semtech: &spi30 { clock-frequency = ; }; -// restore full RRAM and SRAM space - by default some parts are dedicated to FLRP &cpuapp_rram { reg = <0x0 DT_SIZE_K(1524)>; }; @@ -75,26 +64,6 @@ sid_semtech: &spi30 { }; }; -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&wdt31 { - status = "okay"; -}; - -&mx25r64 { - status = "disabled"; -}; - // TODO: re-enable HWFC once it's fixed &uart20 { /delete-property/ hw-flow-control; diff --git a/tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf b/tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf new file mode 100644 index 0000000000..9d282f3e7c --- /dev/null +++ b/tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp_ns.conf @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Disable tf-m uart to reuse pins for semtech +CONFIG_TFM_LOG_LEVEL_SILENCE=y +CONFIG_TFM_SECURE_UART=n diff --git a/tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay b/tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay similarity index 83% rename from tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay rename to tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay index baf527fc41..1de3413a75 100644 --- a/tests/functional/spi_bus/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay +++ b/tests_new/integration/spi/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay @@ -5,13 +5,6 @@ */ /{ - aliases { - state-notifier-connected = &led0; - state-notifier-time-sync = &led1; - state-notifier-registered = &led2; - state-notifier-working = &led3; - }; - semtech_sx1262_gpios{ compatible = "gpio-keys"; semtech_sx1262_reset_gpios: reset { @@ -71,25 +64,6 @@ sid_semtech: &spi30 { }; }; -&adc { - status = "disabled"; -}; -&uart21 { - status = "disabled"; -}; -&pwm20 { - status = "disabled"; -}; -&i2c20 { - status = "disabled"; -}; -&spi20 { - status = "disabled"; -}; -&spi22 { - status = "disabled"; -}; - // TODO: re-enable HWFC once it's fixed &uart20 { /delete-property/ hw-flow-control; diff --git a/tests/functional/crypto_keys/prj.conf b/tests_new/integration/spi/prj.conf similarity index 84% rename from tests/functional/crypto_keys/prj.conf rename to tests_new/integration/spi/prj.conf index aef3015656..9320387007 100644 --- a/tests/functional/crypto_keys/prj.conf +++ b/tests_new/integration/spi/prj.conf @@ -5,4 +5,3 @@ # CONFIG_ZTEST=y CONFIG_MAIN_THREAD_PRIORITY=14 -CONFIG_NVS_LOG_LEVEL_WRN=y diff --git a/tests/functional/spi_bus/src/main.c b/tests_new/integration/spi/src/main.c similarity index 94% rename from tests/functional/spi_bus/src/main.c rename to tests_new/integration/spi/src/main.c index cf7528c699..220881d8a1 100644 --- a/tests/functional/spi_bus/src/main.c +++ b/tests_new/integration/spi/src/main.c @@ -17,6 +17,11 @@ #include #include +#if defined(CONFIG_SOC_POSIX) +#define NULL_STRUCT_INITIALIZER { 0 } +#define INVALID_DT_GPIO NULL_STRUCT_INITIALIZER +#endif /* CONFIG_SOC_POSIX */ + ZTEST(spi_bus, test_init_spi) { const struct sid_pal_serial_bus_iface *interface; @@ -90,14 +95,10 @@ ZTEST(spi_bus, test_send_spi) zassert_not_null(interface->xfer); uint8_t tx[] = { 0x1d, 0x08, 0xac, 0, 0 }; uint8_t rx[5] = { 0 }; - uint8_t invalid_rx[5] = { 0 }; sid_error_t e = interface->xfer(interface, &client, tx, rx, sizeof(rx)); + printk("err %d\n", e); zassert_equal(SID_ERROR_NONE, e); - for (int i = 0; i < ARRAY_SIZE(rx); i++) { - printf("%x ", rx[i]); - } - zassert_true(memcmp(rx, invalid_rx, ARRAY_SIZE(rx)) != 0); } ZTEST(spi_bus, test_only_tx_spi) @@ -118,9 +119,4 @@ ZTEST(spi_bus, test_only_tx_spi) zassert_equal(SID_ERROR_NONE, e); } -ZTEST(spi_bus, test_sanity) -{ - zassert_equal(true, true); -} - ZTEST_SUITE(spi_bus, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/functional/pal_delay/testcase.yaml b/tests_new/integration/spi/testcase.yaml similarity index 92% rename from tests/functional/pal_delay/testcase.yaml rename to tests_new/integration/spi/testcase.yaml index 7036873df7..0b9e087ed5 100644 --- a/tests/functional/pal_delay/testcase.yaml +++ b/tests_new/integration/spi/testcase.yaml @@ -1,6 +1,7 @@ tests: - sidewalk.functional.delay: + sidewalk.test.integration.spi: sysbuild: true + tags: Sidewalk platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp @@ -13,4 +14,3 @@ tests: - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuapp/ns - nrf54l15dk/nrf54l10/cpuapp - tags: Sidewalk diff --git a/tests/functional/storage/CMakeLists.txt b/tests_new/integration/storage/CMakeLists.txt similarity index 93% rename from tests/functional/storage/CMakeLists.txt rename to tests_new/integration/storage/CMakeLists.txt index dfcbef6c5d..cdb0fd480d 100644 --- a/tests/functional/storage/CMakeLists.txt +++ b/tests_new/integration/storage/CMakeLists.txt @@ -7,10 +7,10 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(sidewalk_functional_test) -set(SIDEWALK_BASE $ENV{ZEPHYR_BASE}/../sidewalk) +project(sidewalk_storage_test) # add test file FILE(GLOB app_sources src/*.c) +set(SIDEWALK_BASE $ENV{ZEPHYR_BASE}/../sidewalk) target_sources(app PRIVATE ${app_sources} ${SIDEWALK_BASE}/utils/settings_utils/settings_utils.c) target_include_directories(app PRIVATE . ${SIDEWALK_BASE}/utils/include) diff --git a/tests_new/integration/storage/Kconfig b/tests_new/integration/storage/Kconfig new file mode 100644 index 0000000000..07a48ff7da --- /dev/null +++ b/tests_new/integration/storage/Kconfig @@ -0,0 +1,16 @@ +# +# Copyright (c) 2022 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +config SIDEWALK_BUILD + default y + +config SIDEWALK_STORAGE + default y + +config SIDEWALK_LOG_LEVEL + default 0 + +source "Kconfig.zephyr" +source "${ZEPHYR_BASE}/../sidewalk/Kconfig.dependencies" diff --git a/tests/functional/storage/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay b/tests_new/integration/storage/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay similarity index 100% rename from tests/functional/storage/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay rename to tests_new/integration/storage/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay diff --git a/tests_new/integration/storage/prj.conf b/tests_new/integration/storage/prj.conf new file mode 100644 index 0000000000..9320387007 --- /dev/null +++ b/tests_new/integration/storage/prj.conf @@ -0,0 +1,7 @@ +# +# Copyright (c) 2022 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ZTEST=y +CONFIG_MAIN_THREAD_PRIORITY=14 diff --git a/tests/functional/storage/src/main.c b/tests_new/integration/storage/src/main.c similarity index 87% rename from tests/functional/storage/src/main.c rename to tests_new/integration/storage/src/main.c index 1d34a1aa33..fa1789bd48 100644 --- a/tests/functional/storage/src/main.c +++ b/tests_new/integration/storage/src/main.c @@ -45,27 +45,29 @@ static void *sid_pal_storage_test_init(void) return NULL; } -/****************************************************************** -* NOTE: DO NOT CHANGE THE ORDER OF THE TESTS! -* ****************************************************************/ -// ZTEST(functional_storage, test_1sid_pal_storage_no_init) -// { -// uint32_t len; - -// // NVM is not initialized. -// zassert_equal(SID_ERROR_STORAGE_ERASE_FAIL, -// sid_pal_storage_kv_group_delete(GROUP_ID_TEST_OK)); -// zassert_equal(SID_ERROR_STORAGE_WRITE_FAIL, -// sid_pal_storage_kv_record_set(GROUP_ID_TEST_OK, TEST_KEY_1, &test_data[0], -// sizeof(test_data[0]))); -// zassert_equal(SID_ERROR_STORAGE_READ_FAIL, -// sid_pal_storage_kv_record_get(GROUP_ID_TEST_OK, TEST_KEY_1, &test_read_data, -// sizeof(test_read_data))); -// zassert_equal(SID_ERROR_STORAGE_READ_FAIL, -// sid_pal_storage_kv_record_get_len(GROUP_ID_TEST_OK, TEST_KEY_1, &len)); -// zassert_equal(SID_ERROR_STORAGE_ERASE_FAIL, -// sid_pal_storage_kv_record_delete(GROUP_ID_TEST_OK, TEST_KEY_1)); -// } +/********************************************* + * NOTE: DO NOT CHANGE THE ORDER OF THE TESTS! + ********************************************* + * + * ZTEST(functional_storage, test_1sid_pal_storage_no_init) + * { + * uint32_t len; + * + * // NVM is not initialized. + * zassert_equal(SID_ERROR_STORAGE_ERASE_FAIL, + * sid_pal_storage_kv_group_delete(GROUP_ID_TEST_OK)); + * zassert_equal(SID_ERROR_STORAGE_WRITE_FAIL, + * sid_pal_storage_kv_record_set(GROUP_ID_TEST_OK, TEST_KEY_1, &test_data[0], + * sizeof(test_data[0]))); + * zassert_equal(SID_ERROR_STORAGE_READ_FAIL, + * sid_pal_storage_kv_record_get(GROUP_ID_TEST_OK, TEST_KEY_1, &test_read_data, + * sizeof(test_read_data))); + * zassert_equal(SID_ERROR_STORAGE_READ_FAIL, + * sid_pal_storage_kv_record_get_len(GROUP_ID_TEST_OK, TEST_KEY_1, &len)); + * zassert_equal(SID_ERROR_STORAGE_ERASE_FAIL, + * sid_pal_storage_kv_record_delete(GROUP_ID_TEST_OK, TEST_KEY_1)); + * } + */ ZTEST(functional_storage, test_2sid_pal_storage_kv_init) { @@ -261,9 +263,4 @@ ZTEST(functional_storage, test_8sid_pal_storage_erase_all_2) sid_pal_storage_kv_record_get_len(GROUP_ID_TEST_OK, test_key_x, &len)); } -ZTEST(functional_storage, test_sanity) -{ - zassert_equal(true, true); -} - ZTEST_SUITE(functional_storage, NULL, sid_pal_storage_test_init, NULL, NULL, NULL); diff --git a/tests_new/integration/storage/testcase.yaml b/tests_new/integration/storage/testcase.yaml new file mode 100644 index 0000000000..723eca181a --- /dev/null +++ b/tests_new/integration/storage/testcase.yaml @@ -0,0 +1,18 @@ +tests: + sidewalk.test.integration.storage: + sysbuild: true + tags: Sidewalk + platform_allow: + - native_sim + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp/ns + - nrf54l15dk/nrf54l10/cpuapp + integration_platforms: + - native_sim + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp/ns + - nrf54l15dk/nrf54l10/cpuapp diff --git a/tests/functional/time/CMakeLists.txt b/tests_new/integration/time/CMakeLists.txt similarity index 90% rename from tests/functional/time/CMakeLists.txt rename to tests_new/integration/time/CMakeLists.txt index a908c40594..0f3aa8ed85 100644 --- a/tests/functional/time/CMakeLists.txt +++ b/tests_new/integration/time/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(sidewalk_functional_test) +project(sidewalk_time_test) # add test file FILE(GLOB app_sources src/*.c) diff --git a/tests/functional/time/Kconfig b/tests_new/integration/time/Kconfig similarity index 100% rename from tests/functional/time/Kconfig rename to tests_new/integration/time/Kconfig diff --git a/tests_new/integration/time/prj.conf b/tests_new/integration/time/prj.conf new file mode 100644 index 0000000000..9320387007 --- /dev/null +++ b/tests_new/integration/time/prj.conf @@ -0,0 +1,7 @@ +# +# Copyright (c) 2022 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_ZTEST=y +CONFIG_MAIN_THREAD_PRIORITY=14 diff --git a/tests/functional/time/src/main.c b/tests_new/integration/time/src/main.c similarity index 99% rename from tests/functional/time/src/main.c rename to tests_new/integration/time/src/main.c index e085b9010f..a973ea9b1b 100644 --- a/tests/functional/time/src/main.c +++ b/tests_new/integration/time/src/main.c @@ -348,9 +348,4 @@ ZTEST(time, test_sid_pal_uptime_get) zassert_true(sid_time.tv_nsec >= uptime_nsec); } -ZTEST(time, test_sanity) -{ - zassert_equal(true, true); -} - ZTEST_SUITE(time, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/functional/time/src/sid_timer_stub.c b/tests_new/integration/time/src/sid_timer_stub.c similarity index 100% rename from tests/functional/time/src/sid_timer_stub.c rename to tests_new/integration/time/src/sid_timer_stub.c diff --git a/tests/functional/crypto_keys/testcase.yaml b/tests_new/integration/time/testcase.yaml similarity index 85% rename from tests/functional/crypto_keys/testcase.yaml rename to tests_new/integration/time/testcase.yaml index 69ad53855c..3e595182f5 100644 --- a/tests/functional/crypto_keys/testcase.yaml +++ b/tests_new/integration/time/testcase.yaml @@ -1,14 +1,16 @@ tests: - sidewalk.functional.crypto_keys: + sidewalk.test.integration.time: sysbuild: true tags: Sidewalk platform_allow: + - native_sim - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l15dk/nrf54l15/cpuapp/ns - nrf54l15dk/nrf54l10/cpuapp integration_platforms: + - native_sim - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp