Skip to content

Commit b76cce8

Browse files
authored
Merge pull request #6777 from NlightNFotis/run_tests_against_cvc5
Enable new SMT backend test suite to be run against cvc5 locally and on CI
2 parents 2bf999e + fbd7662 commit b76cce8

File tree

18 files changed

+49
-24
lines changed

18 files changed

+49
-24
lines changed

.github/workflows/pull-request-checks.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,12 @@ jobs:
644644
sudo apt-get install -y --allow-downgrades --reinstall gcc g++ libgcc-s1- libstdc++6=$target liblsan0=$target libtsan0=$target libcc1-0=$target libgcc1=1:$target gdb=8.1.1-0ubuntu1
645645
- name: Confirm z3 solver is available and log the version installed
646646
run: z3 --version
647+
- name: Download cvc-5 from the releases page and make sure it can be deployed
648+
run: |
649+
wget -O cvc5 https://github.com/cvc5/cvc5/releases/download/cvc5-${{env.cvc5-version}}/cvc5-Linux
650+
chmod u+x cvc5
651+
mv cvc5 /usr/local/bin
652+
cvc5 --version
647653
- name: Prepare ccache
648654
uses: actions/cache@v2
649655
with:
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11

22
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
3-
set(exclude_win_broken_tests -X winbug)
3+
set(exclude_win_broken_tests "-X;winbug")
44
else()
55
set(exclude_win_broken_tests "")
66
endif()
77

8-
add_test_pl_tests(
9-
"$<TARGET_FILE:cbmc> --validate-goto-model --validate-ssa-equation --slice-formula" ${exclude_win_broken_tests}
8+
add_test_pl_profile(
9+
"cbmc-incr-smt2-z3"
10+
"$<TARGET_FILE:cbmc> --incremental-smt2-solver 'z3 --smt2 -in' --validate-goto-model --validate-ssa-equation --slice-formula"
11+
"-C;${exclude_win_broken_tests};-s;new-smt-z3"
12+
"CORE"
13+
)
14+
15+
add_test_pl_profile(
16+
"cbmc-incr-smt2-cvc5"
17+
"$<TARGET_FILE:cbmc> --incremental-smt2-solver 'cvc5 --lang=smtlib2.6 --incremental' --validate-goto-model --validate-ssa-equation --slice-formula"
18+
"-C;${exclude_win_broken_tests};-s;new-smt-cvc5"
19+
"CORE"
1020
)

regression/cbmc-incr-smt2/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ else
99
exclude_broken_windows_tests=
1010
endif
1111

12-
test:
13-
@../test.pl -e -p -c "../../../src/cbmc/cbmc --validate-goto-model --validate-ssa-equation --slice-formula" $(exclude_broken_windows_tests)
12+
test: test.z3 test.cvc5
13+
14+
test.z3:
15+
@../test.pl -e -p -c "../../../src/cbmc/cbmc --incremental-smt2-solver 'z3 --smt2 -in' --validate-goto-model --validate-ssa-equation --slice-formula" $(exclude_broken_windows_tests)
16+
17+
test.cvc5:
18+
@../test.pl -e -p -c "../../../src/cbmc/cbmc --incremental-smt2-solver 'cvc5 --lang=smtlib2.6 --incremental' --validate-goto-model --validate-ssa-equation --slice-formula" $(exclude_broken_windows_tests)
1419

1520
tests.log: ../test.pl test
1621

regression/cbmc-incr-smt2/bitvector-arithmetic-operators/overflow_behaviour.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
overflow_behaviour.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --trace
3+
--trace
44
\[main\.assertion\.1\] line \d+ Wrap-around to INT_MIN when adding to INT_MAX: SUCCESS
55
\[main\.assertion\.2\] line \d+ Wrap-around to INT_MAX when subtracting from INT_MIN: SUCCESS
66
\[main\.assertion\.3\] line \d+ INT_MAX minus INT_MIN equals -1: SUCCESS

regression/cbmc-incr-smt2/bitvector-arithmetic-operators/polynomial.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
polynomial.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --trace
3+
--trace
44
\[main\.assertion\.1\] line \d+ No negative solution: FAILURE
55
\[main\.assertion\.2\] line \d+ No positive solution: FAILURE
66
x=-8\ \(11111111 11111111 11111111 11111000\)

regression/cbmc-incr-smt2/bitvector-arithmetic-operators/simple_equation.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
simple_equation.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --trace --verbosity 10
3+
--trace --verbosity 10
44
\[main\.assertion\.1\] line \d+ a plus a always equals two times a: SUCCESS
55
\[main\.assertion\.2\] line \d+ a minus a always equals 0: SUCCESS
66
\[main\.assertion\.3\] line \d+ a plus its additive inverse equals 0: SUCCESS

regression/cbmc-incr-smt2/bitvector-arithmetic-operators/unsigned_behaviour.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
unsigned_behaviour.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --trace
3+
--trace
44
\[main\.assertion\.1\] line \d+ a plus b should be more than 27: FAILURE
55
\[main\.assertion\.2\] line \d+ a plus b should be more than 27: FAILURE
66
\[main\.assertion\.3\] line \d+ c plus d should be more than 27: FAILURE

regression/cbmc-incr-smt2/bitvector-bitwise-operators/bitwise.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
bitwise_ops.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --slice-formula
3+
--slice-formula
44
\[main\.assertion\.1\] line \d+ This is going to fail for bit-opposites: FAILURE
55
\[main\.assertion\.2\] line \d+ This is going to hold for all values != 0: SUCCESS
66
\[main\.assertion\.3\] line \d+ This is going to fail for the same value in A and B: FAILURE

regression/cbmc-incr-smt2/bitvector-bitwise-operators/shift_left.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
shift_left.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --slice-formula
3+
--slice-formula
44
\[main\.assertion\.1\] line \d Shifted result should be greater than one: FAILURE
55
^EXIT=10$
66
^SIGNAL=0$

regression/cbmc-incr-smt2/bitvector-bitwise-operators/shift_right.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ int main()
1010
{
1111
int first;
1212
uint8_t second;
13+
// This assumption is here in order to constrain the value the solver
14+
// can produce to just 128 so that we don't get test failures for different
15+
// values returned by different SMT solvers.
16+
__CPROVER_assume((second & 1) == 0);
1317

1418
int place;
1519
__CPROVER_assume(place >= 1);

regression/cbmc-incr-smt2/bitvector-bitwise-operators/shift_right.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
shift_right.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --slice-formula --trace
3+
--slice-formula --trace
44
\[main\.assertion\.1\] line \d+ Right shifting a uint with leftmost bit set is a logical shift: FAILURE
55
\[main\.assertion\.2\] line \d+ Right shifting a positive number has a lower bound of 0: SUCCESS
66
\[main\.assertion\.3\] line \d+ Right shifting a negative number has a lower bound value of -1: SUCCESS

regression/cbmc-incr-smt2/bitvector-flag-tests/div_by_zero.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
div_by_zero.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --div-by-zero-check --trace
3+
--div-by-zero-check --trace
44
\[main\.division-by-zero\.1\] line \d division by zero in x / y: FAILURE
55
\[main\.division-by-zero\.2\] line \d+ division by zero in x / z: SUCCESS
66
y=0

regression/cbmc-incr-smt2/bitvector-flag-tests/signed_overflow.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
signed_overflow.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --signed-overflow-check --trace
3+
--signed-overflow-check --trace
44
^VERIFICATION FAILED$
55
^EXIT=10$
66
^SIGNAL=0$

regression/cbmc-incr-smt2/nondeterministic-int-assert/control_flow.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
control_flow.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --verbosity 10
4-
Passing problem to incremental SMT2 solving via "z3 --smt2 -in"
3+
--verbosity 10
4+
Passing problem to incremental SMT2 solving via
55
Sending command to SMT2 solver - \(set-option :produce-models true\)
66
Sending command to SMT2 solver - \(set-logic QF_UFBV\)
77
Sending command to SMT2 solver - \(declare-fun |goto_symex::&92;guard#1| \(\) Bool\)

regression/cbmc-incr-smt2/nondeterministic-int-assert/incremental_solver_called.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
test.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --verbosity 10
4-
Passing problem to incremental SMT2 solving via "z3 --smt2 -in"
3+
--verbosity 10
4+
Passing problem to incremental SMT2 solving via
55
Sending command to SMT2 solver - \(set-option :produce-models true\)
66
Sending command to SMT2 solver - \(set-logic QF_UFBV\)
77
Sending command to SMT2 solver - \(define-fun |B0| \(\) Bool true\)

regression/cbmc-incr-smt2/nondeterministic-int-assert/stdbool.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
stdbool_example.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --trace
4-
Passing problem to incremental SMT2 solving via "z3 --smt2 -in"
3+
--trace
4+
Passing problem to incremental SMT2 solving via
55
VERIFICATION FAILED
66
equal=FALSE\s*\([0 ]+\)
77
equal=TRUE\s*\([0 ]+1\)

regression/cbmc-incr-smt2/nondeterministic-int-assert/trace.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
trace.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --trace
4-
Passing problem to incremental SMT2 solving via "z3 --smt2 -in"
3+
--trace
4+
Passing problem to incremental SMT2 solving via
55
Assert of inequality to 4\.: FAILURE
66
Assert of inequality to 2\.: FAILURE
77
y=4

regression/cbmc-incr-smt2/nondeterministic-int-assert/valid_unsat.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
valid_unsat.c
3-
--incremental-smt2-solver 'z3 --smt2 -in' --verbosity 10
4-
Passing problem to incremental SMT2 solving via "z3 --smt2 -in"
3+
--verbosity 10
4+
Passing problem to incremental SMT2 solving via
55
Sending command to SMT2 solver - \(check-sat\)
66
Solver response - unsat
77
VERIFICATION SUCCESSFUL

0 commit comments

Comments
 (0)