Skip to content

Replace cover-function-only by cover-include-pattern #1348

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

Conversation

peterschrammel
Copy link
Member

@peterschrammel peterschrammel commented Sep 5, 2017

@thk123
Copy link
Contributor

thk123 commented Sep 5, 2017

Could I ask for some explanation either in the commit or on the PR as to what this is intending to do?

// cover entry point function only
std::string cover_include_pattern=cmdline.get_value("cover-include-pattern");
if(cmdline.isset("cover-function-only"))
cover_include_pattern=config.main;
Copy link
Contributor

Choose a reason for hiding this comment

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

for regex we should escape ., else there could be a problem with correct matching, may also be required for other characters that can be part of a function name, maybe '<', '>' ?

Copy link
Contributor

Choose a reason for hiding this comment

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

This appears to be a robust way of doing this: https://stackoverflow.com/a/40195721/958004

@peterschrammel peterschrammel force-pushed the cleanup/cover-function-only branch from 9d3b30a to 8641287 Compare September 5, 2017 13:59
@peterschrammel
Copy link
Member Author

@thk123, amended the commit message.

Copy link
Contributor

@thk123 thk123 left a comment

Choose a reason for hiding this comment

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

Somewhat incredibly, there are no tests in cbmc/regression using the --cover-function-only flag. Could you add some in the cbmc-cover directory:

  • A default entry point
  • A default entry point specified by the --function flag
  • A function specified with the --function flag using the minimal format: --function Class.functionName
  • A function specified with the --function flag using the complex format that includes types etc (I'm not an expert on how this works, it might be appropriate to test static methods, non-static methods, methods that take and return arrays, generic methods)

As a first step you should probably bump the test-gen submodule (which does have --cover-function-only tests) and check they pass with this change.

@thk123
Copy link
Contributor

thk123 commented Sep 5, 2017

@peterschrammel thanks for the commit message - makes sense 👍

@peterschrammel
Copy link
Member Author

peterschrammel commented Sep 5, 2017

These options have never been made available in CBMC's CLI (as many others...). There are tests in test-gen, but not as systematic as you suggest...

@thk123
Copy link
Contributor

thk123 commented Sep 5, 2017

@peterschrammel Ah that makes sense - well OK I won't block on that, but I think a PR to test-gen that brings this in should probably test complex format style of specifying functions since I believe this is what the platform uses (and would have caught the regex escape problem)

@peterschrammel peterschrammel force-pushed the cleanup/cover-function-only branch from 8641287 to 0525585 Compare September 5, 2017 15:31
Copy link
Contributor

@mgudemann mgudemann left a comment

Choose a reason for hiding this comment

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

LGTM

cover-function-only (instrumentating coverage goals in the
entry point function only) is now implemented with the help
of cover-include-pattern (regex matching of functions to
be instrumented). This is to avoid potential consistencies
due to providing two mechanisms for filtering functions.
cover-function-only has priority over the given
cover-include-pattern.
@peterschrammel peterschrammel force-pushed the cleanup/cover-function-only branch from 0525585 to 215c7ae Compare September 5, 2017 15:41
@thk123
Copy link
Contributor

thk123 commented Sep 5, 2017

Will approve once test-gen#1031 is working as expected.

@tautschnig
Copy link
Collaborator

@thk123 What's the state of TG on this one?

@thk123
Copy link
Contributor

thk123 commented Nov 30, 2017

Sorry been away and then busy - current state of TG is failing however...

@tautschnig tautschnig assigned peterschrammel and unassigned thk123 Nov 30, 2017
@peterschrammel
Copy link
Member Author

Closing because obsolete (subsumed by #1419).

@peterschrammel peterschrammel deleted the cleanup/cover-function-only branch January 5, 2018 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants