Bug 38840 - Adding coverage analysis to unit tests

John Smith lbalbalba at gmail.com
Fri Aug 24 09:31:49 PDT 2012


On Fri, Aug 24, 2012 at 5:28 PM, Stephan Bergmann <sbergman at redhat.com> wrote:
> On 08/19/2012 09:14 PM, John Smith wrote:
>>
>> - First you run a plain make in the top level directory to build LO
>> (with analysis stuff enabled).
>> - then you create a 'baseline' with lcov (sort of create a 'before
>> snapshot' of LO)
>> - *then* you run all your tests (whatever they may be)
>> - then you re-run lcov to create an 'after snapshot'
>> - then you compare the 'before' and 'after' snapshots, and you can
>> tell what code was actually executed and therefore tested by your
>> tests.
>
>
> Call me dumb, but what I don't understand is why you want to have the
> difference between the before and after snapshots, rather than the plain
> after snapshot.
>
Dont ask me, Im just doing what 'man lcov (1)' told me to do here.
;)


>
> Do you want to filter out any code that is executed "by accident" (as it
> belongs to tools we build and already execute at build time, say) rather
> than by dedicated tests?
>
I guess gcov/lcov assume that there is a difference between

a.)
strictly compiling your project

and

b.)
running tests on your compiled project

I guess thats just how the tool was designed to function, and the
approach that I took.


>
> In a sense, even during the tests, very much of our code is executed "by
> accident" rather than due to dedicated test code calling it:  Especially the
> subsequentcheck stuff contains checks that are not simple unit tests, but
> start of a complete soffice.bin process, causing "unintended" testing of
> large parts of the infrastructure code anyway.
>
Whether code gets tested 'unintended' or not during your 'tests' is
really not relevant, is it ? Only if the code gets executed or not ?




Regards,


John Smith.


More information about the LibreOffice mailing list