diff options
| author | Jonathan Turner <jturner@mozilla.com> | 2016-05-16 18:40:50 -0400 |
|---|---|---|
| committer | Jonathan Turner <jturner@mozilla.com> | 2016-05-17 06:46:08 -0400 |
| commit | 175ecfefd50932c0ae8fa328579e26baadd6a110 (patch) | |
| tree | cb01c5880bdb348749ab44b1966b44c95f2d9bac /src/tools | |
| parent | 3e9747af497d826aa863e5d47830d7cfc80d94d2 (diff) | |
| download | rust-175ecfefd50932c0ae8fa328579e26baadd6a110.tar.gz rust-175ecfefd50932c0ae8fa328579e26baadd6a110.zip | |
Improve a few errors and fix #33366
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/compiletest/src/json.rs | 6 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 41 |
2 files changed, 28 insertions, 19 deletions
diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 665f304d69f..84b78547ab9 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -12,7 +12,7 @@ use errors::{Error, ErrorKind}; use rustc_serialize::json; use std::str::FromStr; use std::path::Path; -use runtest::{fatal_proc_rec, ProcRes}; +use runtest::{ProcRes}; // These structs are a subset of the ones found in // `syntax::errors::json`. @@ -73,9 +73,9 @@ fn parse_line(file_name: &str, line: &str, output: &str, proc_res: &ProcRes) -> expected_errors } Err(error) => { - fatal_proc_rec(None, &format!( + proc_res.fatal(Some(&format!( "failed to decode compiler output as json: `{}`\noutput: {}\nline: {}", - error, line, output), proc_res); + error, line, output))); } } } else { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 208057a423b..280c87a2874 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1528,23 +1528,9 @@ actual:\n\ self.error(err); panic!(); } - pub fn fatal_proc_rec(&self, err: &str, proc_res: &ProcRes) -> ! { + fn fatal_proc_rec(&self, err: &str, proc_res: &ProcRes) -> ! { self.error(err); - print!("\ - status: {}\n\ - command: {}\n\ - stdout:\n\ - ------------------------------------------\n\ - {}\n\ - ------------------------------------------\n\ - stderr:\n\ - ------------------------------------------\n\ - {}\n\ - ------------------------------------------\n\ - \n", - proc_res.status, proc_res.cmdline, proc_res.stdout, - proc_res.stderr); - panic!(); + proc_res.fatal(None); } fn _arm_exec_compiled_test(&self, env: Vec<(String, String)>) -> ProcRes { @@ -2209,6 +2195,29 @@ enum Status { Normal(ExitStatus), } +impl ProcRes { + pub fn fatal(&self, err: Option<&str>) -> ! { + if let Some(e) = err { + println!("\nerror: {}", e); + } + print!("\ + status: {}\n\ + command: {}\n\ + stdout:\n\ + ------------------------------------------\n\ + {}\n\ + ------------------------------------------\n\ + stderr:\n\ + ------------------------------------------\n\ + {}\n\ + ------------------------------------------\n\ + \n", + self.status, self.cmdline, self.stdout, + self.stderr); + panic!(); + } +} + impl Status { fn code(&self) -> Option<i32> { match *self { |
