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

coverage: support output in LCOV tracefile format #30381

Merged
merged 1 commit into from
Dec 20, 2018
Merged

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Dec 13, 2018

Since Base code-coverage has been broken for stdlibs for a long time, this adds support for a format that doesn't share the same problems. This'll also allow us to adopt the newly-added code-caches for coverage, and to add handling of them to Coverage.jl similar to that already present in Revise.jl.

@vtjnash vtjnash added the testsystem The unit testing framework and Test stdlib label Dec 13, 2018
@vtjnash vtjnash requested a review from staticfloat December 13, 2018 21:40
src/init.c Show resolved Hide resolved
src/init.c Outdated Show resolved Hide resolved
src/jloptions.c Show resolved Hide resolved
src/runtime_ccall.cpp Show resolved Hide resolved
src/init.c Show resolved Hide resolved
src/processor.cpp Show resolved Hide resolved
test/cmdlineargs.jl Show resolved Hide resolved
test/spawn.jl Outdated Show resolved Hide resolved
test/testenv.jl Outdated Show resolved Hide resolved
@staticfloat
Copy link
Member

Adding a test and removing the unnecessary comments would make this good to go from my perspective. I'm just kind of assuming that the info it generates is good; I haven't run it locally to check it, which is why I'm particularly interested in a test.

@vtjnash
Copy link
Member Author

vtjnash commented Dec 14, 2018

OK, I added a small test so we'll be alerted earlier if coverage output changes. I had tested the results locally with genhtml to see that it looked valid, and more recently now have also checked that my PRs to Coverage.jl and CoverageBase.jl are successful at analyzing a sample file.

@vtjnash vtjnash force-pushed the jn/lcov branch 4 times, most recently from 3e9c893 to d585095 Compare December 18, 2018 05:46
base/util.jl Outdated Show resolved Hide resolved
@JeffBezanson JeffBezanson added needs news A NEWS entry is required for this change and removed backport pending 1.1 labels Dec 18, 2018
@vtjnash vtjnash removed the needs news A NEWS entry is required for this change label Dec 18, 2018
@vtjnash vtjnash added this to the 1.1 milestone Dec 18, 2018
@JeffBezanson
Copy link
Member

Why is this on the milestone? It adds a new command line option, which is a new feature.

@JeffBezanson
Copy link
Member

Rebased as #30453 for release-1.1.

@JeffBezanson JeffBezanson removed this from the 1.1 milestone Dec 19, 2018
Also ensure that `julia_cmd` is forwarding all desirable options,
and provide a general framework for specifying formatted filenames
for similar such options.
@JeffBezanson JeffBezanson merged commit 735d755 into master Dec 20, 2018
@JeffBezanson JeffBezanson deleted the jn/lcov branch December 20, 2018 04:38
@vtjnash vtjnash mentioned this pull request Dec 22, 2018
@bramtayl
Copy link
Contributor

a) Where is the documentation about how to use this?

b) I've been doing some investigating into why code coverage for LightQuery seems low despite the recent improvements. I tried running the command

julia --code-coverage=tracefile-%p.info --code-coverage=user -e 'include("runtests.jl")'

This gives me a 'tracefile-DIGITS.info' file in my test directory. I can view this info in Atom using the lcov-info package (LCOV itself doesn't seem to support windows...), but first I have to make a coverage directory and rename the file to lcov.info. There's definitely something wrong. I'm getting this entry

SF:ia\dev\LightQuery\src\macros.jl
DA:58,12454531
DA:83,3405931
LH:2
LF:2
end_of_record

I just want a green coverage badge halp

BTW Version 1.2.0-DEV.307 (2019-02-11)

@bramtayl
Copy link
Contributor

Line 58 points to this macro:

macro _(body)
    anonymous(LineNumberNode(@__LINE__, @__FILE__), macroexpand(@__MODULE__, body)) |> esc
end

@bramtayl
Copy link
Contributor

Aha! the SF:/ia this is fixed if I put Symbol around @__FILE__; apparently LineNumberNode expects one. still, some docs would be nice.

@bramtayl
Copy link
Contributor

Also, looking at this, I'm noticing @__LINE__ doesn't seem to do what I'd hope it would do: point to the line number where the macro was called, not defined. I suppose there's no way to get that?

@bramtayl
Copy link
Contributor

Turns out I just need to pass __source__. Nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testsystem The unit testing framework and Test stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants