Skip to content

Commit c8f0a26

Browse files
authored
feat:[sal][utest] added test cases for the sal api (#10720)
* feat:[sal][utest] added test cases for the sal api * improve[net][utestcase]: standardize script construction * ci[auto utest run]: standardize naming and add sal testcases * add sal utest auto run configure and standard Information
1 parent 16e729e commit c8f0a26

File tree

5 files changed

+1088
-43
lines changed

5 files changed

+1088
-43
lines changed

.github/workflows/utest_auto_run.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ jobs:
7272
config_file: "components/lwip.cfg"
7373
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
7474
config_file: "components/netdev.cfg"
75+
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
76+
config_file: "components/sal.cfg"
7577
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
7678
config_file: "components/dfs.cfg"
7779

components/net/utest/Kconfig

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

4-
config RT_UTEST_TC_USING_LWIP
5-
bool "lwIP API Test"
3+
config 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,5 @@ if RT_USING_LWIP
103136
This should match the actual IP of the test domain
104137

105138
endif
106-
endmenu
107-
endif
108139

109-
if RT_USING_NETDEV
110-
menu "Netdev"
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
140+
endmenu

components/net/utest/SConscript

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ cwd = GetCurrentDir()
55
src = []
66
CPPPATH = [cwd]
77

8-
if GetDepend('RT_UTEST_TC_USING_LWIP') or GetDepend('RT_UTEST_TC_USING_NETDEV'):
8+
if GetDepend('RT_UTEST_TC_USING_LWIP'):
9+
# Add lwIP test source if enabled
10+
src += ['tc_lwip.c']
911

10-
if GetDepend('RT_UTEST_TC_USING_LWIP'):
11-
# Add lwIP test source if enabled
12-
src += ['tc_lwip.c']
12+
if GetDepend('RT_UTEST_TC_USING_NETDEV'):
13+
# Add netdev test source if enabled
14+
src += ['tc_netdev.c']
1315

14-
if GetDepend('RT_UTEST_TC_USING_NETDEV'):
15-
# Add netdev test source if enabled
16-
src += ['tc_netdev.c']
16+
if GetDepend('RT_UTEST_TC_USING_SAL'):
17+
# Add sal test source if enabled
18+
src += ['tc_sal_socket.c']
1719

1820
# Define the test group with proper dependencies
19-
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES'], CPPPATH = CPPPATH)
21+
group = DefineGroup('utestcases', src, depend = [''], CPPPATH = CPPPATH)
2022

2123
Return('group')

0 commit comments

Comments
 (0)