Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Julia reports no counts for a function that was never compiled, so
amend_coverage_from_src!parses the source and marks the lines of such a function as missed (0). It skips any function where some line already has a count, which leaves the lines Julia does not instrument asnothing.TestItemServer.process_coverage_dataruns that amend step on each test item' coverage, and the controller then sums the amended vectors across items. If a functionfis first compiled in item B:fhas no counts. Amend marks every line offas 0, including lines Julia never instruments, such as the signature of a method that is only ever inlined.f's instrumented lines have counts and those lines staynothing.merge_coverage_countsgives0 + nothing = 0, so those lines come out missed even thoughfran from start to finish.Pkg.testruns amend once over the whole process, so therefcounts as having run and the lines staynothing. For my own package I see around a 2 percentage point drop in "coverage" switching fromjulia-runtestto thejulia-run-testitemsaction, largely from counting method signatures and macro lines as missed.This PR makes the following changes:
TestItemServer.process_coverage_datanow sends the raw merged counts of the item. Theamend_coverage_from_src!import is gone from the test process._check_testrun_complete!amends each file once, aftermerge_coverage_counts(tr.coverage), using_amend_coverage_from_src. If the file no longer exists or no longer parses (edited during the run, for example), its counts are reported as collected, with a warning when it doesn't parse. The test process used to throw from inside the item instead.There's a related issue not addressed here. On Julia 1.11–1.13,
jl_clear_coverage_dataresets counters to "not instrumented", and then the next hit only brings a counter back to "instrumented, 0 hits" (JuliaLang/julia#62199, fixed on master by JuliaLang/julia#62307, in 1.14 only). Because the test process clears coverage before every window, a line that was already compiled and runs exactly once in a window reads 0. I think a fix here would be more involved so I didn't touch it.