Skip to content

Commit 3c0e9ac

Browse files
committed
Merge branch 'feature-c-unit-tests'
2 parents 91dc87f + 23be89d commit 3c0e9ac

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

Diff for: src/rust/bitbox02-rust-c/Cargo.toml

+6-2
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,21 @@ target-c-unit-tests = [
5959
# enable these features
6060
"app-bitcoin",
6161
"app-ethereum",
62-
"firmware"
62+
"firmware",
63+
"c-unit-testing",
6364
]
6465

6566
platform-bitbox02 = []
6667

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

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

74+
# Active when the Rust code is compiled to be linked into the C unit tests and simulator.
75+
c-unit-testing = ["bitbox02-rust/c-unit-testing", "bitbox02/c-unit-testing"]
76+
7377
app-ethereum = [
7478
# enable this dep
7579
"sha3",

Diff for: src/rust/bitbox02-rust/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,6 @@ testing = [
115115

116116
# enable these features
117117
"bitbox02/testing"
118-
]
118+
]
119+
120+
c-unit-testing = []

Diff for: src/rust/bitbox02/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ lazy_static = { version = "1.4.0", optional = true }
2929
[features]
3030
# Only to be enabled in unit tests.
3131
testing = ["lazy_static"]
32+
# Active when the Rust code is compiled to be linked into the C unit tests and simulator.
33+
c-unit-testing = []
3234

3335
app-ethereum = []
3436
app-bitcoin = []

Diff for: src/rust/bitbox02/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub fn reboot() -> ! {
176176
panic!("reboot called")
177177
}
178178

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

0 commit comments

Comments
 (0)