Skip to content

Enable goto-analyzer-simplify regression tests #5933

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 @@ -49,6 +49,7 @@ add_subdirectory(goto-cc-cbmc)
add_subdirectory(goto-cc-cbmc-shared-options)
add_subdirectory(cbmc-cpp)
add_subdirectory(goto-cc-goto-analyzer)
add_subdirectory(goto-analyzer-simplify)
add_subdirectory(statement-list)
add_subdirectory(systemc)
add_subdirectory(contracts)
Expand Down
1 change: 1 addition & 0 deletions regression/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ DIRS = cbmc \
goto-cc-cbmc-shared-options \
cbmc-cpp \
goto-cc-goto-analyzer \
goto-analyzer-simplify \
statement-list \
systemc \
contracts \
Expand Down
3 changes: 3 additions & 0 deletions regression/goto-analyzer-simplify/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_test_pl_tests(
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:goto-analyzer>"
)
15 changes: 4 additions & 11 deletions regression/goto-analyzer-simplify/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@

default: tests.log

test:
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi
@../test.pl -e -p -c "../chain.sh ../../../src/goto-analyzer/goto-analyzer"

tests.log:
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi
tests.log: ../test.pl
@../test.pl -e -p -c "../chain.sh ../../../src/goto-analyzer/goto-analyzer"

show:
@for dir in *; do \
if [ -d "$$dir" ]; then \
vim -o "$$dir/*.c" "$$dir/*.out"; \
vim -o "$$dir/*.java" "$$dir/*.out"; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??? Why change this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, my bad, I copied regression/goto-analyzer/Makefile. I suppose both should be changed, or perhaps we should just get rid of this show target. Will create a PR for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally done in #5957.

fi; \
done;

Expand Down
16 changes: 7 additions & 9 deletions regression/goto-analyzer-simplify/chain.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#!/bin/bash

src_dir=../../../src
set -e

goto_analyzer=$src_dir/goto-analyzer/goto-analyzer
goto_analyzer=$1

options=$1
file_name=${2%.c}
options=${*:2:$#-2}
name=${*:$#}
name=${name%.c}

echo options: $options
echo file name : $file_name

$goto_analyzer $file_name.c $options --simplify $file_name_simp.out
$goto_analyzer $file_name_simp.out --show-goto-functions
"${goto_analyzer}" "${name}.c" ${options} --simplify "${name}.gb"
"${goto_analyzer}" "${name}.gb" --show-goto-functions
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays"

arr\[0l\]
--vsd --vsd-arrays every-element
arr\[0l?l?\]
^SIGNAL=0$
^EXIT=0$
--
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
CORE
main.c
--variable-sensitivity
--vsd
r == 2
^SIGNAL=0$
^EXIT=6$
^EXIT=0$
--
--

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays"

arr\[0l\] =
arr\[1l\] =
arr\[\(signed long int\)nondet\] =
--vsd --vsd-arrays every-element
arr\[0l?l?\] =
arr\[1l?l?\] =
arr\[\(signed (long (long )?)?int\)nondet\] =
^SIGNAL=0$
^EXIT=0$
--
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays --vsd-pointers"

--vsd --vsd-arrays every-element --vsd-pointers value-set
symbol_a = 1
symbol_b = 2
\*arr\[2l\] = 3;
\*arr\[\(signed long int\)nondet_index\] = 4;
\*arr\[2l?l?\] = 3;
\*arr\[\(signed (long (long )?)?int\)nondet_index\] = 4;
^SIGNAL=0$
^EXIT=0$
--
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CORE
main.c
"--variable-sensitivity --vsd-pointers"

--vsd --vsd-pointers value-set
symbol = 5
\*pointer = 6
^SIGNAL=0$
^EXIT=0$
--
10 changes: 6 additions & 4 deletions regression/goto-analyzer-simplify/simplify-lhs-member/test.desc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays --vsd-pointers --vsd-structs"

--vsd --vsd-arrays every-element --vsd-pointers value-set --vsd-structs every-field
symbol = 5
\*value\.pointer_component = 6
value\.array\[1l\] = 2
value\.array\[\(signed long int\)nondet\] = 3
value\.array\[1l?l?\] = 2
value\.array\[\(signed (long (long )?)?int\)nondet\] = 3
^SIGNAL=0$
^EXIT=0$
--
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays --vsd-pointers"
array\[0l\] = 5
array\[\(signed long int\)nondet\] = 6
new_array\[1l\] = 7
--vsd --vsd-arrays every-element --vsd-pointers value-set
array\[0l?l?\] = 5
array\[\(signed (long (long )?)?int\)nondet\] = 6
new_array\[1l?l?\] = 7
^SIGNAL=0$
^EXIT=0$
--
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
CORE
main.c
"--variable-sensitivity"
--vsd
^SIGNAL=0$
^EXIT=6$
^EXIT=0$
main#return_value = 0;
--
--
Tests that a multiplication
of variable*variable can be simplified
if one of the variables can be evaluated to 0.
if one of the variables can be evaluated to 0.