Fixes #404: Use log.rs and a file-per-thread logger instead of the dbg! macro;
This commit is contained in:
committed by
Dan Gohman
parent
60c2cad06e
commit
a044f58cea
@@ -3,7 +3,9 @@
|
||||
//! This module provides the `ConcurrentRunner` struct which uses a pool of threads to run tests
|
||||
//! concurrently.
|
||||
|
||||
use cranelift_codegen::dbg::LOG_FILENAME_PREFIX;
|
||||
use cranelift_codegen::timing;
|
||||
use file_per_thread_logger;
|
||||
use num_cpus;
|
||||
use std::panic::catch_unwind;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -100,6 +102,7 @@ fn heartbeat_thread(replies: Sender<Reply>) -> thread::JoinHandle<()> {
|
||||
thread::Builder::new()
|
||||
.name("heartbeat".to_string())
|
||||
.spawn(move || {
|
||||
file_per_thread_logger::initialize(LOG_FILENAME_PREFIX);
|
||||
while replies.send(Reply::Tick).is_ok() {
|
||||
thread::sleep(Duration::from_secs(1));
|
||||
}
|
||||
@@ -116,6 +119,7 @@ fn worker_thread(
|
||||
thread::Builder::new()
|
||||
.name(format!("worker #{}", thread_num))
|
||||
.spawn(move || {
|
||||
file_per_thread_logger::initialize(LOG_FILENAME_PREFIX);
|
||||
loop {
|
||||
// Lock the mutex only long enough to extract a request.
|
||||
let Request(jobid, path) = match requests.lock().unwrap().recv() {
|
||||
@@ -140,7 +144,7 @@ fn worker_thread(
|
||||
});
|
||||
|
||||
if let Err(ref msg) = result {
|
||||
dbg!("FAIL: {}", msg);
|
||||
error!("FAIL: {}", msg);
|
||||
}
|
||||
|
||||
replies.send(Reply::Done { jobid, result }).unwrap();
|
||||
|
||||
@@ -18,11 +18,13 @@
|
||||
)
|
||||
)]
|
||||
|
||||
#[macro_use(dbg)]
|
||||
extern crate cranelift_codegen;
|
||||
extern crate file_per_thread_logger;
|
||||
extern crate cranelift_reader;
|
||||
extern crate filecheck;
|
||||
extern crate num_cpus;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
use cranelift_reader::TestCommand;
|
||||
use runner::TestRunner;
|
||||
|
||||
@@ -29,7 +29,7 @@ fn read_to_string<P: AsRef<Path>>(path: P) -> io::Result<String> {
|
||||
/// If running this test causes a panic, it will propagate as normal.
|
||||
pub fn run(path: &Path) -> TestResult {
|
||||
let _tt = timing::process_file();
|
||||
dbg!("---\nFile: {}", path.to_string_lossy());
|
||||
info!("---\nFile: {}", path.to_string_lossy());
|
||||
let started = time::Instant::now();
|
||||
let buffer = read_to_string(path).map_err(|e| e.to_string())?;
|
||||
let testfile = parse_test(&buffer).map_err(|e| e.to_string())?;
|
||||
@@ -122,7 +122,7 @@ fn run_one_test<'a>(
|
||||
) -> SubtestResult<()> {
|
||||
let (test, flags, isa) = tuple;
|
||||
let name = format!("{}({})", test.name(), func.name);
|
||||
dbg!("Test: {} {}", name, isa.map_or("-", TargetIsa::name));
|
||||
info!("Test: {} {}", name, isa.map_or("-", TargetIsa::name));
|
||||
|
||||
context.flags = flags;
|
||||
context.isa = isa;
|
||||
|
||||
@@ -41,7 +41,7 @@ impl SubTest for TestCompile {
|
||||
.compile(isa)
|
||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, e))?;
|
||||
|
||||
dbg!(
|
||||
info!(
|
||||
"Generated {} bytes of code:\n{}",
|
||||
code_size,
|
||||
comp_ctx.func.display(isa)
|
||||
|
||||
Reference in New Issue
Block a user