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

[6.0.0]Fix identical gcov json file name problem #16647

Merged
merged 1 commit into from
Nov 3, 2022

Commits on Nov 3, 2022

  1. Fix identical gcov json file name problem

    **The problem:**
    
    Bazel moves all `.gcov.json.gz` files to one directory. If in a test target, two source files have identical names, then the second `.gcov.json.gz` overwrites the first one.
    
    **The solution:**
    
    I added `gcno_path` to the move destination in order to distinguish multiple `.gcov.json.gz` with the same name.
    
    **Testing:**
    
    In the `test_cc_test_coverage_gcov` test case I added the `different/a.cc` source file, so currently we have the following source tree:
    ```
    coverage_srcs/a.h
    coverage_srcs/a.cc
    coverage_srcs/b.h
    coverage_srcs/t.cc
    coverage_srcs/different/a.h
    coverage_srcs/different/a.cc
    ```
    
    gcda and gcno files are created next to the source files. The final `gcov.json` files are placed in the corresponding paths:
    ```
    $COVERAGE_DIR_VAR/coverage_srcs/*a.gcov.json.gz
    $COVERAGE_DIR_VAR/coverage_srcs/*t.gcov.json.gz
    $COVERAGE_DIR_VAR/coverage_srcs/different/*a.gcov.json.gz
    ```
    
    Closes bazelbuild#16527.
    
    PiperOrigin-RevId: 483911427
    Change-Id: I1608407e4b7264fb5fd436997bdc344344932b97
    krisukox committed Nov 3, 2022
    Configuration menu
    Copy the full SHA
    2e10d59 View commit details
    Browse the repository at this point in the history