Closed jszwedko closed 1 year ago
Thanks for reporting this! I think the easiest thing to do would be to make criterion support the --format terse option and output lines in the format nextest accepts: https://nexte.st/book/custom-test-harnesses.html
Note that following the standard Rust benchmark library, lines ending in ": bench" are ignored. We may want to add an option to run benchmarks as tests if that's a desired use case (is that what you want?)
Thanks for the response! That makes sense, I missed that section in the book. I'll open an issue over on criterion to see if they'd be open to adding those flags.
Note that following the standard Rust benchmark library, lines ending in ": bench" are ignored. We may want to add an option to run benchmarks as tests if that's a desired use case (is that what you want?)
Yeah, we have had cases where benches were broken accidentally so we started running them as tests in CI which seems to just run one benchmark iteration and lets us validate that no assertions failed (for criterion at least). That would be great if nextest
supported them, but I can just run cargo test --benches -- --bench
separately for now.
There's also https://github.com/nextest-rs/nextest/issues/38 which might be useful.
I think we can support this with a --run-benches
option, similar to --run-ignored
today.
I looked at this a bit more and it seems like criterion binaries built with cargo test don't appear to behave with --list
:
/home/rain/dev/cargo-guppy/target/debug/deps/package_graph-4455225dc7640272 --list
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.
Gnuplot not found, using plotters backend
Testing make_package_graph
Success
Testing depends_on
Success
Testing depends_on_cache
Success
Testing into_ids
Success
Testing resolve_package_name
Success
Testing make_package_name_hashmap
Success
Testing make_cycles
Success
I think this will need to be fixed in criterion first -- marking this "help wanted" in case someone wants to pick up the work in criterion. See https://nexte.st/book/custom-test-harnesses for more documentation (note that we also accept lines ending with : bench
and currently skip them, but we can choose to not do that in the future.)
Thanks for following up @sunshowers ! I agree https://github.com/bheisler/criterion.rs/issues/562 will need to be resolved first.
https://github.com/bheisler/criterion.rs/pull/602 addresses this.
Criterion 0.5, which came out a few days ago, supports nextest.
Hi all!
I'm a big fan of what this project is doing.
I noticed when trying to integrate this into https://github.com/vectordotdev/vector that it fails to run test binaries built from criterion benchmarks which don't support the same
--format
flag that normal test binaries support:Running
--help
on the test binary:I was just curious to get thoughts on handling this. Should I stick with normal
cargo test --benches
for that target for now and usenextest
for the other targets?