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 352D67030F; Thu, 25 Feb 2021 17:37:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 352D67030F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614263822; bh=YKVEBe6z/8TkrkZbGxbtEwbOEaeeIZerCWIuwTJArt4=; 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=uZxgHW/JNZm9R2sdDz6/gQ3jg5uugT/LBP97vKPOnhWnPPR1HfDel6/NovKLTCotk 0n5/8SzodmmHxFOmske/tHim9zAHQOgABWJDmC4pUw7o5PaPPciU8TRue3a/uMPELh aNZNMmvhDbzrF7abHHwuwbcx8jIOQMfL0u01Pjdk= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 6E4E67030F for ; Thu, 25 Feb 2021 17:37:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6E4E67030F Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lFHlD-00056B-9Q; Thu, 25 Feb 2021 17:36:59 +0300 To: Artem , Alexander Turenko References: <7a1f0cb7a97b41b3cde25ac5d2c591a84aa13f0b.1613674486.git.artemreyt@tarantool.org> <77565553-c787-e953-e275-c4a4ce0b8a74@tarantool.org> <1abcc665-11af-ca37-989b-b244cdaef4d5@tarantool.org> Message-ID: Date: Thu, 25 Feb 2021 17:36:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1abcc665-11af-ca37-989b-b244cdaef4d5@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD975C3EC174F5669228C980786C9DBA186ED94931C77F7596E182A05F538085040B00EE04D8116E10D839508FC2D77EAA97ED7FD220E30618454A66531752725B0 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE741DC22BF90A736D8EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373F9BB84380CC00728638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CDDE882590F889B1C544FCB66B2BF2581E160A87DEB445256A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE74601F13E4625331C9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3D6B8D1F75A55B56DCC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FC81DF583BEE9BDE68A7F4EDE966BC389F395957E7521B51C24C7702A67D5C33162DBA43225CD8A89FC0F9454058DFE53CA91E23F1B6B78B78B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DB48C21F01D89DB561574AF45C6390F7469DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A51237ACE31661B23CC6C3247C4EBE75BF0227AB45C92928C0D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75B7BFB303F1C7DB4D8E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AAC3D1FDB34D048830FE926128F26FE1A1660C417745080A396CE7D1700AB56F71DAF87AD12CFDB91D7E09C32AA3244CF22FD0033904BDE521A6934EC9B3D18C3FD9C8CA1B0515E0927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojvz1c9SWJtj8PFIYi/dtYmQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638226F587EEDDE80EE69E8E0AEFE06D59762DD788429FD8613638ED9BB8B05EE7B3AFB559BB5D741EB96D19CD4E7312BAA970A04DAD6CC59E33667EA787935ED9F1B 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: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hello, thanks for patch! small nit: with patch below alignment looks more accurately. --- a/test/box-tap/errinj_set_with_enviroment_vars.test.lua +++ b/test/box-tap/errinj_set_with_enviroment_vars.test.lua @@ -4,8 +4,8 @@ local fio = require('fio')  -- Execute errinj_set_with_enviroment_vars_script.lua  -- via tarantool with presetted environment variables.  local TARANTOOL_PATH = arg[-1] -local bool_env = 'ERRINJ_TESTING=true ERRINJ_WAL_IO=True ERRINJ_WAL_SYNC=TRUE' .. -                ' ERRINJ_WAL_WRITE=false ERRINJ_INDEX_ALLOC=False ERRINJ_WAL_WRITE_DISK=FALSE' +local bool_env = 'ERRINJ_TESTING=true ERRINJ_WAL_IO=True ERRINJ_WAL_SYNC=TRUE ' .. +                 'ERRINJ_WAL_WRITE=false ERRINJ_INDEX_ALLOC=False ERRINJ_WAL_WRITE_DISK=FALSE'  local integer_env = 'ERRINJ_WAL_WRITE_PARTIAL=2 ERRINJ_WAL_FALLOCATE=+2 ERRINJ_WAL_WRITE_COUNT=-2'  local double_env = 'ERRINJ_VY_READ_PAGE_TIMEOUT=2.5 ERRINJ_VY_SCHED_TIMEOUT=+2.5 ERRINJ_RELAY_TIMEOUT=-2.5'  local set_env_str = ('%s %s %s'):format(bool_env, integer_env, double_env) On 24.02.2021 12:38, Artem wrote: > 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. >