Skip to content

Commit 79d8a9c

Browse files
author
Enrico Steffinlongo
authored
Merge pull request #7762 from NlightNFotis/esteffin/verifier-only-entry-point
Add `goto-bmc`, a new tool to run only the verifier
2 parents 6066b34 + 4f5a3b0 commit 79d8a9c

30 files changed

+424
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ cprover_default_properties(
228228
driver
229229
goto-analyzer
230230
goto-analyzer-lib
231+
goto-bmc
231232
goto-cc
232233
goto-cc-lib
233234
goto-checker

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
# These files change frequently and changes are medium-risk
5151

5252
/src/goto-analyzer/ @martin-cs @peterschrammel
53+
/src/goto-bmc/ @NlightNFotis @thomasspriggs @esteffin @TGWDB @peterschrammel
5354
/src/goto-harness/ @martin-cs @peterschrammel
5455
/src/goto-instrument/ @martin-cs @peterschrammel @tautschnig @kroening
5556
/src/goto-instrument/contracts/ @tautschnig @feliperodri @remi-delmas-3000

regression/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ add_subdirectory(invariants)
5454
add_subdirectory(goto-diff)
5555
add_subdirectory(test-script)
5656
add_subdirectory(goto-analyzer-taint)
57+
add_subdirectory(goto-bmc/goto-bmc-symex-ready-goto)
58+
add_subdirectory(goto-bmc/goto-bmc-non-symex-ready-goto)
59+
add_subdirectory(goto-bmc)
5760
if(NOT WIN32)
5861
add_subdirectory(goto-gcc)
5962
else()

regression/goto-bmc/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_test_pl_tests(
2+
"$<TARGET_FILE:goto-bmc>"
3+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
3+
--help
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
goto-bmc \d\.\d+\.\d+
7+
Usage\:
8+
Purpose\:
9+
show help
10+
show version and exit
11+
--
12+
--
13+
Test that help is output when help argument is specified.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
3+
4+
^EXIT=6$
5+
^SIGNAL=0$
6+
Please give exactly one binary file
7+
--
8+
--
9+
Test that an appropriate error message is produced when no input goto binary is
10+
specified.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
3+
--version
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\d\.\d+\.\d+
7+
--
8+
--
9+
Test that version is output when version argument is specified.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
2+
set(is_windows true)
3+
else()
4+
set(is_windows false)
5+
endif()
6+
7+
# Second suite of tests is running `goto-cc` to produce "normal" goto-binaries,
8+
# which we expect `goto-bmc` to reject in some capacity. For now, it just fails
9+
# non-gracefully, with invariant violations. This behaviour is important enough
10+
# that we want to test for it, but we expect the software to become better behaved
11+
# in the future (by checking that the input binary *is* in symex-ready-goto form
12+
# and if not produce appropriate error reporting for the user).
13+
add_test_pl_tests(
14+
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:goto-cc> $<TARGET_FILE:goto-bmc> ${is_windows}"
15+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
goto_cc=$1
6+
goto_bmc=$2
7+
is_windows=$3
8+
9+
options=${*:4:$#-4}
10+
name=${*:$#}
11+
base_name=${name%.c}
12+
base_name=${base_name%.cpp}
13+
14+
if [[ "${is_windows}" == "true" ]]; then
15+
"${goto_cc}" "${name}" "/Fe${base_name}.gb"
16+
else
17+
"${goto_cc}" "${name}" -o "${base_name}.gb"
18+
fi
19+
20+
"${goto_bmc}" "${base_name}.gb" ${options}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
int main(int argc, char *argv[])
2+
{
3+
int a[] = {0, 1, 2, 3, 4};
4+
__CPROVER_assert(a[0] != 0, "expected fail: 0 == 0");
5+
return 0;
6+
}

0 commit comments

Comments
 (0)