Remove non-working code for "running" mir-opt tests

Tests in `tests/mir-opt` always use `--emit=mir`, so the compiler doesn't even
produce an executable.

Attempting to "run" these tests (e.g. with `./x test mir-opt --pass=run`)
therefore fails when the OS notices that a MIR text file is not executable.
This commit is contained in:
Zalathar
2026-04-22 17:48:16 +10:00
parent cf1817bc6e
commit 8172f47781
2 changed files with 4 additions and 29 deletions
+3 -17
View File
@@ -295,14 +295,9 @@ fn pass_mode(&self) -> Option<PassMode> {
fn should_run(&self, pm: Option<PassMode>) -> WillExecute {
let test_should_run = match self.config.mode {
TestMode::Ui
if pm == Some(PassMode::Run)
|| matches!(self.props.fail_mode, Some(FailMode::Run(_))) =>
{
true
TestMode::Ui => {
pm == Some(PassMode::Run) || matches!(self.props.fail_mode, Some(FailMode::Run(_)))
}
TestMode::MirOpt if pm == Some(PassMode::Run) => true,
TestMode::Ui | TestMode::MirOpt => false,
mode => panic!("unimplemented for mode {:?}", mode),
};
if test_should_run { self.run_if_enabled() } else { WillExecute::No }
@@ -314,7 +309,7 @@ fn run_if_enabled(&self) -> WillExecute {
fn should_run_successfully(&self, pm: Option<PassMode>) -> bool {
match self.config.mode {
TestMode::Ui | TestMode::MirOpt => pm == Some(PassMode::Run),
TestMode::Ui => pm == Some(PassMode::Run),
mode => panic!("unimplemented for mode {:?}", mode),
}
}
@@ -938,15 +933,6 @@ fn compile_test(&self, will_execute: WillExecute, emit: Emit) -> ProcRes {
self.compile_test_general(will_execute, emit, self.props.local_pass_mode(), Vec::new())
}
fn compile_test_with_passes(
&self,
will_execute: WillExecute,
emit: Emit,
passes: Vec<String>,
) -> ProcRes {
self.compile_test_general(will_execute, emit, self.props.local_pass_mode(), passes)
}
fn compile_test_general(
&self,
will_execute: WillExecute,
+1 -12
View File
@@ -10,9 +10,6 @@
impl TestCx<'_> {
pub(super) fn run_mir_opt_test(&self) {
let pm = self.pass_mode();
let should_run = self.should_run(pm);
let mut test_info = files_for_miropt_test(
&self.testpaths.file.as_std_path(),
self.config.get_pointer_width(),
@@ -21,19 +18,11 @@ pub(super) fn run_mir_opt_test(&self) {
let passes = std::mem::take(&mut test_info.passes);
let proc_res = self.compile_test_with_passes(should_run, Emit::Mir, passes);
let proc_res = self.compile_test_general(WillExecute::No, Emit::Mir, None, passes);
if !proc_res.status.success() {
self.fatal_proc_rec("compilation failed!", &proc_res);
}
self.check_mir_dump(test_info);
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);
}
}
}
fn check_mir_dump(&self, test_info: MiroptTest) {