mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-11-16 04:24:33 +00:00
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
This commit is contained in:
2
.github/workflows/utest_auto_run.yml
vendored
2
.github/workflows/utest_auto_run.yml
vendored
@@ -72,6 +72,8 @@ jobs:
|
||||
config_file: "components/lwip.cfg"
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "components/netdev.cfg"
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "components/sal.cfg"
|
||||
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
|
||||
config_file: "components/dfs.cfg"
|
||||
|
||||
|
||||
@@ -1,8 +1,41 @@
|
||||
if RT_USING_LWIP
|
||||
menu "LwIP"
|
||||
menu "Network"
|
||||
|
||||
config RT_UTEST_TC_USING_LWIP
|
||||
bool "lwIP API Test"
|
||||
config RT_UTEST_TC_USING_SAL
|
||||
select RT_USING_SAL
|
||||
bool "SAL Unit Testcase"
|
||||
default n
|
||||
|
||||
menuconfig RT_UTEST_TC_USING_NETDEV
|
||||
select RT_USING_NETDEV
|
||||
bool "Netdev API Test"
|
||||
help
|
||||
Enable netdev network device framework unit tests.
|
||||
|
||||
Test coverage includes:
|
||||
* Network connectivity (ping operations)
|
||||
* DHCP functionality (enable/disable/restore)
|
||||
* DNS configuration and hostname resolution
|
||||
* Interface configuration (IP/gateway/netmask)
|
||||
* IP address conversion functions
|
||||
* Device retrieval and management
|
||||
* Status control and callback mechanisms
|
||||
|
||||
if RT_UTEST_TC_USING_NETDEV
|
||||
|
||||
config RT_UTEST_DEFAULT_NETDEV_NAME
|
||||
string "Default Netdev Name"
|
||||
default "e0"
|
||||
help
|
||||
Network interface name for tests. Common values:
|
||||
"e0" (Ethernet), "w0" (Wireless).
|
||||
Ensure the device exists in your environment.
|
||||
endif
|
||||
|
||||
menuconfig RT_UTEST_TC_USING_LWIP
|
||||
select RT_USING_LWIP
|
||||
select RT_LWIP_NETIF_LOOPBACK
|
||||
bool "lwIP Unit Testcase"
|
||||
default n
|
||||
help
|
||||
Enable lwIP network stack unit tests including DNS resolution,
|
||||
TCP/UDP socket operations, and network interface tests
|
||||
@@ -103,35 +136,5 @@ if RT_USING_LWIP
|
||||
This should match the actual IP of the test domain
|
||||
|
||||
endif
|
||||
endmenu
|
||||
endif
|
||||
|
||||
if RT_USING_NETDEV
|
||||
menu "Netdev"
|
||||
|
||||
config RT_UTEST_TC_USING_NETDEV
|
||||
bool "Netdev API Test"
|
||||
help
|
||||
Enable netdev network device framework unit tests.
|
||||
|
||||
Test coverage includes:
|
||||
* Network connectivity (ping operations)
|
||||
* DHCP functionality (enable/disable/restore)
|
||||
* DNS configuration and hostname resolution
|
||||
* Interface configuration (IP/gateway/netmask)
|
||||
* IP address conversion functions
|
||||
* Device retrieval and management
|
||||
* Status control and callback mechanisms
|
||||
|
||||
if RT_UTEST_TC_USING_NETDEV
|
||||
|
||||
config RT_UTEST_DEFAULT_NETDEV_NAME
|
||||
string "Default Netdev Name"
|
||||
default "e0"
|
||||
help
|
||||
Network interface name for tests. Common values:
|
||||
"e0" (Ethernet), "w0" (Wireless).
|
||||
Ensure the device exists in your environment.
|
||||
endif
|
||||
endmenu
|
||||
endif
|
||||
endmenu
|
||||
|
||||
@@ -5,17 +5,19 @@ cwd = GetCurrentDir()
|
||||
src = []
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if GetDepend('RT_UTEST_TC_USING_LWIP') or GetDepend('RT_UTEST_TC_USING_NETDEV'):
|
||||
if GetDepend('RT_UTEST_TC_USING_LWIP'):
|
||||
# Add lwIP test source if enabled
|
||||
src += ['tc_lwip.c']
|
||||
|
||||
if GetDepend('RT_UTEST_TC_USING_LWIP'):
|
||||
# Add lwIP test source if enabled
|
||||
src += ['tc_lwip.c']
|
||||
if GetDepend('RT_UTEST_TC_USING_NETDEV'):
|
||||
# Add netdev test source if enabled
|
||||
src += ['tc_netdev.c']
|
||||
|
||||
if GetDepend('RT_UTEST_TC_USING_NETDEV'):
|
||||
# Add netdev test source if enabled
|
||||
src += ['tc_netdev.c']
|
||||
if GetDepend('RT_UTEST_TC_USING_SAL'):
|
||||
# Add sal test source if enabled
|
||||
src += ['tc_sal_socket.c']
|
||||
|
||||
# Define the test group with proper dependencies
|
||||
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES'], CPPPATH = CPPPATH)
|
||||
group = DefineGroup('utestcases', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
|
||||
1030
components/net/utest/tc_sal_socket.c
Normal file
1030
components/net/utest/tc_sal_socket.c
Normal file
File diff suppressed because it is too large
Load Diff
8
examples/utest/configs/components/sal.cfg
Normal file
8
examples/utest/configs/components/sal.cfg
Normal file
@@ -0,0 +1,8 @@
|
||||
# dependencies
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=1024
|
||||
CONFIG_RT_NAME_MAX=24
|
||||
CONFIG_RT_USING_CI_ACTION=y
|
||||
|
||||
CONFIG_RT_UTEST_TC_USING_SAL=y
|
||||
CONFIG_RT_LWIP_NETIF_LOOPBACK=y
|
||||
CONFIG_BSP_DRV_EMAC=y
|
||||
Reference in New Issue
Block a user