Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print verification coverage only when -trace used #770

Merged
merged 7 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/ExecutionEngine/ExecutionEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ private async Task<PipelineOutcome> VerifyEachImplementation(TextWriter output,
CleanupRequest(requestId);
}

if (Options.TrackVerificationCoverage && processedProgram.Program.AllCoveredElements.Any()) {
if (Options.Trace && Options.TrackVerificationCoverage && processedProgram.Program.AllCoveredElements.Any()) {
Options.OutputWriter.WriteLine("Elements covered by verification: {0}", string.Join(", ", processedProgram.Program.AllCoveredElements.OrderBy(s => s)));
}

Expand Down
17 changes: 15 additions & 2 deletions Test/coverage/verificationCoverage.bpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
// RUN: %boogie "%s" > "%t.plain"
// RUN: %diff "%s.expect.plain" "%t.plain"
// RUN: %diff "%s.expect" "%t.plain"
// RUN: %boogie -trackVerificationCoverage -trace "%s" > "%t.coverage"
// RUN %OutputCheck "%s" --file-to-check="%t.coverage"
// CHECK: Covered elements: a0, assert_a0, assert_r0, r0
// CHECK: Covered elements: sinv_not_1$established, sinv_not_1$maintained, sinv1$assume_in_body, sinv1$established, sinv1$maintained, sinv2$assume_in_body, sinv2$established, sinv2$maintained, spost, spre1
// CHECK: Covered elements: cont_assume_1, cont_assume_2
// CHECK: Covered elements: false_req
// CHECK: Covered elements: cont_req_1, cont_req_2
// CHECK: Covered elements: assumeFalse
// CHECK: Covered elements: tee0, tee1, ter0
// CHECK: Covered elements: call2_tee1, tee_not_1, tee0$call1$ensures, tee0$call2$ensures, tee1$call2$ensures, ter0$call1$requires, ter0$call2$requires, ter1, xy_sum
// CHECK: Covered elements: a_gt_10, constrained, x_gt_10
// CHECK: Covered elements: cont_ens_abs$call_cont$ensures, xpos_abs$call_cont$requires, xpos_caller
// CHECK: Elements covered by verification: a_gt_10, a0, assert_a0, assert_r0, assumeFalse, call2_tee1, constrained, cont_assume_1, cont_assume_2, cont_ens_abs$call_cont$ensures, cont_req_1, cont_req_2, false_req, r0, sinv_not_1$established, sinv_not_1$maintained, sinv1$assume_in_body, sinv1$established, sinv1$maintained, sinv2$assume_in_body, sinv2$established, sinv2$maintained, spost, spre1, tee_not_1, tee0, tee0$call1$ensures, tee0$call2$ensures, tee1, tee1$call2$ensures, ter0, ter0$call1$requires, ter0$call2$requires, ter1, x_gt_10, xpos_abs$call_cont$requires, xpos_caller, xy_sum
// RUN: %boogie -trackVerificationCoverage "%s" > "%t.coverage"
// RUN: %diff "%s.expect.coverage" "%t.coverage"
// RUN: %diff "%s.expect" "%t.coverage"
// UNSUPPORTED: batch_mode

procedure testRequiresAssign(n: int)
Expand Down
3 changes: 0 additions & 3 deletions Test/coverage/verificationCoverage.bpl.expect.coverage

This file was deleted.

7 changes: 5 additions & 2 deletions Test/unnecessaryassumes/unnecessaryassumes1.bpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// We use boogie instead of parallel-boogie here to fix the order of the output from /trackVerificationCoverage
// RUN: %boogie /trackVerificationCoverage "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
// RUN: %boogie -trackVerificationCoverage -trace "%s" > "%t"
// RUN: %OutputCheck "%s" --file-to-check="%t"
// CHECK: Covered elements: s0
// CHECK: Covered elements: s2, s3
// CHECK: Elements covered by verification: s0, s2, s3
// UNSUPPORTED: batch_mode

procedure test0(n: int)
Expand Down
3 changes: 0 additions & 3 deletions Test/unnecessaryassumes/unnecessaryassumes1.bpl.expect

This file was deleted.

Loading