Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 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
13df092
add test cases related to consider_goals method
lucasccordeiro Sep 14, 2016
179ea5a
add consider_goals method
lucasccordeiro Sep 14, 2016
5dc24b1
minor changes
lucasccordeiro Sep 14, 2016
b46dd00
update test cases
lucasccordeiro Sep 14, 2016
fe40027
add test cases to check the --no-trivial-tests option
lucasccordeiro Sep 14, 2016
f617419
add the --no-trivial-tests option to CBMC
lucasccordeiro Sep 14, 2016
52c8ed9
add option to exclude trivial coverage test goals
lucasccordeiro Sep 15, 2016
3b3542a
do not produce test goals for constructor and destructor methods
lucasccordeiro Sep 15, 2016
4998f05
minor changes
lucasccordeiro Sep 15, 2016
e7061a0
consolidate integration with cover
peterschrammel Sep 16, 2016
d462a70
fixed compilation error
Sep 16, 2016
ce8c607
Merge pull request #1 from peterschrammel/lucasccordeiro-coverage
lucasccordeiro Sep 17, 2016
abe8e17
fix merge
lucasccordeiro Sep 19, 2016
c69583d
fix test case condition1
lucasccordeiro Sep 20, 2016
a017d00
fix test case consider_goals6
lucasccordeiro Sep 20, 2016
4da31e5
fix test case consider_goals7
lucasccordeiro Sep 20, 2016
34594cc
fix test case consider_goals8
lucasccordeiro Sep 20, 2016
2eddeb4
fix test case location1
lucasccordeiro Sep 20, 2016
8a50896
fix test case location3
lucasccordeiro Sep 20, 2016
bb4359e
fix test case location5
lucasccordeiro Sep 20, 2016
f680c4e
fix test case location6
lucasccordeiro Sep 20, 2016
e3edd91
fix test case location7
lucasccordeiro Sep 20, 2016
6a82bc7
fix test case location8
lucasccordeiro Sep 20, 2016
3e4d11c
fix test case location9
lucasccordeiro Sep 20, 2016
cf54786
fix test case mcdc1
lucasccordeiro Sep 20, 2016
e5f95bd
fix test case mcdc2
lucasccordeiro Sep 20, 2016
111b9d5
fix test case mcdc3
lucasccordeiro Sep 20, 2016
e4f54c0
fix test case mcdc4
lucasccordeiro Sep 20, 2016
2516b15
fix test case mcdc5
lucasccordeiro Sep 20, 2016
2775262
fix test case mcdc7
lucasccordeiro Sep 20, 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
44 changes: 22 additions & 22 deletions regression/cbmc-concurrency/deadlock1/main.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#include <pthread.h>
#include <stdlib.h>
#include <assert.h>
pthread_mutex_t lock_never_unlock_002_glb_mutex = PTHREAD_MUTEX_INITIALIZER;
void* lock_never_unlock_002_tsk_001(void* pram) {
pthread_mutex_lock(&lock_never_unlock_002_glb_mutex);
return NULL;
}
void main() {
pthread_t tid1;
pthread_t tid2;
pthread_mutex_init(&lock_never_unlock_002_glb_mutex, NULL);
pthread_create(&tid1, NULL, lock_never_unlock_002_tsk_001, NULL);
pthread_create(&tid2, NULL, lock_never_unlock_002_tsk_001, NULL);
pthread_join(tid1, NULL);
pthread_join(tid2, NULL);
// deadlock in the threads; assertion should not be reachable
assert(0);
}
#include <pthread.h>
#include <stdlib.h>
#include <assert.h>

pthread_mutex_t lock_never_unlock_002_glb_mutex = PTHREAD_MUTEX_INITIALIZER;

void* lock_never_unlock_002_tsk_001(void* pram) {
pthread_mutex_lock(&lock_never_unlock_002_glb_mutex);
return NULL;
}

void main() {
pthread_t tid1;
pthread_t tid2;
pthread_mutex_init(&lock_never_unlock_002_glb_mutex, NULL);
pthread_create(&tid1, NULL, lock_never_unlock_002_tsk_001, NULL);
pthread_create(&tid2, NULL, lock_never_unlock_002_tsk_001, NULL);
pthread_join(tid1, NULL);
pthread_join(tid2, NULL);
// deadlock in the threads; assertion should not be reachable
assert(0);
}
46 changes: 23 additions & 23 deletions regression/cbmc-concurrency/deadlock2/main.c
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#include <pthread.h>
#include <stdlib.h>
#include <assert.h>
pthread_mutex_t lock_never_unlock_002_glb_mutex = PTHREAD_MUTEX_INITIALIZER;
void* lock_never_unlock_002_tsk_001(void* pram) {
pthread_mutex_lock(&lock_never_unlock_002_glb_mutex);
pthread_mutex_unlock(&lock_never_unlock_002_glb_mutex);
return NULL;
}
void main() {
pthread_t tid1;
pthread_t tid2;
pthread_mutex_init(&lock_never_unlock_002_glb_mutex, NULL);
pthread_create(&tid1, NULL, lock_never_unlock_002_tsk_001, NULL);
pthread_create(&tid2, NULL, lock_never_unlock_002_tsk_001, NULL);
pthread_join(tid1, NULL);
pthread_join(tid2, NULL);
// no deadlock in the threads; assertion should be reached
assert(0);
}
#include <pthread.h>
#include <stdlib.h>
#include <assert.h>

pthread_mutex_t lock_never_unlock_002_glb_mutex = PTHREAD_MUTEX_INITIALIZER;

void* lock_never_unlock_002_tsk_001(void* pram) {
pthread_mutex_lock(&lock_never_unlock_002_glb_mutex);
pthread_mutex_unlock(&lock_never_unlock_002_glb_mutex);
return NULL;
}

void main() {
pthread_t tid1;
pthread_t tid2;
pthread_mutex_init(&lock_never_unlock_002_glb_mutex, NULL);
pthread_create(&tid1, NULL, lock_never_unlock_002_tsk_001, NULL);
pthread_create(&tid2, NULL, lock_never_unlock_002_tsk_001, NULL);
pthread_join(tid1, NULL);
pthread_join(tid2, NULL);
// no deadlock in the threads; assertion should be reached
assert(0);
}
52 changes: 26 additions & 26 deletions regression/cbmc-concurrency/norace_array1/main.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#include <pthread.h>
#include <assert.h>
int s[2];
void* thread_0(void* arg)
{
s[0] = 2;
assert(s[0] == 2);
return NULL;
}
void* thread_1(void* arg)
{
s[1] = 1;
assert(s[1] == 1);
return NULL;
}
int main(void)
{
pthread_t thread0, thread1;
pthread_create(&thread0, NULL, thread_0, 0);
pthread_create(&thread1, NULL, thread_1, 0);
return 0;
}
#include <pthread.h>
#include <assert.h>

int s[2];

void* thread_0(void* arg)
{
s[0] = 2;
assert(s[0] == 2);
return NULL;
}

void* thread_1(void* arg)
{
s[1] = 1;
assert(s[1] == 1);
return NULL;
}

int main(void)
{
pthread_t thread0, thread1;
pthread_create(&thread0, NULL, thread_0, 0);
pthread_create(&thread1, NULL, thread_1, 0);
return 0;
}
52 changes: 26 additions & 26 deletions regression/cbmc-concurrency/norace_scalar1/main.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#include <pthread.h>
#include <assert.h>
int f0, f1;
void* thread_0(void* arg)
{
f0 = 2;
assert(f0 == 2);
return NULL;
}
void* thread_1(void* arg)
{
f1 = 1;
assert(f1 == 1);
return NULL;
}
int main(void)
{
pthread_t thread0, thread1;
pthread_create(&thread0, NULL, thread_0, 0);
pthread_create(&thread1, NULL, thread_1, 0);
return 0;
}
#include <pthread.h>
#include <assert.h>

int f0, f1;

void* thread_0(void* arg)
{
f0 = 2;
assert(f0 == 2);
return NULL;
}

void* thread_1(void* arg)
{
f1 = 1;
assert(f1 == 1);
return NULL;
}

int main(void)
{
pthread_t thread0, thread1;
pthread_create(&thread0, NULL, thread_0, 0);
pthread_create(&thread1, NULL, thread_1, 0);
return 0;
}
52 changes: 26 additions & 26 deletions regression/cbmc-concurrency/norace_struct1/main.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#include <pthread.h>
#include <assert.h>
struct { int f0; int f1; } s;
void* thread_0(void* arg)
{
s.f0 = 2;
assert(s.f0 == 2);
return NULL;
}
void* thread_1(void* arg)
{
s.f1 = 1;
assert(s.f1 == 1);
return NULL;
}
int main(void)
{
pthread_t thread0, thread1;
pthread_create(&thread0, NULL, thread_0, 0);
pthread_create(&thread1, NULL, thread_1, 0);
return 0;
}
#include <pthread.h>
#include <assert.h>

struct { int f0; int f1; } s;

void* thread_0(void* arg)
{
s.f0 = 2;
assert(s.f0 == 2);
return NULL;
}

void* thread_1(void* arg)
{
s.f1 = 1;
assert(s.f1 == 1);
return NULL;
}

int main(void)
{
pthread_t thread0, thread1;
pthread_create(&thread0, NULL, thread_0, 0);
pthread_create(&thread1, NULL, thread_1, 0);
return 0;
}
80 changes: 40 additions & 40 deletions regression/cbmc-concurrency/struct_and_array1/main.c
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
#include <pthread.h>
typedef struct st_t
{
unsigned char x;
unsigned char y;
} ST;
ST st;
char my_array[10];
_Bool done1, done2;
void *foo1(void *arg1)
{
st.x = 1;
my_array[1]=1;
done1 = 1;
}
void *foo2(void *arg2)
{
st.y = 1;
my_array[2]=2;
done2 = 1;
}
int main()
{
pthread_t t;
pthread_create(&t,NULL,foo1,NULL);
pthread_create(&t,NULL,foo2,NULL);
if(done1 && done2)
{
assert(st.x==st.y);
assert(my_array[1]==my_array[2]);
}
}
#include <pthread.h>

typedef struct st_t
{
unsigned char x;
unsigned char y;
} ST;

ST st;

char my_array[10];

_Bool done1, done2;

void *foo1(void *arg1)
{
st.x = 1;
my_array[1]=1;
done1 = 1;
}

void *foo2(void *arg2)
{
st.y = 1;
my_array[2]=2;
done2 = 1;
}

int main()
{
pthread_t t;
pthread_create(&t,NULL,foo1,NULL);
pthread_create(&t,NULL,foo2,NULL);

if(done1 && done2)
{
assert(st.x==st.y);
assert(my_array[1]==my_array[2]);
}
}
16 changes: 8 additions & 8 deletions regression/cbmc-cover/condition1/test.desc
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ main.c
--cover condition
^EXIT=0$
^SIGNAL=0$
^\[coverage.1] file main.c line 8 condition .* false: SATISFIED
^\[coverage.2] file main.c line 8 condition .* true: SATISFIED
^\[main.coverage.1] file main.c line 8 function main condition .* false: SATISFIED
^\[main.coverage.2] file main.c line 8 function main condition .* true: SATISFIED
^\[main.coverage.3] file main.c line 8 function main condition .* false: SATISFIED
^\[main.coverage.4] file main.c line 8 function main condition .* true: SATISFIED
^\[main.coverage.5] file main.c line 11 function main condition .* false: SATISFIED
^\[main.coverage.6] file main.c line 11 function main condition .* true: SATISFIED
^\[main.coverage.7] file main.c line 14 function main condition .* false: SATISFIED
^\[main.coverage.8] file main.c line 14 function main condition .* true: SATISFIED
^\[main.coverage.9] file main.c line 16 function main condition .* false: FAILED
^\[main.coverage.10] file main.c line 16 function main condition .* true: SATISFIED
^\[main.coverage.3] file main.c line 11 function main condition .* false: SATISFIED
^\[main.coverage.4] file main.c line 11 function main condition .* true: SATISFIED
^\[main.coverage.5] file main.c line 14 function main condition .* false: SATISFIED
^\[main.coverage.6] file main.c line 14 function main condition .* true: SATISFIED
^\[main.coverage.7] file main.c line 16 function main condition .* false: FAILED
^\[main.coverage.8] file main.c line 16 function main condition .* true: SATISFIED
^\*\* 9 of 10 covered (90.0%)
--
^warning: ignoring
Binary file added regression/cbmc-cover/consider_goals1/if_icmp1.class
Binary file not shown.
31 changes: 31 additions & 0 deletions regression/cbmc-cover/consider_goals1/if_icmp1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class if_icmp1
{
private static void f() {
int i = 10;
int j = 11;
if (i == j) {
assert false;
}
if (i >= j) {
assert false;
}
if (j > i) {
assert true;
} else {
assert false;
}
if (j <= i) {
assert false;
}
if (j < i) {
assert false;
} else {
assert true;
}
}

public static void main(String[] args)
{
f();
}
}
8 changes: 8 additions & 0 deletions regression/cbmc-cover/consider_goals1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
if_icmp1.class
--cover location --no-trivial-tests
^EXIT=0$
^SIGNAL=0$
^\*\* 12 of 27 covered (44.4%)
--
^warning: ignoring
Binary file added regression/cbmc-cover/consider_goals2/Person.class
Binary file not shown.
Loading