Improve a few errors and fix #33366

This commit is contained in:
Jonathan Turner 2016-05-16 18:40:50 -04:00
parent 3e9747af49
commit 175ecfefd5
11 changed files with 68 additions and 58 deletions

View file

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

View file

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