From 1d58e6ba05b826fa436e41a1929eac4925b59d1a Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Thu, 9 Apr 2020 14:12:07 +0300 Subject: compiletest: diff direction should be (-)expected -> (+)actual. --- src/tools/compiletest/src/runtest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 26a9cd11997..4a024cadf49 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3146,7 +3146,7 @@ impl<'test> TestCx<'test> { } let expected_string = fs::read_to_string(&expected_file).unwrap(); if dumped_string != expected_string { - print_diff(&dumped_string, &expected_string, 3); + print_diff(&expected_string, &dumped_string, 3); panic!( "Actual MIR output differs from expected MIR output {}", expected_file.display() -- cgit 1.4.1-3-g733a5 From 15719cde5e4f90e6a596d640e6eed49f2516b3ed Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sat, 11 Apr 2020 13:38:12 +0300 Subject: compiletest: support --pass=check and --pass=build for mir-opt tests. --- src/tools/compiletest/src/runtest.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/tools') diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 4a024cadf49..389098be096 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -357,14 +357,15 @@ impl<'test> TestCx<'test> { Ui if pm == Some(PassMode::Run) || self.props.fail_mode == Some(FailMode::Run) => { WillExecute::Yes } - Ui => WillExecute::No, + MirOpt if pm == Some(PassMode::Run) => WillExecute::Yes, + Ui | MirOpt => WillExecute::No, mode => panic!("unimplemented for mode {:?}", mode), } } fn should_run_successfully(&self, pm: Option) -> bool { match self.config.mode { - Ui => pm == Some(PassMode::Run), + Ui | MirOpt => pm == Some(PassMode::Run), mode => panic!("unimplemented for mode {:?}", mode), } } @@ -3057,18 +3058,24 @@ impl<'test> TestCx<'test> { } fn run_mir_opt_test(&self) { - let proc_res = self.compile_test(WillExecute::Yes, EmitMetadata::No); + let pm = self.pass_mode(); + let should_run = self.should_run(pm); + let emit_metadata = self.should_emit_metadata(pm); + let proc_res = self.compile_test(should_run, emit_metadata); if !proc_res.status.success() { self.fatal_proc_rec("compilation failed!", &proc_res); } - let proc_res = self.exec_compiled_test(); + self.check_mir_dump(); - if !proc_res.status.success() { - self.fatal_proc_rec("test run failed!", &proc_res); + if let WillExecute::Yes = should_run { + let proc_res = self.exec_compiled_test(); + + if !proc_res.status.success() { + self.fatal_proc_rec("test run failed!", &proc_res); + } } - self.check_mir_dump(); } fn check_mir_dump(&self) { -- cgit 1.4.1-3-g733a5