Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove atty and tracing-tree, update hermit-abi #2581

Merged
merged 5 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 8 additions & 67 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,6 @@ version = "1.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"

[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi",
]

[[package]]
name = "autocfg"
version = "1.1.0"
Expand Down Expand Up @@ -439,27 +428,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"

[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]

[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]

[[package]]
name = "hermit-abi"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"

[[package]]
name = "home"
Expand All @@ -480,25 +451,13 @@ dependencies = [
"hashbrown 0.14.0",
]

[[package]]
name = "io-lifetimes"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
"hermit-abi 0.3.1",
"libc",
"windows-sys 0.48.0",
]

[[package]]
name = "is-terminal"
version = "0.4.7"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb"
dependencies = [
"hermit-abi 0.3.1",
"io-lifetimes",
"hermit-abi",
"rustix",
"windows-sys 0.48.0",
]
Expand Down Expand Up @@ -529,7 +488,6 @@ dependencies = [
name = "kani-compiler"
version = "0.31.0"
dependencies = [
"atty",
"clap",
"cprover_bindings",
"home",
Expand All @@ -545,15 +503,13 @@ dependencies = [
"strum_macros",
"tracing",
"tracing-subscriber",
"tracing-tree",
]

[[package]]
name = "kani-driver"
version = "0.31.0"
dependencies = [
"anyhow",
"atty",
"cargo_metadata",
"clap",
"comfy-table",
Expand All @@ -573,7 +529,6 @@ dependencies = [
"toml",
"tracing",
"tracing-subscriber",
"tracing-tree",
"which",
]

Expand Down Expand Up @@ -1012,13 +967,12 @@ dependencies = [

[[package]]
name = "rustix"
version = "0.37.20"
version = "0.38.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0"
checksum = "aabcb0461ebd01d6b79945797c27f8529082226cb630a9865a71870ff63532a4"
dependencies = [
"bitflags",
"bitflags 2.3.3",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys 0.48.0",
Expand Down Expand Up @@ -1378,19 +1332,6 @@ dependencies = [
"tracing-serde",
]

[[package]]
name = "tracing-tree"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f9742d8df709837409dbb22aa25dd7769c260406f20ff48a2320b80a4a6aed0"
dependencies = [
"atty",
"nu-ansi-term",
"tracing-core",
"tracing-log",
"tracing-subscriber",
]

[[package]]
name = "unicase"
version = "2.6.0"
Expand Down
2 changes: 0 additions & 2 deletions kani-compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ license = "MIT OR Apache-2.0"
publish = false

[dependencies]
atty = "0.2.14"
cbmc = { path = "../cprover_bindings", package = "cprover_bindings", optional = true }
clap = { version = "4.1.3", features = ["cargo"] }
home = "0.5"
Expand All @@ -25,7 +24,6 @@ strum_macros = "0.24.0"
shell-words = "1.0.0"
tracing = {version = "0.1", features = ["max_level_trace", "release_max_level_debug"]}
tracing-subscriber = {version = "0.3.8", features = ["env-filter", "json", "fmt"]}
tracing-tree = "0.2.2"

# Future proofing: enable backend dependencies using feature.
[features]
Expand Down
11 changes: 4 additions & 7 deletions kani-compiler/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use rustc_errors::{
emitter::Emitter, emitter::HumanReadableErrorType, fallback_fluent_bundle, json::JsonEmitter,
ColorConfig, Diagnostic, TerminalUrl,
};
use std::io::IsTerminal;
use std::panic;
use std::str::FromStr;
use std::sync::LazyLock;
use tracing_subscriber::{filter::Directive, layer::SubscriberExt, EnvFilter, Registry};
use tracing_tree::HierarchicalLayer;

/// Environment variable used to control this session log tracing.
const LOG_ENV_VAR: &str = "KANI_LOG";
Expand Down Expand Up @@ -107,16 +107,13 @@ fn json_logs(filter: EnvFilter) {

/// Configure global logger to use a hierarchical view.
fn hier_logs(args: &ArgMatches, filter: EnvFilter) {
let use_colors = atty::is(atty::Stream::Stdout) || args.get_flag(parser::COLOR_OUTPUT);
let use_colors = std::io::stdout().is_terminal() || args.get_flag(parser::COLOR_OUTPUT);
let subscriber = Registry::default().with(filter);
let subscriber = subscriber.with(
HierarchicalLayer::default()
tracing_subscriber::fmt::layer()
.with_writer(std::io::stderr)
.with_indent_lines(true)
.with_ansi(use_colors)
.with_targets(true)
.with_verbose_exit(true)
.with_indent_amount(4),
.with_target(true),
);
tracing::subscriber::set_global_default(subscriber).unwrap();
}
Expand Down
2 changes: 0 additions & 2 deletions kani-driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ publish = false
kani_metadata = { path = "../kani_metadata" }
cargo_metadata = "0.15.0"
anyhow = "1"
atty = "0.2.14"
console = "0.15.1"
once_cell = "1.13.0"
serde = { version = "1", features = ["derive"] }
Expand All @@ -32,7 +31,6 @@ strum = {version = "0.24.0"}
strum_macros = {version = "0.24.0"}
tracing = {version = "0.1", features = ["max_level_trace", "release_max_level_debug"]}
tracing-subscriber = {version = "0.3.8", features = ["env-filter", "json", "fmt"]}
tracing-tree = "0.2.2"
rand = "0.8"
which = "4.4.0"

Expand Down
3 changes: 2 additions & 1 deletion kani-driver/src/call_cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::ffi::{OsStr, OsString};
use std::fmt::{self, Display};
use std::fs::{self, File};
use std::io::BufReader;
use std::io::IsTerminal;
use std::path::PathBuf;
use std::process::Command;
use tracing::{debug, trace};
Expand Down Expand Up @@ -180,7 +181,7 @@ impl KaniSession {
/// Run cargo and collect any error found.
/// We also collect the metadata file generated during compilation if any.
fn run_cargo(&self, cargo_cmd: Command, target: &Target) -> Result<Option<Artifact>> {
let support_color = atty::is(atty::Stream::Stdout);
let support_color = std::io::stdout().is_terminal();
let mut artifact = None;
if let Some(mut cargo_process) = self.run_piped(cargo_cmd)? {
let reader = BufReader::new(cargo_process.stdout.take().unwrap());
Expand Down
11 changes: 4 additions & 7 deletions kani-driver/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::args::common::Verbosity;
use crate::args::VerificationArgs;
use crate::util::render_command;
use anyhow::{bail, Context, Result};
use std::io::IsTerminal;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::{Child, Command, ExitStatus, Stdio};
Expand All @@ -13,7 +14,6 @@ use std::time::Instant;
use strum_macros::Display;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry};
use tracing_tree::HierarchicalLayer;

/// Environment variable used to control this session log tracing.
/// This is the same variable used to control `kani-compiler` logs. Note that you can still control
Expand Down Expand Up @@ -368,16 +368,13 @@ fn init_logger(args: &VerificationArgs) {
};

// Use a hierarchical view for now.
let use_colors = atty::is(atty::Stream::Stdout);
let use_colors = std::io::stdout().is_terminal();
let subscriber = Registry::default().with(filter);
let subscriber = subscriber.with(
HierarchicalLayer::default()
tracing_subscriber::fmt::layer()
.with_writer(std::io::stderr)
.with_indent_lines(true)
.with_ansi(use_colors)
.with_targets(true)
.with_verbose_exit(true)
.with_indent_amount(4),
.with_target(true),
);
tracing::subscriber::set_global_default(subscriber).unwrap();
}