<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>Hello guys,</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>I used the approach from the next article to do that:</div>
<div>http://logan.tw/posts/2015/04/28/check-code-coverage-with-clang-and-lcov/#create-a-wrapper-script-for-lcov</div>
<div><br>
</div>
<div>In short, it is based on using -fprofile-arcs -ftest-coverage clang flags and then generating the HTML report using lcov and genhtml tools.<br>
</div>
<div><br>
</div>
<div>The results are actually not that bad (I expected we would have much more issues, but glad to see we seem don't :) </div>
<div>Coverage screenshot:<br>
</div>
<div>https://drive.google.com/file/d/1rjFdMA0HOjvz4vw_nDttv_dlbMiNYiaw/view</div>
<div><br>
</div>
<div>We have few problematic places, but generally seems we cover the most of the code, except the few specific</div>
<div>errors and conditions. <span style="font-size: 12pt;">The full HTML report is available here:</span></div>
<div>https://drive.google.com/file/d/1ROo9rZ4p7-IT68jI0nnhNMOqPNpk1l0c/view?usp=sharing</div>
<div><br>
</div>
<div>Noticeable places I have to mention though are <span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">(we have some large code parts uncover</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">e</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">d)</span>:</div>
<div><br>
</div>
<div>1) I was able to place `assert(false);` <span style="font-size: 12pt;">on line 386 below in ICF.cpp and all our tests pass.</span></div>
<div>(https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L386)</div>
<div><br>
</div>
<div>2) In Relocations.cpp, all code inside `if`:</div>
<div>https://github.com/llvm-mirror/lld/blob/master/ELF/Relocations.cpp#L1177</div>
<div>Is not covered by tests.<br>
</div>
<div><br>
</div>
<div>3) MicroMipsR6Thunk::writeTo(), MicroMipsR6Thunk::addSymbols(), </div>
<div>MicroMipsR6Thunk::getTargetInputSection() are not covered.</div>
<div><br>
</div>
<div>That seems to be all major places I saw in report.<br>
</div>
<div><br>
</div>
<div>Now we probably can think about what we can do with that?<br>
</div>
<div>* Ideal scenario I can imagine is that we could fix all the places and, for example, setup the watching bot</div>
<div>looking for LLD code coverage for each commit.<br>
</div>
<div>* Minimal scenario I see is to fix the major known places mentioned at least.<br>
</div>
<div><br>
</div>
<div>What do you think guys?<br>
</div>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">Best regards,<br>
George | Developer | <span style="background-color:rgb(255,255,255); color:rgb(33,33,33); font-family:Calibri,sans-serif; font-size:13.3333px">Access Softek, Inc</span></div>
</font></div>
</div>
</div>
</body>
</html>