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

Unable to find gcov files in /tmp folder. #54

Open
citypilgrim opened this issue Aug 1, 2023 · 1 comment
Open

Unable to find gcov files in /tmp folder. #54

citypilgrim opened this issue Aug 1, 2023 · 1 comment

Comments

@citypilgrim
Copy link

citypilgrim commented Aug 1, 2023

To Replicate

  1. Write a hello world program main.C
  2. Build with coverage activated
CC=g++ -g -01 -ftest-coverage -fprofile-arcs
$CC -c main.C
$CC main.o -o main.exe
  1. Generate coverage files
./main.exe
gcov -b main.exe
  1. Move coverage files to /tmp
  2. Configure cov-coverage-file-paths
(add-to-list 'cov-coverage-file-paths "/tmp")
(add-to-list 'cov-coverage-file-paths
    #’(lambda (file-dir file-name)
        (let ((try (format "%s/%s%s"
                           "/tmp" file-name
                           ".gcov")))
          (and (file-exists-p try)
               (cons (file-truename try) ’gcov)))))
  1. Activate cov-mode inside of main.C

Output

In messages buffer

No coverage data found for /path/to/main.C
snogge added a commit to snogge/cov that referenced this issue Sep 20, 2023
Use expand-file-name to handle both relative and and absolute paths in
cov--locate-coverage-postfix.

Solves part of AdamNiederer#54.
@snogge
Copy link
Contributor

snogge commented Sep 20, 2023

There was a problem in the file lookup that did not handle absolute paths in cov-coverage-file-paths correctly, I fixed that in #55.
But one problem remains that I'm not sure we can or should fix in cov.el.
The gcov file starts with the line

        -:    0:Source:main.C

cov uses that path to associate the coverage data with related source code files. This is very relevant for some other coverage formats that collect data for multiple source code files in a single coverage file.
If you modify that path in main.C.gcov to be the absolute path to main.C (and apply fix #55) cov-modewill work.

AdamNiederer pushed a commit that referenced this issue Sep 20, 2023
Use expand-file-name to handle both relative and and absolute paths in
cov--locate-coverage-postfix.

Solves part of #54.
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

2 participants