-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cargo-codspeed): fix build when package is included in its deps
Fix #37
- Loading branch information
1 parent
4cf6291
commit 47d35a1
Showing
6 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Cargo.lock | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "blit" | ||
version = "0.8.5" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
bencher = "0.1.5" | ||
codspeed = { path = "../../../codspeed" } | ||
codspeed-bencher-compat = { path = "../../../bencher_compat" } | ||
|
||
[dev-dependencies] | ||
blit = "*" | ||
|
||
[[bench]] | ||
name = "bencher_example" | ||
harness = false |
16 changes: 16 additions & 0 deletions
16
crates/cargo-codspeed/tests/package_in_deps.in/benches/bencher_example.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use codspeed::codspeed::black_box; | ||
use codspeed_bencher_compat::{benchmark_group, benchmark_main, Bencher}; | ||
|
||
pub fn a(bench: &mut Bencher) { | ||
bench.iter(|| (0..100).fold(0, |x, y| black_box(x + y))) | ||
} | ||
|
||
pub fn b(bench: &mut Bencher) { | ||
const N: usize = 1024; | ||
bench.iter(|| vec![0u8; N]); | ||
|
||
bench.bytes = N as u64; | ||
} | ||
|
||
benchmark_group!(benches, a, b); | ||
benchmark_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use predicates::str::contains; | ||
|
||
mod helpers; | ||
use helpers::*; | ||
|
||
const DIR: &str = "tests/package_in_deps.in"; | ||
|
||
#[test] | ||
fn test_package_in_deps_build() { | ||
let dir = setup(DIR, Project::PackageInDeps); | ||
cargo_codspeed(&dir) | ||
.arg("build") | ||
.assert() | ||
.success() | ||
.stderr(contains("Finished built 1 benchmark suite(s)")); | ||
teardown(dir); | ||
} |