@@ -155,7 +155,7 @@ async fn populate_report(
155
155
. entry ( confidence. is_definitely_relevant ( ) . then ( || direction) )
156
156
. or_default ( ) ;
157
157
158
- entry. push ( write_summary ( ctxt, comparison) . await )
158
+ entry. push ( write_triage_summary ( ctxt, comparison) . await )
159
159
}
160
160
}
161
161
}
@@ -320,6 +320,10 @@ impl ComparisonSummary {
320
320
self . comparisons . is_empty ( )
321
321
}
322
322
323
+ pub fn errors_in ( & self ) -> & [ String ] {
324
+ & self . errors_in
325
+ }
326
+
323
327
fn arithmetic_mean < ' a > (
324
328
& ' a self ,
325
329
changes : impl Iterator < Item = & ' a TestResultComparison > ,
@@ -372,7 +376,7 @@ impl ComparisonSummary {
372
376
}
373
377
}
374
378
375
- async fn write_summary ( ctxt : & SiteCtxt , comparison : & Comparison ) -> String {
379
+ async fn write_triage_summary ( ctxt : & SiteCtxt , comparison : & Comparison ) -> String {
376
380
use std:: fmt:: Write ;
377
381
let mut result = if let Some ( pr) = comparison. b . pr {
378
382
let title = github:: pr_title ( pr) . await ;
@@ -393,7 +397,7 @@ async fn write_summary(ctxt: &SiteCtxt, comparison: &Comparison) -> String {
393
397
let primary = primary. unwrap_or_else ( ComparisonSummary :: empty) ;
394
398
let secondary = secondary. unwrap_or_else ( ComparisonSummary :: empty) ;
395
399
396
- write_summary_table ( & primary, & secondary, & mut result) ;
400
+ write_summary_table ( & primary, & secondary, false , & mut result) ;
397
401
398
402
result
399
403
}
@@ -402,6 +406,7 @@ async fn write_summary(ctxt: &SiteCtxt, comparison: &Comparison) -> String {
402
406
pub fn write_summary_table (
403
407
primary : & ComparisonSummary ,
404
408
secondary : & ComparisonSummary ,
409
+ with_footnotes : bool ,
405
410
result : & mut String ,
406
411
) {
407
412
use std:: fmt:: Write ;
@@ -421,7 +426,8 @@ pub fn write_summary_table(
421
426
. unwrap ( ) ;
422
427
writeln ! (
423
428
result,
424
- "| count[^1] | {} | {} | {} | {} | {} |" ,
429
+ "| count{} | {} | {} | {} | {} | {} |" ,
430
+ if with_footnotes { "[^1]" } else { "" } ,
425
431
primary. num_regressions,
426
432
secondary. num_regressions,
427
433
primary. num_improvements,
@@ -432,7 +438,8 @@ pub fn write_summary_table(
432
438
433
439
writeln ! (
434
440
result,
435
- "| mean[^2] | {} | {} | {} | {} | {} |" ,
441
+ "| mean{} | {} | {} | {} | {} | {} |" ,
442
+ if with_footnotes { "[^2]" } else { "" } ,
436
443
render_stat( primary. num_regressions, || Some (
437
444
primary. arithmetic_mean_of_regressions( )
438
445
) ) ,
@@ -497,27 +504,15 @@ pub fn write_summary_table(
497
504
)
498
505
. unwrap ( ) ;
499
506
500
- if !primary . errors_in . is_empty ( ) {
501
- write ! (
507
+ if with_footnotes {
508
+ writeln ! (
502
509
result,
503
- "\n The following benchmark(s) failed to build:\n {}\n " ,
504
- primary
505
- . errors_in
506
- . iter( )
507
- . map( |benchmark| format!( "- {benchmark}" ) )
508
- . collect:: <Vec <_>>( )
509
- . join( "\n " )
510
+ r#"
511
+ [^1]: *number of relevant changes*
512
+ [^2]: *the arithmetic mean of the percent change*"#
510
513
)
511
514
. unwrap ( ) ;
512
515
}
513
-
514
- writeln ! (
515
- result,
516
- r#"
517
- [^1]: *number of relevant changes*
518
- [^2]: *the arithmetic mean of the percent change*"#
519
- )
520
- . unwrap ( ) ;
521
516
}
522
517
523
518
/// The amount of confidence we have that a comparison actually represents a real
@@ -760,6 +755,7 @@ pub struct Comparison {
760
755
pub b : ArtifactDescription ,
761
756
/// Statistics based on test case
762
757
pub statistics : HashSet < TestResultComparison > ,
758
+ /// A map from benchmark name to an error which occured when building `b` but not `a`.
763
759
pub new_errors : HashMap < String , String > ,
764
760
}
765
761
@@ -795,24 +791,29 @@ impl Comparison {
795
791
/// Splits comparison into primary and secondary summaries based on benchmark category
796
792
pub fn summarize_by_category (
797
793
self ,
798
- map : HashMap < Benchmark , Category > ,
794
+ category_map : HashMap < Benchmark , Category > ,
799
795
) -> ( Option < ComparisonSummary > , Option < ComparisonSummary > ) {
800
796
let ( primary, secondary) = self
801
797
. statistics
802
798
. into_iter ( )
803
- . partition ( |s| map. get ( & s. benchmark ( ) ) == Some ( & Category :: Primary ) ) ;
799
+ . partition ( |s| category_map. get ( & s. benchmark ( ) ) == Some ( & Category :: Primary ) ) ;
800
+
801
+ let ( primary_errors, secondary_errors) = self
802
+ . new_errors
803
+ . into_iter ( )
804
+ . partition ( |( b, _) | category_map. get ( & b. as_str ( ) . into ( ) ) == Some ( & Category :: Primary ) ) ;
804
805
805
806
let primary = Comparison {
806
807
a : self . a . clone ( ) ,
807
808
b : self . b . clone ( ) ,
808
809
statistics : primary,
809
- new_errors : self . new_errors . clone ( ) ,
810
+ new_errors : primary_errors ,
810
811
} ;
811
812
let secondary = Comparison {
812
813
a : self . a ,
813
814
b : self . b ,
814
815
statistics : secondary,
815
- new_errors : self . new_errors ,
816
+ new_errors : secondary_errors ,
816
817
} ;
817
818
(
818
819
ComparisonSummary :: summarize_comparison ( & primary) ,
@@ -1275,16 +1276,13 @@ fn compare_link(start: &ArtifactId, end: &ArtifactId) -> String {
1275
1276
1276
1277
#[ cfg( test) ]
1277
1278
mod tests {
1279
+ use super :: * ;
1280
+
1278
1281
use collector:: category:: Category ;
1279
1282
use std:: collections:: HashSet ;
1280
1283
1281
1284
use database:: { ArtifactId , Profile , Scenario } ;
1282
1285
1283
- use crate :: comparison:: {
1284
- write_summary_table, ArtifactDescription , Comparison , ComparisonSummary ,
1285
- TestResultComparison ,
1286
- } ;
1287
-
1288
1286
#[ test]
1289
1287
fn summary_table_only_regressions_primary ( ) {
1290
1288
check_table (
@@ -1487,7 +1485,7 @@ mod tests {
1487
1485
let secondary = create_summary ( secondary_statistics) ;
1488
1486
1489
1487
let mut result = String :: new ( ) ;
1490
- write_summary_table ( & primary, & secondary, & mut result) ;
1488
+ write_summary_table ( & primary, & secondary, true , & mut result) ;
1491
1489
assert_eq ! ( result, expected) ;
1492
1490
}
1493
1491
0 commit comments