1b8a62b91Sopenharmony_ci//! Tests for [`rustix::net`].
2b8a62b91Sopenharmony_ci
3b8a62b91Sopenharmony_ci#![cfg(feature = "net")]
4b8a62b91Sopenharmony_ci#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
5b8a62b91Sopenharmony_ci#![cfg(not(any(target_os = "redox", target_os = "wasi")))]
6b8a62b91Sopenharmony_ci#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
7b8a62b91Sopenharmony_ci#![cfg_attr(core_c_str, feature(core_c_str))]
8b8a62b91Sopenharmony_ci
9b8a62b91Sopenharmony_cimod addr;
10b8a62b91Sopenharmony_cimod connect_bind_send;
11b8a62b91Sopenharmony_cimod poll;
12b8a62b91Sopenharmony_cimod sockopt;
13b8a62b91Sopenharmony_ci#[cfg(unix)]
14b8a62b91Sopenharmony_cimod unix;
15b8a62b91Sopenharmony_cimod v4;
16b8a62b91Sopenharmony_cimod v6;
17b8a62b91Sopenharmony_ci
18b8a62b91Sopenharmony_ci/// Windows requires us to call a setup function before using any of the
19b8a62b91Sopenharmony_ci/// socket APIs.
20b8a62b91Sopenharmony_ci#[cfg(windows)]
21b8a62b91Sopenharmony_ci#[ctor::ctor]
22b8a62b91Sopenharmony_cifn windows_startup() {
23b8a62b91Sopenharmony_ci    let _ = rustix::net::wsa_startup().unwrap();
24b8a62b91Sopenharmony_ci}
25b8a62b91Sopenharmony_ci
26b8a62b91Sopenharmony_ci/// Windows requires us to call a cleanup function after using any of the
27b8a62b91Sopenharmony_ci/// socket APIs.
28b8a62b91Sopenharmony_ci#[cfg(windows)]
29b8a62b91Sopenharmony_ci#[ctor::dtor]
30b8a62b91Sopenharmony_cifn windows_shutdown() {
31b8a62b91Sopenharmony_ci    rustix::net::wsa_cleanup().unwrap();
32b8a62b91Sopenharmony_ci}
33