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
Code coverage runtime #20539
Code coverage runtime #20539
Conversation
moved coverage to base/common temp add Small bugfixes regarding old-style casts and variable renames Removed old include Removed old declaration Added the initial dump callback Added the definition to hide the sanitizer callbacks
This comment has been minimized.
This comment has been minimized.
maybe it causes such bugs. fix amend finalizing fix
Looks like it's the |
is better for build with and without code coverage
This comment has been minimized.
This comment has been minimized.
A word about the IPC between the tester script and the server -- currently we have 3 main options:
|
as clang's sanitizer blacklist options are broken
This comment has been minimized.
This comment has been minimized.
Depends on #27228 |
…stream/master' into ba-thesis
…nch 'upstream/master' into ba-thesis
Depends on #27361 |
I think this PR won't be done in near future, so I'm closing it. If you operate entirely on the information provided by the binary itself (with or without PC-table), all you can get is addresses that were hit (or some basic blocks indices that were hit). You can symbolize this data and get the source file and line, but the problem is that, you can't really do anything with this information. Multiple basic blocks can correspond to some lines (e.g. function template instantiations). Basic blocks can correspond to lines not belonging to functions (e.g. macro expansion like settings traits implementation). If you involve the compiler (.gcno), things don't get better. clang does not enumerate its basic blocks, so there's no way to match the basic block that was hit, for example, in the boolean counters array (the PC-table) with a basic block parsed from a gcno file. You get stuck at the function level. Sorting-transforming basic blocks line ranges still does not solve the problem (moreover, .gcno produces strange results like a line belonging to a basic block that's empty). gcno parsers like lcov use perl scripts containing thousands of lines to turn all this information into a human-readable format. And if one day you want to try the source-based code coverage, you'll also fail. There's no way to tweak what data are stored and tracked (unless you patch the compiler which obviously is not a good idea here), so you just collect everything (and it takes >= 9 hours currently for a general run without per-test data). All you can do is use builtins provided to write the report to some other location, but it won't make everything substantially faster. You may wonder: why can't you simply collect addresses that were hit and display them? Well, for CH purposes it's a) useless, as one needs to get the coverage percentage, and b) useless, as you reinvent the sancov wheel. I doubt there's a good way to resolve this PR. |
I'm going to do exactly this in #56102
The percentage can be calculated as the percentage of all instrumented edges, the percentage of instrumented symbols in the binary, functions, or source files. The percentage of lines can be calculated roughly if you take the assumption that every basic block spans from the line corresponding to its address to the next instrumented line. |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Сode coverage runtime for functional tests (replaces coverage CI check).
Uses clang SanitizerCoverage callbacks to store data on a per-test basis and dump them after testing.
Introduces critical edges coverage metric.