From: Alexander Turenko <alexander.turenko@tarantool.org> To: Roman Khabibov <roman.habibov@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [tarantool-patches] [PATCH v2 2/2] say: take getaddrinfo() errors into account Date: Fri, 27 Dec 2019 00:05:24 +0300 [thread overview] Message-ID: <20191226210524.ss6rwhnxu3mcixrw@tkn_work_nb> (raw) In-Reply-To: <858A7AA0-6429-4D6E-9359-4D846BB84963@tarantool.org> > > I run tests and got EAI_AGAIN. Let's add it too to the list. See > > https://lists.tarantool.org/pipermail/tarantool-patches/2019-December/013260.html > + /* > + * gh-4138: Check getaddrinfo() retval and diagnostics > + * area. > + */ > + rc = coio_getaddrinfo("non_exists_hostname", port, NULL, &i, > + 15768000000); > + isnt(rc, 0, "getaddrinfo retval"); > + const char *errmsg = diag_get()->last->errmsg; > + const char *exp_errmsg_1 = "getaddrinfo: nodename nor servname provided" > + ", or not known"; > + const char *exp_errmsg_2 = "getaddrinfo: Servname not supported for " > + "ai_socktype"; > + const char *exp_errmsg_3 = "getaddrinfo: Name or service not known"; > + const char *exp_errmsg_4 = "getaddrinfo: hostname nor servname provided" > + ", or not known"; > + const char *exp_errmsg_5 = "getaddrinfo: temporary failure in name " > + "resolution"; Linux: $ gcc -Wall -Wextra -x c <(echo -e '#include <sys/types.h>\n#include <sys/socket.h>\n#include <netdb.h>\n#include <stdio.h>\nint main() { printf("%s\\n", gai_strerror(EAI_AGAIN)); return 0; }') && ./a.out; rm a.out Temporary failure in name resolution Mac OS: $ clang -Wall -Wextra -x c <(echo -e '#include <sys/types.h>\n#include <sys/socket.h>\n#include <netdb.h>\n#include <stdio.h>\nint main() { printf("%s\\n", gai_strerror(EAI_AGAIN)); return 0; }') && ./a.out; rm a.out Temporary failure in name resolution FreeBSD: % printf '#include <sys/types.h>\n#include <sys/socket.h>\n#include <netdb.h>\n#include <stdio.h>\nint main() { printf("%%s\\n", gai_strerror(EAI_AGAIN)); return 0; }' > tmp.c && gcc -Wall -Wextra -x c tmp.c && ./a.out ; rm a.out tmp.c Name could not be resolved at this time "temporary failure in name resolution" does not match any. > + bool is_match_with_exp = strcmp(errmsg, exp_errmsg_1) == 0 || > + strcmp(errmsg, exp_errmsg_2) == 0 || > + strcmp(errmsg, exp_errmsg_3) == 0 || > + strcmp(errmsg, exp_errmsg_4) == 0 || > + strcmp(errmsg, exp_errmsg_5) == 0; > + is(is_match_with_exp, true, "getaddrinfo error message");
next prev parent reply other threads:[~2019-12-26 21:05 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-25 13:38 [tarantool-patches] [PATCH v2 0/2] " Roman Khabibov 2019-06-25 13:38 ` [tarantool-patches] [PATCH v2 2/2] say: " Roman Khabibov 2019-07-23 14:52 ` [tarantool-patches] " Alexander Turenko 2019-08-05 13:32 ` Roman Khabibov 2019-08-28 21:34 ` Alexander Turenko 2019-08-29 0:51 ` Alexander Turenko [not found] ` <8E98F721-601F-436D-8F0A-5E399D8F7CAB@tarantool.org> 2019-09-06 13:44 ` Alexander Turenko 2019-09-10 12:52 ` Roman Khabibov 2019-11-01 15:19 ` [Tarantool-patches] " Alexander Turenko 2019-11-21 17:28 ` [Tarantool-patches] [tarantool-patches] " Roman Khabibov 2019-12-08 19:48 ` Alexander Turenko 2019-12-10 16:25 ` Roman Khabibov 2019-12-18 15:01 ` Alexander Turenko 2019-12-21 17:50 ` Roman Khabibov 2019-12-23 12:56 ` Alexander Turenko 2019-12-23 13:38 ` Alexander Turenko 2019-12-26 17:29 ` Roman Khabibov 2019-12-26 21:05 ` Alexander Turenko [this message] 2019-12-27 13:01 ` Roman Khabibov
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=20191226210524.ss6rwhnxu3mcixrw@tkn_work_nb \ --to=alexander.turenko@tarantool.org \ --cc=roman.habibov@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [tarantool-patches] [PATCH v2 2/2] say: take getaddrinfo() errors into account' \ /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: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox