Skip to content

Commit 7bba456

Browse files
committed
Enable regression tests of k-induction instrumentation
goto-instrument supports instrumentation for k-induction, and we have tests that weren't previously used. Enable these.
1 parent 5e145e4 commit 7bba456

File tree

5 files changed

+49
-12
lines changed

5 files changed

+49
-12
lines changed

regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ add_subdirectory(statement-list)
5353
add_subdirectory(systemc)
5454
add_subdirectory(contracts)
5555
add_subdirectory(acceleration)
56+
add_subdirectory(k-induction)
5657
add_subdirectory(goto-harness)
5758
add_subdirectory(goto-harness-multi-file-project)
5859
add_subdirectory(goto-cc-file-local)

regression/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ DIRS = cbmc \
2828
systemc \
2929
contracts \
3030
acceleration \
31+
k-induction \
3132
goto-harness \
3233
goto-harness-multi-file-project \
3334
goto-cc-file-local \

regression/k-induction/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if(WIN32)
2+
set(is_windows true)
3+
else()
4+
set(is_windows false)
5+
endif()
6+
7+
add_test_pl_tests(
8+
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:goto-cc> $<TARGET_FILE:goto-instrument> $<TARGET_FILE:cbmc> ${is_windows}"
9+
)

regression/k-induction/Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
default: tests.log
22

3+
include ../../src/config.inc
4+
include ../../src/common
5+
6+
ifeq ($(BUILD_ENV_),MSVC)
7+
exe=../../../src/goto-cc/goto-cl
8+
is_windows=true
9+
else
10+
exe=../../../src/goto-cc/goto-cc
11+
is_windows=false
12+
endif
13+
314
test:
4-
@../test.pl -c ../chain.sh
15+
@../test.pl -e -p -c '../chain.sh $(exe) ../../../src/goto-instrument/goto-instrument ../../../src/cbmc/cbmc $(is_windows)'
516

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

920
show:
1021
@for dir in *; do \

regression/k-induction/chain.sh

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
set -e
44

5-
src=../../../src
6-
goto_cc=$src/goto-cc/goto-cc
7-
goto_instrument=$src/goto-instrument/goto-instrument
8-
cbmc=$src/cbmc/cbmc
5+
goto_cc=$1
6+
goto_instrument=$2
7+
cbmc=$3
8+
is_windows=$4
9+
10+
shift 4
911

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

18-
$goto_cc -o $name.o $name.c
20+
if [[ "${is_windows}" == "true" ]]; then
21+
$goto_cc "${name}.c" "/Fe${name}.gb"
22+
else
23+
$goto_cc -o "${name}.gb" "${name}.c"
24+
fi
25+
1926

20-
$goto_instrument --k-induction $k --base-case $name.o $name.base.o
21-
if $cbmc $name.base.o ; then echo "## Base case passes" ; else echo "## Base case fails" ; fi
27+
"$goto_instrument" --k-induction $k --base-case "$name.gb" "$name.base.gb"
28+
if "$cbmc" "$name.base.gb" ; then
29+
echo "## Base case passes"
30+
else
31+
echo "## Base case fails"
32+
fi
2233

23-
$goto_instrument --k-induction $k --step-case $name.o $name.step.o
24-
if $cbmc $name.step.o ; then echo "## Step case passes" ; else echo "## Step case fails" ; fi
34+
"$goto_instrument" --k-induction $k --step-case "$name.gb" "$name.step.gb"
35+
if "$cbmc" "$name.step.gb" ; then
36+
echo "## Step case passes"
37+
else
38+
echo "## Step case fails"
39+
fi

0 commit comments

Comments
 (0)