mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-06 00:45:22 +08:00
[utest][netdev]add netdev api testcases.
This commit is contained in:
11
.github/utest/netdev/netdev.cfg
vendored
Normal file
11
.github/utest/netdev/netdev.cfg
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# dependencies
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=1024
|
||||
CONFIG_RT_NAME_MAX=24
|
||||
CONFIG_RT_USING_CI_ACTION=y
|
||||
# CONFIG_RT_USING_LWIP203=y
|
||||
CONFIG_RT_USING_LWIP212=y
|
||||
|
||||
CONFIG_RT_UTEST_TC_USING_NETDEV=y
|
||||
CONFIG_RT_UTEST_DEFAULT_NETDEV_NAME="e0"
|
||||
|
||||
CONFIG_BSP_DRV_EMAC=y
|
||||
3
.github/workflows/utest_auto_run.yml
vendored
3
.github/workflows/utest_auto_run.yml
vendored
@@ -61,6 +61,9 @@ jobs:
|
||||
- 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: "lwip/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: "netdev/netdev.cfg"
|
||||
|
||||
env:
|
||||
TEST_QEMU_ARCH: ${{ matrix.platform.QEMU_ARCH }}
|
||||
TEST_QEMU_MACHINE: ${{ matrix.platform.QEMU_MACHINE }}
|
||||
|
||||
@@ -105,3 +105,33 @@ if RT_USING_LWIP
|
||||
endif
|
||||
endmenu
|
||||
endif
|
||||
|
||||
if RT_USING_NETDEV
|
||||
menu "Netdev Network Unit Testcase"
|
||||
|
||||
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
|
||||
|
||||
@@ -5,11 +5,17 @@ cwd = GetCurrentDir()
|
||||
src = []
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if GetDepend('RT_UTEST_TC_USING_LWIP'):
|
||||
# Add lwIP test source if enabled
|
||||
src += ['tc_lwip.c']
|
||||
if GetDepend('RT_UTEST_USING_ALL_CASES') or 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_NETDEV'):
|
||||
# Add netdev test source if enabled
|
||||
src += ['tc_netdev.c']
|
||||
|
||||
# Define the test group with proper dependencies
|
||||
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES', 'RT_USING_LWIP'], CPPPATH = CPPPATH)
|
||||
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
|
||||
1144
components/net/utest/tc_netdev.c
Normal file
1144
components/net/utest/tc_netdev.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user