Skip to content

Cause a regeneration of the _start method if a --function is provided #338

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 17 commits into from
Sep 14, 2017
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
15 changes: 15 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ test_script:
sed -i "13i mv $NAME.exe $NAME.gb" goto-instrument-typedef/chain.sh || true
cat goto-instrument-typedef/chain.sh || true

sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-cc-cbmc/chain.sh || true
sed -i "11s/.*/$GC $NAME.c/" goto-cc-cbmc/chain.sh || true
sed -i "12i mv $NAME.exe $NAME.gb" goto-cc-cbmc/chain.sh || true
cat goto-cc-cbmc/chain.sh || true

sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-cc-goto-analyzer/chain.sh || true
sed -i "11s/.*/$gc $name.c/" goto-cc-goto-analyzer/chain.sh || true
sed -i "12i mv $name.exe $name.gb" goto-cc-goto-analyzer/chain.sh || true
cat goto-cc-goto-analyzer/chain.sh || true

sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-cc-symex/chain.sh || true
sed -i "11s/.*/$gc $name.c/" goto-cc-symex/chain.sh || true
sed -i "12i mv $name.exe $name.gb" goto-cc-symex/chain.sh || true
cat goto-cc-symex/chain.sh || true

rem HACK disable failing tests
rmdir /s /q ansi-c\arch_flags_mcpu_bad
rmdir /s /q ansi-c\arch_flags_mcpu_good
Expand Down
3 changes: 3 additions & 0 deletions regression/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ DIRS = ansi-c \
cbmc-java-inheritance \
cpp \
goto-analyzer \
goto-cc-cbmc \
goto-cc-goto-analyzer \
goto-cc-goto-symex \
goto-diff \
goto-gcc \
goto-instrument \
Expand Down
8 changes: 4 additions & 4 deletions regression/cbmc/pointer-function-parameters-2/test.desc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ main.c
^\*\* 7 of 7 covered \(100.0%\)$
^\*\* Used 4 iterations$
^Test suite:$
^a=\(\(signed int \*\*\)NULL\), tmp\$1=[^,]*, tmp\$2=[^,]*$
^a=&tmp\$1!0, tmp\$1=\(\(signed int \*\)NULL\), tmp\$2=[^,]*$
^a=&tmp\$1!0, tmp\$1=&tmp\$2!0, tmp\$2=([012356789][0-9]*|4[0-9]+)$
^a=&tmp\$1!0, tmp\$1=&tmp\$2!0, tmp\$2=4$
^a=\(\(signed int \*\*\)NULL\), tmp\$\d+=[^,]*, tmp\$\d+=[^,]*$
^a=&tmp\$\d+!0, tmp\$\d+=\(\(signed int \*\)NULL\), tmp\$\d+=[^,]*$
^a=&tmp\$\d+!0, tmp\$\d+=&tmp\$\d+!0, tmp\$\d+=([012356789][0-9]*|4[0-9]+)$
^a=&tmp\$\d+!0, tmp\$\d+=&tmp\$\d+!0, tmp\$\d+=4$
--
^warning: ignoring
6 changes: 3 additions & 3 deletions regression/cbmc/pointer-function-parameters/test.desc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ main.c
^\*\* 5 of 5 covered \(100\.0%\)$
^\*\* Used 3 iterations$
^Test suite:$
^a=\(\(signed int \*\)NULL\), tmp\$1=[^,]*$
^a=&tmp\$1!0, tmp\$1=4$
^a=&tmp\$1!0, tmp\$1=([012356789][0-9]*|4[0-9]+)$
^a=\(\(signed int \*\)NULL\), tmp\$\d+=[^,]*$
^a=&tmp\$\d+!0, tmp\$\d+=4$
^a=&tmp\$\d+!0, tmp\$\d+=([012356789][0-9]*|4[0-9]+)$
--
^warning: ignoring
16 changes: 16 additions & 0 deletions regression/goto-analyzer/regenerate-entry-function/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <assert.h>

int fun(int x)
{
int i;
if(i>=20)
assert(i>=10);
}

int main(int argc, char** argv)
{
int i;

if(i>=5)
assert(i>=10);
}
8 changes: 8 additions & 0 deletions regression/goto-analyzer/regenerate-entry-function/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--function fun --show-goto-functions
^\s*fun\(x\);$
^EXIT=6$
^SIGNAL=0$
--
^warning: ignoring
30 changes: 30 additions & 0 deletions regression/goto-cc-cbmc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
default: tests.log

test:
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi

tests.log:
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi

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

clean:
@for dir in *; do \
$(RM) tests.log; \
if [ -d "$$dir" ]; then \
cd "$$dir"; \
$(RM) *.out *.gb; \
cd ..; \
fi \
done
12 changes: 12 additions & 0 deletions regression/goto-cc-cbmc/chain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

SRC=../../../src

GC=$SRC/goto-cc/goto-cc
CBMC=$SRC/cbmc/cbmc

OPTS=$1
NAME=${2%.c}

$GC $NAME.c -o $NAME.gb
$CBMC $NAME.gb $OPTS
23 changes: 23 additions & 0 deletions regression/goto-cc-cbmc/regenerate-entry-function/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
int fun(int x)
{
if(x > 0)
{
return x * x;
}
else
{
return x;
}
}

int main(int argc, char** argv)
{
if(argc>4)
{
return 0;
}
else
{
return 1;
}
}
8 changes: 8 additions & 0 deletions regression/goto-cc-cbmc/regenerate-entry-function/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
"--function fun --cover branch"
^EXIT=0$
^SIGNAL=0$
^x=
--
^warning: ignoring
32 changes: 32 additions & 0 deletions regression/goto-cc-goto-analyzer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

default: tests.log

test:
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi

tests.log:
pwd
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi

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

clean:
@for dir in *; do \
rm -f tests.log; \
if [ -d "$$dir" ]; then \
cd "$$dir"; \
rm -f *.out *.gb; \
cd ..; \
fi \
done
12 changes: 12 additions & 0 deletions regression/goto-cc-goto-analyzer/chain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

src=../../../src

gc=$src/goto-cc/goto-cc
goto_analyzer=$src/goto-analyzer/goto-analyzer

options=$1
name=${2%.c}

$gc $name.c -o $name.gb
$goto_analyzer $name.gb $options
16 changes: 16 additions & 0 deletions regression/goto-cc-goto-analyzer/regenerate-entry-function/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <assert.h>

int fun(int x)
{
int i;
if(i>=20)
assert(i>=10);
}

int main(int argc, char** argv)
{
int i;

if(i>=5)
assert(i>=10);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
"--function fun --show-goto-functions"
^\s*fun\(x\);$
^EXIT=6$
^SIGNAL=0$
--
^warning: ignoring
32 changes: 32 additions & 0 deletions regression/goto-cc-symex/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

default: tests.log

test:
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi

tests.log:
pwd
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi

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

clean:
@for dir in *; do \
rm -f tests.log; \
if [ -d "$$dir" ]; then \
cd "$$dir"; \
rm -f *.out *.gb; \
cd ..; \
fi \
done
12 changes: 12 additions & 0 deletions regression/goto-cc-symex/chain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

src=../../../src

gc=$src/goto-cc/goto-cc
symex=$src/symex/symex

options=$1
name=${2%.c}

$gc $name.c -o $name.gb
$symex $name.gb $options
16 changes: 16 additions & 0 deletions regression/goto-cc-symex/regenerate-entry-function/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <assert.h>

int fun(int x)
{
int i;
if(i>=20)
assert(i>=10);
}

int main(int argc, char** argv)
{
int i;

if(i>=5)
assert(i>=10);
}
8 changes: 8 additions & 0 deletions regression/goto-cc-symex/regenerate-entry-function/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
"--function fun --show-goto-functions"
^\s*return.=fun\(x\);$
^EXIT=6$
^SIGNAL=0$
--
^warning: ignoring
16 changes: 16 additions & 0 deletions regression/symex/regenerate-entry-function/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <assert.h>

int fun(int x)
{
int i;
if(i>=20)
assert(i>=10);
}

int main(int argc, char** argv)
{
int i;

if(i>=5)
assert(i>=10);
}
8 changes: 8 additions & 0 deletions regression/symex/regenerate-entry-function/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--function fun --show-goto-functions
fun\(x\);$
^EXIT=6$
^SIGNAL=0$
--
^warning: ignoring
4 changes: 3 additions & 1 deletion regression/symex/show-trace1/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
KNOWNBUG
main.c
--trace
^EXIT=10$
Expand All @@ -9,3 +9,5 @@ main.c
^ k=6 .*$
--
^warning: ignoring
--
diffblue/cbmc#1361
Loading