CBMC
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 #include "util/make_unique.h"
20 
21 class cmdlinet;
22 class goto_modelt;
24 class message_handlert;
25 class optionst;
26 
27 #define OPT_COVER \
28  "(cover):" \
29  "(cover-failed-assertions)" \
30  "(show-test-suite)"
31 
32 #define HELP_COVER \
33  " --cover CC create test-suite with coverage criterion " \
34  "CC,\n" \
35  " where CC is one of assertion[s], " \
36  "assume[s],\n" \
37  " branch[es], condition[s], cover, " \
38  "decision[s],\n" \
39  " location[s], or mcdc\n" \
40  " --cover-failed-assertions do not stop coverage checking at failed " \
41  "assertions\n" \
42  " (this is the default for --cover " \
43  "assertions)\n" \
44  " --show-test-suite print test suite for coverage criterion " \
45  "(requires --cover)\n"
46 
48 {
49  ASSUME,
50  LOCATION,
51  BRANCH,
52  DECISION,
53  CONDITION,
54  PATH,
55  MCDC,
56  ASSERTION,
57  COVER // __CPROVER_cover(x) annotations
58 };
59 
61 {
67  // cover instruments point to goal_filters, so they must be stored on the heap
68  std::unique_ptr<goal_filterst> goal_filters =
69  util_make_unique<goal_filterst>();
73 };
74 
76  const symbol_tablet &,
77  const cover_configt &,
80  message_handlert &message_handler);
81 
83  const symbol_tablet &,
84  const cover_configt &,
85  goto_programt &,
87  message_handlert &message_handler);
88 
91 
93  const optionst &,
94  const irep_idt &main_function_id,
95  const symbol_tablet &,
97 
99  const cover_configt &,
101  message_handlert &);
102 
103 void parse_cover_options(const cmdlinet &, optionst &);
104 
106  const cover_configt &,
107  const symbol_tablet &,
108  goto_functionst &,
109  message_handlert &);
110 
112  const cover_configt &,
113  goto_modelt &,
114  message_handlert &);
115 
116 #endif // CPROVER_GOTO_INSTRUMENT_COVER_H
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
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:186
coverage_criteriont::COVER
@ COVER
symbol_tablet
The symbol table.
Definition: symbol_table.h:13
cover_configt::goal_filters
std::unique_ptr< goal_filterst > goal_filters
Definition: cover.h:68
optionst
Definition: options.h:22
parse_cover_options
void parse_cover_options(const cmdlinet &, optionst &)
Parses coverage-related command line options.
Definition: cover.cpp:148
coverage_criteriont::PATH
@ PATH
cover_configt::cover_failed_assertions
bool cover_failed_assertions
Definition: cover.h:63
goto_modelt
Definition: goto_model.h:25
coverage_criteriont
coverage_criteriont
Definition: cover.h:47
cover_configt::mode
irep_idt mode
Definition: cover.h:65
coverage_criteriont::ASSERTION
@ ASSERTION
coverage_criteriont::CONDITION
@ CONDITION
coverage_criteriont::ASSUME
@ ASSUME
coverage_criteriont::LOCATION
@ LOCATION
cover_configt::cover_instrumenters
cover_instrumenterst cover_instrumenters
Definition: cover.h:70
cmdlinet
Definition: cmdline.h:20
goto_programt::make_assertion
static instructiont make_assertion(const exprt &g, const source_locationt &l=source_locationt::nil())
Definition: goto_program.h:924
instrument_cover_goals
void instrument_cover_goals(const symbol_tablet &, const cover_configt &, goto_functionst &, coverage_criteriont, message_handlert &message_handler)
make_unique.h
coverage_criteriont::DECISION
@ DECISION
cover_configt::traces_must_terminate
bool traces_must_terminate
Definition: cover.h:64
cover_configt::make_assertion
cover_instrumenter_baset::assertion_factoryt make_assertion
Definition: cover.h:71
cover_instrument.h
message_handlert
Definition: message.h:27
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:42
goto_functionst
A collection of goto functions.
Definition: goto_functions.h:24
cover_configt::function_filters
function_filterst function_filters
Definition: cover.h:66
coverage_criteriont::BRANCH
@ BRANCH
goto_programt
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:72
coverage_criteriont::MCDC
@ MCDC
cover_configt
Definition: cover.h:60
function_filterst
A collection of function filters to be applied in conjunction.
Definition: cover_filter.h:61
goto_model_functiont
Interface providing access to a single function in a GOTO model, plus its associated symbol table.
Definition: goto_model.h:182
cover_filter.h
cover_configt::keep_assertions
bool keep_assertions
Definition: cover.h:62
cover_instrumenterst
A collection of instrumenters to be run.
Definition: cover_instrument.h:103