Fix race in the tests

This commit is contained in:
Aleksey Kladov 2020-03-28 13:19:05 +01:00
parent f7df0b56a7
commit 12297ab675
3 changed files with 11 additions and 2 deletions

View File

@ -35,10 +35,10 @@ pub struct CheckOptions {
/// The spawned thread is shut down when this struct is dropped.
#[derive(Debug)]
pub struct CheckWatcher {
pub task_recv: Receiver<CheckTask>,
// XXX: drop order is significant
cmd_send: Option<Sender<CheckCommand>>,
handle: Option<jod_thread::JoinHandle<()>>,
pub task_recv: Receiver<CheckTask>,
}
impl CheckWatcher {

View File

@ -339,6 +339,14 @@ pub fn print_backtrace() {
let bt = backtrace::Backtrace::new();
eprintln!("{:?}", bt);
}
#[cfg(not(feature = "backtrace"))]
pub fn print_backtrace() {
eprintln!(
r#"enable the backtrace feature:
ra_prof = {{ path = "../ra_prof", features = [ "backtrace"] }}
"#
);
}
thread_local!(static IN_SCOPE: RefCell<bool> = RefCell::new(false));

View File

@ -83,9 +83,10 @@ pub fn project(fixture: &str) -> Server {
pub struct Server {
req_id: Cell<u64>,
messages: RefCell<Vec<Message>>,
dir: TempDir,
_thread: jod_thread::JoinHandle<()>,
client: Connection,
/// XXX: remove the tempdir last
dir: TempDir,
}
impl Server {