Skip to content

Commit 5bdf565

Browse files
jtguggedaljorgenmk
authored andcommitted
tests: lib: Add lte_lc_pdn tests
Add tests for the PDN handling recently added to lte_lc. The tests are copied from PDN library tests, and adapted to the new type and function names. Some changes were needed due to events now going through the lte_lc events system and not direct callbacks. Signed-off-by: Jan Tore Guggedal <[email protected]>
1 parent 505ecd6 commit 5bdf565

File tree

7 files changed

+1689
-29
lines changed

7 files changed

+1689
-29
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@
885885
/tests/lib/hw_id/ @nrfconnect/ncs-cia
886886
/tests/lib/location/ @nrfconnect/ncs-modem-tre
887887
/tests/lib/lte_lc_api/ @nrfconnect/ncs-modem-tre
888+
/tests/lib/lte_lc_pdn/ @nrfconnect/ncs-modem-tre @nrfconnect/ncs-cia
888889
/tests/lib/modem_battery/ @nrfconnect/ncs-modem
889890
/tests/lib/modem_info/ @nrfconnect/ncs-cia
890891
/tests/lib/modem_jwt/ @nrfconnect/ncs-iot-oulu

include/modem/lte_lc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2493,7 +2493,7 @@ const char *lte_lc_pdn_esm_strerror(int reason);
24932493
*/
24942494
int lte_lc_cellular_profile_configure(struct lte_lc_cellular_profile *profile);
24952495

2496-
#if CONFIG_LTE_LC_PDN_ESM_STRERROR
2496+
#if defined(CONFIG_LTE_LC_PDN_ESM_STRERROR)
24972497

24982498
/**
24992499
* Retrieve a statically allocated textual description for a given ESM error reason.

tests/lib/lte_lc_pdn/CMakeLists.txt

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,44 @@ cmake_minimum_required(VERSION 3.20.0)
99
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1010
project(lte_lc_pdn)
1111

12-
FILE(GLOB app_sources src/*.c)
13-
target_sources(app PRIVATE ${app_sources})
14-
target_sources(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/stubs/lte_lc_stubs.c)
12+
target_sources(app PRIVATE
13+
src/main.c
14+
${CMAKE_CURRENT_SOURCE_DIR}/stubs/lte_lc_stubs.c
15+
)
1516

1617
test_runner_generate(src/main.c)
1718

18-
target_sources(app
19-
PRIVATE
19+
target_sources(app PRIVATE
2020
${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/lte_lc.c
2121
${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/modules/pdn.c
2222
${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/modules/esm.c
2323
${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/modules/cellular_profile.c
2424
${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/common/event_handler_list.c
2525
)
2626

27-
zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/stubs)
28-
zephyr_include_directories(${ZEPHYR_NRFXLIB_MODULE_DIR}/nrf_modem/include/)
29-
zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/include/modem/)
30-
zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/)
31-
zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/include)
32-
zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/include/modules/)
33-
zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/include/common/)
34-
zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/lib/at_monitor/)
35-
zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/lib/at_parser/)
36-
zephyr_include_directories(${ZEPHYR_BASE}/subsys/testsuite/include)
27+
zephyr_include_directories(
28+
${CMAKE_CURRENT_SOURCE_DIR}/stubs
29+
${ZEPHYR_NRFXLIB_MODULE_DIR}/nrf_modem/include/
30+
${ZEPHYR_NRF_MODULE_DIR}/include/modem/
31+
${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/
32+
${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/include
33+
${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/include/modules/
34+
${ZEPHYR_NRF_MODULE_DIR}/lib/lte_link_control/include/common/
35+
${ZEPHYR_NRF_MODULE_DIR}/lib/at_monitor/
36+
${ZEPHYR_NRF_MODULE_DIR}/lib/at_parser/
37+
${ZEPHYR_BASE}/subsys/testsuite/include
38+
)
3739

38-
add_compile_definitions(CONFIG_LTE_LC_PDN_MODULE=1)
39-
add_compile_definitions(CONFIG_LTE_LC_PDN_HEAP_SIZE=64)
40-
add_compile_definitions(CONFIG_LTE_LC_PDN_ESM_TIMEOUT=1000)
41-
add_compile_definitions(CONFIG_LTE_LC_PDN_DEFAULTS_OVERRIDE)
42-
add_compile_definitions(CONFIG_LTE_LC_PDN_DEFAULT_APN="apn0")
43-
add_compile_definitions(CONFIG_LTE_LC_PDN_DEFAULT_FAM=2)
44-
add_compile_definitions(CONFIG_LTE_LC_PDN_ESM_STRERROR)
45-
add_compile_definitions(CONFIG_HEAP_MEM_POOL_ADD_SIZE_LTE_LC_PDN=64)
46-
add_compile_definitions(CONFIG_LTE_LINK_CONTROL)
47-
add_compile_definitions(CONFIG_LTE_LC_CELLULAR_PROFILE_MODULE=1)
48-
add_compile_definitions(CONFIG_LTE_LINK_CONTROL_LOG_LEVEL=0)
49-
add_compile_definitions(CONFIG_AT_MONITOR_LOG_LEVEL=0)
50-
add_compile_definitions(CONFIG_HEAP_MEM_POOL_ADD_SIZE_LTE_LINK_CONTROL=96)
40+
add_compile_definitions(
41+
CONFIG_LTE_LC_PDN_MODULE=1
42+
CONFIG_LTE_LC_PDN_ESM_TIMEOUT=1000
43+
CONFIG_LTE_LC_PDN_DEFAULTS_OVERRIDE
44+
CONFIG_LTE_LC_PDN_DEFAULT_APN="apn0"
45+
CONFIG_LTE_LC_PDN_DEFAULT_FAM=2
46+
CONFIG_LTE_LC_PDN_ESM_STRERROR
47+
CONFIG_LTE_LINK_CONTROL
48+
CONFIG_LTE_LC_CELLULAR_PROFILE_MODULE=1
49+
CONFIG_LTE_LINK_CONTROL_LOG_LEVEL=0
50+
CONFIG_AT_MONITOR_LOG_LEVEL=0
51+
CONFIG_HEAP_MEM_POOL_ADD_SIZE_LTE_LINK_CONTROL=96
52+
)

tests/lib/lte_lc_pdn/prj.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
CONFIG_UNITY=y
8+
CONFIG_TEST=y

0 commit comments

Comments
 (0)