fix(cli): preserve target order in summaries
Final multi-target summaries were printed by iterating the label-keyed BTreeMap directly, so they came out in lexicographic label order instead of the order targets were given on the command line. Iterate setup.targets (the canonical prepared CLI order) instead, looking up each target's stats by label, and keep the BTreeMap only for event-time lookup.
This commit is contained in:
2 files changed
+54
-3
No files matched your search
@@ -176,15 +176,18 @@ pub fn run_stream(
|
||||
stream_output.print_final_summary = should_print_final_summary(continuous, interrupted);
|
||||
stream_output.show_running_only_summary_note =
|
||||
continuous && interrupted && stream_output.print_final_summary;
|
||||
for (label, stats) in &stats {
|
||||
for target in &setup.targets {
|
||||
let target_stats = stats.get(&target.label).expect(
|
||||
"every prepared target must have a stats collector inserted before the run begins",
|
||||
);
|
||||
if multi_target
|
||||
&& stream_output.print_final_summary
|
||||
&& stream_output.config.prints_summary()
|
||||
{
|
||||
writeln!(stream_output.out)?;
|
||||
writeln!(stream_output.out, "target: {label}")?;
|
||||
writeln!(stream_output.out, "target: {}", target.label)?;
|
||||
}
|
||||
stream_output.print_summary(stats)?;
|
||||
stream_output.print_summary(target_stats)?;
|
||||
}
|
||||
stream_output.out.flush()?;
|
||||
if let Some(error) = terminal_error {
|
||||
|
||||
Reference in new issue
Block a user