[utest][netdev]add netdev api testcases.

This commit is contained in:
Rbb666
2025-09-14 12:09:08 +08:00
committed by R b b666
parent 64a938174e
commit d7dded112e
5 changed files with 1198 additions and 4 deletions

11
.github/utest/netdev/netdev.cfg vendored Normal file
View 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

View File

@@ -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 }}

View File

@@ -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

View File

@@ -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')

File diff suppressed because it is too large Load Diff