[patch] Add tests for atexit/on_exit firing order

Paul Pluzhnikov ppluzhnikov@google.com
Mon Jul 10 15:39:00 GMT 2017


On Mon, Jul 10, 2017 at 8:18 AM, Joseph Myers <joseph@codesourcery.com> wrote:

>> This patch adds such test. I am using on_exit here because it
>> conveniently allows passing an argument.
>
> I'd think that it would make sense to test all of atexit, on_exit,
> at_quick_exit this way.

I could be missing something, but I don't see an easy way to test
atexit and at_quick_exit the same way due to them not taking an
argument.

To test atexit, I would have to implement separate fn1 .. fn8 and
hard-code expected call sequence into each of them, wouldn't I?

That would make for a more verbose and more difficult to modify test,
and given that all 3 functions currently share implementation, that
seems like an overkill. Of course if later the implementation is
un-shared, it would be nice to have a test case for each. But it seems
unlikely to ever happen.

Thanks,
-- 
Paul Pluzhnikov



More information about the Libc-alpha mailing list