Skip to main content

Crate banc_host

Crate banc_host 

Source
Expand description

Host-side fixtures and runner for the banc HIL test framework.

The shape of a banc test suite:

use banc_host::{run, BancTest, TestCx};

fn main() -> std::process::ExitCode {
    run(vec![BancTest::new("blink_observed", |cx| {
        Box::pin(async move {
            let assistant = cx.rig.assistant("a0").await?;
            // drive the target, assert on assistant-observed ground truth
            Ok(())
        })
    })])
}

On a machine without a rig (no banc-rig.toml, no BANC_RIG), every test reports ignored with a reason — never passed, never failed — so cargo test stays green off-rig and honest on-rig.

Re-exports§

pub use config::RigConfig;
pub use device::DeviceSuite;
pub use device::DeviceTest;
pub use evidence::Evidence;
pub use node::Node;
pub use rig::Acquire;
pub use rig::Rig;
pub use runner::run;
pub use runner::BancTest;
pub use runner::TestCx;

Modules§

config
Rig topology configuration.
device
The device half of a paired scenario: one on-target embedded-test, run as a child cargo test invocation in the firmware crate (which builds, flashes and executes it via that crate’s configured runner, e.g. probe-rs).
evidence
Per-test evidence: everything observed while a test ran, attached to the failure when it fails and discarded when it passes.
expect
Event-stream assertion helpers: wait for a matching event within a deadline, or assert silence over a window. The negative form succeeds via the timeout path — “nothing observed” is a verdict, not an error.
net
Network transport for remote rigs: postcard-rpc nodes and the rig lease over token-authenticated TCP.
node
A banc node: anything speaking banc-icd over postcard-rpc, whether a board on USB or a rig daemon across the network.
rig
Rig acquisition: locate the topology config, take the cross-process lock, hand out fixtures. One Rig per process; access to the hardware is exclusive for as long as it lives (the pattern is embedded-test-stand’s lock-owned-by-fixture, extended with a file lock because nextest runs one process per test).
runner
libtest-mimic glue: async tests with fixture injection, honest runtime self-skip when no rig is present, and evidence attached to failures.

Macros§

paired_suite
Generate a paired-scenario suite: a harness = false main where every scenario owns a DeviceTest handle bound to its on-target twin.

Structs§

Failed
Indicates that a test/benchmark has failed. Optionally carries a message.