Skip to content

Commit 3e14369

Browse files
committed
feat:[sal][utest] added test cases for the sal api
1 parent 2d375b2 commit 3e14369

File tree

3 files changed

+1072
-37
lines changed

3 files changed

+1072
-37
lines changed

components/net/utest/Kconfig

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
1-
if RT_USING_LWIP
2-
menu "LwIP Network Unit Testcase"
1+
menu "Network Unit Testcase"
32

4-
config RT_UTEST_TC_USING_LWIP
5-
bool "lwIP API test"
3+
menuconfig RT_UTEST_TC_USING_SAL
4+
select RT_USING_SAL
5+
bool "SAL Unit Testcase"
6+
default n
7+
8+
menuconfig RT_UTEST_TC_USING_NETDEV
9+
select RT_USING_NETDEV
10+
bool "netdev api test"
11+
help
12+
Enable netdev network device framework unit tests.
13+
14+
Test coverage includes:
15+
* Network connectivity (ping operations)
16+
* DHCP functionality (enable/disable/restore)
17+
* DNS configuration and hostname resolution
18+
* Interface configuration (IP/gateway/netmask)
19+
* IP address conversion functions
20+
* Device retrieval and management
21+
* Status control and callback mechanisms
22+
23+
if RT_UTEST_TC_USING_NETDEV
24+
25+
config RT_UTEST_DEFAULT_NETDEV_NAME
26+
string "Default netdev name"
27+
default "e0"
28+
help
29+
Network interface name for tests. Common values:
30+
"e0" (Ethernet), "w0" (Wireless).
31+
Ensure the device exists in your environment.
32+
endif
33+
34+
menuconfig RT_UTEST_TC_USING_LWIP
35+
select RT_USING_LWIP
36+
select RT_LWIP_NETIF_LOOPBACK
37+
bool "lwIP Unit Testcase"
38+
default n
639
help
740
Enable lwIP network stack unit tests including DNS resolution,
841
TCP/UDP socket operations, and network interface tests
@@ -103,35 +136,4 @@ if RT_USING_LWIP
103136
This should match the actual IP of the test domain
104137

105138
endif
106-
endmenu
107-
endif
108-
109-
if RT_USING_NETDEV
110-
menu "Netdev Network Unit Testcase"
111-
112-
config RT_UTEST_TC_USING_NETDEV
113-
bool "netdev api test"
114-
help
115-
Enable netdev network device framework unit tests.
116-
117-
Test coverage includes:
118-
* Network connectivity (ping operations)
119-
* DHCP functionality (enable/disable/restore)
120-
* DNS configuration and hostname resolution
121-
* Interface configuration (IP/gateway/netmask)
122-
* IP address conversion functions
123-
* Device retrieval and management
124-
* Status control and callback mechanisms
125-
126-
if RT_UTEST_TC_USING_NETDEV
127-
128-
config RT_UTEST_DEFAULT_NETDEV_NAME
129-
string "Default netdev name"
130-
default "e0"
131-
help
132-
Network interface name for tests. Common values:
133-
"e0" (Ethernet), "w0" (Wireless).
134-
Ensure the device exists in your environment.
135-
endif
136-
endmenu
137-
endif
139+
endmenu

components/net/utest/SConscript

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cwd = GetCurrentDir()
55
src = []
66
CPPPATH = [cwd]
77

8-
if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('RT_UTEST_TC_USING_LWIP') or GetDepend('RT_UTEST_TC_USING_NETDEV'):
8+
if GetDepend('RT_UTEST_USING_ALL_CASES'):
99

1010
if GetDepend('RT_UTEST_TC_USING_LWIP'):
1111
# Add lwIP test source if enabled
@@ -15,6 +15,9 @@ if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('RT_UTEST_TC_USING_LWIP')
1515
# Add netdev test source if enabled
1616
src += ['tc_netdev.c']
1717

18+
if GetDepend('RT_UTEST_TC_USING_SAL'):
19+
src += ['tc_sal_socket.c']
20+
1821
# Define the test group with proper dependencies
1922
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES'], CPPPATH = CPPPATH)
2023

0 commit comments

Comments
 (0)