cov icon indicating copy to clipboard operation
cov copied to clipboard

Unable to find gcov files in /tmp folder.

Open citypilgrim opened this issue 2 years ago • 1 comments

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

citypilgrim avatar Aug 01 '23 07:08 citypilgrim

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.

snogge avatar Sep 20 '23 07:09 snogge