Skip to content

Commit

Permalink
Add more test error messages to guess where hanging may happen.
Browse files Browse the repository at this point in the history
  • Loading branch information
wmedrano committed Sep 14, 2024
1 parent 92a3403 commit af91abf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/tests/processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ use crate::RawMidi;
fn panic_in_process_handler_propagates_as_error_in_deactivate() {
let (client, _) = crate::Client::new("", crate::ClientOptions::NO_START_SERVER).unwrap();
let (send, recv) = std::sync::mpsc::sync_channel(1);
eprintln!("Activating async client.");
let process_handler = crate::ClosureProcessHandler::new(move |_, _| {
send.try_send(true).ok();
panic!("panic should convert to error!");
});
let ac = client.activate_async((), process_handler).unwrap();
eprintln!("Waiting for process signal.");
assert!(recv
.recv_timeout(std::time::Duration::from_secs(1))
.unwrap());
eprintln!("Deactivating client.");
assert_eq!(ac.deactivate().err(), Some(crate::Error::ClientPanicked));
}

Expand All @@ -26,10 +29,13 @@ fn quitting_stops_calling_process() {
assert_eq!(calls, 1);
crate::Control::Quit
});
eprintln!("Activating async client.");
let ac = client.activate_async((), process_handler).unwrap();
eprintln!("Waiting for process signal.");
assert!(recv
.recv_timeout(std::time::Duration::from_secs(1))
.unwrap());
eprintln!("Deactivating client.");
ac.deactivate().unwrap();
}

Expand Down Expand Up @@ -66,13 +72,16 @@ fn signals_in_audio_ports_are_forwarded() {
});

// Runs checks.
eprintln!("Activating async client.");
let ac = client.activate_async((), process_handler).unwrap();
ac.as_client()
.connect_ports_by_name(&output_name, &input_name)
.unwrap();
eprintln!("Waiting for process signal.");
assert!(recv
.recv_timeout(std::time::Duration::from_secs(1))
.unwrap());
eprintln!("Deactivating client.");
ac.deactivate().unwrap();
}

Expand Down

0 comments on commit af91abf

Please sign in to comment.