compiletest: print{,ln}!
-> eprint{,ln}!
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
This commit is contained in:
parent
15d7331a01
commit
a6c462863d
11 changed files with 57 additions and 57 deletions
|
@ -144,7 +144,7 @@ where
|
|||
}
|
||||
|
||||
if !wrote_data {
|
||||
println!("note: diff is identical to nightly rustdoc");
|
||||
eprintln!("note: diff is identical to nightly rustdoc");
|
||||
assert!(diff_output.metadata().unwrap().len() == 0);
|
||||
return false;
|
||||
} else if verbose {
|
||||
|
|
|
@ -20,7 +20,7 @@ pub(crate) fn configure_gdb(config: &Config) -> Option<Arc<Config>> {
|
|||
}
|
||||
|
||||
if config.remote_test_client.is_some() && !config.target.contains("android") {
|
||||
println!(
|
||||
eprintln!(
|
||||
"WARNING: debuginfo tests are not available when \
|
||||
testing with remote"
|
||||
);
|
||||
|
@ -28,7 +28,7 @@ pub(crate) fn configure_gdb(config: &Config) -> Option<Arc<Config>> {
|
|||
}
|
||||
|
||||
if config.target.contains("android") {
|
||||
println!(
|
||||
eprintln!(
|
||||
"{} debug-info test uses tcp 5039 port.\
|
||||
please reserve it",
|
||||
config.target
|
||||
|
@ -50,7 +50,7 @@ pub(crate) fn configure_lldb(config: &Config) -> Option<Arc<Config>> {
|
|||
config.lldb_python_dir.as_ref()?;
|
||||
|
||||
if let Some(350) = config.lldb_version {
|
||||
println!(
|
||||
eprintln!(
|
||||
"WARNING: The used version of LLDB (350) has a \
|
||||
known issue that breaks debuginfo tests. See \
|
||||
issue #32520 for more information. Skipping all \
|
||||
|
|
|
@ -188,8 +188,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
|||
let (argv0, args_) = args.split_first().unwrap();
|
||||
if args.len() == 1 || args[1] == "-h" || args[1] == "--help" {
|
||||
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
|
||||
println!("{}", opts.usage(&message));
|
||||
println!();
|
||||
eprintln!("{}", opts.usage(&message));
|
||||
eprintln!();
|
||||
panic!()
|
||||
}
|
||||
|
||||
|
@ -200,8 +200,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
|||
|
||||
if matches.opt_present("h") || matches.opt_present("help") {
|
||||
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
|
||||
println!("{}", opts.usage(&message));
|
||||
println!();
|
||||
eprintln!("{}", opts.usage(&message));
|
||||
eprintln!();
|
||||
panic!()
|
||||
}
|
||||
|
||||
|
@ -508,7 +508,7 @@ pub fn run_tests(config: Arc<Config>) {
|
|||
// easy to miss which tests failed, and as such fail to reproduce
|
||||
// the failure locally.
|
||||
|
||||
println!(
|
||||
eprintln!(
|
||||
"Some tests failed in compiletest suite={}{} mode={} host={} target={}",
|
||||
config.suite,
|
||||
config
|
||||
|
|
|
@ -131,7 +131,7 @@ pub fn run(config: Arc<Config>, testpaths: &TestPaths, revision: Option<&str>) {
|
|||
|
||||
if config.verbose {
|
||||
// We're going to be dumping a lot of info. Start on a new line.
|
||||
print!("\n\n");
|
||||
eprintln!("\n");
|
||||
}
|
||||
debug!("running {:?}", testpaths.file.display());
|
||||
let mut props = TestProps::from_file(&testpaths.file, revision, &config);
|
||||
|
@ -353,7 +353,7 @@ impl<'test> TestCx<'test> {
|
|||
{
|
||||
self.error(&format!("{} test did not emit an error", self.config.mode));
|
||||
if self.config.mode == crate::common::Mode::Ui {
|
||||
println!("note: by default, ui tests are expected not to compile");
|
||||
eprintln!("note: by default, ui tests are expected not to compile");
|
||||
}
|
||||
proc_res.fatal(None, || ());
|
||||
};
|
||||
|
@ -774,20 +774,20 @@ impl<'test> TestCx<'test> {
|
|||
unexpected.len(),
|
||||
not_found.len()
|
||||
));
|
||||
println!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline);
|
||||
eprintln!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline);
|
||||
if !unexpected.is_empty() {
|
||||
println!("{}", "--- unexpected errors (from JSON output) ---".green());
|
||||
eprintln!("{}", "--- unexpected errors (from JSON output) ---".green());
|
||||
for error in &unexpected {
|
||||
println!("{}", error.render_for_expected());
|
||||
eprintln!("{}", error.render_for_expected());
|
||||
}
|
||||
println!("{}", "---".green());
|
||||
eprintln!("{}", "---".green());
|
||||
}
|
||||
if !not_found.is_empty() {
|
||||
println!("{}", "--- not found errors (from test file) ---".red());
|
||||
eprintln!("{}", "--- not found errors (from test file) ---".red());
|
||||
for error in ¬_found {
|
||||
println!("{}", error.render_for_expected());
|
||||
eprintln!("{}", error.render_for_expected());
|
||||
}
|
||||
println!("{}", "---\n".red());
|
||||
eprintln!("{}", "---\n".red());
|
||||
}
|
||||
panic!("errors differ from expected");
|
||||
}
|
||||
|
@ -1876,18 +1876,18 @@ impl<'test> TestCx<'test> {
|
|||
|
||||
fn maybe_dump_to_stdout(&self, out: &str, err: &str) {
|
||||
if self.config.verbose {
|
||||
println!("------stdout------------------------------");
|
||||
println!("{}", out);
|
||||
println!("------stderr------------------------------");
|
||||
println!("{}", err);
|
||||
println!("------------------------------------------");
|
||||
eprintln!("------stdout------------------------------");
|
||||
eprintln!("{}", out);
|
||||
eprintln!("------stderr------------------------------");
|
||||
eprintln!("{}", err);
|
||||
eprintln!("------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
fn error(&self, err: &str) {
|
||||
match self.revision {
|
||||
Some(rev) => println!("\nerror in revision `{}`: {}", rev, err),
|
||||
None => println!("\nerror: {}", err),
|
||||
Some(rev) => eprintln!("\nerror in revision `{}`: {}", rev, err),
|
||||
None => eprintln!("\nerror: {}", err),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1972,7 +1972,7 @@ impl<'test> TestCx<'test> {
|
|||
if !self.config.has_html_tidy {
|
||||
return;
|
||||
}
|
||||
println!("info: generating a diff against nightly rustdoc");
|
||||
eprintln!("info: generating a diff against nightly rustdoc");
|
||||
|
||||
let suffix =
|
||||
self.safe_revision().map_or("nightly".into(), |path| path.to_owned() + "-nightly");
|
||||
|
@ -2082,7 +2082,7 @@ impl<'test> TestCx<'test> {
|
|||
.output()
|
||||
.unwrap();
|
||||
assert!(output.status.success());
|
||||
println!("{}", String::from_utf8_lossy(&output.stdout));
|
||||
eprintln!("{}", String::from_utf8_lossy(&output.stdout));
|
||||
eprintln!("{}", String::from_utf8_lossy(&output.stderr));
|
||||
} else {
|
||||
use colored::Colorize;
|
||||
|
@ -2496,7 +2496,7 @@ impl<'test> TestCx<'test> {
|
|||
)"#
|
||||
)
|
||||
.replace_all(&output, |caps: &Captures<'_>| {
|
||||
println!("{}", &caps[0]);
|
||||
eprintln!("{}", &caps[0]);
|
||||
caps[0].replace(r"\", "/")
|
||||
})
|
||||
.replace("\r\n", "\n")
|
||||
|
@ -2601,14 +2601,14 @@ impl<'test> TestCx<'test> {
|
|||
if let Err(err) = fs::write(&actual_path, &actual) {
|
||||
self.fatal(&format!("failed to write {stream} to `{actual_path:?}`: {err}",));
|
||||
}
|
||||
println!("Saved the actual {stream} to {actual_path:?}");
|
||||
eprintln!("Saved the actual {stream} to {actual_path:?}");
|
||||
|
||||
let expected_path =
|
||||
expected_output_path(self.testpaths, self.revision, &self.config.compare_mode, stream);
|
||||
|
||||
if !self.config.bless {
|
||||
if expected.is_empty() {
|
||||
println!("normalized {}:\n{}\n", stream, actual);
|
||||
eprintln!("normalized {}:\n{}\n", stream, actual);
|
||||
} else {
|
||||
self.show_diff(
|
||||
stream,
|
||||
|
@ -2631,10 +2631,10 @@ impl<'test> TestCx<'test> {
|
|||
if let Err(err) = fs::write(&expected_path, &actual) {
|
||||
self.fatal(&format!("failed to write {stream} to `{expected_path:?}`: {err}"));
|
||||
}
|
||||
println!("Blessing the {stream} of {test_name} in {expected_path:?}");
|
||||
eprintln!("Blessing the {stream} of {test_name} in {expected_path:?}");
|
||||
}
|
||||
|
||||
println!("\nThe actual {0} differed from the expected {0}.", stream);
|
||||
eprintln!("\nThe actual {0} differed from the expected {0}.", stream);
|
||||
|
||||
if self.config.bless { 0 } else { 1 }
|
||||
}
|
||||
|
@ -2783,7 +2783,7 @@ impl<'test> TestCx<'test> {
|
|||
fs::create_dir_all(&incremental_dir).unwrap();
|
||||
|
||||
if self.config.verbose {
|
||||
println!("init_incremental_test: incremental_dir={}", incremental_dir.display());
|
||||
eprintln!("init_incremental_test: incremental_dir={}", incremental_dir.display());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2841,7 +2841,7 @@ impl ProcRes {
|
|||
}
|
||||
}
|
||||
|
||||
println!(
|
||||
eprintln!(
|
||||
"status: {}\ncommand: {}\n{}\n{}\n",
|
||||
self.status,
|
||||
self.cmdline,
|
||||
|
@ -2852,7 +2852,7 @@ impl ProcRes {
|
|||
|
||||
pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! {
|
||||
if let Some(e) = err {
|
||||
println!("\nerror: {}", e);
|
||||
eprintln!("\nerror: {}", e);
|
||||
}
|
||||
self.print_info();
|
||||
on_failure();
|
||||
|
|
|
@ -64,13 +64,13 @@ impl TestCx<'_> {
|
|||
if !missing.is_empty() {
|
||||
missing.sort();
|
||||
|
||||
println!("\nThese items should have been contained but were not:\n");
|
||||
eprintln!("\nThese items should have been contained but were not:\n");
|
||||
|
||||
for item in &missing {
|
||||
println!("{}", item);
|
||||
eprintln!("{}", item);
|
||||
}
|
||||
|
||||
println!("\n");
|
||||
eprintln!("\n");
|
||||
}
|
||||
|
||||
if !unexpected.is_empty() {
|
||||
|
@ -80,24 +80,24 @@ impl TestCx<'_> {
|
|||
sorted
|
||||
};
|
||||
|
||||
println!("\nThese items were contained but should not have been:\n");
|
||||
eprintln!("\nThese items were contained but should not have been:\n");
|
||||
|
||||
for item in sorted {
|
||||
println!("{}", item);
|
||||
eprintln!("{}", item);
|
||||
}
|
||||
|
||||
println!("\n");
|
||||
eprintln!("\n");
|
||||
}
|
||||
|
||||
if !wrong_cgus.is_empty() {
|
||||
wrong_cgus.sort_by_key(|pair| pair.0.name.clone());
|
||||
println!("\nThe following items were assigned to wrong codegen units:\n");
|
||||
eprintln!("\nThe following items were assigned to wrong codegen units:\n");
|
||||
|
||||
for &(ref expected_item, ref actual_item) in &wrong_cgus {
|
||||
println!("{}", expected_item.name);
|
||||
println!(" expected: {}", codegen_units_to_str(&expected_item.codegen_units));
|
||||
println!(" actual: {}", codegen_units_to_str(&actual_item.codegen_units));
|
||||
println!();
|
||||
eprintln!("{}", expected_item.name);
|
||||
eprintln!(" expected: {}", codegen_units_to_str(&expected_item.codegen_units));
|
||||
eprintln!(" actual: {}", codegen_units_to_str(&actual_item.codegen_units));
|
||||
eprintln!();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ impl TestCx<'_> {
|
|||
cmdline,
|
||||
};
|
||||
if adb.kill().is_err() {
|
||||
println!("Adb process is already finished.");
|
||||
eprintln!("Adb process is already finished.");
|
||||
}
|
||||
} else {
|
||||
let rust_src_root =
|
||||
|
@ -275,7 +275,7 @@ impl TestCx<'_> {
|
|||
|
||||
match self.config.gdb_version {
|
||||
Some(version) => {
|
||||
println!("NOTE: compiletest thinks it is using GDB version {}", version);
|
||||
eprintln!("NOTE: compiletest thinks it is using GDB version {}", version);
|
||||
|
||||
if version > extract_gdb_version("7.4").unwrap() {
|
||||
// Add the directory containing the pretty printers to
|
||||
|
@ -297,7 +297,7 @@ impl TestCx<'_> {
|
|||
}
|
||||
}
|
||||
_ => {
|
||||
println!(
|
||||
eprintln!(
|
||||
"NOTE: compiletest does not know which version of \
|
||||
GDB it is using"
|
||||
);
|
||||
|
@ -392,10 +392,10 @@ impl TestCx<'_> {
|
|||
|
||||
match self.config.lldb_version {
|
||||
Some(ref version) => {
|
||||
println!("NOTE: compiletest thinks it is using LLDB version {}", version);
|
||||
eprintln!("NOTE: compiletest thinks it is using LLDB version {}", version);
|
||||
}
|
||||
_ => {
|
||||
println!(
|
||||
eprintln!(
|
||||
"NOTE: compiletest does not know which version of \
|
||||
LLDB it is using"
|
||||
);
|
||||
|
|
|
@ -30,7 +30,7 @@ impl TestCx<'_> {
|
|||
assert!(incremental_dir.exists(), "init_incremental_test failed to create incremental dir");
|
||||
|
||||
if self.config.verbose {
|
||||
print!("revision={:?} props={:#?}", revision, self.props);
|
||||
eprint!("revision={:?} props={:#?}", revision, self.props);
|
||||
}
|
||||
|
||||
if revision.starts_with("cpass") {
|
||||
|
|
|
@ -89,7 +89,7 @@ impl TestCx<'_> {
|
|||
}
|
||||
let expected_string = fs::read_to_string(&expected_file).unwrap();
|
||||
if dumped_string != expected_string {
|
||||
print!("{}", write_diff(&expected_string, &dumped_string, 3));
|
||||
eprint!("{}", write_diff(&expected_string, &dumped_string, 3));
|
||||
panic!(
|
||||
"Actual MIR output differs from expected MIR output {}",
|
||||
expected_file.display()
|
||||
|
|
|
@ -29,7 +29,7 @@ impl TestCx<'_> {
|
|||
|
||||
if !res.status.success() {
|
||||
self.fatal_proc_rec_with_ctx("jsondocck failed!", &res, |_| {
|
||||
println!("Rustdoc Output:");
|
||||
eprintln!("Rustdoc Output:");
|
||||
proc_res.print_info();
|
||||
})
|
||||
}
|
||||
|
|
|
@ -109,10 +109,10 @@ impl TestCx<'_> {
|
|||
}
|
||||
|
||||
if errors > 0 {
|
||||
println!("To update references, rerun the tests and pass the `--bless` flag");
|
||||
eprintln!("To update references, rerun the tests and pass the `--bless` flag");
|
||||
let relative_path_to_file =
|
||||
self.testpaths.relative_dir.join(self.testpaths.file.file_name().unwrap());
|
||||
println!(
|
||||
eprintln!(
|
||||
"To only update this specific test, also pass `--test-args {}`",
|
||||
relative_path_to_file.display(),
|
||||
);
|
||||
|
|
|
@ -30,7 +30,7 @@ fn path_div() -> &'static str {
|
|||
pub fn logv(config: &Config, s: String) {
|
||||
debug!("{}", s);
|
||||
if config.verbose {
|
||||
println!("{}", s);
|
||||
eprintln!("{}", s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue