Skip to content

Commit 323eb74

Browse files
committed
Change regression testing suite to support running tests with cvc5.
This allows us to test against more than one solvers in the new backend (currently tested - cvc5, z3). This ensures that we don't invariably issue output that is solver specific, tying the new backend to a single solver by accident.
1 parent ce7e74c commit 323eb74

File tree

16 files changed

+39
-23
lines changed

16 files changed

+39
-23
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,12 @@ jobs:
634634
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
635635
- name: Confirm z3 solver is available and log the version installed
636636
run: z3 --version
637+
- name: Download cvc-5 from the releases page and make sure it can be deployed
638+
run: |
639+
wget -O cvc5 https://github.com/cvc5/cvc5/releases/download/cvc5-${{env.cvc5-version}}/cvc5-Linux
640+
chmod u+x cvc5
641+
mv cvc5 /usr/local/bin
642+
cvc5 --version
637643
- name: Prepare ccache
638644
uses: actions/cache@v2
639645
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-new-smt-backend-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-new-smt-backend-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/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.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
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
7-
second=128
7+
second=[128|\d+]
88
result_unsigned=64
99
^EXIT=10$
1010
^SIGNAL=0$

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)