Skip to content

Enable regression tests of k-induction instrumentation #5938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ add_subdirectory(statement-list)
add_subdirectory(systemc)
add_subdirectory(contracts)
add_subdirectory(acceleration)
add_subdirectory(k-induction)
add_subdirectory(goto-harness)
add_subdirectory(goto-harness-multi-file-project)
add_subdirectory(goto-cc-file-local)
Expand Down
1 change: 1 addition & 0 deletions regression/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DIRS = cbmc \
systemc \
contracts \
acceleration \
k-induction \
goto-harness \
goto-harness-multi-file-project \
goto-cc-file-local \
Expand Down
9 changes: 9 additions & 0 deletions regression/k-induction/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if(WIN32)
set(is_windows true)
else()
set(is_windows false)
endif()

add_test_pl_tests(
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:goto-cc> $<TARGET_FILE:goto-instrument> $<TARGET_FILE:cbmc> ${is_windows}"
)
17 changes: 14 additions & 3 deletions regression/k-induction/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
default: tests.log

include ../../src/config.inc
include ../../src/common

ifeq ($(BUILD_ENV_),MSVC)
exe=../../../src/goto-cc/goto-cl
is_windows=true
else
exe=../../../src/goto-cc/goto-cc
is_windows=false
endif

test:
@../test.pl -c ../chain.sh
@../test.pl -e -p -c '../chain.sh $(exe) ../../../src/goto-instrument/goto-instrument ../../../src/cbmc/cbmc $(is_windows)'

tests.log: ../test.pl
@../test.pl -c ../chain.sh
tests.log:
@../test.pl -e -p -c '../chain.sh $(exe) ../../../src/goto-instrument/goto-instrument ../../../src/cbmc/cbmc $(is_windows)'

show:
@for dir in *; do \
Expand Down
33 changes: 24 additions & 9 deletions regression/k-induction/chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

set -e

src=../../../src
goto_cc=$src/goto-cc/goto-cc
goto_instrument=$src/goto-instrument/goto-instrument
cbmc=$src/cbmc/cbmc
goto_cc=$1
goto_instrument=$2
cbmc=$3
is_windows=$4

shift 4

function usage() {
echo "Usage: chain k test_file.c"
Expand All @@ -15,10 +17,23 @@ function usage() {
name=`echo $2 | cut -d. -f1`
k=$1

$goto_cc -o $name.o $name.c
if [[ "${is_windows}" == "true" ]]; then
$goto_cc "${name}.c" "/Fe${name}.gb"
else
$goto_cc -o "${name}.gb" "${name}.c"
fi


$goto_instrument --k-induction $k --base-case $name.o $name.base.o
if $cbmc $name.base.o ; then echo "## Base case passes" ; else echo "## Base case fails" ; fi
"$goto_instrument" --k-induction $k --base-case "$name.gb" "$name.base.gb"
if "$cbmc" "$name.base.gb" ; then
echo "## Base case passes"
else
echo "## Base case fails"
fi

$goto_instrument --k-induction $k --step-case $name.o $name.step.o
if $cbmc $name.step.o ; then echo "## Step case passes" ; else echo "## Step case fails" ; fi
"$goto_instrument" --k-induction $k --step-case "$name.gb" "$name.step.gb"
if "$cbmc" "$name.step.gb" ; then
echo "## Step case passes"
else
echo "## Step case fails"
fi