-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add integration test for assert
add test for assert Signed-off-by: Robert Gałat <robert.galat@nordicsemi.no>
- Loading branch information
1 parent
2ad48d4
commit 69ae765
Showing
5 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(sidewalk_assert_test) | ||
|
||
# add test file | ||
FILE(GLOB app_sources src/*.c) | ||
target_sources(app PRIVATE ${app_sources}) | ||
target_include_directories(app PRIVATE .) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
# Copyright (c) 2022 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
config SIDEWALK_BUILD | ||
default y | ||
|
||
config SIDEWALK_ASSERT | ||
default y | ||
|
||
config SIDEWALK_LOG_LEVEL | ||
default 0 | ||
|
||
source "Kconfig.zephyr" | ||
source "${ZEPHYR_BASE}/../sidewalk/Kconfig.dependencies" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
CONFIG_ZTEST=y | ||
CONFIG_MAIN_THREAD_PRIORITY=14 | ||
CONFIG_ZTEST_ASSERT_HOOK=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#include <zephyr/ztest.h> | ||
#include <sid_pal_assert_ifc.h> | ||
#include <zephyr/ztest_error_hook.h> | ||
|
||
void before(void *fixture) | ||
{ | ||
// Set assert behaviour to normal | ||
ztest_set_assert_valid(false); | ||
} | ||
|
||
ZTEST(pal_assert, test_sid_pal_assert_true) | ||
{ | ||
SID_PAL_ASSERT(true); | ||
} | ||
ZTEST(pal_assert, test_sid_pal_assert_false) | ||
{ | ||
// Expect asserts to fail | ||
ztest_set_assert_valid(true); | ||
SID_PAL_ASSERT(false); | ||
} | ||
|
||
ZTEST(pal_assert, test_sid_pal_assert_false_raw) | ||
{ | ||
// Expect asserts to fail | ||
ztest_set_assert_valid(true); | ||
sid_pal_assert(__LINE__, __FILE__); | ||
} | ||
|
||
ZTEST_SUITE(pal_assert, NULL, NULL, before, NULL, NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
tests: | ||
sidewalk.test.integration.assert: | ||
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 |