@@ -538,6 +538,7 @@ impl Step for RustdocUi {
538538 target : self . target ,
539539 mode : "ui" ,
540540 suite : "rustdoc-ui" ,
541+ compare_mode : None ,
541542 } )
542543 }
543544}
@@ -590,19 +591,44 @@ macro_rules! default_test {
590591 }
591592}
592593
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+
593602macro_rules! host_test {
594603 ( $name: ident { path: $path: expr, mode: $mode: expr, suite: $suite: expr } ) => {
595604 test!( $name { path: $path, mode: $mode, suite: $suite, default : true , host: true } ) ;
596605 }
597606}
598607
599608macro_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 {
600625 ( $name: ident {
601626 path: $path: expr,
602627 mode: $mode: expr,
603628 suite: $suite: expr,
604629 default : $default: expr,
605- host: $host: expr
630+ host: $host: expr,
631+ compare_mode: $compare_mode: expr
606632 } ) => {
607633 #[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
608634 pub struct $name {
@@ -634,16 +660,18 @@ macro_rules! test {
634660 target: self . target,
635661 mode: $mode,
636662 suite: $suite,
663+ compare_mode: $compare_mode,
637664 } )
638665 }
639666 }
640667 }
641668}
642669
643- default_test ! ( Ui {
670+ default_test_with_compare_mode ! ( Ui {
644671 path: "src/test/ui" ,
645672 mode: "ui" ,
646- suite: "ui"
673+ suite: "ui" ,
674+ compare_mode: "nll"
647675} ) ;
648676
649677default_test ! ( RunPass {
@@ -804,6 +832,7 @@ struct Compiletest {
804832 target : Interned < String > ,
805833 mode : & ' static str ,
806834 suite : & ' static str ,
835+ compare_mode : Option < & ' static str > ,
807836}
808837
809838impl Step for Compiletest {
@@ -823,6 +852,7 @@ impl Step for Compiletest {
823852 let target = self . target ;
824853 let mode = self . mode ;
825854 let suite = self . suite ;
855+ let compare_mode = self . compare_mode ;
826856
827857 // Skip codegen tests if they aren't enabled in configuration.
828858 if !builder. config . codegen_tests && suite == "codegen" {
@@ -1044,6 +1074,15 @@ impl Step for Compiletest {
10441074 suite, mode, & compiler. host, target) ) ;
10451075 let _time = util:: timeit ( & builder) ;
10461076 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+ }
10471086 }
10481087}
10491088
0 commit comments