Skip to content

Commit 81eff9f

Browse files
casaroliacassis
authored andcommitted
testing/nettest: Fix the build of the others test
test_others_bufpool.c includes "../../nuttx/net/utils/utils.h". This path is correct only when the NuttX tree is a directory with the name "nuttx" next to the apps tree. Add the net directory of the NuttX tree to the include path, and include "utils/utils.h", as the network stack does. The test calls functions of the network stack (net_bufpool_*() and chksum_iob()), which user space cannot link in a protected or kernel build. Make TESTING_NET_OTHERS depend on BUILD_FLAT. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
1 parent af2922d commit 81eff9f

4 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎testing/nettest/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ if(CONFIG_TESTING_NET_TEST)
140140
cmocka
141141
INCLUDE_DIRECTORIES
142142
${CMAKE_CURRENT_LIST_DIR}/utils
143+
${NUTTX_DIR}/net
143144
SRCS
144145
${SRCS})
145146
endif()

‎testing/nettest/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ config TESTING_NET_LOCAL_DGRAM
6666

6767
config TESTING_NET_OTHERS
6868
bool "Enable cmocka net other test"
69+
depends on BUILD_FLAT
6970
default y
71+
---help---
72+
The test calls functions of the network stack directly
73+
(net_bufpool_*() and chksum_iob()), so it needs a flat build.
7074

7175
config TESTING_NET_MCAST
7276
bool "Enable cmocka net multicast test"

‎testing/nettest/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ MAINSRC += others/test_others.c
7171
PROGNAME += cmocka_net_others
7272
CSRCS += others/test_others_common.c others/test_others_bufpool.c \
7373
others/test_others_chksum.c
74+
CFLAGS += -I$(TOPDIR)/net
7475
endif
7576

7677
ifeq ($(CONFIG_TESTING_NET_MCAST),y)

‎testing/nettest/others/test_others_bufpool.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <stdint.h>
3030
#include <cmocka.h>
3131

32-
#include "../../nuttx/net/utils/utils.h"
32+
#include "utils/utils.h"
3333

3434
/****************************************************************************
3535
* Pre-processor Definitions

0 commit comments

Comments
 (0)