Skip to content

Commit

Permalink
Add an integration test for path satisfiability checking
Browse files Browse the repository at this point in the history
  • Loading branch information
robdockins committed Oct 20, 2020
1 parent 322bc81 commit 8029801
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
Binary file added intTests/test0061_path_sat/termination.bc
Binary file not shown.
23 changes: 23 additions & 0 deletions intTests/test0061_path_sat/termination.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdint.h>

uint64_t g1(uint64_t x) {
int i = 0;
uint64_t r = x;
do {
r = r+1;
} while ( i++ < 3 && r == 0 );
return r;
}

// NB the termination of the following loop
// is a bit tricky because of the interaction
// between short-cutting '&&' and the 'i++'
// expression.
uint64_t g2(uint64_t x) {
int i = 0;
uint64_t r = x;
do {
r = r+1;
} while ( r == 0 && i++ < 3 );
return r;
}
12 changes: 12 additions & 0 deletions intTests/test0061_path_sat/test.saw
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
m <- llvm_load_module "termination.bc";

let g_spec = do {
x <- crucible_fresh_var "x" (llvm_int 64);
crucible_execute_func [crucible_term x];
};

crucible_llvm_verify m "g1" [] false g_spec z3;

// NB: path sat checking is required for this
// to terminate in a reasonable time
crucible_llvm_verify m "g2" [] true g_spec z3;
1 change: 1 addition & 0 deletions intTests/test0061_path_sat/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$SAW test.saw

0 comments on commit 8029801

Please sign in to comment.