Do not rely on getservbyname() for most of the dns regression tests
authorAzat Khuzhin <a3at.mail@gmail.com>
Sun, 21 Oct 2018 00:03:25 +0000 (03:03 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Sun, 21 Oct 2018 00:12:24 +0000 (03:12 +0300)
There is only one test that uses service name getaddrinfo_async, which
manually check whether it works or not, other should not assume that it
is available and works.

There was already an attempt to overcome some possible limitations, like
lack of "http" in /etc/services in
d6bafbbeb27ff3943d6f3b6783bcded76384c31e ("test/dns: replace servname
since solaris does not have "http"")

test/regress_dns.c

index fbdf827b8ce57a4bdee0d990af05feaaaabf7df9..9a3f88dc3b1c779c45eb3084756601c36967ce0c 100644 (file)
@@ -2112,7 +2112,7 @@ dns_client_fail_requests_getaddrinfo_test(void *arg)
        tt_assert(!evdns_base_nameserver_ip_add(dns, buf));
 
        for (i = 0; i < 20; ++i)
-               tt_assert(evdns_getaddrinfo(dns, "foof.example.com", "ssh", NULL, getaddrinfo_cb, &r[i]));
+               tt_assert(evdns_getaddrinfo(dns, "foof.example.com", "80", NULL, getaddrinfo_cb, &r[i]));
 
        n_replies_left = 20;
        exit_base = base;
@@ -2236,7 +2236,7 @@ getaddrinfo_race_gotresolve_test(void *arg)
        rp.locked = 1;
 
        for (i = 0; i < n_reqs; ++i) {
-               tt_assert(evdns_getaddrinfo(rp.dns, "foof.example.com", "ssh", NULL, race_gai_cb, &rp));
+               tt_assert(evdns_getaddrinfo(rp.dns, "foof.example.com", "80", NULL, race_gai_cb, &rp));
                // This magic along with busy-wait threads make this thread yield frequently
                if (i % 100 == 0) {
                        tv.tv_sec = 0;