public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-3261] libstdc++: Fix ip::tcp::resolver test failure on Solaris Date: Tue, 31 Aug 2021 16:37:19 +0000 (GMT) [thread overview] Message-ID: <20210831163719.4BB6E385840B@sourceware.org> (raw) https://gcc.gnu.org/g:48b20d46f9597a4b1e19e0e2d4a0c68d056d7662 commit r12-3261-g48b20d46f9597a4b1e19e0e2d4a0c68d056d7662 Author: Jonathan Wakely <jwakely@redhat.com> Date: Tue Aug 31 13:08:23 2021 +0100 libstdc++: Fix ip::tcp::resolver test failure on Solaris Solaris 11 does not have "http" in /etc/services, which causes this test to fail. Try some other services until we find one that works. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * testsuite/experimental/net/internet/resolver/ops/lookup.cc: Try other service if "http" fails. Diff: --- .../experimental/net/internet/resolver/ops/lookup.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc b/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc index ca8f0899ccd..69be194fa29 100644 --- a/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc +++ b/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc @@ -30,13 +30,27 @@ test01() std::error_code ec; io_context ctx; ip::tcp::resolver resolv(ctx); - auto addrs = resolv.resolve("localhost", "http", ec); + auto hostname = "localhost", service = "http"; + auto addrs = resolv.resolve(hostname, service, ec); + if (ec == ip::resolver_errc::service_not_found) + { + // Solaris doesn't have http in /etc/services, try some others. + for (auto serv : {"ftp", "telnet", "smtp"}) + { + addrs = resolv.resolve(hostname, serv, ec); + if (!ec) + { + service = serv; + break; + } + } + } VERIFY( !ec ); VERIFY( addrs.size() > 0 ); VERIFY( addrs.begin() != addrs.end() ); VERIFY( ! addrs.empty() ); - auto addrs2 = resolv.resolve("localhost", "http"); + auto addrs2 = resolv.resolve(hostname, service); VERIFY( addrs == addrs2 ); } @@ -68,7 +82,7 @@ test02() #if __cpp_exceptions bool caught = false; try { - resolv.resolve("localhost", "http", flags); + resolv.resolve("localhost", "42", flags); } catch (const std::system_error& e) { caught = true; VERIFY( e.code() == ec );
reply other threads:[~2021-08-31 16:37 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210831163719.4BB6E385840B@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).