Open vlnn opened 1 month ago
Relative filenames are supported - as I read the code, despite the comment - , but they are assumed to be relative to the lcov.info
file.
I'm not sure how project roots should be handled in a generic way.
The lcov specification (such as it is; man geninfo
) specifies that SF should be absolute. Maybe file an issue with https://github.com/cloverage/cloverage instead?
Update:
The man page on my system (debian bookworm) says that SF should be absolute, but the current man page in the lcov repo only says file path https://github.com/linux-test-project/lcov/blob/master/man/geninfo.1#L1194 without explaining how relative paths should be interpreted.
cloverage already has an issue about this: https://github.com/cloverage/cloverage/issues/323
Would it be possible for you to post (part of) an lcov.info file here? Please try to make it minimal but complete.
Sure! Here it is for the smallest file:
TN:
SF:src/call_martian/config/core.clj
DA:1,1
DA:5,1
DA:6,5
DA:8,1
DA:9,7
DA:11,1
DA:12,7
DA:14,1
DA:15,4
DA:17,1
DA:18,4
DA:20,1
DA:21,4
LF:13
LH:13
end_of_record
There is really nothing in there to help us find the starting point of the relative paths.
How do you find the lcov.info
file from your source file when you start cov-mode
?
How do you find the
lcov.info
file from your source file when you startcov-mode
?
As I'm using lcov.info generated over Clojure project, I run lein cloverage —lcov
from the root of the project (the directory with project.clj
), and then the results are in the ./target/coverage/lcov.info
. The full path from each source file to lcov.info
can vary, as Clojure ./src/
can hold *.clj
files in complex tree of directories.
Maybe my question was not clear enough - or I'm not awake enough to understand the answer.
When you activate cov-mode
in one of your source files, what do you need to do for cov-mode to find the lcov.info
file? Do you have any directory local variables, for instance cov-lcov-patterns
. Otherwise cov-mode
would only look in the same directory as the source file.
Maybe my question was not clear enough - or I'm not awake enough to understand the answer. When you activate
cov-mode
in one of your source files, what do you need to do for cov-mode to find thelcov.info
file? Do you have any directory local variables, for instancecov-lcov-patterns
. Otherwisecov-mode
would only look in the same directory as the source file.
All I'm using to configure cov-mode
so it can find lcov.info
is exactly one line in use-package!
as it seems to be in same place for every project I've been testing:
(setq cov-lcov-file-name (concat (clojure-project-dir) "target/coverage/lcov.info"))
Full configuration in my doom-emacs style is:
(use-package! cov
:demand t
:defer t
:init
(setq cov-coverage-mode t)
(setq cov-fringe-symbol 'empty-line)
(custom-set-faces
'(cov-coverage-not-run-face ((t (:foreground "#900000"))))
'(cov-coverage-run-face ((t (:foreground "#00BE00"))))
'(cov-none-face ((t (:foreground "#0000F0")))))
:config
(setq cov-lcov-file-name (concat (clojure-project-dir) "target/coverage/lcov.info"))
:hook
(cider-mode . cov-mode))
The cov.el expects the lcov.info with absolute file paths in SF field: https://github.com/AdamNiederer/cov/blob/42bf07c6ab51ceb45753c798bcbc3327a9230ed5/cov.el#L402
At least one tool (https://github.com/cloverage/cloverage) generates lcov files with file names relative to the project path, which makes it impossible to match with cov.el workflow. I've made quick POC to enable this flow: https://github.com/vlnn/cov/commit/9d1836aeaf0b5a5f7d6ec9fd85e877c658cc45ed . This is, of course, very limited to my needs only, without configuration and relying on specific clojure mode to find the project's root.
Is there a possibility to enable proper configuration/functionality for relative filenames in lcov.info?