@@ -9,6 +9,8 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr};
99/// Test `connect_any`.
1010#[ test]
1111fn net_dgram_v4_connect_any ( ) {
12+ crate :: init ( ) ;
13+
1214 let localhost = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
1315 let addr = SocketAddr :: new ( localhost, 0 ) ;
1416 let listener = rustix:: net:: socket ( AddressFamily :: INET , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -38,6 +40,8 @@ fn net_dgram_v4_connect_any() {
3840#[ cfg( not( any( apple, windows, target_os = "haiku" ) ) ) ]
3941#[ test]
4042fn net_dgram_v4_connect_any_accept_with ( ) {
43+ crate :: init ( ) ;
44+
4145 let localhost = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
4246 let addr = SocketAddr :: new ( localhost, 0 ) ;
4347 let listener = rustix:: net:: socket ( AddressFamily :: INET , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -66,6 +70,8 @@ fn net_dgram_v4_connect_any_accept_with() {
6670/// Similar, but with V6.
6771#[ test]
6872fn net_dgram_v6_connect_any ( ) {
73+ crate :: init ( ) ;
74+
6975 let localhost = IpAddr :: V6 ( Ipv6Addr :: LOCALHOST ) ;
7076 let addr = SocketAddr :: new ( localhost, 0 ) ;
7177 let listener = rustix:: net:: socket ( AddressFamily :: INET6 , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -95,6 +101,8 @@ fn net_dgram_v6_connect_any() {
95101#[ cfg( not( any( apple, windows, target_os = "haiku" ) ) ) ]
96102#[ test]
97103fn net_dgram_v6_connect_any_accept_with ( ) {
104+ crate :: init ( ) ;
105+
98106 let localhost = IpAddr :: V6 ( Ipv6Addr :: LOCALHOST ) ;
99107 let addr = SocketAddr :: new ( localhost, 0 ) ;
100108 let listener = rustix:: net:: socket ( AddressFamily :: INET6 , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -123,6 +131,8 @@ fn net_dgram_v6_connect_any_accept_with() {
123131/// Test `connect` with a `SocketAddr`.
124132#[ test]
125133fn net_dgram_v4_connect ( ) {
134+ crate :: init ( ) ;
135+
126136 let localhost = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
127137 let addr = SocketAddr :: new ( localhost, 0 ) ;
128138 let listener = rustix:: net:: socket ( AddressFamily :: INET , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -154,6 +164,8 @@ fn net_dgram_v4_connect() {
154164/// Similar, but use V6.
155165#[ test]
156166fn net_dgram_v6_connect ( ) {
167+ crate :: init ( ) ;
168+
157169 let localhost = IpAddr :: V6 ( Ipv6Addr :: LOCALHOST ) ;
158170 let addr = SocketAddr :: new ( localhost, 0 ) ;
159171 let listener = rustix:: net:: socket ( AddressFamily :: INET6 , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -185,6 +197,8 @@ fn net_dgram_v6_connect() {
185197/// Test `connect_unspec`.
186198#[ test]
187199fn net_dgram_v4_connect_unspec ( ) {
200+ crate :: init ( ) ;
201+
188202 const SOME_PORT : u16 = 47 ;
189203 let localhost_addr = SocketAddrV4 :: new ( Ipv4Addr :: LOCALHOST , SOME_PORT ) ;
190204
@@ -229,6 +243,8 @@ fn net_dgram_v4_connect_unspec() {
229243/// Test `connect_unspec`.
230244#[ test]
231245fn net_dgram_v6_connect_unspec ( ) {
246+ crate :: init ( ) ;
247+
232248 const SOME_PORT : u16 = 47 ;
233249 let localhost_addr = SocketAddrV6 :: new ( Ipv6Addr :: LOCALHOST , SOME_PORT , 0 , 0 ) ;
234250
@@ -273,6 +289,8 @@ fn net_dgram_v6_connect_unspec() {
273289/// Test `bind_any`.
274290#[ test]
275291fn net_dgram_v4_bind_any ( ) {
292+ crate :: init ( ) ;
293+
276294 let localhost = Ipv4Addr :: LOCALHOST ;
277295 let addr = SocketAddrV4 :: new ( localhost, 0 ) . into ( ) ;
278296 let listener = rustix:: net:: socket ( AddressFamily :: INET , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -300,6 +318,8 @@ fn net_dgram_v4_bind_any() {
300318/// Similar, but use V6.
301319#[ test]
302320fn net_dgram_v6_bind_any ( ) {
321+ crate :: init ( ) ;
322+
303323 let localhost = Ipv6Addr :: LOCALHOST ;
304324 let addr = SocketAddrAny :: V6 ( SocketAddrV6 :: new ( localhost, 0 , 0 , 0 ) ) ;
305325 let listener = rustix:: net:: socket ( AddressFamily :: INET6 , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -328,6 +348,8 @@ fn net_dgram_v6_bind_any() {
328348#[ cfg( not( any( bsd, target_os = "illumos" ) ) ) ]
329349#[ test]
330350fn net_dgram_v4_connect_sendto ( ) {
351+ crate :: init ( ) ;
352+
331353 let localhost = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
332354 let addr = SocketAddr :: new ( localhost, 0 ) ;
333355 let listener = rustix:: net:: socket ( AddressFamily :: INET , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -373,6 +395,8 @@ fn net_dgram_v4_connect_sendto() {
373395/// Test `sendto` without calling `connect`.
374396#[ test]
375397fn net_dgram_v4_sendto ( ) {
398+ crate :: init ( ) ;
399+
376400 let localhost = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
377401 let addr = SocketAddr :: new ( localhost, 0 ) ;
378402 let listener = rustix:: net:: socket ( AddressFamily :: INET , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -418,6 +442,8 @@ fn net_dgram_v4_sendto() {
418442#[ cfg( not( any( bsd, target_os = "illumos" ) ) ) ]
419443#[ test]
420444fn net_dgram_v6_connect_sendto ( ) {
445+ crate :: init ( ) ;
446+
421447 let localhost = IpAddr :: V6 ( Ipv6Addr :: LOCALHOST ) ;
422448 let addr = SocketAddr :: new ( localhost, 0 ) ;
423449 let listener = rustix:: net:: socket ( AddressFamily :: INET6 , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -463,6 +489,8 @@ fn net_dgram_v6_connect_sendto() {
463489/// Similar, but with V6.
464490#[ test]
465491fn net_dgram_v6_sendto ( ) {
492+ crate :: init ( ) ;
493+
466494 let localhost = IpAddr :: V6 ( Ipv6Addr :: LOCALHOST ) ;
467495 let addr = SocketAddr :: new ( localhost, 0 ) ;
468496 let listener = rustix:: net:: socket ( AddressFamily :: INET6 , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -508,6 +536,8 @@ fn net_dgram_v6_sendto() {
508536#[ cfg( not( any( bsd, target_os = "illumos" ) ) ) ]
509537#[ test]
510538fn net_dgram_v4_connect_sendto_any ( ) {
539+ crate :: init ( ) ;
540+
511541 let localhost = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
512542 let addr = SocketAddr :: new ( localhost, 0 ) ;
513543 let listener = rustix:: net:: socket ( AddressFamily :: INET , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -550,6 +580,8 @@ fn net_dgram_v4_connect_sendto_any() {
550580/// Test `sendto_any` without calling connect.
551581#[ test]
552582fn net_dgram_v4_sendto_any ( ) {
583+ crate :: init ( ) ;
584+
553585 let localhost = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
554586 let addr = SocketAddr :: new ( localhost, 0 ) ;
555587 let listener = rustix:: net:: socket ( AddressFamily :: INET , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -592,6 +624,8 @@ fn net_dgram_v4_sendto_any() {
592624#[ cfg( not( any( bsd, target_os = "illumos" ) ) ) ]
593625#[ test]
594626fn net_dgram_v6_connect_sendto_any ( ) {
627+ crate :: init ( ) ;
628+
595629 let localhost = IpAddr :: V6 ( Ipv6Addr :: LOCALHOST ) ;
596630 let addr = SocketAddr :: new ( localhost, 0 ) ;
597631 let listener = rustix:: net:: socket ( AddressFamily :: INET6 , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -634,6 +668,8 @@ fn net_dgram_v6_connect_sendto_any() {
634668/// Similar, but with V6.
635669#[ test]
636670fn net_dgram_v6_sendto_any ( ) {
671+ crate :: init ( ) ;
672+
637673 let localhost = IpAddr :: V6 ( Ipv6Addr :: LOCALHOST ) ;
638674 let addr = SocketAddr :: new ( localhost, 0 ) ;
639675 let listener = rustix:: net:: socket ( AddressFamily :: INET6 , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -675,6 +711,8 @@ fn net_dgram_v6_sendto_any() {
675711/// Test `acceptfrom`.
676712#[ test]
677713fn net_dgram_v4_acceptfrom ( ) {
714+ crate :: init ( ) ;
715+
678716 let localhost = IpAddr :: V4 ( Ipv4Addr :: LOCALHOST ) ;
679717 let addr = SocketAddr :: new ( localhost, 0 ) ;
680718 let listener = rustix:: net:: socket ( AddressFamily :: INET , SocketType :: DGRAM , None ) . unwrap ( ) ;
@@ -702,6 +740,8 @@ fn net_dgram_v4_acceptfrom() {
702740/// Similar, but with V6.
703741#[ test]
704742fn net_dgram_v6_acceptfrom ( ) {
743+ crate :: init ( ) ;
744+
705745 let localhost = IpAddr :: V6 ( Ipv6Addr :: LOCALHOST ) ;
706746 let addr = SocketAddr :: new ( localhost, 0 ) ;
707747 let listener = rustix:: net:: socket ( AddressFamily :: INET6 , SocketType :: DGRAM , None ) . unwrap ( ) ;
0 commit comments