Skip to content

Commit

Permalink
Overhaul testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
wmedrano committed Sep 13, 2024
1 parent cb708b2 commit 0551d4f
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 1,939 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ log = { version = "0.4", optional = true}

[dev-dependencies]
crossbeam-channel = "0.5"
ctor = "0.2"

[features]
default = ["dynamic_loading", "log"]
Expand Down
9 changes: 1 addition & 8 deletions src/client/async_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::sync::atomic::AtomicBool;
use super::callbacks::clear_callbacks;
use super::callbacks::{CallbackContext, NotificationHandler, ProcessHandler};
use crate::client::client_impl::Client;
use crate::client::common::{sleep_on_test, CREATE_OR_DESTROY_CLIENT_MUTEX};
use crate::client::common::CREATE_OR_DESTROY_CLIENT_MUTEX;
use crate::Error;

/// A JACK client that is processing data asynchronously, in real-time.
Expand Down Expand Up @@ -56,19 +56,14 @@ where
pub fn new(client: Client, notification_handler: N, process_handler: P) -> Result<Self, Error> {
let _m = CREATE_OR_DESTROY_CLIENT_MUTEX.lock().ok();
unsafe {
sleep_on_test();
let mut callback_context = Box::new(CallbackContext {
client,
notification: notification_handler,
process: process_handler,
is_valid: AtomicBool::new(true),
});
CallbackContext::register_callbacks(&mut callback_context)?;
sleep_on_test();
let res = j::jack_activate(callback_context.client.raw());
for _ in 0..4 {
sleep_on_test();
}
match res {
0 => Ok(AsyncClient {
callback: Some(callback_context),
Expand Down Expand Up @@ -117,13 +112,11 @@ impl<N, P> AsyncClient<N, P> {
let client = cb.client.raw();

// deactivate
sleep_on_test();
if j::jack_deactivate(client) != 0 {
return Err(Error::ClientDeactivationError);
}

// clear the callbacks
sleep_on_test();
clear_callbacks(client)?;
// done, take ownership of callback
if cb.is_valid.load(std::sync::atomic::Ordering::Relaxed) {
Expand Down
7 changes: 0 additions & 7 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,3 @@ pub use self::client_status::ClientStatus;
pub use self::common::CLIENT_NAME_SIZE;

pub use self::handler_impls::ClosureProcessHandler;

// client.rs excluding functionality that involves ports or callbacks
#[cfg(test)]
mod test;

#[cfg(test)]
mod test_callback;
262 changes: 0 additions & 262 deletions src/client/test.rs

This file was deleted.

Loading

0 comments on commit 0551d4f

Please sign in to comment.