From: Martin Willi Date: Mon, 2 Mar 2015 13:05:44 +0000 (+0100) Subject: unit-tests: Don't fail host_create_from_dns() test if IPv6 not supported X-Git-Tag: 5.3.0dr1~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53013b5f0c50de177cac7932e341771e0aa41d2a;p=thirdparty%2Fstrongswan.git unit-tests: Don't fail host_create_from_dns() test if IPv6 not supported On some systems, such as the Ubuntu daily build machine, localhost does not resolve to an IPv6 address. Accept such a lookup failure. --- diff --git a/src/libstrongswan/tests/suites/test_host.c b/src/libstrongswan/tests/suites/test_host.c index 1a3c9476f1..7161b2c5b9 100644 --- a/src/libstrongswan/tests/suites/test_host.c +++ b/src/libstrongswan/tests/suites/test_host.c @@ -245,12 +245,18 @@ static void test_create_from_dns(int family, chunk_t addr) host_t *host; host = host_create_from_dns("localhost", family, 500); - ck_assert(host); - if (family != AF_UNSPEC) + if (family != AF_INET6) { - verify_address(host, addr, family, 500); + ck_assert(host != NULL); + } + if (host) + { + if (family != AF_UNSPEC) + { + verify_address(host, addr, family, 500); + } + host->destroy(host); } - host->destroy(host); } START_TEST(test_create_from_dns_any)