compiletest: println! -> eprintln!

This commit is contained in:
clubby789 2024-12-03 20:21:51 +00:00
parent 3fadb87d76
commit 23725619c4
9 changed files with 54 additions and 54 deletions

View file

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

View file

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

View file

@ -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!()
}
@ -501,7 +501,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

View file

@ -771,20 +771,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 &not_found {
println!("{}", error.render_for_expected());
eprintln!("{}", error.render_for_expected());
}
println!("{}", "---\n".red());
eprintln!("{}", "---\n".red());
}
panic!("errors differ from expected");
}
@ -1873,18 +1873,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),
}
}
@ -1969,7 +1969,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");
@ -2079,7 +2079,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;
@ -2479,7 +2479,7 @@ impl<'test> TestCx<'test> {
)"#
)
.replace_all(&output, |caps: &Captures<'_>| {
println!("{}", &caps[0]);
eprintln!("{}", &caps[0]);
caps[0].replace(r"\", "/")
})
.replace("\r\n", "\n")
@ -2578,16 +2578,16 @@ 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 {
println!("diff of {stream}:\n");
eprintln!("diff of {stream}:\n");
if let Some(diff_command) = self.config.diff_command.as_deref() {
let mut args = diff_command.split_whitespace();
let name = args.next().unwrap();
@ -2622,10 +2622,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 }
}
@ -2704,7 +2704,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());
}
}
@ -2762,7 +2762,7 @@ impl ProcRes {
}
}
println!(
eprintln!(
"status: {}\ncommand: {}\n{}\n{}\n",
self.status,
self.cmdline,
@ -2773,7 +2773,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();

View file

@ -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!();
}
}

View file

@ -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"
);

View file

@ -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();
})
}

View file

@ -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(),
);

View file

@ -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);
}
}