Skip to content

Commit

Permalink
add fn compile_test_with_passes()
Browse files Browse the repository at this point in the history
  • Loading branch information
mj10021 committed May 5, 2023
1 parent 4b94c23 commit 2da54a9
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ impl<'test> TestCx<'test> {

fn run_cfail_test(&self) {
let pm = self.pass_mode();
let proc_res =
self.compile_test(WillExecute::No, self.should_emit_metadata(pm), Vec::new());
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
self.check_if_test_should_compile(&proc_res, pm);
self.check_no_compiler_crash(&proc_res, self.props.should_ice);

Expand Down Expand Up @@ -348,7 +347,7 @@ impl<'test> TestCx<'test> {
fn run_rfail_test(&self) {
let pm = self.pass_mode();
let should_run = self.run_if_enabled();
let proc_res = self.compile_test(should_run, self.should_emit_metadata(pm), Vec::new());
let proc_res = self.compile_test(should_run, self.should_emit_metadata(pm));

if !proc_res.status.success() {
self.fatal_proc_rec("compilation failed!", &proc_res);
Expand Down Expand Up @@ -396,7 +395,7 @@ impl<'test> TestCx<'test> {

fn run_cpass_test(&self) {
let emit_metadata = self.should_emit_metadata(self.pass_mode());
let proc_res = self.compile_test(WillExecute::No, emit_metadata, Vec::new());
let proc_res = self.compile_test(WillExecute::No, emit_metadata);

if !proc_res.status.success() {
self.fatal_proc_rec("compilation failed!", &proc_res);
Expand All @@ -411,7 +410,7 @@ impl<'test> TestCx<'test> {
fn run_rpass_test(&self) {
let emit_metadata = self.should_emit_metadata(self.pass_mode());
let should_run = self.run_if_enabled();
let proc_res = self.compile_test(should_run, emit_metadata, Vec::new());
let proc_res = self.compile_test(should_run, emit_metadata);

if !proc_res.status.success() {
self.fatal_proc_rec("compilation failed!", &proc_res);
Expand Down Expand Up @@ -441,7 +440,7 @@ impl<'test> TestCx<'test> {
}

let should_run = self.run_if_enabled();
let mut proc_res = self.compile_test(should_run, Emit::None, Vec::new());
let mut proc_res = self.compile_test(should_run, Emit::None);

if !proc_res.status.success() {
self.fatal_proc_rec("compilation failed!", &proc_res);
Expand Down Expand Up @@ -687,7 +686,7 @@ impl<'test> TestCx<'test> {

// compile test file (it should have 'compile-flags:-g' in the header)
let should_run = self.run_if_enabled();
let compile_result = self.compile_test(should_run, Emit::None, Vec::new());
let compile_result = self.compile_test(should_run, Emit::None);
if !compile_result.status.success() {
self.fatal_proc_rec("compilation failed!", &compile_result);
}
Expand Down Expand Up @@ -807,7 +806,7 @@ impl<'test> TestCx<'test> {

// compile test file (it should have 'compile-flags:-g' in the header)
let should_run = self.run_if_enabled();
let compiler_run_result = self.compile_test(should_run, Emit::None, Vec::new());
let compiler_run_result = self.compile_test(should_run, Emit::None);
if !compiler_run_result.status.success() {
self.fatal_proc_rec("compilation failed!", &compiler_run_result);
}
Expand Down Expand Up @@ -1044,7 +1043,7 @@ impl<'test> TestCx<'test> {
fn run_debuginfo_lldb_test_no_opt(&self) {
// compile test file (it should have 'compile-flags:-g' in the header)
let should_run = self.run_if_enabled();
let compile_result = self.compile_test(should_run, Emit::None, Vec::new());
let compile_result = self.compile_test(should_run, Emit::None);
if !compile_result.status.success() {
self.fatal_proc_rec("compilation failed!", &compile_result);
}
Expand Down Expand Up @@ -1483,7 +1482,16 @@ impl<'test> TestCx<'test> {
}
}

fn compile_test(&self, will_execute: WillExecute, emit: Emit, passes: Vec<String>) -> ProcRes {
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)
}

Expand Down Expand Up @@ -2791,7 +2799,7 @@ impl<'test> TestCx<'test> {
fn run_codegen_units_test(&self) {
assert!(self.revision.is_none(), "revisions not relevant here");

let proc_res = self.compile_test(WillExecute::No, Emit::None, Vec::new());
let proc_res = self.compile_test(WillExecute::No, Emit::None);

if !proc_res.status.success() {
self.fatal_proc_rec("compilation failed!", &proc_res);
Expand Down Expand Up @@ -3340,7 +3348,7 @@ impl<'test> TestCx<'test> {
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, Vec::new());
let proc_res = self.compile_test(should_run, emit_metadata);
self.check_if_test_should_compile(&proc_res, pm);

// if the user specified a format in the ui test
Expand Down Expand Up @@ -3523,7 +3531,7 @@ impl<'test> TestCx<'test> {
let emit_metadata = self.should_emit_metadata(pm);
let passes = self.get_passes();

let proc_res = self.compile_test(should_run, emit_metadata, passes);
let proc_res = self.compile_test_with_passes(should_run, emit_metadata, passes);
self.check_mir_dump();
if !proc_res.status.success() {
self.fatal_proc_rec("compilation failed!", &proc_res);
Expand Down

0 comments on commit 2da54a9

Please sign in to comment.