|
37 | 37 | #include <goto-programs/string_instrumentation.h>
|
38 | 38 | #include <goto-programs/loop_ids.h>
|
39 | 39 | #include <goto-programs/link_to_library.h>
|
| 40 | +#include <goto-programs/remove_skip.h> |
40 | 41 |
|
41 | 42 | #include <goto-instrument/full_slicer.h>
|
42 | 43 | #include <goto-instrument/nondet_static.h>
|
| 44 | +#include <goto-instrument/cover.h> |
43 | 45 |
|
44 | 46 | #include <pointer-analysis/add_failed_symbols.h>
|
45 | 47 |
|
@@ -909,16 +911,43 @@ bool cbmc_parse_optionst::process_goto_program(
|
909 | 911 |
|
910 | 912 | // recalculate numbers, etc.
|
911 | 913 | goto_functions.update();
|
912 |
| - |
| 914 | + |
913 | 915 | // add loop ids
|
914 | 916 | goto_functions.compute_loop_numbers();
|
915 | 917 |
|
916 |
| - // if we aim to cover assertions, replace |
917 |
| - // all assertions by false to prevent simplification |
| 918 | + // instrument cover goals |
918 | 919 |
|
919 |
| - if(cmdline.isset("cover") && |
920 |
| - cmdline.get_value("cover")=="assertions") |
921 |
| - make_assertions_false(goto_functions); |
| 920 | + if(cmdline.isset("cover")) |
| 921 | + { |
| 922 | + std::string criterion=cmdline.get_value("cover"); |
| 923 | + |
| 924 | + coverage_criteriont c; |
| 925 | + |
| 926 | + if(criterion=="assertion" || criterion=="assertions") |
| 927 | + c=coverage_criteriont::ASSERTION; |
| 928 | + else if(criterion=="path" || criterion=="paths") |
| 929 | + c=coverage_criteriont::PATH; |
| 930 | + else if(criterion=="branch" || criterion=="branches") |
| 931 | + c=coverage_criteriont::BRANCH; |
| 932 | + else if(criterion=="location" || criterion=="locations") |
| 933 | + c=coverage_criteriont::LOCATION; |
| 934 | + else if(criterion=="decision" || criterion=="decisions") |
| 935 | + c=coverage_criteriont::DECISION; |
| 936 | + else if(criterion=="condition" || criterion=="conditions") |
| 937 | + c=coverage_criteriont::CONDITION; |
| 938 | + else if(criterion=="mcdc") |
| 939 | + c=coverage_criteriont::MCDC; |
| 940 | + else |
| 941 | + { |
| 942 | + error() << "unknown coverage criterion" << eom; |
| 943 | + return false; |
| 944 | + } |
| 945 | + |
| 946 | + instrument_cover_goals(symbol_table, goto_functions, c); |
| 947 | + } |
| 948 | + |
| 949 | + // remove skips |
| 950 | + remove_skip(goto_functions); |
922 | 951 |
|
923 | 952 | // show it?
|
924 | 953 | if(cmdline.isset("show-loops"))
|
|
0 commit comments