Navigation Menu

Skip to content

Commit

Permalink
Change thread name
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 3, 2017
1 parent 5fe3915 commit a0ad4ad
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions src/librustdoc/test.rs
Expand Up @@ -88,7 +88,7 @@ pub fn run(input: &str,
config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone()));

let krate = panictry!(driver::phase_1_parse_input(&sess, &input));
let driver::ExpansionResult { defs, mut hir_forest, .. } = {
let driver::ExpansionResult { hir_forest, .. } = {
phase_2_configure_and_expand(
&sess, &cstore, krate, None, "rustdoc-test", None, MakeGlobMap::No, |_| Ok(())
).expect("phase_2_configure_and_expand aborted in rustdoc!")
Expand Down Expand Up @@ -183,8 +183,6 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
name: driver::anon_src(),
input: test.to_owned(),
};
let test = format!("Error in \"{}\" at line {}.\n",
filename, line_number);
let outputs = OutputTypes::new(&[(OutputType::Exe, None)]);

let sessopts = config::Options {
Expand Down Expand Up @@ -265,22 +263,22 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
if count > 0 && !compile_fail {
sess.fatal("aborting due to previous error(s)")
} else if count == 0 && compile_fail {
panic!("test compiled while it wasn't supposed to:\n\n{}\n", test)
panic!("test compiled while it wasn't supposed to")
}
if count > 0 && error_codes.len() > 0 {
let out = String::from_utf8(data.lock().unwrap().to_vec()).unwrap();
error_codes.retain(|err| !out.contains(err));
}
}
Ok(()) if compile_fail => {
panic!("test compiled while it wasn't supposed to:\n\n{}\n", test)
panic!("test compiled while it wasn't supposed to")
}
_ => {}
}
}
Err(_) => {
if !compile_fail {
panic!("couldn't compile the test:\n\n{}\n", test);
panic!("couldn't compile the test");
}
if error_codes.len() > 0 {
let out = String::from_utf8(data.lock().unwrap().to_vec()).unwrap();
Expand All @@ -290,7 +288,7 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
}

if error_codes.len() > 0 {
panic!("Some expected error codes were not found: {:?}\n\n{}\n", error_codes, test);
panic!("Some expected error codes were not found: {:?}", error_codes);
}

if no_run { return }
Expand All @@ -312,18 +310,17 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
cmd.env(var, &newpath);

match cmd.output() {
Err(e) => panic!("couldn't run the test: {}{}\n\n{}\n", e,
Err(e) => panic!("couldn't run the test: {}{}", e,
if e.kind() == io::ErrorKind::PermissionDenied {
" - maybe your tempdir is mounted with noexec?"
} else { "" }, test),
} else { "" }),
Ok(out) => {
if should_panic && out.status.success() {
panic!("test executable succeeded when it should have failed\n\n{}\n", test);
panic!("test executable succeeded when it should have failed");
} else if !should_panic && !out.status.success() {
panic!("test executable failed:\n{}\n{}\n\n{}\n",
panic!("test executable failed:\n{}\n{}\n",
str::from_utf8(&out.stdout).unwrap_or(""),
str::from_utf8(&out.stderr).unwrap_or(""),
test);
str::from_utf8(&out.stderr).unwrap_or(""));
}
}
}
Expand Down Expand Up @@ -458,12 +455,8 @@ impl Collector {
should_panic: bool, no_run: bool, should_ignore: bool,
as_test_harness: bool, compile_fail: bool, error_codes: Vec<String>,
original: String) {
let name = if self.use_headers {
let s = self.current_header.as_ref().map(|s| &**s).unwrap_or("");
format!("{}_{}", s, self.cnt)
} else {
format!("{}_{}", self.names.join("::"), self.cnt)
};
let line_number = self.get_line_from_key(&format!("{}\n{}\n", original, test));
let name = format!("{} - line {}", self.filename, line_number);
self.cnt += 1;
let cfgs = self.cfgs.clone();
let libs = self.libs.clone();
Expand All @@ -472,8 +465,6 @@ impl Collector {
let opts = self.opts.clone();
let maybe_sysroot = self.maybe_sysroot.clone();
debug!("Creating test {}: {}", name, test);
let line_number = self.get_line_from_key(&format!("{}\n{}\n", original, test));
let filename = self.filename.clone();
self.tests.push(testing::TestDescAndFn {
desc: testing::TestDesc {
name: testing::DynTestName(name),
Expand Down

0 comments on commit a0ad4ad

Please sign in to comment.