Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add integration test for assert #667

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests_new/integration/assert/CMakeLists.txt
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 .)
16 changes: 16 additions & 0 deletions tests_new/integration/assert/Kconfig
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"
8 changes: 8 additions & 0 deletions tests_new/integration/assert/prj.conf
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
35 changes: 35 additions & 0 deletions tests_new/integration/assert/src/main.c
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);
18 changes: 18 additions & 0 deletions tests_new/integration/assert/testcase.yaml
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