clif-util: always use pretty-env-logger (#4443)
Rather than sometimes using `file-per-thread-logger`. Also remove the debug CLI flags, so that we can always just define `RUST_LOG=...` to get logging and don't need to also do other things.
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -706,7 +706,6 @@ dependencies = [
|
|||||||
"cranelift-preopt",
|
"cranelift-preopt",
|
||||||
"cranelift-reader",
|
"cranelift-reader",
|
||||||
"cranelift-wasm",
|
"cranelift-wasm",
|
||||||
"file-per-thread-logger",
|
|
||||||
"filecheck",
|
"filecheck",
|
||||||
"indicatif",
|
"indicatif",
|
||||||
"log",
|
"log",
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ wat = { version = "1.0.45", optional = true }
|
|||||||
target-lexicon = { version = "0.12", features = ["std"] }
|
target-lexicon = { version = "0.12", features = ["std"] }
|
||||||
pretty_env_logger = "0.4.0"
|
pretty_env_logger = "0.4.0"
|
||||||
rayon = { version = "1", optional = true }
|
rayon = { version = "1", optional = true }
|
||||||
file-per-thread-logger = "0.1.2"
|
|
||||||
indicatif = "0.13.0"
|
indicatif = "0.13.0"
|
||||||
thiserror = "1.0.15"
|
thiserror = "1.0.15"
|
||||||
walkdir = "2.2"
|
walkdir = "2.2"
|
||||||
|
|||||||
@@ -15,14 +15,9 @@ pub struct Options {
|
|||||||
/// Specify input file(s) to be used. Use '-' for stdin.
|
/// Specify input file(s) to be used. Use '-' for stdin.
|
||||||
#[clap(required = true)]
|
#[clap(required = true)]
|
||||||
files: Vec<PathBuf>,
|
files: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Enable debug output on stderr/stdout
|
|
||||||
#[clap(short)]
|
|
||||||
debug: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(options: &Options) -> Result<()> {
|
pub fn run(options: &Options) -> Result<()> {
|
||||||
crate::handle_debug_flag(options.debug);
|
|
||||||
for (i, f) in options.files.iter().enumerate() {
|
for (i, f) in options.files.iter().enumerate() {
|
||||||
if i != 0 {
|
if i != 0 {
|
||||||
println!();
|
println!();
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
)]
|
)]
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use cranelift_codegen::dbg::LOG_FILENAME_PREFIX;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
mod bugpoint;
|
mod bugpoint;
|
||||||
@@ -31,14 +30,6 @@ mod souper_harvest;
|
|||||||
#[cfg(feature = "wasm")]
|
#[cfg(feature = "wasm")]
|
||||||
mod wasm;
|
mod wasm;
|
||||||
|
|
||||||
fn handle_debug_flag(debug: bool) {
|
|
||||||
if debug {
|
|
||||||
pretty_env_logger::init();
|
|
||||||
} else {
|
|
||||||
file_per_thread_logger::initialize(LOG_FILENAME_PREFIX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Cranelift code generator utility.
|
/// Cranelift code generator utility.
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
enum Commands {
|
enum Commands {
|
||||||
@@ -73,10 +64,6 @@ struct TestOptions {
|
|||||||
#[clap(short = 'T')]
|
#[clap(short = 'T')]
|
||||||
time_passes: bool,
|
time_passes: bool,
|
||||||
|
|
||||||
/// Enable debug output on stderr/stdout
|
|
||||||
#[clap(short = 'd')]
|
|
||||||
debug: bool,
|
|
||||||
|
|
||||||
/// Specify an input file to be used. Use '-' for stdin.
|
/// Specify an input file to be used. Use '-' for stdin.
|
||||||
#[clap(required = true)]
|
#[clap(required = true)]
|
||||||
files: Vec<PathBuf>,
|
files: Vec<PathBuf>,
|
||||||
@@ -93,10 +80,6 @@ struct PassOptions {
|
|||||||
#[clap(short = 'T')]
|
#[clap(short = 'T')]
|
||||||
time_passes: bool,
|
time_passes: bool,
|
||||||
|
|
||||||
/// Enable debug output on stderr/stdout
|
|
||||||
#[clap(short)]
|
|
||||||
debug: bool,
|
|
||||||
|
|
||||||
/// Specify an input file to be used. Use '-' for stdin.
|
/// Specify an input file to be used. Use '-' for stdin.
|
||||||
file: PathBuf,
|
file: PathBuf,
|
||||||
|
|
||||||
@@ -113,6 +96,8 @@ struct PassOptions {
|
|||||||
struct CompiledWithoutSupportOptions {}
|
struct CompiledWithoutSupportOptions {}
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
|
pretty_env_logger::init();
|
||||||
|
|
||||||
match Commands::parse() {
|
match Commands::parse() {
|
||||||
Commands::Cat(c) => cat::run(&c)?,
|
Commands::Cat(c) => cat::run(&c)?,
|
||||||
Commands::Run(r) => run::run(&r)?,
|
Commands::Run(r) => run::run(&r)?,
|
||||||
@@ -135,7 +120,6 @@ fn main() -> anyhow::Result<()> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
Commands::Test(t) => {
|
Commands::Test(t) => {
|
||||||
handle_debug_flag(t.debug);
|
|
||||||
cranelift_filetests::run(
|
cranelift_filetests::run(
|
||||||
t.verbose,
|
t.verbose,
|
||||||
t.time_passes,
|
t.time_passes,
|
||||||
@@ -146,7 +130,6 @@ fn main() -> anyhow::Result<()> {
|
|||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Commands::Pass(p) => {
|
Commands::Pass(p) => {
|
||||||
handle_debug_flag(p.debug);
|
|
||||||
cranelift_filetests::run_passes(
|
cranelift_filetests::run_passes(
|
||||||
p.verbose,
|
p.verbose,
|
||||||
p.time_passes,
|
p.time_passes,
|
||||||
|
|||||||
@@ -37,14 +37,9 @@ pub struct Options {
|
|||||||
|
|
||||||
/// Specify an input file to be used. Use '-' for stdin.
|
/// Specify an input file to be used. Use '-' for stdin.
|
||||||
files: Vec<PathBuf>,
|
files: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Enable debug output on stderr/stdout
|
|
||||||
#[clap(short)]
|
|
||||||
debug: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(options: &Options) -> Result<()> {
|
pub fn run(options: &Options) -> Result<()> {
|
||||||
crate::handle_debug_flag(options.debug);
|
|
||||||
let parsed = parse_sets_and_triple(&options.settings, &options.target)?;
|
let parsed = parse_sets_and_triple(&options.settings, &options.target)?;
|
||||||
for path in &options.files {
|
for path in &options.files {
|
||||||
let name = String::from(path.as_os_str().to_string_lossy());
|
let name = String::from(path.as_os_str().to_string_lossy());
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ pub struct Options {
|
|||||||
#[clap(required = true)]
|
#[clap(required = true)]
|
||||||
files: Vec<PathBuf>,
|
files: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Enable debug output on stderr/stdout
|
|
||||||
#[clap(short)]
|
|
||||||
debug: bool,
|
|
||||||
|
|
||||||
/// Be more verbose
|
/// Be more verbose
|
||||||
#[clap(short, long)]
|
#[clap(short, long)]
|
||||||
verbose: bool,
|
verbose: bool,
|
||||||
@@ -28,8 +24,6 @@ pub struct Options {
|
|||||||
|
|
||||||
/// Run files through the Cranelift interpreter, interpreting any functions with annotations.
|
/// Run files through the Cranelift interpreter, interpreting any functions with annotations.
|
||||||
pub fn run(options: &Options) -> anyhow::Result<()> {
|
pub fn run(options: &Options) -> anyhow::Result<()> {
|
||||||
crate::handle_debug_flag(options.debug);
|
|
||||||
|
|
||||||
let mut total = 0;
|
let mut total = 0;
|
||||||
let mut errors = 0;
|
let mut errors = 0;
|
||||||
for file in iterate_files(&options.files) {
|
for file in iterate_files(&options.files) {
|
||||||
@@ -179,7 +173,6 @@ mod test {
|
|||||||
fn filetests() {
|
fn filetests() {
|
||||||
run(&Options {
|
run(&Options {
|
||||||
files: vec![PathBuf::from("../filetests/filetests/interpreter")],
|
files: vec![PathBuf::from("../filetests/filetests/interpreter")],
|
||||||
debug: true,
|
|
||||||
verbose: true,
|
verbose: true,
|
||||||
})
|
})
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|||||||
@@ -16,14 +16,9 @@ pub struct Options {
|
|||||||
/// Specify an input file to be used. Use '-' for stdin.
|
/// Specify an input file to be used. Use '-' for stdin.
|
||||||
#[clap(required = true)]
|
#[clap(required = true)]
|
||||||
files: Vec<PathBuf>,
|
files: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Enable debug output on stderr/stdout
|
|
||||||
#[clap(short)]
|
|
||||||
debug: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(options: &Options) -> Result<()> {
|
pub fn run(options: &Options) -> Result<()> {
|
||||||
crate::handle_debug_flag(options.debug);
|
|
||||||
for (i, f) in options.files.iter().enumerate() {
|
for (i, f) in options.files.iter().enumerate() {
|
||||||
if i != 0 {
|
if i != 0 {
|
||||||
println!();
|
println!();
|
||||||
|
|||||||
@@ -17,17 +17,12 @@ pub struct Options {
|
|||||||
#[clap(required = true)]
|
#[clap(required = true)]
|
||||||
files: Vec<PathBuf>,
|
files: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Enable debug output on stderr/stdout
|
|
||||||
#[clap(short)]
|
|
||||||
debug: bool,
|
|
||||||
|
|
||||||
/// Be more verbose
|
/// Be more verbose
|
||||||
#[clap(short, long)]
|
#[clap(short, long)]
|
||||||
verbose: bool,
|
verbose: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(options: &Options) -> Result<()> {
|
pub fn run(options: &Options) -> Result<()> {
|
||||||
crate::handle_debug_flag(options.debug);
|
|
||||||
let stdin_exist = options
|
let stdin_exist = options
|
||||||
.files
|
.files
|
||||||
.iter()
|
.iter()
|
||||||
|
|||||||
@@ -90,10 +90,6 @@ pub struct Options {
|
|||||||
/// Specify an input file to be used. Use '-' for stdin.
|
/// Specify an input file to be used. Use '-' for stdin.
|
||||||
files: Vec<PathBuf>,
|
files: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Enable debug output on stderr/stdout
|
|
||||||
#[clap(short)]
|
|
||||||
debug: bool,
|
|
||||||
|
|
||||||
/// Print bytecode size
|
/// Print bytecode size
|
||||||
#[clap(short = 'X')]
|
#[clap(short = 'X')]
|
||||||
print_size: bool,
|
print_size: bool,
|
||||||
@@ -137,8 +133,6 @@ impl std::str::FromStr for ColorOpt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(options: &Options) -> Result<()> {
|
pub fn run(options: &Options) -> Result<()> {
|
||||||
crate::handle_debug_flag(options.debug);
|
|
||||||
|
|
||||||
let parsed = parse_sets_and_triple(&options.settings, &options.target)?;
|
let parsed = parse_sets_and_triple(&options.settings, &options.target)?;
|
||||||
for path in &options.files {
|
for path in &options.files {
|
||||||
let name = String::from(path.as_os_str().to_string_lossy());
|
let name = String::from(path.as_os_str().to_string_lossy());
|
||||||
|
|||||||
Reference in New Issue
Block a user