-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[utest][lwip]add lwip api testcase. #10675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# dependencies | ||
CONFIG_RT_CONSOLEBUF_SIZE=1024 | ||
CONFIG_RT_NAME_MAX=24 | ||
CONFIG_RT_USING_CI_ACTION=y | ||
|
||
CONFIG_RT_LWIP_NETIF_LOOPBACK=y | ||
CONFIG_LWIP_NETIF_LOOPBACK=1 | ||
CONFIG_RT_UTEST_TC_USING_LWIP=y | ||
CONFIG_RT_UTEST_LWIP_DNS_TEST=y | ||
CONFIG_RT_UTEST_LWIP_TCP_TEST=y | ||
CONFIG_RT_UTEST_LWIP_UDP_TEST=y | ||
CONFIG_RT_UTEST_LWIP_ICMP_TEST=y | ||
CONFIG_RT_UTEST_LWIP_SOCKET_OPT_TEST=y | ||
CONFIG_RT_UTEST_LWIP_ADDR_CONV_TEST=y | ||
CONFIG_RT_UTEST_LWIP_NETIF_TEST=y | ||
CONFIG_RT_UTEST_LWIP_TCP_PORT=1234 | ||
CONFIG_RT_UTEST_LWIP_UDP_PORT=1235 | ||
CONFIG_RT_UTEST_LWIP_TEST_URL="www.rt-thread.org" | ||
CONFIG_RT_UTEST_LWIP_TEST_ADDR="180.163.146.111" | ||
CONFIG_BSP_DRV_EMAC=y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
if RT_USING_LWIP | ||
menu "LwIP Network Unit Testcase" | ||
|
||
config RT_UTEST_TC_USING_LWIP | ||
bool "lwIP API test" | ||
help | ||
Enable lwIP network stack unit tests including DNS resolution, | ||
TCP/UDP socket operations, and network interface tests | ||
|
||
if RT_UTEST_TC_USING_LWIP | ||
|
||
config RT_UTEST_LWIP_DNS_TEST | ||
bool "DNS resolution test" | ||
default y | ||
help | ||
Enable DNS resolution unit tests including gethostbyname() | ||
and gethostbyname_r() functions for hostname to IP resolution, | ||
as well as getaddrinfo() and freeaddrinfo() for address info | ||
retrieval and release. Tests verify successful resolution | ||
without hardcoded IP comparisons. | ||
|
||
config RT_UTEST_LWIP_TCP_TEST | ||
bool "TCP socket test" | ||
default y | ||
help | ||
Enable TCP socket unit tests including client-server communication | ||
with echo functionality, socket creation, binding, listening, | ||
accepting connections, data transmission with varying buffer sizes, | ||
socket options (TCP_NODELAY, SO_REUSEADDR, SO_REUSEPORT), | ||
and connection management (shutdown, close). | ||
|
||
config RT_UTEST_LWIP_UDP_TEST | ||
bool "UDP socket test" | ||
default y | ||
help | ||
Enable UDP socket unit tests including datagram transmission | ||
and reception, client-server echo communication, socket binding | ||
to any port, select() operations with timeout, recvfrom/sendto | ||
functions, and timeout handling for receive operations. | ||
|
||
config RT_UTEST_LWIP_ICMP_TEST | ||
bool "ICMP ping test" | ||
default y | ||
help | ||
Enable ICMP ping unit tests using raw sockets to send | ||
ICMP echo requests and receive echo replies. Tests verify | ||
basic ICMP functionality with loopback address (127.0.0.1). | ||
|
||
config RT_UTEST_LWIP_SOCKET_OPT_TEST | ||
bool "Socket options test" | ||
default y | ||
help | ||
Enable socket options unit tests including setsockopt() | ||
and getsockopt() functions. Tests verify setting and | ||
retrieving socket options such as SO_REUSEADDR. | ||
|
||
config RT_UTEST_LWIP_ADDR_CONV_TEST | ||
bool "Address conversion test" | ||
default y | ||
help | ||
Enable address conversion unit tests including inet_addr() | ||
for converting string IP addresses to binary format and | ||
inet_ntoa() for converting binary addresses back to strings. | ||
Tests verify proper conversion functionality. | ||
|
||
config RT_UTEST_LWIP_NETIF_TEST | ||
bool "Network interface management test" | ||
default y | ||
help | ||
Enable network interface management unit tests including | ||
netif_set_up(), netif_set_down(), and netif_set_default() | ||
functions. Tests verify interface state changes and | ||
default interface configuration. | ||
|
||
config RT_UTEST_LWIP_TCP_PORT | ||
int "TCP test port" | ||
default 1234 | ||
range 1024 65535 | ||
help | ||
Configure the TCP port number for unit test communication. | ||
Must be in the range 1024-65535 to avoid system ports | ||
|
||
config RT_UTEST_LWIP_UDP_PORT | ||
int "UDP test port" | ||
default 1235 | ||
range 1024 65535 | ||
help | ||
Configure the UDP port number for unit test communication. | ||
Must be in the range 1024-65535 to avoid system ports | ||
|
||
config RT_UTEST_LWIP_TEST_URL | ||
string "Test domain name" | ||
default "www.rt-thread.org" | ||
help | ||
Configure the domain name for DNS resolution tests. | ||
This domain will be resolved to verify DNS functionality | ||
|
||
config RT_UTEST_LWIP_TEST_ADDR | ||
string "Expected IP address" | ||
default "180.163.146.111" | ||
help | ||
Configure the expected IP address for DNS resolution verification. | ||
This should match the actual IP of the test domain | ||
|
||
endif | ||
endmenu | ||
endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Import('rtconfig') | ||
from building import * | ||
|
||
cwd = GetCurrentDir() | ||
src = [] | ||
CPPPATH = [cwd] | ||
|
||
if GetDepend('RT_UTEST_TC_USING_LWIP'): | ||
# Add lwIP test source if enabled | ||
src += ['tc_lwip.c'] | ||
|
||
# Define the test group with proper dependencies | ||
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES', 'RT_USING_LWIP'], CPPPATH = CPPPATH) | ||
|
||
Return('group') |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为何不依赖于
RT_UTEST_USING_ALL_CASES
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个原因和此评论的 第二条 一样
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我不是很清楚为啥会影响 CI。不过如果按照这个缘由继续下去,看上去
RT_UTEST_USING_ALL_CASES
会失去意义。