[PATCH v2] resolv: Add tests for getaddrinfo returning EAI_AGAIN [BZ #16849]
Florian Weimer
fweimer@redhat.com
Mon Sep 22 09:45:44 GMT 2025
* Sergey Kolosov:
> @@ -136,6 +138,7 @@ tests-static += tst-ns_rr_cursor
> # These tests need libdl.
> ifeq (yes,$(build-shared))
> tests += \
> + tst-getaddrinfo-eai-again-timeout \
> tst-resolv-ai_idn \
> tst-resolv-ai_idn-latin1 \
> tst-resolv-ai_idn-nolibidn2 \
> @@ -280,6 +283,7 @@ $(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
>
> $(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
> $(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
> +$(objpfx)tst-getaddrinfo-eai-again-timeout: $(objpfx)libresolv.so $(shared-thread-library)
> $(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)
> $(objpfx)tst-resolv-ai_idn-latin1: \
> $(objpfx)libresolv.so $(shared-thread-library)
> diff --git a/resolv/tst-getaddrinfo-eai-again-timeout.c b/resolv/tst-getaddrinfo-eai-again-timeout.c
> new file mode 100644
> index 0000000000..677bfbe703
> +#include <resolv.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <support/check.h>
> +#include <support/check_nss.h>
I'm not sure if check_nss is required?
> +#define TIMEOUT 40
This needs a comment. Is this large timeout really required?
Maybe we should tweak the resolver configuration so that the test run
more quickly. I think setting _res.retrans to 1 (measured in seconds,
default is 5) and _res.retry to 1 (retry attempts, default 2) achieves
that.
> diff --git a/resolv/tst-getaddrinfo-eai-again.c b/resolv/tst-getaddrinfo-eai-again.c
> new file mode 100644
> index 0000000000..2a93c1644c
> --- /dev/null
> +++ b/resolv/tst-getaddrinfo-eai-again.c
> +#include <resolv.h>
I think this should be <netdb.h>, where getaddrinfo is declared.
> +#include <stdlib.h>
> +#include <string.h>
> +#include <support/check.h>
> +#include <support/check_nss.h>
> +#include <support/resolv_test.h>
> +#include <support/support.h>
I think those aren't needed anymore. <stdlib.h> and <string.h> look
superfluous, too.
General direction of this patch looks good.
Thanks,
Florian
More information about the Libc-alpha
mailing list