compiletest: print{,ln}! -> eprint{,ln}! · rust-lang/rust@a6c4628 (original) (raw)

`@@ -131,7 +131,7 @@ pub fn run(config: Arc, testpaths: &TestPaths, revision: Option<&str>) {

`

131

131

``

132

132

`if config.verbose {

`

133

133

`// We're going to be dumping a lot of info. Start on a new line.

`

134

``

`-

print!("\n\n");

`

``

134

`+

eprintln!("\n");

`

135

135

`}

`

136

136

`debug!("running {:?}", testpaths.file.display());

`

137

137

`let mut props = TestProps::from_file(&testpaths.file, revision, &config);

`

`@@ -353,7 +353,7 @@ impl<'test> TestCx<'test> {

`

353

353

`{

`

354

354

`self.error(&format!("{} test did not emit an error", self.config.mode));

`

355

355

`if self.config.mode == crate::common::Mode::Ui {

`

356

``

`-

println!("note: by default, ui tests are expected not to compile");

`

``

356

`+

eprintln!("note: by default, ui tests are expected not to compile");

`

357

357

`}

`

358

358

` proc_res.fatal(None, || ());

`

359

359

`};

`

`@@ -774,20 +774,20 @@ impl<'test> TestCx<'test> {

`

774

774

` unexpected.len(),

`

775

775

` not_found.len()

`

776

776

`));

`

777

``

`-

println!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline);

`

``

777

`+

eprintln!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline);

`

778

778

`if !unexpected.is_empty() {

`

779

``

`-

println!("{}", "--- unexpected errors (from JSON output) ---".green());

`

``

779

`+

eprintln!("{}", "--- unexpected errors (from JSON output) ---".green());

`

780

780

`for error in &unexpected {

`

781

``

`-

println!("{}", error.render_for_expected());

`

``

781

`+

eprintln!("{}", error.render_for_expected());

`

782

782

`}

`

783

``

`-

println!("{}", "---".green());

`

``

783

`+

eprintln!("{}", "---".green());

`

784

784

`}

`

785

785

`if !not_found.is_empty() {

`

786

``

`-

println!("{}", "--- not found errors (from test file) ---".red());

`

``

786

`+

eprintln!("{}", "--- not found errors (from test file) ---".red());

`

787

787

`for error in &not_found {

`

788

``

`-

println!("{}", error.render_for_expected());

`

``

788

`+

eprintln!("{}", error.render_for_expected());

`

789

789

`}

`

790

``

`-

println!("{}", "---\n".red());

`

``

790

`+

eprintln!("{}", "---\n".red());

`

791

791

`}

`

792

792

`panic!("errors differ from expected");

`

793

793

`}

`

`@@ -1876,18 +1876,18 @@ impl<'test> TestCx<'test> {

`

1876

1876

``

1877

1877

`fn maybe_dump_to_stdout(&self, out: &str, err: &str) {

`

1878

1878

`if self.config.verbose {

`

1879

``

`-

println!("------stdout------------------------------");

`

1880

``

`-

println!("{}", out);

`

1881

``

`-

println!("------stderr------------------------------");

`

1882

``

`-

println!("{}", err);

`

1883

``

`-

println!("------------------------------------------");

`

``

1879

`+

eprintln!("------stdout------------------------------");

`

``

1880

`+

eprintln!("{}", out);

`

``

1881

`+

eprintln!("------stderr------------------------------");

`

``

1882

`+

eprintln!("{}", err);

`

``

1883

`+

eprintln!("------------------------------------------");

`

1884

1884

`}

`

1885

1885

`}

`

1886

1886

``

1887

1887

`fn error(&self, err: &str) {

`

1888

1888

`match self.revision {

`

1889

``

`` -

Some(rev) => println!("\nerror in revision {}: {}", rev, err),

``

1890

``

`-

None => println!("\nerror: {}", err),

`

``

1889

`` +

Some(rev) => eprintln!("\nerror in revision {}: {}", rev, err),

``

``

1890

`+

None => eprintln!("\nerror: {}", err),

`

1891

1891

`}

`

1892

1892

`}

`

1893

1893

``

`@@ -1972,7 +1972,7 @@ impl<'test> TestCx<'test> {

`

1972

1972

`if !self.config.has_html_tidy {

`

1973

1973

`return;

`

1974

1974

`}

`

1975

``

`-

println!("info: generating a diff against nightly rustdoc");

`

``

1975

`+

eprintln!("info: generating a diff against nightly rustdoc");

`

1976

1976

``

1977

1977

`let suffix =

`

1978

1978

`self.safe_revision().map_or("nightly".into(), |path| path.to_owned() + "-nightly");

`

`@@ -2082,7 +2082,7 @@ impl<'test> TestCx<'test> {

`

2082

2082

`.output()

`

2083

2083

`.unwrap();

`

2084

2084

`assert!(output.status.success());

`

2085

``

`-

println!("{}", String::from_utf8_lossy(&output.stdout));

`

``

2085

`+

eprintln!("{}", String::from_utf8_lossy(&output.stdout));

`

2086

2086

`eprintln!("{}", String::from_utf8_lossy(&output.stderr));

`

2087

2087

`} else {

`

2088

2088

`use colored::Colorize;

`

`@@ -2496,7 +2496,7 @@ impl<'test> TestCx<'test> {

`

2496

2496

` )"#

`

2497

2497

`)

`

2498

2498

`.replace_all(&output, |caps: &Captures<'_>| {

`

2499

``

`-

println!("{}", &caps[0]);

`

``

2499

`+

eprintln!("{}", &caps[0]);

`

2500

2500

` caps[0].replace(r"", "/")

`

2501

2501

`})

`

2502

2502

`.replace("\r\n", "\n")

`

`@@ -2601,14 +2601,14 @@ impl<'test> TestCx<'test> {

`

2601

2601

`if let Err(err) = fs::write(&actual_path, &actual) {

`

2602

2602

`` self.fatal(&format!("failed to write {stream} to {actual_path:?}: {err}",));

``

2603

2603

`}

`

2604

``

`-

println!("Saved the actual {stream} to {actual_path:?}");

`

``

2604

`+

eprintln!("Saved the actual {stream} to {actual_path:?}");

`

2605

2605

``

2606

2606

`let expected_path =

`

2607

2607

`expected_output_path(self.testpaths, self.revision, &self.config.compare_mode, stream);

`

2608

2608

``

2609

2609

`if !self.config.bless {

`

2610

2610

`if expected.is_empty() {

`

2611

``

`-

println!("normalized {}:\n{}\n", stream, actual);

`

``

2611

`+

eprintln!("normalized {}:\n{}\n", stream, actual);

`

2612

2612

`} else {

`

2613

2613

`self.show_diff(

`

2614

2614

` stream,

`

`@@ -2631,10 +2631,10 @@ impl<'test> TestCx<'test> {

`

2631

2631

`if let Err(err) = fs::write(&expected_path, &actual) {

`

2632

2632

`` self.fatal(&format!("failed to write {stream} to {expected_path:?}: {err}"));

``

2633

2633

`}

`

2634

``

`-

println!("Blessing the {stream} of {test_name} in {expected_path:?}");

`

``

2634

`+

eprintln!("Blessing the {stream} of {test_name} in {expected_path:?}");

`

2635

2635

`}

`

2636

2636

``

2637

``

`-

println!("\nThe actual {0} differed from the expected {0}.", stream);

`

``

2637

`+

eprintln!("\nThe actual {0} differed from the expected {0}.", stream);

`

2638

2638

``

2639

2639

`if self.config.bless { 0 } else { 1 }

`

2640

2640

`}

`

`@@ -2783,7 +2783,7 @@ impl<'test> TestCx<'test> {

`

2783

2783

` fs::create_dir_all(&incremental_dir).unwrap();

`

2784

2784

``

2785

2785

`if self.config.verbose {

`

2786

``

`-

println!("init_incremental_test: incremental_dir={}", incremental_dir.display());

`

``

2786

`+

eprintln!("init_incremental_test: incremental_dir={}", incremental_dir.display());

`

2787

2787

`}

`

2788

2788

`}

`

2789

2789

``

`@@ -2841,7 +2841,7 @@ impl ProcRes {

`

2841

2841

`}

`

2842

2842

`}

`

2843

2843

``

2844

``

`-

println!(

`

``

2844

`+

eprintln!(

`

2845

2845

`"status: {}\ncommand: {}\n{}\n{}\n",

`

2846

2846

`self.status,

`

2847

2847

`self.cmdline,

`

`@@ -2852,7 +2852,7 @@ impl ProcRes {

`

2852

2852

``

2853

2853

`pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! {

`

2854

2854

`if let Some(e) = err {

`

2855

``

`-

println!("\nerror: {}", e);

`

``

2855

`+

eprintln!("\nerror: {}", e);

`

2856

2856

`}

`

2857

2857

`self.print_info();

`

2858

2858

`on_failure();

`