File tree 3 files changed +27
-0
lines changed
tests/expected/report/verification-time
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;
6
6
use std:: ffi:: OsString ;
7
7
use std:: path:: Path ;
8
8
use std:: process:: Command ;
9
+ use std:: time:: Instant ;
9
10
10
11
use crate :: args:: KaniArgs ;
11
12
use crate :: session:: KaniSession ;
@@ -40,7 +41,9 @@ impl KaniSession {
40
41
// extra argument
41
42
cmd. arg ( "--json-ui" ) ;
42
43
44
+ let now = Instant :: now ( ) ;
43
45
let _cbmc_result = self . run_redirect ( cmd, & output_filename) ?;
46
+ let elapsed = now. elapsed ( ) . as_secs_f32 ( ) ;
44
47
let format_result = self . format_cbmc_output ( & output_filename) ;
45
48
46
49
if format_result. is_err ( ) {
@@ -51,6 +54,7 @@ impl KaniSession {
51
54
// the best possible fix is port to rust instead of using python, or getting more
52
55
// feedback than just exit status (or using a particular magic exit code?)
53
56
}
57
+ println ! ( "Verification Time: {}s" , elapsed) ;
54
58
}
55
59
56
60
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