This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Consensus on unit tests?


On 07/01/2016 02:43 AM, Florian Weimer wrote:
> On 06/25/2016 01:59 AM, Carlos O'Donell wrote:
> 
>> I would like to remove the superfluous condition and add a unit
>> test for all the cases that define the way the interface should
>> behave.
>> 
>> Since Florian asked for pretty diagrams, I have included them.
> 
> I can't quote your patch due to the way it is included in the message
> (inline text after the signature).

I can certainly adjust the way I inline my messages if that helps.
Out of curiosity, what MUA are you using?
 
> What's unclear based on the documentation if the address has to fall
> in the range covered by the link map (i.e., if there are indeed only
> three cases, or five).  If there is indeed a precondition that the
> address is in some special range, you should add it to the comment.

There is no precondition that I am aware of. I have clarified the
new patch to say "loadable segment" where I previously said "segment"
to make it more clear.

There are some "optimizations" going on here, and l_contiguous is used
to avoid calling _dl_addr_inside_object, under the assumption that
for finding the "caller" it is sufficient just to see if the address
was between the start and end of the mappings. This is only possible
if the mappings are right beside each other, because otherwise it's
conceivable you might have two ELF files that actually interleave
as long as their segment alignments allow it and the kernel
assigns addresses to the gaps.

> There is also a stray comment in the function itself.

Fixed.

>> Should we allow unit tests for the dynamic loader?
> 
> I expect unit tests which look like this to be noncontroversial.

Thank you for your input.

> Things are more interesting if you have to add testing hooks to the
> code, or export additional symbols.

Agreed. My goal here was to be as open about my vision for testing.
I think unit testing to define an interface is fine. I think unit testing
to look for bugs is not fine. The unit testing should be simple enough to
describe the way the interface works, but not contain a million regression
tests.

-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]