This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 81eff9fc87d16dc96640ad1e78a17135de2dbfa7
Author: Marco Casaroli <[email protected]>
AuthorDate: Wed Nov 11 03:48:58 2026 +0100

    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 <[email protected]>
---
 testing/nettest/CMakeLists.txt               | 1 +
 testing/nettest/Kconfig                      | 4 ++++
 testing/nettest/Makefile                     | 1 +
 testing/nettest/others/test_others_bufpool.c | 2 +-
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/testing/nettest/CMakeLists.txt b/testing/nettest/CMakeLists.txt
index 7e2bfbe4a..3ca8b82e6 100644
--- a/testing/nettest/CMakeLists.txt
+++ b/testing/nettest/CMakeLists.txt
@@ -140,6 +140,7 @@ if(CONFIG_TESTING_NET_TEST)
       cmocka
       INCLUDE_DIRECTORIES
       ${CMAKE_CURRENT_LIST_DIR}/utils
+      ${NUTTX_DIR}/net
       SRCS
       ${SRCS})
   endif()
diff --git a/testing/nettest/Kconfig b/testing/nettest/Kconfig
index 5dcc86a04..55312f402 100644
--- a/testing/nettest/Kconfig
+++ b/testing/nettest/Kconfig
@@ -66,7 +66,11 @@ config TESTING_NET_LOCAL_DGRAM
 
 config TESTING_NET_OTHERS
        bool "Enable cmocka net other test"
+       depends on BUILD_FLAT
        default y
+       ---help---
+               The test calls functions of the network stack directly
+               (net_bufpool_*() and chksum_iob()), so it needs a flat build.
 
 config TESTING_NET_MCAST
        bool "Enable cmocka net multicast test"
diff --git a/testing/nettest/Makefile b/testing/nettest/Makefile
index 2888b669e..29b3e0533 100644
--- a/testing/nettest/Makefile
+++ b/testing/nettest/Makefile
@@ -71,6 +71,7 @@ MAINSRC  += others/test_others.c
 PROGNAME += cmocka_net_others
 CSRCS    += others/test_others_common.c others/test_others_bufpool.c \
             others/test_others_chksum.c
+CFLAGS   += -I$(TOPDIR)/net
 endif
 
 ifeq ($(CONFIG_TESTING_NET_MCAST),y)
diff --git a/testing/nettest/others/test_others_bufpool.c 
b/testing/nettest/others/test_others_bufpool.c
index 59585cb36..8b312da02 100644
--- a/testing/nettest/others/test_others_bufpool.c
+++ b/testing/nettest/others/test_others_bufpool.c
@@ -29,7 +29,7 @@
 #include <stdint.h>
 #include <cmocka.h>
 
-#include "../../nuttx/net/utils/utils.h"
+#include "utils/utils.h"
 
 /****************************************************************************
  * Pre-processor Definitions

Reply via email to