This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 9722b6b2e testing/nettest: remove the net_bufpool test
9722b6b2e is described below
commit 9722b6b2e7f518229140eb13195d73de9b445739
Author: zhanghongyu <[email protected]>
AuthorDate: Wed Nov 25 23:26:15 2026 +0800
testing/nettest: remove the net_bufpool test
net_bufpool is being replaced by mm/mempool in nuttx, which leaves this
test without the code it tests. It exercises net_bufpool directly:
NET_BUFPOOL_DECLARE() for a fixed, a limited and an unlimited pool, then
the preallocation, the maxalloc ceiling and the unlimited expansion
through NET_BUFPOOL_ALLOC(), _TRYALLOC(), _FREE() and _TEST(). None of
those exist once net_bufpool is gone, so the file stops compiling.
The equivalent coverage for mempool belongs with mm/mempool rather than
here. Note also that the test reached into the private
net/utils/utils.h through -I$(TOPDIR)/net, which is why
TESTING_NET_OTHERS needs a flat build; only chksum_iob() needs that now.
This has to be merged before the nuttx-side removal, otherwise any
configuration with CONFIG_TESTING_NET_OTHERS=y fails to build.
Assisted-by: claude-opus-5
Signed-off-by: zhanghongyu <[email protected]>
---
testing/nettest/CMakeLists.txt | 1 -
testing/nettest/Kconfig | 2 +-
testing/nettest/Makefile | 3 +-
testing/nettest/others/test_others.c | 1 -
testing/nettest/others/test_others.h | 3 +-
testing/nettest/others/test_others_bufpool.c | 136 ---------------------------
6 files changed, 3 insertions(+), 143 deletions(-)
diff --git a/testing/nettest/CMakeLists.txt b/testing/nettest/CMakeLists.txt
index 6e87e7987..c6889ae3b 100644
--- a/testing/nettest/CMakeLists.txt
+++ b/testing/nettest/CMakeLists.txt
@@ -159,7 +159,6 @@ if(CONFIG_TESTING_NET_TEST)
set(SRCS
${CMAKE_CURRENT_LIST_DIR}/others/test_others.c
${CMAKE_CURRENT_LIST_DIR}/others/test_others_common.c
- ${CMAKE_CURRENT_LIST_DIR}/others/test_others_bufpool.c
${CMAKE_CURRENT_LIST_DIR}/others/test_others_chksum.c)
nuttx_add_application(
diff --git a/testing/nettest/Kconfig b/testing/nettest/Kconfig
index 83caa7e85..17567c222 100644
--- a/testing/nettest/Kconfig
+++ b/testing/nettest/Kconfig
@@ -89,7 +89,7 @@ config TESTING_NET_OTHERS
default y
---help---
The test calls functions of the network stack directly
- (net_bufpool_*() and chksum_iob()), so it needs a flat build.
+ (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 c95dc2bdb..43c8031d0 100644
--- a/testing/nettest/Makefile
+++ b/testing/nettest/Makefile
@@ -92,8 +92,7 @@ endif
ifeq ($(CONFIG_TESTING_NET_OTHERS),y)
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
+CSRCS += others/test_others_common.c others/test_others_chksum.c
CFLAGS += -I$(TOPDIR)/net
endif
diff --git a/testing/nettest/others/test_others.c
b/testing/nettest/others/test_others.c
index 994f1eaf9..10f984648 100644
--- a/testing/nettest/others/test_others.c
+++ b/testing/nettest/others/test_others.c
@@ -38,7 +38,6 @@ int main(int argc, FAR char *argv[])
{
const struct CMUnitTest others_tests[] =
{
- cmocka_unit_test(test_others_bufpool),
cmocka_unit_test(test_others_chksum),
};
diff --git a/testing/nettest/others/test_others.h
b/testing/nettest/others/test_others.h
index 621be46a7..5dd698d61 100644
--- a/testing/nettest/others/test_others.h
+++ b/testing/nettest/others/test_others.h
@@ -44,10 +44,9 @@ int test_others_group_setup(FAR void **state);
int test_others_group_teardown(FAR void **state);
/****************************************************************************
- * Name: test_others_bufpool
+ * Name: test_others_chksum
****************************************************************************/
-void test_others_bufpool(FAR void **state);
void test_others_chksum(FAR void **state);
#endif /* __APPS_TESTING_NETTEST_OTHERS_TEST_OTHERS_H */
diff --git a/testing/nettest/others/test_others_bufpool.c
b/testing/nettest/others/test_others_bufpool.c
deleted file mode 100644
index 8b312da02..000000000
--- a/testing/nettest/others/test_others_bufpool.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
- * apps/testing/nettest/others/test_others_bufpool.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <errno.h>
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <cmocka.h>
-
-#include "utils/utils.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define TEST_PREALLOC 10
-#define TEST_DYNALLOC 1
-#define TEST_MAXALLOC 20
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: test_net_bufpool_alloc_to
- ****************************************************************************/
-
-static void test_net_bufpool_alloc_to(FAR struct net_bufpool_s *pool,
- FAR sq_queue_t *allocated)
-{
- FAR sq_entry_t *node;
-
- assert_true(NET_BUFPOOL_TEST(*pool) == OK);
- node = NET_BUFPOOL_ALLOC(*pool);
- assert_non_null(node);
- sq_addlast(node, allocated);
-}
-
-/****************************************************************************
- * Name: test_net_bufpool_free_from
- ****************************************************************************/
-
-static void test_net_bufpool_free_from(FAR struct net_bufpool_s *pool,
- FAR sq_queue_t *allocated)
-{
- while (!sq_empty(allocated))
- {
- FAR sq_entry_t *node = sq_remfirst(allocated);
-
- NET_BUFPOOL_FREE(*pool, node);
- assert_true(NET_BUFPOOL_TEST(*pool) == OK);
- }
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: test_others_bufpool
- ****************************************************************************/
-
-void test_others_bufpool(FAR void **state)
-{
- NET_BUFPOOL_DECLARE(fixed, sizeof(sq_entry_t), TEST_PREALLOC, 0, 0);
- NET_BUFPOOL_DECLARE(limited, sizeof(sq_entry_t), TEST_PREALLOC,
- TEST_DYNALLOC, TEST_MAXALLOC);
- NET_BUFPOOL_DECLARE(unlimited, sizeof(sq_entry_t), TEST_PREALLOC,
- TEST_DYNALLOC, 0);
- sq_queue_t allocated_fixed;
- sq_queue_t allocated_limited;
- sq_queue_t allocated_unlimited;
- FAR sq_entry_t *node;
- int i;
-
-#ifdef NET_BUFPOOL_INIT
- NET_BUFPOOL_INIT(fixed);
- NET_BUFPOOL_INIT(limited);
- NET_BUFPOOL_INIT(unlimited);
-#endif
- sq_init(&allocated_fixed);
- sq_init(&allocated_limited);
- sq_init(&allocated_unlimited);
-
- for (i = 0; i < TEST_PREALLOC; i++)
- {
- test_net_bufpool_alloc_to(&fixed, &allocated_fixed);
- test_net_bufpool_alloc_to(&limited, &allocated_limited);
- test_net_bufpool_alloc_to(&unlimited, &allocated_unlimited);
- }
-
- for (i = TEST_PREALLOC; i < TEST_MAXALLOC; i++)
- {
- test_net_bufpool_alloc_to(&limited, &allocated_limited);
- test_net_bufpool_alloc_to(&unlimited, &allocated_unlimited);
- }
-
- node = NET_BUFPOOL_TRYALLOC(fixed);
- assert_null(node);
- assert_true(NET_BUFPOOL_TEST(fixed) == -ENOSPC);
-
- node = NET_BUFPOOL_TRYALLOC(limited);
- assert_null(node);
- assert_true(NET_BUFPOOL_TEST(limited) == -ENOSPC);
-
- node = NET_BUFPOOL_TRYALLOC(unlimited);
- assert_non_null(node);
- assert_true(NET_BUFPOOL_TEST(unlimited) == OK);
- NET_BUFPOOL_FREE(unlimited, node);
-
- test_net_bufpool_free_from(&fixed, &allocated_fixed);
- test_net_bufpool_free_from(&limited, &allocated_limited);
- test_net_bufpool_free_from(&unlimited, &allocated_unlimited);
-}