From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 94B9746970E for ; Fri, 27 Dec 2019 00:05:25 +0300 (MSK) Date: Fri, 27 Dec 2019 00:05:24 +0300 From: Alexander Turenko Message-ID: <20191226210524.ss6rwhnxu3mcixrw@tkn_work_nb> References: <20191101151939.lewxpitqxzyn6dz6@tkn_work_nb> <20191208194823.krw4hc4lm7bhxqrk@tkn_work_nb> <20191218150132.upsy57nxmk3xpfqk@tkn_work_nb> <20191223125658.ngkmmngbkxyfiy45@tkn_work_nb> <20191223133845.7ltx5n5ipffpohkc@tkn_work_nb> <858A7AA0-6429-4D6E-9359-4D846BB84963@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <858A7AA0-6429-4D6E-9359-4D846BB84963@tarantool.org> Subject: Re: [Tarantool-patches] [tarantool-patches] [PATCH v2 2/2] say: take getaddrinfo() errors into account List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Khabibov Cc: tarantool-patches@dev.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 \n#include \n#include \n#include \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 \n#include \n#include \n#include \nint main() { printf("%s\\n", gai_strerror(EAI_AGAIN)); return 0; }') && ./a.out; rm a.out Temporary failure in name resolution FreeBSD: % printf '#include \n#include \n#include \n#include \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");