From fabbf3b31074ed74b9f0657299836fe40e4e365a Mon Sep 17 00:00:00 2001 From: Pierce Lopez Date: Tue, 14 Sep 2021 01:19:36 -0400 Subject: [PATCH] test: skip dns_initialize_nameservers if missing /etc/resolv.conf some build systems run tests in minimal containers with no resolv.conf, and the primary thing this test does is load the default /etc/resolv.conf --- test/regress_dns.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/regress_dns.c b/test/regress_dns.c index 3d97cb22..f97db676 100644 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@ -1146,6 +1146,15 @@ dns_initialize_nameservers_test(void *arg) struct sockaddr_storage ss; int size; +#ifndef _WIN32 + /* /etc/resolv.conf does not exist in some test container + * setups but EVDNS_BASE_INITIALIZE_NAMESERVERS requires it */ + struct stat st; + if (stat("/etc/resolv.conf", &st) < 0 || st.st_size == 0) { + tt_skip(); + } +#endif + dns = evdns_base_new(base, 0); tt_assert(dns); tt_int_op(evdns_base_get_nameserver_addr(dns, 0, NULL, 0), ==, -1); -- 2.50.1