Files
tokio/tests/drop_then_get_a_signal.rs
T
Ivan Petkov 266919add6 signal: Refactor Signal tests
* Added timeouts to all tests that were missing them
 - any issue we have will likely result in deadlocks/starvation so its
   best if all tests quickly timeout rather than require getting killed
   or have the CI timeout itself
* Added a `support` module and put a bunch of helpers there to DRY the
tests
2018-09-10 11:30:06 -07:00

29 lines
710 B
Rust

#![cfg(unix)]
extern crate libc;
pub mod support;
use support::*;
#[test]
fn drop_then_get_a_signal() {
let mut lp = Core::new().unwrap();
let handle = lp.handle();
let signal = run_core_with_timeout(&mut lp, Signal::with_handle(
libc::SIGUSR1,
&handle.new_tokio_handle(),
)).expect("failed to create first signal");
drop(signal);
send_signal(libc::SIGUSR1);
let signal = lp.run(Signal::with_handle(libc::SIGUSR1, &handle.new_tokio_handle()))
.expect("failed to create signal")
.into_future()
.map(|_| ())
.map_err(|(e, _)| panic!("{}", e));
run_core_with_timeout(&mut lp, signal)
.expect("failed to get signal");
}