File tree Expand file tree Collapse file tree 37 files changed +468
-222
lines changed Expand file tree Collapse file tree 37 files changed +468
-222
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ DIRS = ansi-c \
3
3
cpp \
4
4
cbmc-java \
5
5
cbmc-java-inheritance \
6
+ cbmc-cover \
6
7
goto-analyzer \
7
8
goto-diff \
8
9
goto-instrument \
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ int main()
5
5
__CPROVER_input ("input1" , input1 );
6
6
__CPROVER_input ("input2" , input2 );
7
7
8
+ // assert() is platform-dependent and changes set of coverage goals
8
9
__CPROVER_assert (!input1 , "" );
9
10
10
11
if (input1 )
Original file line number Diff line number Diff line change 3
3
--cover assertion
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.coverage.1\] file main.c line 8 function main: SATISFIED$
7
- ^\[main.coverage.2\] file main.c line 12 function main: SATISFIED$
6
+ ^\[main.coverage.1\] file main.c line 9 function main: SATISFIED$
7
+ ^\[main.coverage.2\] file main.c line 13 function main: SATISFIED$
8
8
--
9
9
^warning: ignoring
Original file line number Diff line number Diff line change 3
3
--cover branch
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.coverage.1\] file main.c line 3 function main function main entry point: SATISFIED$
7
- ^\[main.coverage.2\] file main.c line 8 function main function main block 1 branch false: SATISFIED$
8
- ^\[main.coverage.3\] file main.c line 8 function main function main block 1 branch true: SATISFIED$
9
- ^\[main.coverage.4\] file main.c line 10 function main function main block 2 branch false: FAILED$
10
- ^\[main.coverage.5\] file main.c line 10 function main function main block 2 branch true: SATISFIED$
11
- ^\[main.coverage.6\] file main.c line 16 function main function main block 4 branch false: SATISFIED$
12
- ^\[main.coverage.7\] file main.c line 16 function main function main block 4 branch true: SATISFIED$
6
+ ^\[main.coverage.1\] file main.c line 3 function main entry point: SATISFIED$
7
+ ^\[main.coverage.2\] file main.c line 8 function main block 1 branch false: SATISFIED$
8
+ ^\[main.coverage.3\] file main.c line 8 function main block 1 branch true: SATISFIED$
9
+ ^\[main.coverage.4\] file main.c line 10 function main block 2 branch false: FAILED$
10
+ ^\[main.coverage.5\] file main.c line 10 function main block 2 branch true: SATISFIED$
11
+ ^\[main.coverage.6\] file main.c line 16 function main block 4 branch false: SATISFIED$
12
+ ^\[main.coverage.7\] file main.c line 16 function main block 4 branch true: SATISFIED$
13
13
--
14
14
^warning: ignoring
Original file line number Diff line number Diff line change 3
3
--cover branch --unwind 2
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.coverage.1\] file main.c line 5 function main function main entry point: SATISFIED$
7
- ^\[main.coverage.2\] file main.c line 6 function main function main block .* branch false: SATISFIED$
8
- ^\[main.coverage.3\] file main.c line 6 function main function main block .* branch true: SATISFIED$
6
+ ^\[main.coverage.1\] file main.c line 5 function main entry point: SATISFIED$
7
+ ^\[main.coverage.2\] file main.c line 6 function main block .* branch false: SATISFIED$
8
+ ^\[main.coverage.3\] file main.c line 6 function main block .* branch true: SATISFIED$
9
9
--
10
10
^warning: ignoring
Original file line number Diff line number Diff line change 1
- #include <assert.h>
2
1
#include <stdio.h>
3
2
4
3
int main ()
Original file line number Diff line number Diff line change 3
3
--cover branch --unwind 6
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\*\* 23 of 23 covered \(100.0%\)$
6
+ ^\*\* .* of .* covered \(100.0%\)$
7
7
--
8
8
^warning: ignoring
Original file line number Diff line number Diff line change 3
3
--cover location --unwind 10
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\*\* 4 of 4 covered
6
+ ^\*\* .* of .* covered \(100.0%\)
7
7
--
8
8
^warning: ignoring
9
9
^\[.*<builtin-library-
Original file line number Diff line number Diff line change @@ -14,5 +14,6 @@ int main()
14
14
}
15
15
16
16
// should not produce a goal
17
+ // assert() is platform-dependent and changes set of coverage goals
17
18
__CPROVER_assert (input1 , "" );
18
19
}
Original file line number Diff line number Diff line change 3
3
--cover branch
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[my_func.coverage.1\] file main.c line 3 function my_func function my_func block 1 branch false: SATISFIED$
7
- ^\[my_func.coverage.2\] file main.c line 3 function my_func function my_func block 1 branch true: FAILED$
8
- ^\[my_func.coverage.3\] file main.c line 3 function my_func function my_func block 2 branch false: FAILED$
9
- ^\[my_func.coverage.4\] file main.c line 3 function my_func function my_func block 2 branch true: SATISFIED$
6
+ ^\[my_func.coverage.1\] file main.c line 3 function my_func block 1 branch false: SATISFIED$
7
+ ^\[my_func.coverage.2\] file main.c line 3 function my_func block 1 branch true: FAILED$
8
+ ^\[my_func.coverage.3\] file main.c line 3 function my_func block 2 branch false: FAILED$
9
+ ^\[my_func.coverage.4\] file main.c line 3 function my_func block 2 branch true: SATISFIED$
10
10
--
11
11
^warning: ignoring
Original file line number Diff line number Diff line change 1
- #include <assert.h>
2
-
3
1
int myfunc (int x , int y )
4
2
{
5
3
int z = x + y ;
Original file line number Diff line number Diff line change 3
3
--cover location
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.coverage.1\] file main.c line 11 function main block 1: SATISFIED$
7
- ^\[main.coverage.2\] file main.c line 13 function main block 2: FAILED$
8
- ^\[main.coverage.3\] file main.c line 13 function main block 3: FAILED$
9
- ^\[main.coverage.4\] file main.c line 15 function main block 4: SATISFIED$
10
- ^\[main.coverage.5\] file main.c line 17 function main block 5: SATISFIED$
11
- ^\[main.coverage.6\] file main.c line 18 function main block 6: SATISFIED$
12
- ^\[main.coverage.7\] file main.c line 20 function main block 7: FAILED$
13
- ^\[main.coverage.8\] file main.c line 22 function main block 8: SATISFIED$
14
- ^\[main.coverage.9\] file main.c line 23 function main block 9: SATISFIED$
15
- ^\[myfunc.coverage.1\] file main.c line 5 function myfunc block 1: FAILED$
16
- ^\[myfunc.coverage.2\] file main.c line 7 function myfunc block 2: FAILED$
17
- ^\*\* 6 of 11 covered \(54.5%\)
6
+ ^\[main.coverage.1\] file main.c line 9 function main block 1: SATISFIED$
7
+ ^\[main.coverage.2\] file main.c line 11 function main block 2: FAILED$
8
+ ^\[main.coverage.3\] file main.c line 11 function main block 3: FAILED$
9
+ ^\[main.coverage.4\] file main.c line 13 function main block 4: SATISFIED$
10
+ ^\[main.coverage.5\] file main.c line 15 function main block 5: SATISFIED$
11
+ ^\[main.coverage.6\] file main.c line 16 function main block 6: SATISFIED$
12
+ ^\[main.coverage.7\] file main.c line 18 function main block 7: FAILED$
13
+ ^\[main.coverage.8\] file main.c line 20 function main block 8: SATISFIED$
14
+ ^\[myfunc.coverage.1\] file main.c line 3 function myfunc block 1: FAILED$
15
+ ^\*\* 5 of 9 covered \(55.6%\)
18
16
--
19
17
^warning: ignoring
Original file line number Diff line number Diff line change 1
- #include <assert.h>
2
-
3
1
int foo (int iX , int iY )
4
2
{
5
3
return iX + iY ;
Original file line number Diff line number Diff line change 3
3
--cover location
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.coverage.1\] file main.c line 11 function main block 1: SATISFIED$
7
- ^\[main.coverage.2\] file main.c line 12 function main block 2: SATISFIED$
8
- ^\[foo.coverage.1\] file main.c line 5 function foo block 1: SATISFIED$
9
- ^\[foo.coverage.2\] file main.c line 6 function foo block 2: FAILED$
10
- ^\[foo.coverage.3\] file main.c line 7 function foo block 3: FAILED$
11
- ^\[foo.coverage.4\] file main.c line 7 function foo block 4: SATISFIED$
12
- ^\*\* 4 of 6 covered \(66.7%\)
6
+ ^\[main.coverage.1\] file main.c line 9 function main block 1: SATISFIED$
7
+ ^\[main.coverage.2\] file main.c line 10 function main block 2: SATISFIED$
8
+ ^\[foo.coverage.1\] file main.c line 3 function foo block 1: SATISFIED$
9
+ ^\[foo.coverage.2\] file main.c line 4 function foo block 2: FAILED$
10
+ ^\[foo.coverage.3\] file main.c line 5 function foo block 3: SATISFIED$
11
+ ^\*\* 4 of 5 covered \(80.0%\)
13
12
--
14
13
^warning: ignoring
Original file line number Diff line number Diff line change 1
- #include <assert.h>
2
-
3
1
int myfunc (int a , int b )
4
2
{
5
3
return a + b ;
Original file line number Diff line number Diff line change 3
3
--cover location
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.coverage.1\] file main.c line 16 function main block 1: SATISFIED$
7
- ^\[main.coverage.2\] file main.c line 17 function main block 2: SATISFIED$
8
- ^\[myfunc.coverage.1\] file main.c line 5 function myfunc block 1: FAILED$
9
- ^\[myfunc .coverage.2 \] file main.c line 6 function myfunc block 2: FAILED $
10
- ^\[foo.coverage.1 \] file main.c line 10 function foo block 1: SATISFIED $
11
- ^\[foo.coverage.2 \] file main.c line 11 function foo block 2 : FAILED$
12
- ^\[foo.coverage.3 \] file main.c line 12 function foo block 3: FAILED $
13
- ^\*\* 4 of 8 covered \(50.0 %\)
6
+ ^\[main.coverage.1\] file main.c line 14 function main block 1: SATISFIED$
7
+ ^\[main.coverage.2\] file main.c line 15 function main block 2: SATISFIED$
8
+ ^\[myfunc.coverage.1\] file main.c line 3 function myfunc block 1: FAILED$
9
+ ^\[foo .coverage.1 \] file main.c line 8 function foo block 1: SATISFIED $
10
+ ^\[foo.coverage.2 \] file main.c line 9 function foo block 2: FAILED $
11
+ ^\[foo.coverage.3 \] file main.c line 10 function foo block 3 : FAILED$
12
+ ^\[foo.coverage.4 \] file main.c line 10 function foo block 4: SATISFIED $
13
+ ^\*\* 4 of 7 covered \(57.1 %\)
14
14
--
15
15
^warning: ignoring
Original file line number Diff line number Diff line change 1
- #include <assert.h>
2
-
3
1
int foo (int iX , int iY )
4
2
{
5
3
return iX + iY ;
@@ -9,5 +7,7 @@ int main(void)
9
7
{
10
8
int iN = 2 + 1 ;
11
9
if (iN == 4 )
12
- assert (foo (5 ,3 )== 8 );
10
+
11
+ // assert() is platform-dependent and changes set of coverage goals
12
+ __CPROVER_assert (foo (5 ,3 )== 8 , "" );
13
13
}
Original file line number Diff line number Diff line change 3
3
--cover location
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.coverage.1\] file main.c line 10 function main block 1: SATISFIED$
6
+ ^\[main.coverage.1\] file main.c line 8 function main block 1: SATISFIED$
7
7
^\[main.coverage.2\] file main.c line 12 function main block 2: FAILED$
8
8
^\[main.coverage.3\] file main.c line 12 function main block 3: FAILED$
9
- ^\[main.coverage.4\] file main.c line 12 function main block 4: FAILED$
10
- ^\[main.coverage.5\] file main.c line 13 function main block 6: SATISFIED$
11
- ^\[foo.coverage.1\] file main.c line 5 function foo block 1: FAILED$
12
- ^\[foo.coverage.2\] file main.c line 6 function foo block 2: FAILED$
13
- ^\*\* 2 of 7 covered \(28.6%\)
9
+ ^\[main.coverage.4\] file main.c line 13 function main block 4: SATISFIED$
10
+ ^\[foo.coverage.1\] file main.c line 3 function foo block 1: FAILED$
11
+ ^\*\* 2 of 5 covered \(40.0%\)
14
12
--
15
13
^warning: ignoring
Original file line number Diff line number Diff line change 1
- #include <assert.h>
2
1
#include <math.h>
3
2
4
3
int foo (int iX , int iY )
Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ THOROUGH
2
2
main.c
3
3
--cover location
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.coverage.1\] file main.c line 11 function main block 1: SATISFIED$
6
+ ^\[main.coverage.1\] file main.c line 10 function main block 1: SATISFIED$
7
7
^\[main.coverage.2\] file main.c line 11 function main block 2: SATISFIED$
8
- ^\[main.coverage.3\] file main.c line 14 function main block 3: FAILED$
9
- ^\[main.coverage.4\] file main.c line 15 function main block 4: FAILED$
10
- ^\[main.coverage.5\] file main.c line 15 function main block 5: FAILED$
11
- ^\[main.coverage.6\] file main.c line 16 function main block 6: FAILED$
12
- ^\[main.coverage.7\] file main.c line 17 function main block 7: SATISFIED$
13
- ^\[foo.coverage.1\] file main.c line 6 function foo block 1: FAILED$
14
- ^\[foo.coverage.2\] file main.c line 7 function foo block 2: FAILED$
15
- ^\*\* 3 of 9 covered \(33.3%\)
8
+ ^\[main.coverage.3\] file main.c line 13 function main block 3: FAILED$
9
+ ^\[main.coverage.4\] file main.c line 16 function main block 4: SATISFIED$
10
+ ^\[foo.coverage.1\] file main.c line 5 function foo block 1: FAILED$
11
+ ^\*\* 3 of 5 covered \(60.0%\)
16
12
--
17
13
^warning: ignoring
Original file line number Diff line number Diff line change 1
- #include <assert.h>
2
-
3
1
int func (int a )
4
2
{
5
3
int b = a * 2 ;
@@ -10,7 +8,8 @@ int func(int a)
10
8
b += 10 ;
11
9
}
12
10
13
- assert (0 );
11
+ // assert() is platform-dependent and changes set of coverage goals
12
+ __CPROVER_assert (0 , "" );
14
13
15
14
return b ;
16
15
}
Original file line number Diff line number Diff line change 3
3
--cover location
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.coverage.1\] file main.c line 20 function main block 1: SATISFIED$
7
- ^\[main.coverage.2\] file main.c line 21 function main block 2: SATISFIED$
8
- ^\[func.coverage.1\] file main.c line 5 function func block 1: SATISFIED$
9
- ^\[func.coverage.2\] file main.c line 8 function func block 2: FAILED$
10
- ^\[func.coverage.3\] file main.c line 10 function func block 3: FAILED$
11
- ^\[func.coverage.4\] file main.c line 13 function func block 4: FAILED$
12
- ^\[func.coverage.5\] file main.c line 13 function func block 5: FAILED$
13
- ^\[func.coverage.6\] file main.c line 15 function func block 6: FAILED$
14
- ^\[func.coverage.7\] file main.c line 16 function func block 7: SATISFIED$
15
- ^\*\* 4 of 9 covered \(44.4%\)
6
+ ^\[main.coverage.1\] file main.c line 19 function main block 1: SATISFIED$
7
+ ^\[main.coverage.2\] file main.c line 20 function main block 2: SATISFIED$
8
+ ^\[func.coverage.1\] file main.c line 3 function func block 1: SATISFIED$
9
+ ^\[func.coverage.2\] file main.c line 6 function func block 2: FAILED$
10
+ ^\[func.coverage.3\] file main.c line 8 function func block 3: FAILED$
11
+ ^\[func.coverage.4\] file main.c line 12 function func block 4: FAILED$
12
+ ^\[func.coverage.5\] file main.c line 15 function func block 5: SATISFIED$
13
+ ^\*\* 4 of 7 covered \(57.1%\)
16
14
--
17
15
^warning: ignoring
Original file line number Diff line number Diff line change
1
+ class Test {
2
+ public static void main (String [] args ) {
3
+ for (int i =0 ; i <3 ; i ++) {
4
+ }
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --cover location --show-properties --verbosity 10
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ --
7
+ ^Ignoring block .* java::Test\.main
Original file line number Diff line number Diff line change
1
+ class Test {
2
+ static int s =5 ;
3
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --cover location --show-properties --verbosity 10
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^java::Test\.<clinit>:\(\)V block 2, location 4: bytecode-index 1 already instrumented
7
+ ^Ignoring block 2 location .* file Test\.java line 2 function java::Test\.<clinit>:\(\)V bytecode-index .* \(bytecode-index already instrumented\)
8
+ --
Original file line number Diff line number Diff line change
1
+ class Test {
2
+ static int x = 0 ;
3
+ static int y = 1 ;
4
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --cover location --show-properties --verbosity 10
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^java::Test\.<clinit>:\(\)V block 2, location 4: bytecode-index 1 already instrumented
7
+ ^java::Test\.<clinit>:\(\)V block 2: location 5, bytecode-index 3 selected for instrumentation
8
+ --
9
+ ^Ignoring block 2 location .* file Test\.java line 3 function java::Test\.<clinit>:\(\)V bytecode-index .* \(bytecode-index already instrumented\)
Original file line number Diff line number Diff line change @@ -161,7 +161,8 @@ void bmc_covert::satisfying_assignment()
161
161
162
162
if (solver.l_get (cond).is_true ())
163
163
{
164
- status () << " Covered " << g.description << messaget::eom;
164
+ status () << " Covered function " << g.source_location .get_function ()
165
+ << " " << g.description << messaget::eom;
165
166
g.satisfied =true ;
166
167
test.covered_goals .push_back (goal_pair.first );
167
168
break ;
You can’t perform that action at this time.
0 commit comments