Skip to content

Commit

Permalink
commented out test
Browse files Browse the repository at this point in the history
  • Loading branch information
amab8901 committed Apr 9, 2023
1 parent 7075cd4 commit ca426bd
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions applications/test_channel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ fn rmain(matches: Matches) -> Result<(), &'static str> {
println!("Running asynchronous channel test in oneshot mode.");
for _i in 0 .. iterations!() {
asynchronous_test_oneshot()?;
// asynchronous_test_oneshot_drop()?;
}
}
if matches.opt_present("m") {
Expand Down Expand Up @@ -318,6 +319,47 @@ fn asynchronous_test_oneshot() -> Result<(), &'static str> {
Ok(())
}

// Modified version of asynchronous_test_oneshot to test the drop() method of sender and receiver
// fn asynchronous_test_oneshot_drop() -> Result<(), &'static str>{
// let my_cpu = cpu::current_cpu();

// let (sender, receiver) = async_channel::new_channel(2);

// let t1 = spawn::new_task_builder(|_: ()| -> Result<(), &'static str> {
// warn!("asynchronous_test_oneshot(): Entered sender task!");
// sender.send("hello").map_err(|error| {
// warn!("Sender task failed due to : {:?}", error);
// return "Sender task failed";
// })?;
// Ok(())
// }, ())
// .name(String::from("sender_task_asynchronous_oneshot"))
// .block();
// let t1 = pin_task!(t1, my_cpu).spawn()?;

// let t2 = spawn::new_task_builder(|_: ()| -> Result<(), &'static str> {
// warn!("asynchronous_test_oneshot(): Entered receiver task!");
// let msg = receiver.receive().map_err(|error| {
// warn!("Receiver task failed due to : {:?}", error);
// return "Receiver task failed"
// })?;
// warn!("asynchronous_test_oneshot(): Receiver got msg: {:?}", msg);
// Ok(())
// }, ())
// .name(String::from("receiver_task_asynchronous_oneshot"))
// .block();
// let t2 = pin_task!(t2, my_cpu).spawn()?;

// warn!("asynchronous_test_oneshot(): Finished spawning the sender and receiver tasks");
// t2.unblock().unwrap();
// t1.unblock().unwrap();

// t1.join()?;
// t2.join()?;
// warn!("asynchronous_test_oneshot(): Joined the sender and receiver tasks.");

// Ok(())
// }

/// A simple test that spawns a sender & receiver task to send `send_count` and receive `receive_count` messages.
fn asynchronous_test_multiple(send_count: usize, receive_count: usize, send_panic: Option<usize>, receive_panic: Option<usize>) -> Result<(), &'static str> {
Expand Down

0 comments on commit ca426bd

Please sign in to comment.