File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
tests/expected/report/verification-time Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use kani_metadata::HarnessMetadata;
66use std:: ffi:: OsString ;
77use std:: path:: Path ;
88use std:: process:: Command ;
9+ use std:: time:: Instant ;
910
1011use crate :: args:: KaniArgs ;
1112use crate :: session:: KaniSession ;
@@ -40,7 +41,9 @@ impl KaniSession {
4041 // extra argument
4142 cmd. arg ( "--json-ui" ) ;
4243
44+ let now = Instant :: now ( ) ;
4345 let _cbmc_result = self . run_redirect ( cmd, & output_filename) ?;
46+ let elapsed = now. elapsed ( ) . as_secs_f32 ( ) ;
4447 let format_result = self . format_cbmc_output ( & output_filename) ;
4548
4649 if format_result. is_err ( ) {
@@ -51,6 +54,7 @@ impl KaniSession {
5154 // the best possible fix is port to rust instead of using python, or getting more
5255 // feedback than just exit status (or using a particular magic exit code?)
5356 }
57+ println ! ( "Verification Time: {}s" , elapsed) ;
5458 }
5559
5660 Ok ( VerificationStatus :: Success )
Original file line number Diff line number Diff line change 1+ Verification Time:
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+ // This test is meant for checking that the "Verification time:" line (which
5+ // reports the time spent in CBMC) is printed in the output
6+
7+ fn is_sorted ( s : & [ i32 ] ) -> bool {
8+ for i in 0 ..s. len ( ) - 1 {
9+ if !( s[ i] <= s[ i + 1 ] ) {
10+ return false ;
11+ }
12+ }
13+ true
14+ }
15+
16+ #[ kani:: proof]
17+ #[ kani:: unwind( 6 ) ]
18+ fn check_sorted ( ) {
19+ let mut arr: [ i32 ; 5 ] = kani:: any ( ) ;
20+ arr. sort ( ) ;
21+ assert ! ( is_sorted( & arr) ) ;
22+ }
You can’t perform that action at this time.
0 commit comments