Skip to content

Commit

Permalink
Merge branch 'feature-c-unit-tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Jan 24, 2024
2 parents 91dc87f + 23be89d commit 3c0e9ac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/rust/bitbox02-rust-c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,21 @@ target-c-unit-tests = [
# enable these features
"app-bitcoin",
"app-ethereum",
"firmware"
"firmware",
"c-unit-testing",
]

platform-bitbox02 = []

bootloader = []
firmware = ["bitbox02-rust", "bitbox02", "bitbox02-noise", "sha2"]

# Only to be enabled in unit tests.
# Only to be enabled in Rust unit tests.
testing = ["bitbox02-rust/testing", "bitbox02/testing"]

# Active when the Rust code is compiled to be linked into the C unit tests and simulator.
c-unit-testing = ["bitbox02-rust/c-unit-testing", "bitbox02/c-unit-testing"]

app-ethereum = [
# enable this dep
"sha3",
Expand Down
4 changes: 3 additions & 1 deletion src/rust/bitbox02-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,6 @@ testing = [

# enable these features
"bitbox02/testing"
]
]

c-unit-testing = []
2 changes: 2 additions & 0 deletions src/rust/bitbox02/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ lazy_static = { version = "1.4.0", optional = true }
[features]
# Only to be enabled in unit tests.
testing = ["lazy_static"]
# Active when the Rust code is compiled to be linked into the C unit tests and simulator.
c-unit-testing = []

app-ethereum = []
app-bitcoin = []
Expand Down
2 changes: 1 addition & 1 deletion src/rust/bitbox02/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ pub fn reboot() -> ! {
panic!("reboot called")
}

#[cfg(feature = "testing")]
#[cfg(any(feature = "testing", feature = "c-unit-testing"))]
pub fn print_stdout(msg: &str) {
unsafe {
bitbox02_sys::printf(crate::util::str_to_cstr_vec(msg).unwrap().as_ptr());
Expand Down

0 comments on commit 3c0e9ac

Please sign in to comment.