Skip to content

Commit

Permalink
signal: remove oneshot channels from tests (#7015)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn authored Dec 5, 2024
1 parent e0d1293 commit 405d746
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
8 changes: 0 additions & 8 deletions tokio/tests/signal_ctrl_c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
8 changes: 0 additions & 8 deletions tokio/tests/signal_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 405d746

Please sign in to comment.