performance-metrics: Add --continue-on-failure flag and status tracking#7905
performance-metrics: Add --continue-on-failure flag and status tracking#7905anirudhrb wants to merge 1 commit intocloud-hypervisor:mainfrom
Conversation
performance-metrics/src/main.rs
Outdated
| max: 0.0, | ||
| min: 0.0, | ||
| status: "FAILED".to_string(), | ||
| }); |
There was a problem hiding this comment.
A panicked test could leave things hanging. The failure path should call cleanup_stale_processes(), to avoid possible subsequent tests contamination.
Thanks
performance-metrics/src/main.rs
Outdated
| std_dev: f64, | ||
| max: f64, | ||
| min: f64, | ||
| status: String, |
There was a problem hiding this comment.
If there are no compatibility concerns regarding the JSON format change, at least this should update the ./docs/perfomance-metrics.md about the changed output format.
Thanks
There was a problem hiding this comment.
docs/performance-metrics.md doesn't have this schema defined currently. It just says:
| results | A list of metrics |
But the schema of results is not mentioned there.
performance-metrics/src/main.rs
Outdated
| if continue_on_failure { | ||
| eprintln!("Test '{}' failed: '{e:?}'. Continuing.", test.name); | ||
| has_failure = true; | ||
| metrics_report.results.push(PerformanceTestResult { |
There was a problem hiding this comment.
I'd suggest to unify PerformanceTestResult creation through a helper/constructor, so success/failure status and fields stay consistent and future changes don't diverge.
Thanks
There was a problem hiding this comment.
I'm unsure how a constructor/helper would be useful here. Could you please elaborate?
There was a problem hiding this comment.
With this change, success and failure construct PerformanceTestResult independently, duplicating the field list and status logic. A helper would centralize that, so future field additions only need updating in one place.
Thanks
There was a problem hiding this comment.
LGTM, thanks for addressing this. One could tighten it further with impl Default or alike but given both variants here are on the same page, it's obvious enough in case it's changing.
Thanks
|
It looks like we're trying to replicate what It should be possible to convert the performance metric tests to use the same framework. To be clear, I'm not asking you to stop this PR. Switching to |
Yeah, moving these tests to
Ack. I'll continue with this PR for the short term. |
7656e98 to
5688819
Compare
5688819 to
849f729
Compare
849f729 to
1ce8c5c
Compare
performance-metrics/src/main.rs
Outdated
| std_dev, | ||
| max, | ||
| min, | ||
| status: "PASSED".to_string(), |
There was a problem hiding this comment.
Why can't we use an enum here?
There was a problem hiding this comment.
changed it to enum now.
| .long("continue-on-failure") | ||
| .help("Continue running remaining tests after a test failure") | ||
| .num_args(0) | ||
| .action(ArgAction::SetTrue) |
There was a problem hiding this comment.
The default is false. ArgAction::SetTrue in clap inherently defaults to false - absent flag means false, passing --continue-on-failure flips it to true.
Add a --continue-on-failure CLI flag that allows the test harness to
continue executing remaining tests after encountering a failure, instead
of aborting immediately. When set, failed tests are recorded with zeroed
metrics and a "FAILED" status, the report file is always generated, and
the process exits with a non-zero code if any test failed.
Without the flag, the existing fail-fast behavior is preserved.
Also add a "status" field ("PASSED"/"FAILED") to PerformanceTestResult
so report consumers can distinguish successful tests from failed ones.
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
1ce8c5c to
e225eea
Compare
Add a --continue-on-failure CLI flag that allows the test harness to continue executing remaining tests after encountering a failure, instead of aborting immediately. When set, failed tests are recorded with zeroed metrics and a "FAILED" status, the report file is always generated, and the process exits with a non-zero code if any test failed.
Without the flag, the existing fail-fast behavior is preserved.
Also add a "status" field ("PASSED"/"FAILED") to PerformanceTestResult so report consumers can distinguish successful tests from failed ones.