This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch] Add tests for atexit/on_exit firing order
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>, Joseph Myers <joseph at codesourcery dot com>
- Cc: nd at arm dot com, GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Mon, 10 Jul 2017 16:45:09 +0100
- Subject: Re: [patch] Add tests for atexit/on_exit firing order
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com;
- Nodisclaimer: True
- References: <CALoOobMo+n2qfftAYG6Tyibg7Y7iCDn0PEMuBhvJyzwT4vVxZA@mail.gmail.com> <alpine.DEB.2.20.1707101515450.30742@digraph.polyomino.org.uk> <CALoOobOapmq-XJa5jR8BO5sO0yUbraq1iMMyq5E=AwK6MwxF1A@mail.gmail.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 10/07/17 16:39, Paul Pluzhnikov wrote:
> 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.
>
you could call __cxa_atexit and __cxa_at_quick_exit
or just use globals.