tokio/tests/signal.rs
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

21 lines
461 B
Rust

#![cfg(unix)]
extern crate libc;
pub mod support;
use support::*;
#[test]
fn tokio_simple() {
let signal_future = Signal::new(libc::SIGUSR1)
.and_then(|signal| {
send_signal(libc::SIGUSR1);
signal.into_future().map(|_| ()).map_err(|(err, _)| err)
});
let mut rt = CurrentThreadRuntime::new()
.expect("failed to init runtime");
run_with_timeout(&mut rt, signal_future)
.expect("failed");
}