From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 5F8BE70202; Wed, 24 Feb 2021 12:38:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5F8BE70202 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614159530; bh=J7bgxlsRYrp3tXrLdXgnk2G9fLCOdVG5TgffQmIJK+s=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=HkJlja7nBOD677JtdJRCsPX+8rHqzjbIc8JMO0pVjdNBysc2ALcEoiLgtRWHbDiH1 wKju7Ta+GTg+Ob10O8t7BYf58PqP5uLwv9AlYY+T1x3AcLSBRSvhQEKowoJCA/gsMg XpUYyMhoBkkxAewRRXSvoPUQPH6mp9asAxoPD+xU= Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (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 8226370202 for ; Wed, 24 Feb 2021 12:38:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8226370202 Received: by smtp58.i.mail.ru with esmtpa (envelope-from ) id 1lEqd4-0002xT-Nu; Wed, 24 Feb 2021 12:38:47 +0300 To: Sergey Bronnikov , Alexander Turenko References: <7a1f0cb7a97b41b3cde25ac5d2c591a84aa13f0b.1613674486.git.artemreyt@tarantool.org> <77565553-c787-e953-e275-c4a4ce0b8a74@tarantool.org> Message-ID: <1abcc665-11af-ca37-989b-b244cdaef4d5@tarantool.org> Date: Wed, 24 Feb 2021 12:38:43 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD975C3EC174F56692243410BA6471F01664CBE9F2A03BCE963182A05F538085040BBC062EB419426033A19CC9F9535A10D7A164FAF8C70381B6E8622EE9DEB4983 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7922D113DFDC6D5A3EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006376AFB9B40001E44068638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC48EFCC6C8EB03FE669B22A812E4962AF962893389A9A4CD7389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C012F9184CEE6480E98941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B608988D4D34163C9DCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249D7441EF8352D599276E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8BE95B4490390D5D973AA81AA40904B5D9DBF02ECDB25306B2B25CBF701D1BE8734AD6D5ED66289B5278DA827A17800CE7BAE0BF3BEFF3948C67F23339F89546C5A8DF7F3B2552694A6FED454B719173D6725E5C173C3A84C3FFCBA205665D830A35872C767BF85DA2F004C906525384306FED454B719173D6462275124DF8B9C9DE2850DD75B2526BE5BFE6E7EFDEDCD789D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5384EDE70F9DC7DF6C6FD63350DDDCED4BC1696784FB0AB01D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75B7BFB303F1C7DB4D8E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34D75CEA0D7A80616E8CF25991C27CDA415DF0F86226918C916F782E2B8DCE40E4EBF57FC085D8862A1D7E09C32AA3244C39160A68D6BA268ED38932AAB6D342388A6D4CC6FBFAC251927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojyK6JYJ15DtLU9BZp5IgU/w== X-Mailru-Sender: 65CD03CFE33A0EC7E4F6C6702325C427237DD26F1954FB1C7CA191129CA4118D00F2F420787A9E07B08A37556DE0CB7BB7E364AFDB3F206FD953F29DB7D76D89B1E6F68DAE724AB9112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCHv2 1/2] core: add setting error injections via env X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Artem via Tarantool-patches Reply-To: Artem Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, 20.02.2021 17:27, Sergey Bronnikov пишет: > Hi, > > On 20.02.2021 14:21, Artem wrote: >> Hello, >> >> thanks for the review! >> >>>> + >>>> +void errinj_set_with_environment_vars() { >>>> +    for (enum errinj_id i = 0; i < errinj_id_MAX; i++) { >>>> +        struct errinj *inj = &errinjs[i]; >>>> +        const char *env_value = getenv(inj->name); >>>> +        if (!env_value || *env_value == '\0') >>>> +            continue; >>>> + >>>> +        if (inj->type == ERRINJ_INT) { >>>> +            char *end; >>>> +            int64_t int_value = strtoll(env_value, &end, 10); >>>> +            if (*end == '\0') >>>> +                inj->iparam = int_value; >>>> +        } else if (inj->type == ERRINJ_BOOL) { >>>> +            if (strcmp(env_value, "false") == 0 || >>>> strcmp(env_value, "FALSE") == 0) >>> >>> 1. What happen if someone set boolean value to "False"? >>> >>> May be it's worth to convert env_value to lowercase and then >>> compare? The same question for "true". >> >> 1. Done. Case-insensetive value can be set to env variable now. > > Thanks! > > It's worth to add different values for 'true'/'false' to test > > for documentation and regression purposes. Done, added tests for "true", "True", "TRUE" (same for false) and tests for numeric injections with plus and minus signs. Updates you can see on the branch.