From 405d746d38eba8f835ec0d04f4c7fb2f7bcc46d5 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Thu, 5 Dec 2024 17:36:45 +0100 Subject: [PATCH] signal: remove oneshot channels from tests (#7015) --- tokio/tests/signal_ctrl_c.rs | 8 -------- tokio/tests/signal_info.rs | 8 -------- 2 files changed, 16 deletions(-) diff --git a/tokio/tests/signal_ctrl_c.rs b/tokio/tests/signal_ctrl_c.rs index ebeee4d9e2e..1541436e9d8 100644 --- a/tokio/tests/signal_ctrl_c.rs +++ b/tokio/tests/signal_ctrl_c.rs @@ -9,23 +9,15 @@ mod support { use support::signal::send_signal; use tokio::signal; -use tokio::sync::oneshot; use tokio_test::assert_ok; #[tokio::test] async fn ctrl_c() { let ctrl_c = signal::ctrl_c(); - let (fire, wait) = oneshot::channel(); - - // NB: simulate a signal coming in by exercising our signal handler - // to avoid complications with sending SIGINT to the test process tokio::spawn(async { - wait.await.expect("wait failed"); send_signal(libc::SIGINT); }); - let _ = fire.send(()); - assert_ok!(ctrl_c.await); } diff --git a/tokio/tests/signal_info.rs b/tokio/tests/signal_info.rs index b297263f350..4b1bcd53c05 100644 --- a/tokio/tests/signal_info.rs +++ b/tokio/tests/signal_info.rs @@ -17,24 +17,16 @@ use support::signal::send_signal; use tokio::signal; use tokio::signal::unix::SignalKind; -use tokio::sync::oneshot; use tokio::time::{timeout, Duration}; #[tokio::test] async fn siginfo() { let mut sig = signal::unix::signal(SignalKind::info()).expect("installed signal handler"); - let (fire, wait) = oneshot::channel(); - - // NB: simulate a signal coming in by exercising our signal handler - // to avoid complications with sending SIGINFO to the test process tokio::spawn(async { - wait.await.expect("wait failed"); send_signal(libc::SIGINFO); }); - let _ = fire.send(()); - // Add a timeout to ensure the test doesn't hang. timeout(Duration::from_secs(5), sig.recv()) .await