Skip to content

Commit

Permalink
mocker: make ci happy
Browse files Browse the repository at this point in the history
  • Loading branch information
bastibl committed Nov 15, 2024
1 parent 1204ef1 commit 88f8ac1
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ jobs:
- run: cargo test --all-targets --workspace --features=aaronia_http,rtlsdr,zeromq,audio,flow_scheduler,tpb_scheduler,seify_dummy,soapy,lttng,zynq,wgpu
- run: cargo test --all-targets --manifest-path=crates/futuredsp/Cargo.toml
- run: cargo test --all-targets --manifest-path=crates/remote/Cargo.toml
- run: cargo test --all-targets --manifest-path=examples/wlan/Cargo.toml

test-macos:
name: Unit Tests macOS
Expand Down
1 change: 0 additions & 1 deletion examples/m17/src/moving_average.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use futuresdr::anyhow::Result;
use futuresdr::macros::async_trait;
use futuresdr::runtime::Block;
use futuresdr::runtime::BlockMeta;
use futuresdr::runtime::BlockMetaBuilder;
use futuresdr::runtime::Kernel;
Expand Down
7 changes: 3 additions & 4 deletions examples/wlan/src/moving_average.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::marker::PhantomData;
use futuresdr::anyhow::Result;
use futuresdr::macros::async_trait;
use futuresdr::num_complex::Complex32;
use futuresdr::runtime::Block;
use futuresdr::runtime::BlockMeta;
use futuresdr::runtime::BlockMetaBuilder;
use futuresdr::runtime::Kernel;
Expand Down Expand Up @@ -116,7 +115,7 @@ mod test {

#[test]
fn mov_avg_one() {
let mut mocker = Mocker::new(MovingAverage::<f32>::new_typed(2));
let mut mocker = Mocker::new(MovingAverage::<f32>::new(2));
mocker.input(0, vec![1.0f32, 2.0]);
mocker.init_output::<f32>(0, 64);
mocker.run();
Expand All @@ -127,7 +126,7 @@ mod test {

#[test]
fn mov_avg_no_data() {
let mut mocker = Mocker::new(MovingAverage::<f32>::new_typed(3));
let mut mocker = Mocker::new(MovingAverage::<f32>::new(3));
mocker.input(0, vec![1.0f32, 2.0]);
mocker.init_output::<f32>(0, 64);
mocker.run();
Expand All @@ -138,7 +137,7 @@ mod test {

#[test]
fn mov_avg_data() {
let mut mocker = Mocker::new(MovingAverage::<f32>::new_typed(2));
let mut mocker = Mocker::new(MovingAverage::<f32>::new(2));
mocker.input(0, vec![1.0f32, 2.0, 3.0, 4.0]);
mocker.init_output::<f32>(0, 64);
mocker.run();
Expand Down
5 changes: 5 additions & 0 deletions src/runtime/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ impl<T: Kernel + Send + 'static> TypedBlock<T> {
kernel,
}
}

/// Set Instance name of Block.
pub fn set_instance_name(&mut self, name: impl Into<String>) {
self.meta.set_instance_name(name)
}
}

pub(crate) struct TypedBlockWrapper<T> {
Expand Down
3 changes: 0 additions & 3 deletions src/runtime/mocker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,11 @@ impl<K: Kernel + 'static> Mocker<K> {
}

/// Run the block wrapped by the mocker
#[cfg(not(target_arch = "wasm32"))]
pub fn run(&mut self) {
crate::async_io::block_on(self.run_async());
}

/// Init the block wrapped by the mocker
#[cfg(not(target_arch = "wasm32"))]
pub fn init(&mut self) {
crate::async_io::block_on(async {
self.block
Expand All @@ -165,7 +163,6 @@ impl<K: Kernel + 'static> Mocker<K> {
}

/// Deinit the block wrapped by the mocker
#[cfg(not(target_arch = "wasm32"))]
pub fn deinit(&mut self) {
crate::async_io::block_on(async {
self.block
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mod logging;

mod flowgraph;
pub mod message_io;
#[cfg(not(target_arch = "wasm32"))]
mod mocker;
#[allow(clippy::module_inception)]
mod runtime;
Expand All @@ -52,6 +53,7 @@ pub use message_io::MessageInput;
pub use message_io::MessageIo;
pub use message_io::MessageIoBuilder;
pub use message_io::MessageOutput;
#[cfg(not(target_arch = "wasm32"))]
pub use mocker::Mocker;
pub use runtime::Runtime;
pub use runtime::RuntimeHandle;
Expand Down
1 change: 1 addition & 0 deletions src/runtime/stream_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ impl StreamOutput {
}

/// Get a mutable reference to the buffer writer
#[cfg(not(target_arch = "wasm32"))]
pub(super) fn writer_mut(&mut self) -> &mut BufferWriter {
let w = self.writer.as_mut().unwrap();
w
Expand Down

0 comments on commit 88f8ac1

Please sign in to comment.