File tree Expand file tree Collapse file tree 6 files changed +44
-3
lines changed
tests/script-based-pre/check-quiet Expand file tree Collapse file tree 6 files changed +44
-3
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ impl KaniSession {
7272 kani_cbmc_output_filter (
7373 i,
7474 self . args . extra_pointer_checks ,
75+ self . args . quiet ,
7576 & self . args . output_format ,
7677 )
7778 } ) ?;
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ impl ParserItem {
168168pub fn kani_cbmc_output_filter (
169169 item : ParserItem ,
170170 extra_ptr_checks : bool ,
171+ quiet : bool ,
171172 output_format : & OutputFormat ,
172173) -> Option < ParserItem > {
173174 // Some items (e.g., messages) are skipped.
@@ -178,9 +179,11 @@ pub fn kani_cbmc_output_filter(
178179 let processed_item = process_item ( item, extra_ptr_checks) ;
179180 // Both formatting and printing could be handled by objects which
180181 // implement a trait `Printer`.
181- let formatted_item = format_item ( & processed_item, output_format) ;
182- if let Some ( fmt_item) = formatted_item {
183- println ! ( "{fmt_item}" ) ;
182+ if !quiet {
183+ let formatted_item = format_item ( & processed_item, output_format) ;
184+ if let Some ( fmt_item) = formatted_item {
185+ println ! ( "{fmt_item}" ) ;
186+ }
184187 }
185188 // TODO: Record processed items and dump them into a JSON file
186189 // <https://github.com/model-checking/kani/issues/942>
Original file line number Diff line number Diff line change 1+ // Copyright Kani Contributors
2+ // SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+ #[ kani:: proof]
5+ fn assume1 ( ) {
6+ let i: i32 = kani:: any ( ) ;
7+ kani:: assume ( i < 10 ) ;
8+ assert ! ( i < 20 ) ;
9+ }
10+
11+ #[ kani:: proof]
12+ fn assume2 ( ) {
13+ let i: u32 = kani:: any ( ) ;
14+ kani:: assume ( i < 10 ) ;
15+ assert ! ( i < 20 ) ;
16+ }
Original file line number Diff line number Diff line change 1+ success: `--quiet` produced NO output
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # Copyright Kani Contributors
3+ # SPDX-License-Identifier: Apache-2.0 OR MIT
4+
5+ # Checks that no output is produced if `--quiet` is used
6+
7+ set -eu
8+
9+ KANI_OUTPUT=` kani assume.rs --quiet | wc -l`
10+
11+ if [[ ${KANI_OUTPUT} -ne 0 ]]; then
12+ echo " error: \` --quiet\` produced some output"
13+ exit 1
14+ else
15+ echo " success: \` --quiet\` produced NO output"
16+ fi
Original file line number Diff line number Diff line change 1+ # Copyright Kani Contributors
2+ # SPDX-License-Identifier: Apache-2.0 OR MIT
3+ script : check-quiet.sh
4+ expected : check-quiet.expected
You can’t perform that action at this time.
0 commit comments