This is an archive of the discontinued LLVM Phabricator instance.

[Code Coverage] Add a script to check code coverage of a patch
AbandonedPublic

Authored by xgupta on Aug 25 2023, 10:28 AM.

Details

Reviewers
hnrklssn
Summary

This patch is the second part of https://llvm.org/OpenProjects.html#llvm_patch_coverage

This script craete a patch from the HEAD commit, extract modified or added source files, test case files
and source code lines, add coverage instrumentation for the affected source files, runs Lit tests,
and records which test cases cause each counter to be executed. We then report the number of test
cases executing the counter and the number of test cases executing the counter that are also changed
in some way by the patch. Thus providing developer the information of inadequately tested source lines.

Diff Detail

Event Timeline

xgupta created this revision.Aug 25 2023, 10:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 10:28 AM
xgupta requested review of this revision.Aug 25 2023, 10:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 10:28 AM
xgupta updated this revision to Diff 553754.Aug 26 2023, 12:10 PM

Updated patch to list covered and uncovered source lines (counter value equal to zero)

Remaining one minor update!

xgupta updated this revision to Diff 553898.Aug 28 2023, 5:18 AM

Updated code to print line number also + minor fixes

hnrklssn added inline comments.Aug 29 2023, 2:00 AM
llvm/utils/git-check-coverage
49

We should not continue executing the script after catching the errors

122–135

We should only add the flags we need to an existing cmake config

hnrklssn added inline comments.Aug 29 2023, 3:22 AM
llvm/utils/git-check-coverage
177

How will this not always be the case, given that the match comes from r"^\+\+\+ [ab]/(.*\.ll)$"?

xgupta updated this revision to Diff 555102.Aug 31 2023, 10:52 AM

Use python-unidiff to parsing patch diff
Address comment for exit on error

xgupta marked 2 inline comments as done.Aug 31 2023, 10:54 AM
xgupta added inline comments.
llvm/utils/git-check-coverage
122–135

Handles by the second patch of this patch series, marking as done.

hnrklssn added inline comments.Sep 1 2023, 3:43 AM
llvm/utils/git-check-coverage
96

I would've imagined line.target_line_no would've worked here, instead of computing it ourselves.

xgupta updated this revision to Diff 555628.Sep 3 2023, 5:18 AM
xgupta marked 3 inline comments as done.

Use line.target_line_no in parsing the patch

llvm/utils/git-check-coverage
177

Parsing list of test cases will be handled by lit, will remove this in the next update.

xgupta updated this revision to Diff 555719.Sep 4 2023, 5:55 AM

Take changes from D159087 and update the patch

xgupta updated this revision to Diff 557045.Sep 19 2023, 7:56 AM

Use llvm-cov command feature than awk command for simplicity

This comment was removed by hnrklssn.
ellis added a subscriber: ellis.Sun, Nov 19, 7:49 PM
xgupta abandoned this revision.Thu, Nov 30, 11:02 PM