Skip to content

Commit d7dded1

Browse files
committed
[utest][netdev]add netdev api testcases.
1 parent 64a9381 commit d7dded1

File tree

5 files changed

+1198
-4
lines changed

5 files changed

+1198
-4
lines changed

.github/utest/netdev/netdev.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# dependencies
2+
CONFIG_RT_CONSOLEBUF_SIZE=1024
3+
CONFIG_RT_NAME_MAX=24
4+
CONFIG_RT_USING_CI_ACTION=y
5+
# CONFIG_RT_USING_LWIP203=y
6+
CONFIG_RT_USING_LWIP212=y
7+
8+
CONFIG_RT_UTEST_TC_USING_NETDEV=y
9+
CONFIG_RT_UTEST_DEFAULT_NETDEV_NAME="e0"
10+
11+
CONFIG_BSP_DRV_EMAC=y

.github/workflows/utest_auto_run.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ jobs:
6161
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
6262
config_file: "lwip/lwip.cfg"
6363

64+
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
65+
config_file: "netdev/netdev.cfg"
66+
6467
env:
6568
TEST_QEMU_ARCH: ${{ matrix.platform.QEMU_ARCH }}
6669
TEST_QEMU_MACHINE: ${{ matrix.platform.QEMU_MACHINE }}

components/net/utest/Kconfig

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,33 @@ if RT_USING_LWIP
105105
endif
106106
endmenu
107107
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

components/net/utest/SConscript

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

8-
if GetDepend('RT_UTEST_TC_USING_LWIP'):
9-
# Add lwIP test source if enabled
10-
src += ['tc_lwip.c']
8+
if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('RT_UTEST_TC_USING_LWIP') or GetDepend('RT_UTEST_TC_USING_NETDEV'):
9+
10+
if GetDepend('RT_UTEST_TC_USING_LWIP'):
11+
# Add lwIP test source if enabled
12+
src += ['tc_lwip.c']
13+
14+
if GetDepend('RT_UTEST_TC_USING_NETDEV'):
15+
# Add netdev test source if enabled
16+
src += ['tc_netdev.c']
1117

1218
# Define the test group with proper dependencies
13-
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES', 'RT_USING_LWIP'], CPPPATH = CPPPATH)
19+
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES'], CPPPATH = CPPPATH)
1420

1521
Return('group')

0 commit comments

Comments
 (0)