[PATCH] Test that errno is set to 0 at program startup
Maciej W. Rozycki
macro@redhat.com
Wed Sep 11 11:31:42 GMT 2024
On Wed, 11 Sep 2024, Andreas Schwab wrote:
> > +static int
> > +do_test (void)
> > +{
> > + TEST_COMPARE (errno, 0);
> > + TEST_COMPARE (get_ctor_errno (), 0);
> > +
> > + return 0;
> > +}
> > +
> > +#include <support/test-driver.c>
>
> That only tests that the test driver does not modify errno, which is
> uninteresting.
Good point. The test is so simple that I think it does not need to use
the driver as there's hardly if anything that could hang here so that it
would require the driver's intervention (and if it did hang, so could the
test driver anyway).
Alternatively with some macro trickery we could arrange for test driver's
`main' to be called second from test's local `main', so that things like
TEST_COMPARE work as expected (and `do_test' only checks copies of `errno'
values recorded previously).
Maciej
More information about the Libc-alpha
mailing list