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

Fix cargo kani --debug and remove debug logs from --verbose #1730

Merged
merged 4 commits into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion kani-compiler/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn hier_logs(args: &ArgMatches, filter: EnvFilter) {
let subscriber = Registry::default().with(filter);
let subscriber = subscriber.with(
HierarchicalLayer::default()
.with_writer(std::io::stdout)
.with_writer(std::io::stderr)
.with_indent_lines(true)
.with_ansi(use_colors)
.with_targets(true)
Expand Down
2 changes: 1 addition & 1 deletion kani-driver/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub struct KaniArgs {
#[structopt(long, short)]
pub quiet: bool,
/// Output processing stages and commands, along with minor debug information
#[structopt(long, short)]
#[structopt(long, short, default_value_if("debug", None, "true"))]
pub verbose: bool,
/// Enable usage of unstable options
#[structopt(long, hidden_short_help(true))]
Expand Down
2 changes: 0 additions & 2 deletions kani-driver/src/call_single_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ impl KaniSession {

if self.args.debug {
flags.push("--log-level=debug".into());
} else if self.args.verbose {
flags.push("--log-level=info".into());
Comment on lines -110 to -111
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this behavior undesirable? Not sure why this was changed.

The stderr logging was enough to fix, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was to fix #1631

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, despite me being the one to file those issues, I'd forgotten what the verbose one was actually about.

Makes sense! :)

The CI failure is a mystery though...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found out the issue. Submitting a patch now.

} else {
flags.push("--log-level=warn".into());
}
Expand Down
11 changes: 11 additions & 0 deletions tests/cargo-ui/debug/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT
[package]
name = "debug"
version = "0.1.0"
edition = "2021"

[dependencies]

[package.metadata.kani.flags]
debug=true
3 changes: 3 additions & 0 deletions tests/cargo-ui/debug/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DEBUG kani_compiler
goto-cc
cbmc
10 changes: 10 additions & 0 deletions tests/cargo-ui/debug/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
//! This is just to test that cargo kani --debug works.

#[cfg(kani)]
mod harnesses {
#[kani::proof]
fn harness() {}
}
11 changes: 11 additions & 0 deletions tests/cargo-ui/verbose/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT
[package]
name = "verbose"
version = "0.1.0"
edition = "2021"

[dependencies]

[package.metadata.kani.flags]
verbose=true
2 changes: 2 additions & 0 deletions tests/cargo-ui/verbose/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
goto-cc
cbmc
10 changes: 10 additions & 0 deletions tests/cargo-ui/verbose/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
//! This is just to test that cargo kani --verbose works.

#[cfg(kani)]
mod harnesses {
#[kani::proof]
fn harness() {}
}