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

Improve coverage tool for P3 Analysis Library integration #41

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Pennycook
Copy link
Contributor

This PR introduces a new standalone cbicov tool that reads a compilation database and produces JSON that can be read in by the P3 Analysis Library. It is intended to be invoked as below:

cbicov -S <source directory> compile_commands.json coverage.json

This might need a little more work before it is ready to be merged, but I wanted to give us a place to discuss the functionality while we evaluate options for an automated Code Base Investigator + P3 Analysis Library pipeline.

@Pennycook Pennycook added the enhancement New feature or request label Jan 31, 2024
@Pennycook Pennycook added this to the 1.2.0 milestone Jan 31, 2024
Currently identical to the old etc/coverage.py script, but renamed.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
Using angle brackets, similar to how commands like git behave, allows us to use
metavar names that contain spaces and are easier to read.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
This option enables cbicov to be run anywhere, instead of requiring it to be
run in the source directory.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
Using an empty codebase means that cbicov will only generate coverage
information for files in the specified source directory.

Pre-populating the codebase file list restricts our ability to exclude files,
because files that are explicitly listed in the codebase are assumed to have
been specified by the user.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
The new schema allows for coverage files to contain both a file hash
and (optional) path information.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
The previous coverage schema required the exporter logic to replace all
filenames with file hashes unconditionally.

The new exporter logic is able to retain filenames, which can be used to
compute file hashes when required.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
Now requires file name, a unique ID, and a different line representation.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
Signed-off-by: John Pennycook <john.pennycook@intel.com>
Previously, a CodeNode could only recover region information in terms
of an extent (start line and end line) which was not sufficient to
export the information required by the new coverage format.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
@@ -1,5 +1,5 @@
include codebasin/schema/analysis.schema
include codebasin/schema/compilation-database.schema
include codebasin/schema/config.schema
include codebasin/schema/coverage-0.1.0.schema
include codebasin/schema/coverage-0.3.0.schema
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to add this file to your PR :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How embarrassing! Fixed in 57f4ff8.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
Signed-off-by: John Pennycook <john.pennycook@intel.com>
@Pennycook Pennycook mentioned this pull request Apr 3, 2024
@Pennycook Pennycook modified the milestones: 1.2.0, 2.0.0 Apr 22, 2024
Handles excludes in an identical manner to codebasin.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
@Pennycook
Copy link
Contributor Author

@swright87 - I've added -x support, as per your request. It should work the same way as it does in codebasin, but please let me know if you encounter any surprising behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants