@@ -538,6 +538,7 @@ impl Step for RustdocUi {
538
538
target : self . target ,
539
539
mode : "ui" ,
540
540
suite : "rustdoc-ui" ,
541
+ compare_mode : None ,
541
542
} )
542
543
}
543
544
}
@@ -590,19 +591,44 @@ macro_rules! default_test {
590
591
}
591
592
}
592
593
594
+ macro_rules! default_test_with_compare_mode {
595
+ ( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr,
596
+ compare_mode: $compare_mode: expr } ) => {
597
+ test_with_compare_mode!( $name { path: $path, mode: $mode, suite: $suite, default : true ,
598
+ host: false , compare_mode: $compare_mode } ) ;
599
+ }
600
+ }
601
+
593
602
macro_rules! host_test {
594
603
( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr } ) => {
595
604
test!( $name { path: $path, mode: $mode, suite: $suite, default : true , host: true } ) ;
596
605
}
597
606
}
598
607
599
608
macro_rules! test {
609
+ ( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr, default : $default: expr,
610
+ host: $host: expr } ) => {
611
+ test_definitions!( $name { path: $path, mode: $mode, suite: $suite, default : $default,
612
+ host: $host, compare_mode: None } ) ;
613
+ }
614
+ }
615
+
616
+ macro_rules! test_with_compare_mode {
617
+ ( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr, default : $default: expr,
618
+ host: $host: expr, compare_mode: $compare_mode: expr } ) => {
619
+ test_definitions!( $name { path: $path, mode: $mode, suite: $suite, default : $default,
620
+ host: $host, compare_mode: Some ( $compare_mode) } ) ;
621
+ }
622
+ }
623
+
624
+ macro_rules! test_definitions {
600
625
( $name: ident {
601
626
path: $path: expr,
602
627
mode: $mode: expr,
603
628
suite: $suite: expr,
604
629
default : $default: expr,
605
- host: $host: expr
630
+ host: $host: expr,
631
+ compare_mode: $compare_mode: expr
606
632
} ) => {
607
633
#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
608
634
pub struct $name {
@@ -634,16 +660,18 @@ macro_rules! test {
634
660
target: self . target,
635
661
mode: $mode,
636
662
suite: $suite,
663
+ compare_mode: $compare_mode,
637
664
} )
638
665
}
639
666
}
640
667
}
641
668
}
642
669
643
- default_test ! ( Ui {
670
+ default_test_with_compare_mode ! ( Ui {
644
671
path: "src/test/ui" ,
645
672
mode: "ui" ,
646
- suite: "ui"
673
+ suite: "ui" ,
674
+ compare_mode: "nll"
647
675
} ) ;
648
676
649
677
default_test ! ( RunPass {
@@ -804,6 +832,7 @@ struct Compiletest {
804
832
target : Interned < String > ,
805
833
mode : & ' static str ,
806
834
suite : & ' static str ,
835
+ compare_mode : Option < & ' static str > ,
807
836
}
808
837
809
838
impl Step for Compiletest {
@@ -823,6 +852,7 @@ impl Step for Compiletest {
823
852
let target = self . target ;
824
853
let mode = self . mode ;
825
854
let suite = self . suite ;
855
+ let compare_mode = self . compare_mode ;
826
856
827
857
// Skip codegen tests if they aren't enabled in configuration.
828
858
if !builder. config . codegen_tests && suite == "codegen" {
@@ -1044,6 +1074,15 @@ impl Step for Compiletest {
1044
1074
suite, mode, & compiler. host, target) ) ;
1045
1075
let _time = util:: timeit ( & builder) ;
1046
1076
try_run ( builder, & mut cmd) ;
1077
+
1078
+ if let Some ( compare_mode) = compare_mode {
1079
+ cmd. arg ( "--compare-mode" ) . arg ( compare_mode) ;
1080
+ let _folder = builder. fold_output ( || format ! ( "test_{}_{}" , suite, compare_mode) ) ;
1081
+ builder. info ( & format ! ( "Check compiletest suite={} mode={} compare_mode={} ({} -> {})" ,
1082
+ suite, mode, compare_mode, & compiler. host, target) ) ;
1083
+ let _time = util:: timeit ( & builder) ;
1084
+ try_run ( builder, & mut cmd) ;
1085
+ }
1047
1086
}
1048
1087
}
1049
1088
0 commit comments