Skip to content

Commit fc6d14d

Browse files
committed
Merge branch 'master' of https://github.com/tomjielii/rt-thread
2 parents 7217dba + 138c888 commit fc6d14d

File tree

15 files changed

+1465
-181
lines changed

15 files changed

+1465
-181
lines changed

.github/utest/lwip/lwip.cfg

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# dependencies
2+
CONFIG_RT_CONSOLEBUF_SIZE=1024
3+
CONFIG_RT_NAME_MAX=24
4+
CONFIG_RT_USING_CI_ACTION=y
5+
6+
CONFIG_RT_LWIP_NETIF_LOOPBACK=y
7+
CONFIG_LWIP_NETIF_LOOPBACK=1
8+
CONFIG_RT_UTEST_TC_USING_LWIP=y
9+
CONFIG_RT_UTEST_LWIP_DNS_TEST=y
10+
CONFIG_RT_UTEST_LWIP_TCP_TEST=y
11+
CONFIG_RT_UTEST_LWIP_UDP_TEST=y
12+
CONFIG_RT_UTEST_LWIP_ICMP_TEST=y
13+
CONFIG_RT_UTEST_LWIP_SOCKET_OPT_TEST=y
14+
CONFIG_RT_UTEST_LWIP_ADDR_CONV_TEST=y
15+
CONFIG_RT_UTEST_LWIP_NETIF_TEST=y
16+
CONFIG_RT_UTEST_LWIP_TCP_PORT=1234
17+
CONFIG_RT_UTEST_LWIP_UDP_PORT=1235
18+
CONFIG_RT_UTEST_LWIP_TEST_URL="www.rt-thread.org"
19+
CONFIG_RT_UTEST_LWIP_TEST_ADDR="180.163.146.111"
20+
CONFIG_BSP_DRV_EMAC=y

.github/workflows/utest_auto_run.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ jobs:
5858
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
5959
config_file: "cpp11/cpp11.cfg"
6060

61+
- platform: { UTEST: "A9", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", SD_FILE: "sd.bin", KERNEL: "standard", "SMP_RUN":"" }
62+
config_file: "lwip/lwip.cfg"
63+
6164
env:
6265
TEST_QEMU_ARCH: ${{ matrix.platform.QEMU_ARCH }}
6366
TEST_QEMU_MACHINE: ${{ matrix.platform.QEMU_MACHINE }}
@@ -278,4 +281,4 @@ jobs:
278281
echo "=========================================================================================="
279282
break
280283
fi
281-
done
284+
done

Kconfig.utestcases

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ rsource "src/klibc/utest/Kconfig"
2323

2424
rsource "components/drivers/audio/utest/Kconfig"
2525
rsource "components/dfs/utest/Kconfig"
26+
rsource "components/net/utest/Kconfig"
2627

2728
endif
2829

bsp/gd32/arm/gd32h759i-eval/.config

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,10 +1441,7 @@ CONFIG_BSP_USING_UART0=y
14411441
# CONFIG_BSP_USING_UART1 is not set
14421442
# CONFIG_BSP_USING_UART2 is not set
14431443
# CONFIG_BSP_USING_UART3 is not set
1444-
<<<<<<< HEAD
1445-
=======
14461444
# CONFIG_BSP_USING_I2C is not set
1447-
>>>>>>> master
14481445
# end of On-chip Peripheral Drivers
14491446

14501447
#

bsp/renesas/ra2a1-ek/board/Kconfig

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,184 @@ menu "Hardware Drivers Config"
9696
default 0
9797
endif
9898
endif
99+
100+
menuconfig BSP_USING_SCI
101+
bool "Enable SCI Controller"
102+
default n
103+
config BSP_USING_SCIn_SPI
104+
bool
105+
depends on BSP_USING_SCI
106+
select RT_USING_SPI
107+
default n
99108

109+
config BSP_USING_SCIn_I2C
110+
bool
111+
depends on BSP_USING_SCI
112+
select RT_USING_I2C
113+
default n
114+
115+
config BSP_USING_SCIn_UART
116+
bool
117+
depends on BSP_USING_SCI
118+
select RT_USING_SERIAL
119+
select RT_USING_SERIAL_V2
120+
default n
121+
122+
if BSP_USING_SCI
123+
config BSP_USING_SCI0
124+
bool "Enable SCI0"
125+
default n
126+
if BSP_USING_SCI0
127+
choice
128+
prompt "choice sci mode"
129+
default BSP_USING_SCI0_SPI
130+
config BSP_USING_SCI0_SPI
131+
select BSP_USING_SCIn_SPI
132+
bool "SPI mode"
133+
config BSP_USING_SCI0_I2C
134+
select BSP_USING_SCIn_I2C
135+
bool "I2C mode"
136+
config BSP_USING_SCI0_UART
137+
select BSP_USING_SCIn_UART
138+
bool "UART mode"
139+
endchoice
140+
if BSP_USING_SCI0_UART
141+
config BSP_SCI0_UART_RX_BUFSIZE
142+
int "Set UART0 RX buffer size"
143+
range 64 65535
144+
depends on RT_USING_SERIAL_V2
145+
default 256
146+
147+
config BSP_SCI0_UART_TX_BUFSIZE
148+
int "Set UART0 TX buffer size"
149+
range 0 65535
150+
depends on RT_USING_SERIAL_V2
151+
default 0
152+
endif
153+
endif
154+
config BSP_USING_SCI1
155+
bool "Enable SCI1"
156+
default n
157+
if BSP_USING_SCI1
158+
choice
159+
prompt "choice sci mode"
160+
default BSP_USING_SCI1_SPI
161+
config BSP_USING_SCI1_SPI
162+
select BSP_USING_SCIn_SPI
163+
bool "SPI mode"
164+
config BSP_USING_SCI1_I2C
165+
select BSP_USING_SCIn_I2C
166+
bool "I2C mode"
167+
config BSP_USING_SCI1_UART
168+
select BSP_USING_SCIn_UART
169+
bool "UART mode"
170+
endchoice
171+
if BSP_USING_SCI1_UART
172+
config BSP_SCI1_UART_RX_BUFSIZE
173+
int "Set UART1 RX buffer size"
174+
range 64 65535
175+
depends on RT_USING_SERIAL_V2
176+
default 256
177+
178+
config BSP_SCI1_UART_TX_BUFSIZE
179+
int "Set UART1 TX buffer size"
180+
range 0 65535
181+
depends on RT_USING_SERIAL_V2
182+
default 0
183+
endif
184+
endif
185+
186+
config BSP_USING_SCI9
187+
bool "Enable SCI9"
188+
default n
189+
if BSP_USING_SCI9
190+
choice
191+
prompt "choice sci mode"
192+
default BSP_USING_SCI9_SPI
193+
config BSP_USING_SCI9_SPI
194+
select BSP_USING_SCIn_SPI
195+
bool "SPI mode"
196+
config BSP_USING_SCI9_I2C
197+
select BSP_USING_SCIn_I2C
198+
bool "I2C mode"
199+
config BSP_USING_SCI9_UART
200+
select BSP_USING_SCIn_UART
201+
bool "UART mode"
202+
endchoice
203+
if BSP_USING_SCI9_UART
204+
config BSP_SCI9_UART_RX_BUFSIZE
205+
int "Set UART9 RX buffer size"
206+
range 64 65535
207+
depends on RT_USING_SERIAL_V2
208+
default 256
209+
210+
config BSP_SCI9_UART_TX_BUFSIZE
211+
int "Set UART9 TX buffer size"
212+
range 0 65535
213+
depends on RT_USING_SERIAL_V2
214+
default 0
215+
endif
216+
endif
217+
endif
218+
219+
menuconfig BSP_USING_HW_I2C
220+
bool "Enable hardware I2C BUS"
221+
default n
222+
if BSP_USING_HW_I2C
223+
config BSP_USING_HW_I2C0
224+
bool "Enable Hardware I2C0 BUS"
225+
default n
226+
config BSP_USING_HW_I2C1
227+
bool "Enable Hardware I2C1 BUS"
228+
default n
229+
endif
230+
231+
menuconfig BSP_USING_PWM
232+
bool "Enable PWM"
233+
default n
234+
select RT_USING_PWM
235+
if BSP_USING_PWM
236+
config BSP_USING_PWM0
237+
bool "Enable GPT0 (32-Bits) output PWM"
238+
default n
239+
240+
config BSP_USING_PWM1
241+
bool "Enable GPT1 (32-Bits) output PWM"
242+
default n
243+
244+
config BSP_USING_PWM2
245+
bool "Enable GPT2 (32-Bits) output PWM"
246+
default n
247+
248+
config BSP_USING_PWM3
249+
bool "Enable GPT3 (32-Bits) output PWM"
250+
default n
251+
252+
config BSP_USING_PWM4
253+
bool "Enable GPT4 (32-Bits) output PWM"
254+
default n
255+
256+
config BSP_USING_PWM5
257+
bool "Enable GPT5 (32-Bits) output PWM"
258+
default n
259+
260+
config BSP_USING_PWM6
261+
bool "Enable GPT6 (32-Bits) output PWM"
262+
default n
263+
endif
264+
265+
menuconfig BSP_USING_SPI
266+
bool "Enable SPI BUS"
267+
default n
268+
select RT_USING_SPI
269+
if BSP_USING_SPI
270+
config BSP_USING_SPI0
271+
bool "Enable SPI0 BUS"
272+
default n
273+
config BSP_USING_SPI1
274+
bool "Enable SPI1 BUS"
275+
default n
276+
endif
100277
endmenu
101278

102279
menu "Board extended module Drivers"

components/net/sal/src/sal_socket.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,16 +669,13 @@ int sal_bind(int socket, const struct sockaddr *name, socklen_t namelen)
669669
{
670670
struct sal_socket *sock;
671671
struct sal_proto_family *pf;
672-
struct sockaddr_un *addr_un = RT_NULL;
673672
ip_addr_t input_ipaddr;
674673

675674
RT_ASSERT(name);
676675

677676
/* get the socket object by socket descriptor */
678677
SAL_SOCKET_OBJ_GET(sock, socket);
679678

680-
addr_un = (struct sockaddr_un *)name;
681-
682679
#define IS_INET_ADDR_FAMILY(_af) ((_af) == AF_INET) || ((_af) == AF_INET6)
683680
if (IS_INET_ADDR_FAMILY(name->sa_family))
684681
{

components/net/utest/Kconfig

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
if RT_USING_LWIP
2+
menu "LwIP Network Unit Testcase"
3+
4+
config RT_UTEST_TC_USING_LWIP
5+
bool "lwIP API test"
6+
help
7+
Enable lwIP network stack unit tests including DNS resolution,
8+
TCP/UDP socket operations, and network interface tests
9+
10+
if RT_UTEST_TC_USING_LWIP
11+
12+
config RT_UTEST_LWIP_DNS_TEST
13+
bool "DNS resolution test"
14+
default y
15+
help
16+
Enable DNS resolution unit tests including gethostbyname()
17+
and gethostbyname_r() functions for hostname to IP resolution,
18+
as well as getaddrinfo() and freeaddrinfo() for address info
19+
retrieval and release. Tests verify successful resolution
20+
without hardcoded IP comparisons.
21+
22+
config RT_UTEST_LWIP_TCP_TEST
23+
bool "TCP socket test"
24+
default y
25+
help
26+
Enable TCP socket unit tests including client-server communication
27+
with echo functionality, socket creation, binding, listening,
28+
accepting connections, data transmission with varying buffer sizes,
29+
socket options (TCP_NODELAY, SO_REUSEADDR, SO_REUSEPORT),
30+
and connection management (shutdown, close).
31+
32+
config RT_UTEST_LWIP_UDP_TEST
33+
bool "UDP socket test"
34+
default y
35+
help
36+
Enable UDP socket unit tests including datagram transmission
37+
and reception, client-server echo communication, socket binding
38+
to any port, select() operations with timeout, recvfrom/sendto
39+
functions, and timeout handling for receive operations.
40+
41+
config RT_UTEST_LWIP_ICMP_TEST
42+
bool "ICMP ping test"
43+
default y
44+
help
45+
Enable ICMP ping unit tests using raw sockets to send
46+
ICMP echo requests and receive echo replies. Tests verify
47+
basic ICMP functionality with loopback address (127.0.0.1).
48+
49+
config RT_UTEST_LWIP_SOCKET_OPT_TEST
50+
bool "Socket options test"
51+
default y
52+
help
53+
Enable socket options unit tests including setsockopt()
54+
and getsockopt() functions. Tests verify setting and
55+
retrieving socket options such as SO_REUSEADDR.
56+
57+
config RT_UTEST_LWIP_ADDR_CONV_TEST
58+
bool "Address conversion test"
59+
default y
60+
help
61+
Enable address conversion unit tests including inet_addr()
62+
for converting string IP addresses to binary format and
63+
inet_ntoa() for converting binary addresses back to strings.
64+
Tests verify proper conversion functionality.
65+
66+
config RT_UTEST_LWIP_NETIF_TEST
67+
bool "Network interface management test"
68+
default y
69+
help
70+
Enable network interface management unit tests including
71+
netif_set_up(), netif_set_down(), and netif_set_default()
72+
functions. Tests verify interface state changes and
73+
default interface configuration.
74+
75+
config RT_UTEST_LWIP_TCP_PORT
76+
int "TCP test port"
77+
default 1234
78+
range 1024 65535
79+
help
80+
Configure the TCP port number for unit test communication.
81+
Must be in the range 1024-65535 to avoid system ports
82+
83+
config RT_UTEST_LWIP_UDP_PORT
84+
int "UDP test port"
85+
default 1235
86+
range 1024 65535
87+
help
88+
Configure the UDP port number for unit test communication.
89+
Must be in the range 1024-65535 to avoid system ports
90+
91+
config RT_UTEST_LWIP_TEST_URL
92+
string "Test domain name"
93+
default "www.rt-thread.org"
94+
help
95+
Configure the domain name for DNS resolution tests.
96+
This domain will be resolved to verify DNS functionality
97+
98+
config RT_UTEST_LWIP_TEST_ADDR
99+
string "Expected IP address"
100+
default "180.163.146.111"
101+
help
102+
Configure the expected IP address for DNS resolution verification.
103+
This should match the actual IP of the test domain
104+
105+
endif
106+
endmenu
107+
endif

components/net/utest/SConscript

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Import('rtconfig')
2+
from building import *
3+
4+
cwd = GetCurrentDir()
5+
src = []
6+
CPPPATH = [cwd]
7+
8+
if GetDepend('RT_UTEST_TC_USING_LWIP'):
9+
# Add lwIP test source if enabled
10+
src += ['tc_lwip.c']
11+
12+
# Define the test group with proper dependencies
13+
group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES', 'RT_USING_LWIP'], CPPPATH = CPPPATH)
14+
15+
Return('group')

0 commit comments

Comments
 (0)