@@ -69,12 +69,12 @@ fn sort_benchmark_requests<'a>(done: &HashSet<String>, request_queue: &'a mut [B
69
69
// let the commits be benchmarked in the current order that we have, these benchmark runs
70
70
// just won't have a parent result available.
71
71
if level_len == 0 {
72
- log:: warn!( "No commit is ready for benchmarking" ) ;
73
- #[ cfg( test) ]
74
- {
72
+ if cfg ! ( test) {
75
73
panic ! ( "No commit is ready for benchmarking" ) ;
74
+ } else {
75
+ log:: warn!( "No commit is ready for benchmarking" ) ;
76
+ return ;
76
77
}
77
- return ;
78
78
}
79
79
80
80
// Everything in level has the same topological order, then we sort based on heuristics
@@ -525,8 +525,16 @@ mod tests {
525
525
* | m "rrr" C | -----+-->
526
526
* +-----------+ |
527
527
* | +---------------+
528
- * +--->| t "yee" R pr1 | 5 : a try with a low pr
528
+ * +--->| t "yee" R pr1 | 6 : a try with a low pr
529
529
* +---------------+
530
+ * +-----------+
531
+ * | m "aaa" C |
532
+ * +-----------+
533
+ * |
534
+ * V
535
+ * +----------------+
536
+ * | m "mmm" R pr88 | 4: a master commit
537
+ * +----------------+
530
538
*
531
539
* +-----------+
532
540
* | m "345" C |
@@ -549,7 +557,7 @@ mod tests {
549
557
* |
550
558
* V
551
559
* +---------------+
552
- * | t "baz" R pr4 | 6 : a try with a higher pr
560
+ * | t "baz" R pr4 | 7 : a try with a higher pr
553
561
* +---------------+
554
562
*
555
563
* The master commits should take priority, then "yee" followed
@@ -563,19 +571,24 @@ mod tests {
563
571
create_try( "baz" , "foo" , 4 , "days1" ) ,
564
572
create_release( "v.1.2.3" , "days2" ) ,
565
573
create_try( "yee" , "rrr" , 1 , "days2" ) , // lower PR number takes priority
566
- create_try( "t1" , "rrr" , 1 , "days2" ) . with_status( BenchmarkRequestStatus :: InProgress ) ,
574
+ create_try( "t1" , "rrr" , 1 , "days1" ) . with_status( BenchmarkRequestStatus :: InProgress ) ,
575
+ create_master( "mmm" , "aaa" , 88 , "days2" ) ,
567
576
] ;
568
577
569
578
db_insert_requests ( & * db, & requests) . await ;
570
579
571
- let completed: HashSet < String > =
572
- HashSet :: from ( [ "bar" . to_string ( ) , "345" . to_string ( ) , "rrr" . to_string ( ) ] ) ;
580
+ let completed: HashSet < String > = HashSet :: from ( [
581
+ "bar" . to_string ( ) ,
582
+ "345" . to_string ( ) ,
583
+ "rrr" . to_string ( ) ,
584
+ "aaa" . to_string ( ) ,
585
+ ] ) ;
573
586
574
587
let sorted: Vec < BenchmarkRequest > = build_queue ( & mut * db, & completed) . await . unwrap ( ) ;
575
588
576
589
assert ! ( queue_order_matches(
577
590
& sorted,
578
- & [ "t1" , "v.1.2.3" , "123" , "foo" , "yee" , "baz" ]
591
+ & [ "t1" , "v.1.2.3" , "123" , "foo" , "mmm" , " yee", "baz" ]
579
592
) ) ;
580
593
Ok ( ctx)
581
594
} )
0 commit comments