CodeCoverage/Firefly: Difference between revisions

Line 80: Line 80:
== FAQs  ==
== FAQs  ==


Q. Why are you providing line coverage ?  
'''Q'''. Why are you providing line coverage?  


*Line coverage data is the most basic information which helps us to quickly identify the coverage gaps and to come up with suitable test case scenarios.
*Line coverage data is the most basic information which helps us to quickly identify the coverage gaps and to come up with suitable test case scenarios.


<br>Q. What about Functional coverage&nbsp;? Why is functional coverage less than 100% for files that have 100% line coverage&nbsp;? Look at the following scenario to prove my point!! . There is 100% line coverage but only 49.3% functional coverage.  
<br>'''Q'''. What about Functional coverage&nbsp;? Why is functional coverage less than 100% for files that have 100% line coverage&nbsp;? Look at the following scenario to prove my point!! . There is 100% line coverage but only 49.3% functional coverage.  


*As you can see the details from here CLICK, this is an artifact of multi threaded applications running along with runtime generated functions.  
*As you can see the details from here CLICK, this is an artifact of multi threaded applications running along with runtime generated functions.  
Line 90: Line 90:
*&nbsp; Function coverage is the least reliable of all modes of code coverage. For instance, if there is a function with 1000 lines of code [ this is an exaggeration ] &amp; with an if condition in the first 10 lines which throws the execution pointer out of the function block for not meeting a condition ... any such ejection from the 'if' branch also shows 100% function coverage where as we have barely scratched the surface of that function in reality.
*&nbsp; Function coverage is the least reliable of all modes of code coverage. For instance, if there is a function with 1000 lines of code [ this is an exaggeration ] &amp; with an if condition in the first 10 lines which throws the execution pointer out of the function block for not meeting a condition ... any such ejection from the 'if' branch also shows 100% function coverage where as we have barely scratched the surface of that function in reality.


Q. OK smart pants&nbsp;!! what about branch coverage&nbsp;? Is it not the most meaningful of all modes of coverage&nbsp;?  
'''Q'''. OK smart pants&nbsp;!! what about branch coverage&nbsp;? Is it not the most meaningful of all modes of coverage&nbsp;?  


*You are right that branch coverage provides true sense of coverage.  
*You are right that branch coverage provides true sense of coverage.  
Line 98: Line 98:
*I do not have plans in place to implement a general availability of 'branch coverage' results in this Quarter.
*I do not have plans in place to implement a general availability of 'branch coverage' results in this Quarter.


Q. What are the known limitations of line coverage data ?
'''Q'''. What are the known limitations of line coverage data&nbsp;?  


*If you have a multi conditional line like if(test)?dothis:dothat, even if both conditions are not tested, line coverage counts this line as covered.
*If you have a multi conditional line like if(test)?dothis:dothat, even if both conditions are not tested, line coverage counts this line as covered.  
*If you have if(this&that||whatever) , the line would be shown as covered for testing one condition even if the rest are not covered.
*If you have if(this&amp;that||whatever) , the line would be shown as covered for testing one condition even if the rest are not covered.  
*Inlined functions may appear as not being covered.
*Inlined functions may appear as not being covered.  
*But the '''important point''' is these discrepancies would generate a statistically insignificant variations in the coverage %.  
*But the '''important point''' is these discrepancies would generate a statistically insignificant variations in the coverage&nbsp;%.  
*When we pick up critical files we should not only pay attention to uncovered lines, but also to multi branch lines as well.
*When we pick up critical files we should not only pay attention to uncovered lines, but also to multi branch lines as well.


 
<br> '''Q'''. What is the format in which you are presenting the code coverage results analysis&nbsp;?  
Q. What is the format in which you are presenting the code coverage results analysis&nbsp;?  


*The data would look like this
*The data would look like this
Line 118: Line 117:
*Mozilla community can work together to identify suitable scenarios to write test cases to fill the coverage gaps efficiently and effectively.
*Mozilla community can work together to identify suitable scenarios to write test cases to fill the coverage gaps efficiently and effectively.


Q. What components that you recommend for first round of study&nbsp;?  
'''Q'''. What components that you recommend for first round of study&nbsp;?  


*Please check the following PDF files  
*Please check the following PDF files  
Line 127: Line 126:
*Our goal is to identify 10 files in each of these components to improve code coverage.
*Our goal is to identify 10 files in each of these components to improve code coverage.


Q. You wrote in previous posts that code coverage runs on the instrumented executable do not complete test runs due to hangs and crashes. What exactly is crashing? I don't see any inherent reason why an instrumented build would be "more sensitive to problems", unless the instrumentation itself is buggy&nbsp;!!  
'''Q'''. You wrote in previous posts that code coverage runs on the instrumented executable do not complete test runs due to hangs and crashes. What exactly is crashing? I don't see any inherent reason why an instrumented build would be "more sensitive to problems", unless the instrumentation itself is buggy&nbsp;!!  


*one example: instrumentation changes the timing, which can change thread scheduling, which can expose latent threading bugs.We see it with Valgrind relatively often -- bugs that occur natively but not under Valgrind, or vice versa.<br>
*one example: instrumentation changes the timing, which can change thread scheduling, which can expose latent threading bugs.We see it with Valgrind relatively often -- bugs that occur natively but not under Valgrind, or vice versa.<br>
Line 133: Line 132:
*You can pick up any dynamic instrumentation tool of your choice. You can find more bugs with it as opposed to optimized build.
*You can pick up any dynamic instrumentation tool of your choice. You can find more bugs with it as opposed to optimized build.


Q. Ok!! Show me how did you arrive at these conclusions. How can I do it by myself&nbsp;?  
'''Q'''. Ok!! Show me how did you arrive at these conclusions. How can I do it by myself&nbsp;?  
 
*I would be glad to explain that. Buy me a beer&nbsp;:)<br>
 
 
'''Q'''. Why are we doing this ?
 
* My best answer is actually provided by Richard Feynman.


*I would be glad to explain that. Buy me a beer&nbsp;:)<br><br>
** http://mkngama.blogspot.com/2009/08/richard-feynmanthinking.html


== Contact  ==
== Contact  ==
183

edits