Today I tried to find the amount of LLD(elf) code covered by our test cases. So my aim was to run the LLD tests we have (run check-lld task) and find out which code was executed/covered and which was not.
I used the approach from the next article to do that:
In short, it is based on using -fprofile-arcs -ftest-coverage clang flags and then generating the HTML report using lcov and genhtml tools.
The results are actually not that bad (I expected we would have much more issues, but glad to see we seem don’t
We have few problematic places, but generally seems we cover the most of the code, except the few specific
errors and conditions. The full HTML report is available here:
Noticeable places I have to mention though are (we have some large code parts uncovered):
I was able to place
assert(false);on line 386 below in ICF.cpp and all our tests pass.
In Relocations.cpp, all code inside
Is not covered by tests.
MicroMipsR6Thunk::getTargetInputSection() are not covered.
That seems to be all major places I saw in report.
Now we probably can think about what we can do with that?
Ideal scenario I can imagine is that we could fix all the places and, for example, setup the watching bot
looking for LLD code coverage for each commit.
Minimal scenario I see is to fix the major known places mentioned at least.
What do you think guys?