Skip to content

Commit

Permalink
fixup! fixup! refactor(bench)!: move benchmarking facilities to their…
Browse files Browse the repository at this point in the history
… own crate
  • Loading branch information
ROMemories committed Mar 26, 2024
1 parent 4f24136 commit c89c6f5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:

# TODO: we'll eventually want to enable relevant features
- name: "rustdoc"
run: cargo rustdoc -p riot-rs --features no-boards -- -D warnings
run: cargo rustdoc -p riot-rs --features no-boards,bench -- -D warnings

- name: rustfmt
run: cargo fmt --check --all
Expand Down
4 changes: 4 additions & 0 deletions src/riot-rs-bench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ cfg_if::cfg_if! {
if #[cfg(context = "cortex-m")] {
mod cortexm;
use cortexm as bench;
}
else if #[cfg(context = "riot-rs")] {
// When run with laze but the architecture is not supported
compile_error!("benchmarking is not supported for this architecture");
} else {
// Provide a default bench module, for arch-independent tooling
mod bench {
Expand Down
4 changes: 3 additions & 1 deletion src/riot-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ workspace = true
[dependencies]
document-features = { workspace = true }
linkme = { workspace = true }
riot-rs-bench = { workspace = true }
riot-rs-bench = { workspace = true, optional = true }
riot-rs-boards = { path = "../riot-rs-boards" }
riot-rs-buildinfo = { path = "../riot-rs-buildinfo" }
riot-rs-debug = { workspace = true }
Expand Down Expand Up @@ -75,6 +75,8 @@ wifi-esp = ["riot-rs-embassy/wifi-esp"]
## Enables the debug console, required to use
## [`println!`](riot_rs_debug::println).
debug-console = ["riot-rs-rt/debug-console"]
## Enables benchmarking facilities.
bench = ["dep:riot-rs-bench"]
## Prints nothing in case of panics (may help reduce binary size).
silent-panic = ["riot-rs-rt/silent-panic"]
## Allows to have no boards selected, useful to run target-independent tooling.
Expand Down
2 changes: 2 additions & 0 deletions src/riot-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#![no_std]
#![feature(doc_cfg)]

#[cfg(feature = "bench")]
#[doc(cfg(feature = "bench"))]
#[doc(inline)]
pub use riot_rs_bench as bench;
pub use riot_rs_buildinfo as buildinfo;
Expand Down

0 comments on commit c89c6f5

Please sign in to comment.