cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
cover.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Coverage Instrumentation
4
5
Author: Daniel Kroening
6
7
Date: May 2016
8
9
\*******************************************************************/
10
13
14
#ifndef CPROVER_GOTO_INSTRUMENT_COVER_H
15
#define CPROVER_GOTO_INSTRUMENT_COVER_H
16
17
#include "
cover_filter.h
"
18
#include "
cover_instrument.h
"
19
20
class
cmdlinet
;
21
class
goto_modelt
;
22
class
goto_model_functiont
;
23
class
message_handlert
;
24
class
optionst
;
25
class
symbol_tablet
;
26
27
#define OPT_COVER \
28
"(cover):" \
29
"(cover-failed-assertions)" \
30
"(show-test-suite)"
31
32
#define HELP_COVER \
33
" {y--cover} {uCC} \t " \
34
"create test-suite with coverage criterion {uCC}, where {uCC} is one of " \
35
"{yassertion}[{ys}], {yassume}[{ys}], {ybranch}[{yes}], " \
36
"{ycondition}[{ys}], {ycover}, {ydecision}[{ys}], {ylocation}[{ys}], " \
37
"or {ymcdc}\n" \
38
" {y--cover-failed-assertions} \t " \
39
"do not stop coverage checking at failed assertions (this is the default " \
40
"for {y--cover} {yassertions})\n" \
41
" {y--show-test-suite} \t " \
42
"print test suite for coverage criterion (requires {y--cover})\n"
43
44
enum class
coverage_criteriont
45
{
46
ASSUME
,
47
LOCATION
,
48
BRANCH
,
49
DECISION
,
50
CONDITION
,
51
PATH
,
52
MCDC
,
53
ASSERTION
,
54
COVER
// __CPROVER_cover(x) annotations
55
};
56
57
struct
cover_configt
58
{
59
bool
keep_assertions
;
60
bool
cover_failed_assertions
;
61
bool
traces_must_terminate
;
62
irep_idt
mode
;
63
function_filterst
function_filters
;
64
// cover instruments point to goal_filters, so they must be stored on the heap
65
std::unique_ptr<goal_filterst>
goal_filters
=
66
std::make_unique<goal_filterst>();
67
cover_instrumenterst
cover_instrumenters
;
68
cover_instrumenter_baset::assertion_factoryt
make_assertion
=
69
goto_programt::make_assertion
;
70
};
71
72
void
instrument_cover_goals
(
73
const
symbol_tablet
&,
74
const
cover_configt
&,
75
goto_functionst
&,
76
coverage_criteriont
,
77
message_handlert
&message_handler);
78
79
void
instrument_cover_goals
(
80
const
symbol_tablet
&,
81
const
cover_configt
&,
82
goto_programt
&,
83
coverage_criteriont
,
84
message_handlert
&message_handler);
85
86
cover_configt
87
get_cover_config
(
const
optionst
&,
const
symbol_tablet
&,
message_handlert
&);
88
89
cover_configt
get_cover_config
(
90
const
optionst
&,
91
const
irep_idt
&main_function_id,
92
const
symbol_tablet
&,
93
message_handlert
&);
94
95
void
instrument_cover_goals
(
96
const
cover_configt
&,
97
goto_model_functiont
&,
98
message_handlert
&);
99
100
void
parse_cover_options
(
const
cmdlinet
&,
optionst
&);
101
102
bool
instrument_cover_goals
(
103
const
cover_configt
&,
104
const
symbol_tablet
&,
105
goto_functionst
&,
106
message_handlert
&);
107
108
bool
instrument_cover_goals
(
109
const
cover_configt
&,
110
goto_modelt
&,
111
message_handlert
&);
112
113
#endif
// CPROVER_GOTO_INSTRUMENT_COVER_H
cmdlinet
Definition
cmdline.h:20
cover_instrumenter_baset::assertion_factoryt
std::function< goto_programt::instructiont(const exprt &, const source_locationt &)> assertion_factoryt
The type of function used to make goto_program assertions.
Definition
cover_instrument.h:41
cover_instrumenterst
A collection of instrumenters to be run.
Definition
cover_instrument.h:103
function_filterst
A collection of function filters to be applied in conjunction.
Definition
cover_filter.h:64
goto_functionst
A collection of goto functions.
Definition
goto_functions.h:25
goto_model_functiont
Interface providing access to a single function in a GOTO model, plus its associated symbol table.
Definition
goto_model.h:190
goto_modelt
Definition
goto_model.h:27
goto_programt
A generic container class for the GOTO intermediate representation of one function.
Definition
goto_program.h:72
goto_programt::make_assertion
static instructiont make_assertion(const exprt &g, const source_locationt &l=source_locationt::nil())
Definition
goto_program.h:932
message_handlert
Definition
message.h:27
optionst
Definition
options.h:23
symbol_tablet
The symbol table.
Definition
symbol_table.h:14
parse_cover_options
void parse_cover_options(const cmdlinet &, optionst &)
Parses coverage-related command line options.
Definition
cover.cpp:143
coverage_criteriont
coverage_criteriont
Definition
cover.h:45
coverage_criteriont::BRANCH
@ BRANCH
Definition
cover.h:48
coverage_criteriont::DECISION
@ DECISION
Definition
cover.h:49
coverage_criteriont::PATH
@ PATH
Definition
cover.h:51
coverage_criteriont::MCDC
@ MCDC
Definition
cover.h:52
coverage_criteriont::COVER
@ COVER
Definition
cover.h:54
coverage_criteriont::ASSERTION
@ ASSERTION
Definition
cover.h:53
coverage_criteriont::CONDITION
@ CONDITION
Definition
cover.h:50
instrument_cover_goals
void instrument_cover_goals(const symbol_tablet &, const cover_configt &, goto_functionst &, coverage_criteriont, message_handlert &message_handler)
get_cover_config
cover_configt get_cover_config(const optionst &, const symbol_tablet &, message_handlert &)
Build data structures controlling coverage from command-line options.
Definition
cover.cpp:181
cover_filter.h
Filters for the Coverage Instrumentation.
cover_instrument.h
Coverage Instrumentation.
LOCATION
@ LOCATION
Definition
goto_program.h:40
ASSUME
@ ASSUME
Definition
goto_program.h:34
cover_configt
Definition
cover.h:58
cover_configt::traces_must_terminate
bool traces_must_terminate
Definition
cover.h:61
cover_configt::mode
irep_idt mode
Definition
cover.h:62
cover_configt::keep_assertions
bool keep_assertions
Definition
cover.h:59
cover_configt::cover_instrumenters
cover_instrumenterst cover_instrumenters
Definition
cover.h:67
cover_configt::cover_failed_assertions
bool cover_failed_assertions
Definition
cover.h:60
cover_configt::make_assertion
cover_instrumenter_baset::assertion_factoryt make_assertion
Definition
cover.h:68
cover_configt::function_filters
function_filterst function_filters
Definition
cover.h:63
cover_configt::goal_filters
std::unique_ptr< goal_filterst > goal_filters
Definition
cover.h:65
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
goto-instrument
cover.h
Generated by
1.17.0