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

Refactor ccov target dependencies tree #37

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rlalik
Copy link
Contributor

@rlalik rlalik commented May 6, 2022

Problem for me was that e.g. calling ccov-capture-TARGET was doing much more than the name was telling, e.g. it was cleaning all coverage data collected until then. Also ccov was doing the same for all targets.

I draw the targets dependencies tree (- - is a target dependency, + is extra action done by the target):

- ccov
  - ccov-TARGET
    - ccov-capture-TARGET
      - ccov-preprocessing
        - ccov-clean
          + remove *.list files
        + make cov directory
      + remove coverage info
      + zero counters
      + run TARGET
      + generate coverage info
    + gen html

So calling ccov was going down the tree and removing and regenerating everything. So any extra changes done in the meantime like manually called targets with special options were lost.

So I change the hierarchy into this ((**) denotes new targets):

- ccov-html (**)
  - ccov-html-TARGET

- ccov:
  - ccov-clean-TARGET (**)
    + remove coverage info
    + zero counters
  - ccov-run-TARGET
    - ccov-preprocessing
      ...
    + run TARGET
  - ccov-html-TARGET (**)
    - ccov-capture-TARGET
      + generate coverage info
    + gen html

So now ccov-clean-TARGET just clean, ccov-capture-TARGET just captures the data, but ccov does all of them so it is backward compatible. The new target ccov-html-TARGET captures the data and generates html. Here I made exception that -html calls -capture because this makes sense. The ccov-clean-TARGET is new and it sole purpose is to remove files. Task which was previously done by ccov-capture-TARGET.

Similar change I made for ccov-all-* targets. Old scheme was:

- ccov-all
  - ccov-all-capture
    - ccov-preprocessing
    - ccov-all-preprocessing
    + remove coverage info
    + zero counters
    + generate coverage info
  + gen html

new scheme is

- ccov-all
  - ccov-preprocessing
  - ccov-all-processing
  - ccov-all-clean (**)
    + remove coverage info
    + zero counters
  - ccov-all-html (**)
    - ccov-all-capture
      + generate coverage info
    + gen html

Now I can just run my targets in a custom way and call make ccov-all-html to collect data. Previously it was not possible.

Comment on lines +463 to +467
if(NOT TARGET ccov-html)
add_custom_target(ccov-html)
endif()
add_dependencies(ccov-html ccov-html-${target_code_coverage_COVERAGE_TARGET_NAME})

Copy link
Owner

@StableCoder StableCoder May 9, 2022

Choose a reason for hiding this comment

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

ccov-html/ccov-html-$TARGET_NAME is only available for GCC with this change. But because it's here, it's being added for both GCC and Clang. Can this be shifted down into the if(GNU) section just underneath?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I missed that, will fix it.

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.

2 participants