Skip to content
Open
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
11 changes: 8 additions & 3 deletions testing/nettest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@ if(CONFIG_TESTING_NET_TEST)
endif()

if(CONFIG_NET_IPv4)
list(APPEND SRCS ${CMAKE_CURRENT_LIST_DIR}/tcp/test_tcp_reset.c
${CMAKE_CURRENT_LIST_DIR}/tcp/test_tcp_iov.c
${CMAKE_CURRENT_LIST_DIR}/tcp/test_tcp_halfclose.c)
list(
APPEND
SRCS
${CMAKE_CURRENT_LIST_DIR}/tcp/test_tcp_reset.c
${CMAKE_CURRENT_LIST_DIR}/tcp/test_tcp_iov.c
${CMAKE_CURRENT_LIST_DIR}/tcp/test_tcp_halfclose.c
${CMAKE_CURRENT_LIST_DIR}/tcp/test_tcp_backlog.c)
list(APPEND SRCS ${CMAKE_CURRENT_LIST_DIR}/tcp/test_tcp_procfs.c)
endif()

if(CONFIG_NET_IPv4
Expand Down
3 changes: 2 additions & 1 deletion testing/nettest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ endif

ifeq ($(CONFIG_NET_IPv4), y)
CSRCS += tcp/test_tcp_reset.c tcp/test_tcp_iov.c
CSRCS += tcp/test_tcp_halfclose.c
CSRCS += tcp/test_tcp_halfclose.c tcp/test_tcp_backlog.c
CSRCS += tcp/test_tcp_procfs.c
endif

ifeq ($(CONFIG_NET_IPv4)$(CONFIG_NET_SOCKOPTS)$(CONFIG_NET_TCP_WRITE_BUFFERS),yyy)
Expand Down
23 changes: 23 additions & 0 deletions testing/nettest/tcp/test_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,29 @@ int main(int argc, FAR char *argv[])
cmocka_unit_test_setup_teardown(test_tcp_recv_iov_nowait,
test_tcp_iov_setup,
test_tcp_iov_teardown),
# ifdef CONFIG_NET_TCPBACKLOG
# ifdef CONFIG_NET_SOLINGER
cmocka_unit_test_setup_teardown(test_tcp_backlog_relisten_rst,
test_tcp_backlog_setup,
test_tcp_backlog_teardown),
# endif
cmocka_unit_test_setup_teardown(test_tcp_backlog_relisten_race,
test_tcp_backlog_setup,
test_tcp_backlog_teardown),
cmocka_unit_test_setup_teardown(test_tcp_backlog_close_race,
test_tcp_backlog_setup,
test_tcp_backlog_teardown),
# endif
#endif
#ifdef TEST_TCP_PROCFS
cmocka_unit_test_setup_teardown(test_tcp_procfs_many,
test_tcp_procfs_setup,
test_tcp_procfs_teardown),
# ifdef CONFIG_NET_SOLINGER
cmocka_unit_test_setup_teardown(test_tcp_procfs_close,
test_tcp_procfs_setup,
test_tcp_procfs_teardown),
# endif
#endif
};

Expand Down
82 changes: 82 additions & 0 deletions testing/nettest/tcp/test_tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@

#include <pthread.h>

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/* The /proc/net/tcp cases need the file (CONFIG_NET_STATISTICS) and a
* dynamic pool of connections and of callbacks: they leave hundreds of
* connections in TIME_WAIT, which must stay there while the file is read.
* When the pool is full, the oldest of them are freed.
*/

#if defined(CONFIG_NET_IPv4) && defined(CONFIG_FS_PROCFS) && \
!defined(CONFIG_FS_PROCFS_EXCLUDE_NET) && \
defined(CONFIG_NET_STATISTICS) && \
CONFIG_NET_TCP_ALLOC_CONNS > 0 && CONFIG_NET_ALLOC_DEVIF_CALLBACKS > 0
# if (CONFIG_NET_TCP_MAX_CONNS == 0 || CONFIG_NET_TCP_MAX_CONNS >= 1024) && \
CONFIG_NET_TCP_WAIT_TIMEOUT >= 60
# define TEST_TCP_PROCFS 1
# endif
#endif

/****************************************************************************
* Public Types
****************************************************************************/
Expand Down Expand Up @@ -403,5 +423,67 @@ void test_tcp_recv_iov_empty(FAR void **state);
****************************************************************************/

void test_tcp_recv_iov_nowait(FAR void **state);

# ifdef CONFIG_NET_TCPBACKLOG
/****************************************************************************
* Name: test_tcp_backlog_setup
****************************************************************************/

int test_tcp_backlog_setup(FAR void **state);

/****************************************************************************
* Name: test_tcp_backlog_teardown
****************************************************************************/

int test_tcp_backlog_teardown(FAR void **state);

/****************************************************************************
* Name: test_tcp_backlog_relisten_rst
****************************************************************************/

# ifdef CONFIG_NET_SOLINGER
void test_tcp_backlog_relisten_rst(FAR void **state);
# endif

/****************************************************************************
* Name: test_tcp_backlog_relisten_race
****************************************************************************/

void test_tcp_backlog_relisten_race(FAR void **state);

/****************************************************************************
* Name: test_tcp_backlog_close_race
****************************************************************************/

void test_tcp_backlog_close_race(FAR void **state);
# endif
#endif

#ifdef TEST_TCP_PROCFS
/****************************************************************************
* Name: test_tcp_procfs_setup
****************************************************************************/

int test_tcp_procfs_setup(FAR void **state);

/****************************************************************************
* Name: test_tcp_procfs_teardown
****************************************************************************/

int test_tcp_procfs_teardown(FAR void **state);

/****************************************************************************
* Name: test_tcp_procfs_many
****************************************************************************/

void test_tcp_procfs_many(FAR void **state);

/****************************************************************************
* Name: test_tcp_procfs_close
****************************************************************************/

# ifdef CONFIG_NET_SOLINGER
void test_tcp_procfs_close(FAR void **state);
# endif
#endif
#endif /* __APPS_TESTING_NETTEST_TCP_TEST_TCP_H */
Loading
Loading