From 8d694f20cd1c062676fa0b43513d31d5cff4f65a Mon Sep 17 00:00:00 2001 From: John Smith Date: Wed, 6 Sep 2023 09:53:28 -0400 Subject: [PATCH] fix async std test and make windows test script work --- veilid-core/run_windows_tests.bat | 2 +- veilid-core/src/network_manager/native/network_tcp.rs | 11 +++++------ veilid-tools/run_windows_tests.bat | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/veilid-core/run_windows_tests.bat b/veilid-core/run_windows_tests.bat index 7a48beb4..b3e1c3e7 100644 --- a/veilid-core/run_windows_tests.bat +++ b/veilid-core/run_windows_tests.bat @@ -1,4 +1,4 @@ @echo off cargo test -- --nocapture -cargo test --features=rt-async-std -- --nocapture +cargo test --no-default-features --features=default-async-std -- --nocapture diff --git a/veilid-core/src/network_manager/native/network_tcp.rs b/veilid-core/src/network_manager/native/network_tcp.rs index c6112e6c..45cc0267 100644 --- a/veilid-core/src/network_manager/native/network_tcp.rs +++ b/veilid-core/src/network_manager/native/network_tcp.rs @@ -134,9 +134,8 @@ impl Network { #[cfg(all(feature = "rt-async-std", unix))] { - // async-std does not directly support linger on tcpsocket yet - use std::os::fd::AsRawFd; - use std::os::fd::FromRawFd; + // async-std does not directly support linger on TcpStream yet + use std::os::fd::{AsRawFd, FromRawFd}; if let Err(e) = unsafe { socket2::Socket::from_raw_fd(tcp_stream.as_raw_fd()) } .set_linger(Some(core::time::Duration::from_secs(0))) { @@ -146,9 +145,9 @@ impl Network { } #[cfg(all(feature = "rt-async-std", windows))] { - // async-std does not directly support linger on tcpsocket yet - use std::os::windows::io::AsRawSocket; - if let Err(e) = unsafe { socket2::socket_from_raw(tcp_stream.as_raw_socket()) } + // async-std does not directly support linger on TcpStream yet + use std::os::windows::io::{AsRawSocket, FromRawSocket}; + if let Err(e) = unsafe { socket2::Socket::from_raw_socket(tcp_stream.as_raw_socket()) } .set_linger(Some(core::time::Duration::from_secs(0))) { log_net!(debug "Couldn't set TCP linger: {}", e); diff --git a/veilid-tools/run_windows_tests.bat b/veilid-tools/run_windows_tests.bat index 66998e0d..731b3207 100644 --- a/veilid-tools/run_windows_tests.bat +++ b/veilid-tools/run_windows_tests.bat @@ -1,5 +1,5 @@ @echo off -cargo test --features=rt-tokio,tracing -- --nocapture -cargo test --features=rt-async-std,tracing -- --nocapture -cargo test --features=rt-tokio -- --nocapture -cargo test --features=rt-async-std -- --nocapture +cargo test --features=tracing -- --nocapture +cargo test --no-default-features --features=rt-async-std,tracing -- --nocapture +cargo test -- --nocapture +cargo test --no-default-features --features=rt-async-std -- --nocapture