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

Templated methods shift line numbers and produce unreliable coverage for the tail of the file #169

Open
smcclure15 opened this issue Jul 31, 2024 · 0 comments

Comments

@smcclure15
Copy link

My .gcno files get transformed into .gcov files that end up looking like the following:

        -:   99:
        -:  100:template <typename T>
    #####:  101:void times2(T x) {
    #####:  102:    return 2*x;
        -:  103:}
------------------
debugsymbolA:
        -:  100:template <typename T>
    #####:  101:void times2(T x) {
    #####:  102:    return 2*x;
        -:  103:}
------------------
debugsymbolB:
        -:  100:template <typename T>
    #####:  101:void times2(T x) {
    #####:  102:    return 2*x;
        -:  103:}
------------------
        -:  104:

The times2 function is templated and listed several times with the different debug symbol identifiers.

cpp-coveralls simply appends a new element to its coverage array for each line, so the lines 100-103 are counted 3 times each, which causes a shift in the reported lines (and they end up going "off the end" of the file contents because it is now larger than the number of lines in the file). This makes all the coverage lines after this inconsistent and unreliable (and also undetectable to the typical user reading the report).

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

No branches or pull requests

1 participant