Skip to content

Fix255 #268

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

Closed
wants to merge 73 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
64e9512
add the option existing-coverage
lucasccordeiro Sep 2, 2016
5da372f
check whether the user has provided a valid json file for --existing-…
lucasccordeiro Sep 2, 2016
40aa14a
get the line of each goal
lucasccordeiro Sep 2, 2016
ac40ed5
generate goals only if they do not exist in the json file
lucasccordeiro Sep 2, 2016
14e5dc5
refactor the code for checking existing coverage
lucasccordeiro Sep 5, 2016
97ebd80
add test cases to check existing coverage
lucasccordeiro Sep 5, 2016
3895bdc
add more test cases to check existing coverage
lucasccordeiro Sep 5, 2016
766d221
add more test cases to check existing coverage
lucasccordeiro Sep 5, 2016
9a4a1f9
remove whitespace
lucasccordeiro Sep 5, 2016
84f0330
code refactoring to check existing goals
lucasccordeiro Sep 5, 2016
2be7e4e
replace coverage_goals by coverage_goalst
lucasccordeiro Sep 6, 2016
8266595
default variant of instrument_cover_goals that uses an empty set of e…
lucasccordeiro Sep 6, 2016
cf1fdea
a goal should be identified by a source_locationt
lucasccordeiro Sep 6, 2016
031603b
implement get_coverage method
lucasccordeiro Sep 6, 2016
270dea2
a goal should be identified by a source_locationt
lucasccordeiro Sep 6, 2016
76b4a34
method to construct a coverage_goalst object
lucasccordeiro Sep 6, 2016
863f904
remove iostream
lucasccordeiro Sep 6, 2016
5bcc815
use json file suggested at github issue #187
lucasccordeiro Sep 8, 2016
138f89c
use json file as suggested at github issue #187
lucasccordeiro Sep 8, 2016
48e5ebb
remove space
lucasccordeiro Sep 8, 2016
7e39b53
fix merge
lucasccordeiro Sep 19, 2016
5a8f14d
add the option existing-coverage
lucasccordeiro Sep 2, 2016
e067182
check whether the user has provided a valid json file for --existing-…
lucasccordeiro Sep 2, 2016
c904f8c
get the line of each goal
lucasccordeiro Sep 2, 2016
a7e7836
generate goals only if they do not exist in the json file
lucasccordeiro Sep 2, 2016
b688f1c
refactor the code for checking existing coverage
lucasccordeiro Sep 5, 2016
74b76f6
add test cases to check existing coverage
lucasccordeiro Sep 5, 2016
a338c82
add more test cases to check existing coverage
lucasccordeiro Sep 5, 2016
77669df
add more test cases to check existing coverage
lucasccordeiro Sep 5, 2016
ab727a2
remove whitespace
lucasccordeiro Sep 5, 2016
3cb0e28
code refactoring to check existing goals
lucasccordeiro Sep 5, 2016
7eb566d
replace coverage_goals by coverage_goalst
lucasccordeiro Sep 6, 2016
c2b6344
default variant of instrument_cover_goals that uses an empty set of e…
lucasccordeiro Sep 6, 2016
1100815
a goal should be identified by a source_locationt
lucasccordeiro Sep 6, 2016
100d6c8
implement get_coverage method
lucasccordeiro Sep 6, 2016
a758710
a goal should be identified by a source_locationt
lucasccordeiro Sep 6, 2016
50caf55
method to construct a coverage_goalst object
lucasccordeiro Sep 6, 2016
e2e8a80
remove iostream
lucasccordeiro Sep 6, 2016
ec445c9
use json file suggested at github issue #187
lucasccordeiro Sep 8, 2016
d22e9c5
use json file as suggested at github issue #187
lucasccordeiro Sep 8, 2016
11b5fc1
remove space
lucasccordeiro Sep 8, 2016
b7a0afb
fix merge
lucasccordeiro Sep 21, 2016
b0bc02b
fix merge
lucasccordeiro Sep 21, 2016
d42ad2d
add the option existing-coverage
lucasccordeiro Sep 2, 2016
a514fd2
check whether the user has provided a valid json file for --existing-…
lucasccordeiro Sep 2, 2016
8ee2d05
get the line of each goal
lucasccordeiro Sep 2, 2016
5f7f28d
generate goals only if they do not exist in the json file
lucasccordeiro Sep 2, 2016
4496ee7
refactor the code for checking existing coverage
lucasccordeiro Sep 5, 2016
1db39f4
add test cases to check existing coverage
lucasccordeiro Sep 5, 2016
8bd413a
add more test cases to check existing coverage
lucasccordeiro Sep 5, 2016
c4dbf20
add more test cases to check existing coverage
lucasccordeiro Sep 5, 2016
00f8f33
remove whitespace
lucasccordeiro Sep 5, 2016
e6dc38b
code refactoring to check existing goals
lucasccordeiro Sep 5, 2016
a15c500
replace coverage_goals by coverage_goalst
lucasccordeiro Sep 6, 2016
cbc6e26
default variant of instrument_cover_goals that uses an empty set of e…
lucasccordeiro Sep 6, 2016
106f7bd
a goal should be identified by a source_locationt
lucasccordeiro Sep 6, 2016
5cf4a86
implement get_coverage method
lucasccordeiro Sep 6, 2016
05896a6
a goal should be identified by a source_locationt
lucasccordeiro Sep 6, 2016
a66ed50
method to construct a coverage_goalst object
lucasccordeiro Sep 6, 2016
5958459
remove iostream
lucasccordeiro Sep 6, 2016
19788f0
use json file suggested at github issue #187
lucasccordeiro Sep 8, 2016
2a96477
use json file as suggested at github issue #187
lucasccordeiro Sep 8, 2016
420f38b
remove space
lucasccordeiro Sep 8, 2016
cc0187c
fix merge
lucasccordeiro Oct 19, 2016
f2023f2
fix merge
lucasccordeiro Oct 19, 2016
a7cf0f8
add test case location10 to check --cover in the presence of unreacha…
lucasccordeiro Oct 21, 2016
e51488f
add test case location11 to check --cover in the presence of unreacha…
lucasccordeiro Oct 21, 2016
af26c6d
added test case to check the behaviour of --cover in the presence of …
lucasccordeiro Oct 26, 2016
a5868ae
added test case to check the behaviour of --cover in the presence of …
lucasccordeiro Oct 26, 2016
fe52c6d
added location14 to check the behaviour of --cover in the presence of…
lucasccordeiro Oct 26, 2016
43dc052
fix test cases location11 and location12
lucasccordeiro Oct 26, 2016
8efb139
added location15 to check the behaviour of --cover in the presence of…
lucasccordeiro Oct 26, 2016
3181b2f
added location16 to check the behaviour of --cover in the presence of…
lucasccordeiro Oct 26, 2016
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
2 changes: 1 addition & 1 deletion regression/cbmc-concurrency/deadlock1/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ void main() {
pthread_join(tid2, NULL);
// deadlock in the threads; assertion should not be reachable
assert(0);
}
}
23 changes: 23 additions & 0 deletions regression/cbmc-cover/location10/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <assert.h>

int myfunc(int x, int y)
{
int z = x + y;
return z;
}

int main(void)
{
_Bool x=0, y;
if (x)
assert(myfunc(2,3)==5);
else
y=1;

if (y)
assert(myfunc(4,3)==7);
else
assume(0);

assert(y==1);
}
20 changes: 20 additions & 0 deletions regression/cbmc-cover/location10/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CORE
main.c
--cover location
^EXIT=0$
^SIGNAL=0$
^\[main.coverage.1\] file main.c line 11 function main block 1: SATISFIED$
^\[main.coverage.2\] file main.c line 13 function main block 2: FAILED$
^\[main.coverage.3\] file main.c line 13 function main block 3: FAILED$
^\[main.coverage.4\] file main.c line 15 function main block 5: SATISFIED$
^\[main.coverage.5\] file main.c line 17 function main block 6: SATISFIED$
^\[main.coverage.6\] file main.c line 18 function main block 7: SATISFIED$
^\[main.coverage.7\] file main.c line 18 function main block 8: SATISFIED$
^\[main.coverage.8\] file main.c line 20 function main block 10: FAILED$
^\[main.coverage.9\] file main.c line 22 function main block 11: SATISFIED$
^\[main.coverage.10\] file main.c line 23 function main block 12: SATISFIED$
^\[myfunc.coverage.1\] file main.c line 5 function myfunc block 1: SATISFIED$
^\[myfunc.coverage.2\] file main.c line 7 function myfunc block 2: SATISFIED$
^\*\* 9 of 12 covered (75.0%)
--
^warning: ignoring
23 changes: 23 additions & 0 deletions regression/cbmc-cover/location11/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <assert.h>

int myfunc(int x, int y)
{
int z = x + y;
return z;
}

int main(void)
{
_Bool x=0, y;
if (x)
assert(myfunc(2,3)==5);
else
y=1;

if (y)
y=0;
else
__CPROVER_assume(0);

assert(y==1);
}
19 changes: 19 additions & 0 deletions regression/cbmc-cover/location11/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CORE
main.c
--cover location
^EXIT=0$
^SIGNAL=0$
^\[main.coverage.1\] file main.c line 11 function main block 1: SATISFIED$
^\[main.coverage.2\] file main.c line 13 function main block 2: FAILED$
^\[main.coverage.3\] file main.c line 13 function main block 3: FAILED$
^\[main.coverage.4\] file main.c line 15 function main block 5: SATISFIED$
^\[main.coverage.5\] file main.c line 17 function main block 6: SATISFIED$
^\[main.coverage.6\] file main.c line 18 function main block 7: SATISFIED$
^\[main.coverage.7\] file main.c line 20 function main block 8: FAILED$
^\[main.coverage.8\] file main.c line 22 function main block 9: SATISFIED$
^\[main.coverage.9\] file main.c line 23 function main block 10: SATISFIED$
^\[myfunc.coverage.1\] file main.c line 5 function myfunc block 1: FAILED$
^\[myfunc.coverage.2\] file main.c line 7 function myfunc block 2: FAILED$
^\*\* 6 of 11 covered (54.5%)
--
^warning: ignoring
12 changes: 12 additions & 0 deletions regression/cbmc-cover/location12/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <assert.h>

int foo (int iX, int iY)
{
return iX + iY;
__CPROVER_assume(0);
}

int main(void)
{
assert(foo(5,3)==8);
}
15 changes: 15 additions & 0 deletions regression/cbmc-cover/location12/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CORE
main.c
--cover location
^EXIT=0$
^SIGNAL=0$
^\[main.coverage.1\] file main.c line 11 function main block 1: SATISFIED$
^\[main.coverage.2\] file main.c line 11 function main block 2: SATISFIED$
^\[main.coverage.3\] file main.c line 12 function main block 3: SATISFIED$
^\[foo.coverage.1\] file main.c line 5 function foo block 1: SATISFIED$
^\[foo.coverage.2\] file main.c line 6 function foo block 2: FAILED$
^\[foo.coverage.3\] file main.c line 7 function foo block 3: FAILED$
^\[foo.coverage.4\] file main.c line 7 function foo block 4: SATISFIED$
^\*\* 5 of 7 covered (71.4%)
--
^warning: ignoring
17 changes: 17 additions & 0 deletions regression/cbmc-cover/location13/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <assert.h>

int myfunc(int a, int b)
{
return a+b;
}

int foo (int iX, int iY)
{
return iX + iY;
assert(myfunc(iX,iY)==8);
}

int main(void)
{
assert(foo(5,3)==8);
}
18 changes: 18 additions & 0 deletions regression/cbmc-cover/location13/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CORE
main.c
--cover location
^EXIT=0$
^SIGNAL=0$
^\[main.coverage.1\] file main.c line 16 function main block 1: SATISFIED$
^\[main.coverage.2\] file main.c line 16 function main block 2: SATISFIED$
^\[main.coverage.3\] file main.c line 17 function main block 3: SATISFIED$
^\[myfunc.coverage.1\] file main.c line 5 function myfunc block 1: FAILED$
^\[myfunc.coverage.2\] file main.c line 6 function myfunc block 2: FAILED$
^\[foo.coverage.1\] file main.c line 10 function foo block 1: SATISFIED$
^\[foo.coverage.2\] file main.c line 11 function foo block 2: FAILED$
^\[foo.coverage.3\] file main.c line 11 function foo block 3: FAILED$
^\[foo.coverage.4\] file main.c line 12 function foo block 4: FAILED$
^\[foo.coverage.5\] file main.c line 12 function foo block 5: SATISFIED$
^\*\* 5 of 10 covered (50.0%)
--
^warning: ignoring
13 changes: 13 additions & 0 deletions regression/cbmc-cover/location14/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <assert.h>

int foo (int iX, int iY)
{
return iX + iY;
}

int main(void)
{
int iN = 2 + 1;
if (iN == 4)
assert(foo(5,3)==8);
}
14 changes: 14 additions & 0 deletions regression/cbmc-cover/location14/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CORE
main.c
--cover location
^EXIT=0$
^SIGNAL=0$
^\[main.coverage.1\] file main.c line 10 function main block 1: SATISFIED$
^\[main.coverage.2\] file main.c line 12 function main block 2: FAILED$
^\[main.coverage.3\] file main.c line 12 function main block 3: FAILED$
^\[main.coverage.4\] file main.c line 13 function main block 4: SATISFIED$
^\[foo.coverage.1\] file main.c line 5 function foo block 1: FAILED$
^\[foo.coverage.2\] file main.c line 6 function foo block 2: FAILED$
^\*\* 2 of 6 covered (33.3%)
--
^warning: ignoring
17 changes: 17 additions & 0 deletions regression/cbmc-cover/location15/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <assert.h>
#include <math.h>

int foo (int iX, int iY)
{
return iX + iY;
}

int main(void)
{
double dX = sqrt(2);
if (dX > 5)
{
__CPROVER_assume(0);
assert(foo(5,3)==1);
}
}
17 changes: 17 additions & 0 deletions regression/cbmc-cover/location15/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CORE
main.c
--cover location
^EXIT=0$
^SIGNAL=0$
^\[main.coverage.1\] file main.c line 11 function main block 1: SATISFIED$
^\[main.coverage.2\] file main.c line 11 function main block 2: SATISFIED$
^\[main.coverage.3\] file main.c line 14 function main block 3: FAILED$
^\[main.coverage.4\] file main.c line 15 function main block 4: FAILED$
^\[main.coverage.5\] file main.c line 15 function main block 5: FAILED$
^\[main.coverage.6\] file main.c line 16 function main block 6: FAILED$
^\[main.coverage.7\] file main.c line 17 function main block 7: SATISFIED$
^\[foo.coverage.1\] file main.c line 6 function foo block 1: FAILED$
^\[foo.coverage.2\] file main.c line 7 function foo block 2: FAILED$
^\*\* 3 of 9 covered (33.3%)
--
^warning: ignoring
21 changes: 21 additions & 0 deletions regression/cbmc-cover/location16/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <assert.h>

int func(int a)
{
int b = a*2;
return b;

if (b < 10)
{
b += 10;
}

assert(0);

return b;
}

int main(void)
{
func(2);
}
17 changes: 17 additions & 0 deletions regression/cbmc-cover/location16/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CORE
main.c
--cover location
^EXIT=0$
^SIGNAL=0$
^\[main.coverage.1\] file main.c line 20 function main block 1: SATISFIED$
^\[main.coverage.2\] file main.c line 21 function main block 2: SATISFIED$
^\[func.coverage.1\] file main.c line 5 function func block 1: SATISFIED$
^\[func.coverage.2\] file main.c line 8 function func block 2: FAILED$
^\[func.coverage.3\] file main.c line 10 function func block 3: FAILED$
^\[func.coverage.4\] file main.c line 13 function func block 4: FAILED$
^\[func.coverage.5\] file main.c line 13 function func block 5: FAILED$
^\[func.coverage.6\] file main.c line 15 function func block 6: FAILED$
^\[func.coverage.7\] file main.c line 16 function func block 7: SATISFIED$
^\*\* 4 of 9 covered (44.4%)
--
^warning: ignoring
13 changes: 13 additions & 0 deletions regression/cbmc-cover/location2/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
int main()
{
int i, j;

i = 1;

if(j > 0)
j += i;
else
j = 0;

assert(i != j);
}
2 changes: 2 additions & 0 deletions regression/cbmc-cover/location2/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ { "file": "main.c", "function": "main", "lines": [ {"number": 3}, {"number": 8}, {"number": 10}, {"number": 12} ] }
]
8 changes: 8 additions & 0 deletions regression/cbmc-cover/location2/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--cover location --existing-coverage main.json
^EXIT=0$
^SIGNAL=0$
^\*\* 0 of 0 covered (100.0%)
--
^warning: ignoring
13 changes: 13 additions & 0 deletions regression/cbmc-cover/location3/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
int main()
{
int i, j;

i = 1;

if(j > 0)
j += i;
else
j = 0;

assert(i != j);
}
2 changes: 2 additions & 0 deletions regression/cbmc-cover/location3/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ { "file": "main.c", "function": "main", "lines": [ {"number": 3}, {"number": 8}, {"number": 12} ] }
]
9 changes: 9 additions & 0 deletions regression/cbmc-cover/location3/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
main.c
--cover location --existing-coverage main.json
^EXIT=0$
^SIGNAL=0$
^\[main.coverage.1\] file main.c line 10 function main block 3: SATISFIED$
^\*\* 1 of 1 covered (100.0%)
--
^warning: ignoring
41 changes: 41 additions & 0 deletions regression/cbmc-cover/location4/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include <stdio.h>
#include <assert.h>
#include "single-linked-list.h"

int main(void)
{

int i;
mlist *mylist, *temp;

insert_list(mylist,2);
insert_list(mylist,5);
insert_list(mylist,1);
insert_list(mylist,3);

mylist = head;

printf("list all elements: ");
while(mylist)
{
printf("%d ", mylist->key);
mylist = mylist->next;
}
printf("\n");

temp = search_list(mylist,2);
printf("search for element 2: %s\n", temp->key == 2 ? "found" : "not found");
assert(temp->key == 2);

delete_list(temp);

mylist = head;

printf("list all elements except 2: ");
while(mylist)
{
printf("%d ", mylist->key);
mylist = mylist->next;
}
printf("\n");
}
7 changes: 7 additions & 0 deletions regression/cbmc-cover/location4/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[ { "file": "<builtin-library-free>", "function": "free", "lines": [ {"number": 22} ] },
{ "file": "main.c", "function": "main", "lines": [ {"number": 8}, {"number": 12}, {"number": 13}, {"number": 14}, {"number": 16}, {"number": 19}, {"number": 21}, {"number": 24}, {"number": 26}, {"number": 30}, {"number": 32}, {"number": 35}, {"number": 37}, {"number": 40} ] },
{"file": "single-linked-list.c", "function": "search_list", "lines": [ {"number": 9}, {"number": 10}, {"number": 15} ] },
{"file": "single-linked-list.c", "function": "delete_list", "lines": [ {"number": 19}, {"number": 23}, {"number": 24}, {"number": 25}, {"number": 29}, {"number": 31}, {"number": 37}, {"number": 40}, {"number": 45}, {"number": 48} ] },
{"file": "single-linked-list.c", "function": "insert_list", "lines": [ {"number": 37}, {"number": 40}, {"number": 45}, {"number": 48} ] }
]

Loading