Skip to content

Commit 16f8b29

Browse files
author
Daniel Kroening
committed
beautify coverage output
1 parent c58a5e1 commit 16f8b29

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/cbmc/bmc_cover.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,12 @@ bool bmc_covert::operator()()
377377
else
378378
{
379379
status() << "[" << it->first << "]";
380+
381+
if(goal.source_location.is_not_nil())
382+
status() << ' ' << goal.source_location;
383+
380384
if(!goal.description.empty()) status() << ' ' << goal.description;
385+
381386
status() << ": " << (goal.satisfied?"SATISFIED":"FAILED")
382387
<< eom;
383388
}
@@ -387,9 +392,11 @@ bool bmc_covert::operator()()
387392

388393
status() << "** " << goals_covered
389394
<< " of " << goal_map.size() << " covered ("
395+
<< std::fixed << std::setw(1) << std::setprecision(1)
396+
<< 100.0*goals_covered/goal_map.size() << "%), using "
390397
<< cover_goals.iterations() << " iteration"
391398
<< (cover_goals.iterations()==1?"":"s")
392-
<< ")" << eom;
399+
<< eom;
393400

394401
return false;
395402
}

src/goto-instrument/cover.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,11 @@ void instrument_cover_goals(
298298
source_locationt source_location=
299299
basic_blocks.source_location_map[block_nr];
300300

301-
if(source_location.get_file()!="")
301+
if(!source_location.get_file().empty() &&
302+
source_location.get_file()[0]!='<')
302303
{
303304
std::string comment=
304-
"block "+source_location.as_string()+" "+i2string(i_it->location_number);
305+
"block "+i2string(i_it->location_number);
305306

306307
goto_program.insert_before_swap(i_it);
307308
i_it->make_assertion(false_exprt());
@@ -351,13 +352,13 @@ void instrument_cover_goals(
351352

352353
for(const auto & c : conditions)
353354
{
354-
std::string comment_t="condition "+from_expr(ns, "", c)+" true";
355+
std::string comment_t="condition `"+from_expr(ns, "", c)+"' true";
355356
goto_program.insert_before_swap(i_it);
356357
i_it->make_assertion(c);
357358
i_it->source_location=source_location;
358359
i_it->source_location.set_comment(comment_t);
359360

360-
std::string comment_f="condition "+from_expr(ns, "", c)+" false";
361+
std::string comment_f="condition `"+from_expr(ns, "", c)+"' false";
361362
goto_program.insert_before_swap(i_it);
362363
i_it->make_assertion(not_exprt(c));
363364
i_it->source_location=source_location;
@@ -379,13 +380,13 @@ void instrument_cover_goals(
379380

380381
for(const auto & d : decisions)
381382
{
382-
std::string comment_t="decision "+from_expr(ns, "", d)+" true";
383+
std::string comment_t="decision `"+from_expr(ns, "", d)+"' true";
383384
goto_program.insert_before_swap(i_it);
384385
i_it->make_assertion(d);
385386
i_it->source_location=source_location;
386387
i_it->source_location.set_comment(comment_t);
387388

388-
std::string comment_f="decision "+from_expr(ns, "", d)+" false";
389+
std::string comment_f="decision `"+from_expr(ns, "", d)+"' false";
389390
goto_program.insert_before_swap(i_it);
390391
i_it->make_assertion(not_exprt(d));
391392
i_it->source_location=source_location;

0 commit comments

Comments
 (0)