Skip to content

Commit

Permalink
Print out errors to stderr
Browse files Browse the repository at this point in the history
Generated C code is printing to stderr. Printing to stdout on Rust side can lead to scrambled output; also, buffering of stdout can drop messages in case of a crash.
  • Loading branch information
flba-eb authored Jul 8, 2022
1 parent 4c3e291 commit aacc9e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -975,12 +975,12 @@ impl TestGenerator {
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
fn main() {
println!("RUNNING ALL TESTS");
eprintln!("RUNNING ALL TESTS");
run_all();
if FAILED.load(Ordering::SeqCst) {
panic!("some tests failed");
} else {
println!("PASSED {} tests", NTESTS.load(Ordering::SeqCst));
eprintln!("PASSED {} tests", NTESTS.load(Ordering::SeqCst));
}
}
Expand Down Expand Up @@ -1010,7 +1010,7 @@ impl TestGenerator {
fn same<T: Eq + Pretty>(rust: T, c: T, attr: &str) {
if rust != c {
println!("bad {}: rust: {} != c {}", attr, rust.pretty(),
eprintln!("bad {}: rust: {} != c {}", attr, rust.pretty(),
c.pretty());
FAILED.store(true, Ordering::SeqCst);
} else {
Expand Down

0 comments on commit aacc9e6

Please sign in to comment.