cmake-scripts icon indicating copy to clipboard operation
cmake-scripts copied to clipboard

Refactor ccov target dependencies tree

Open rlalik opened this issue 3 years ago • 0 comments

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.

rlalik avatar May 06 '22 16:05 rlalik