Skip to content

Commit 8923641

Browse files
committed
feat(cargo-codspeed): add explicit mode with command when no benchmarks are found in run
1 parent d71bcc0 commit 8923641

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

crates/cargo-codspeed/src/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub fn run_benches(
108108
let benches =
109109
package_filters.benches_to_run(metadata, bench_target_filters, codspeed_target_dir)?;
110110
if benches.is_empty() {
111-
bail!("No benchmarks found. Run `cargo codspeed build` first.");
111+
bail!("No benchmarks found for the {measurement_mode} mode. Run `cargo codspeed build -m {measurement_mode}` first.");
112112
}
113113

114114
eprintln!("Collected {} benchmark suite(s) to run", benches.len());

crates/cargo-codspeed/tests/simple-bencher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn test_simple_run_without_build() {
1313
.arg("run")
1414
.assert()
1515
.failure()
16-
.stderr(contains("Error: No benchmarks found."));
16+
.stderr(contains("Error: No benchmarks found for the instrumentation mode. Run `cargo codspeed build -m instrumentation` first."));
1717
teardown(dir);
1818
}
1919

crates/cargo-codspeed/tests/simple-criterion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn test_criterion_run_without_build() {
1515
.arg("run")
1616
.assert()
1717
.failure()
18-
.stderr(contains("Error: No benchmarks found."));
18+
.stderr(contains("Error: No benchmarks found for the instrumentation mode. Run `cargo codspeed build -m instrumentation` first."));
1919
teardown(dir);
2020
}
2121

crates/cargo-codspeed/tests/simple-divan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn test_divan_run_without_build() {
1515
.arg("run")
1616
.assert()
1717
.failure()
18-
.stderr(contains("Error: No benchmarks found."));
18+
.stderr(contains("Error: No benchmarks found for the instrumentation mode. Run `cargo codspeed build -m instrumentation` first."));
1919
teardown(dir);
2020
}
2121

crates/cargo-codspeed/tests/workspace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn test_workspace_run_without_build() {
1212
.arg("run")
1313
.assert()
1414
.failure()
15-
.stderr(contains("Error: No benchmarks found."));
15+
.stderr(contains("Error: No benchmarks found for the instrumentation mode. Run `cargo codspeed build -m instrumentation` first."));
1616
teardown(dir);
1717
}
1818

@@ -62,7 +62,7 @@ fn test_workspace_build_subpackage_and_run_other() {
6262
.args(["--package", "package-b"])
6363
.assert()
6464
.failure()
65-
.stderr(contains("Error: No benchmarks found."));
65+
.stderr(contains("Error: No benchmarks found for the instrumentation mode. Run `cargo codspeed build -m instrumentation` first."));
6666
teardown(dir);
6767
}
6868

0 commit comments

Comments
 (0)