Skip to content

Commit 1ccd1a2

Browse files
author
thk123
committed
Add support for using the --function flag to goto-analyze and symex
symex and goto-analyze (through the goto_modelt class) now support setting the --function flag on precompiled .gb files. Refactored out the function flag and its help function to rebuild_goto_start_functions. Used this extracted flag in goto-analyze, symex and CBMC. Added tests that check both goto-analyze and symex when ran with the --function flag actually generate the correct _start function. Also added tests for when it isn't a precompiled binary. Added these new folders to the overal test suite
1 parent 0732580 commit 1ccd1a2

File tree

22 files changed

+203
-7
lines changed

22 files changed

+203
-7
lines changed

regression/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ DIRS = ansi-c \
66
cpp \
77
goto-analyzer \
88
goto-cc-cbmc \
9+
goto-cc-goto-analyzer \
10+
goto-cc-goto-symex \
911
goto-diff \
1012
goto-gcc \
1113
goto-instrument \
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <assert.h>
2+
3+
int fun(int x)
4+
{
5+
int i;
6+
if(i>=20)
7+
assert(i>=10);
8+
}
9+
10+
int main(int argc, char** argv)
11+
{
12+
int i;
13+
14+
if(i>=5)
15+
assert(i>=10);
16+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--function fun --show-goto-functions
4+
^\s*fun\(x\);$
5+
^EXIT=6$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring

regression/goto-cc-cbmc/regenerate-entry-function/test.desc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
CORE
22
main.c
33
"--function fun --cover branch"
4-
54
^EXIT=0$
65
^SIGNAL=0$
76
^x=
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
default: tests.log
3+
4+
test:
5+
@if ! ../test.pl -c ../chain.sh ; then \
6+
../failed-tests-printer.pl ; \
7+
exit 1; \
8+
fi
9+
10+
tests.log:
11+
pwd
12+
@if ! ../test.pl -c ../chain.sh ; then \
13+
../failed-tests-printer.pl ; \
14+
exit 1; \
15+
fi
16+
17+
show:
18+
@for dir in *; do \
19+
if [ -d "$$dir" ]; then \
20+
vim -o "$$dir/*.c" "$$dir/*.out"; \
21+
fi; \
22+
done;
23+
24+
clean:
25+
@for dir in *; do \
26+
rm -f tests.log; \
27+
if [ -d "$$dir" ]; then \
28+
cd "$$dir"; \
29+
rm -f *.out *.gb; \
30+
cd ..; \
31+
fi \
32+
done
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
src=../../../src
4+
5+
gc=$src/goto-cc/goto-cc
6+
goto_analyzer=$src/goto-analyzer/goto-analyzer
7+
8+
options=$1
9+
name=${2%.c}
10+
11+
$gc $name.c -o $name.gb
12+
$goto_analyzer $name.gb $options
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <assert.h>
2+
3+
int fun(int x)
4+
{
5+
int i;
6+
if(i>=20)
7+
assert(i>=10);
8+
}
9+
10+
int main(int argc, char** argv)
11+
{
12+
int i;
13+
14+
if(i>=5)
15+
assert(i>=10);
16+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
"--function fun --show-goto-functions"
4+
^\s*fun\(x\);$
5+
^EXIT=6$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring

regression/goto-cc-symex/Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
default: tests.log
3+
4+
test:
5+
@if ! ../test.pl -c ../chain.sh ; then \
6+
../failed-tests-printer.pl ; \
7+
exit 1; \
8+
fi
9+
10+
tests.log:
11+
pwd
12+
@if ! ../test.pl -c ../chain.sh ; then \
13+
../failed-tests-printer.pl ; \
14+
exit 1; \
15+
fi
16+
17+
show:
18+
@for dir in *; do \
19+
if [ -d "$$dir" ]; then \
20+
vim -o "$$dir/*.c" "$$dir/*.out"; \
21+
fi; \
22+
done;
23+
24+
clean:
25+
@for dir in *; do \
26+
rm -f tests.log; \
27+
if [ -d "$$dir" ]; then \
28+
cd "$$dir"; \
29+
rm -f *.out *.gb; \
30+
cd ..; \
31+
fi \
32+
done

regression/goto-cc-symex/chain.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
src=../../../src
4+
5+
gc=$src/goto-cc/goto-cc
6+
symex=$src/symex/symex
7+
8+
options=$1
9+
name=${2%.c}
10+
11+
$gc $name.c -o $name.gb
12+
$symex $name.gb $options

0 commit comments

Comments
 (0)