Skip to content

Commit 5589550

Browse files
committed
Expand x.py test to also run with --compare-mode=nll on src/test/ui suite.
1 parent f4bb956 commit 5589550

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

src/bootstrap/test.rs

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
593602
macro_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

599608
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 {
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

649677
default_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

809838
impl 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

Comments
 (0)