Skip to content

Commit

Permalink
Merge branch 'sim-env'
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Jul 9, 2024
2 parents f76fcb3 + d04a333 commit 295b6a6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,21 @@ To run the example:
cargo run --example singlethreaded --features=usb,tokio/rt,tokio/macros

See [Cargo.toml](Cargo.toml) for further examples.

## Simulator tests

tests/simulator_tests.rs runs a set of integration tests against BitBox02 simulators. They are
automatically downloaded based on [tests/simulators.json](tests/simulators.json), and each one is
tested with.

To run them, use:

cargo test --features=simulator,tokio

If you want to test against a custom simulator build (e.g. when developing new firmware features),
you can run:

SIMULATOR=/path/to/simulator cargo test --features=simulator,tokio

In this case, only the given simulator will be used, and the ones defined in simulators.json will be
ignored.
6 changes: 5 additions & 1 deletion tests/simulator_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ async fn test_btc(bitbox: &PairedBitBox) {

#[tokio::test]
async fn test_device() {
let simulator_filenames = download_simulators().await.unwrap();
let simulator_filenames = if let Some(simulator_filename) = option_env!("SIMULATOR") {
vec![simulator_filename.into()]
} else {
download_simulators().await.unwrap()
};
for simulator_filename in simulator_filenames {
{
println!("Simulator tests using {}", simulator_filename);
Expand Down

0 comments on commit 295b6a6

Please sign in to comment.