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 08B636EC58; Sat, 20 Feb 2021 17:27:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 08B636EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1613831277; bh=caP0dYWsE//tkZIjqXoEE3D5GwxkOi4vdb/3LaoUjjA=; 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=eqfqNg8xb0VcXULpLTUap33KVU/L8jeL1UuCmOlVomyxUujgFEAlHj6OwghM6qGKh mbPHbIJ1mBOnPLmXqJydN1Fqm5SDRaqzlupz3iOeasAMqbHeTILTpvg9lpp2lCVS7j LmMTAIblaIjJqsapuY/4rYpOJBXk9qz20ClFUEuk= 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 88D576EC58 for ; Sat, 20 Feb 2021 17:27:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 88D576EC58 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lDTEg-0007mg-JH; Sat, 20 Feb 2021 17:27:54 +0300 To: Artem , Alexander Turenko References: <7a1f0cb7a97b41b3cde25ac5d2c591a84aa13f0b.1613674486.git.artemreyt@tarantool.org> <77565553-c787-e953-e275-c4a4ce0b8a74@tarantool.org> Message-ID: Date: Sat, 20 Feb 2021 17:27:54 +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: <77565553-c787-e953-e275-c4a4ce0b8a74@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD975C3EC174F5669228C980786C9DBA186ED94931C77F7596E182A05F538085040DB1D3F8463906D17E9A8C1F6E8BA0EC41801A10769995ED55FDC453D67665DEE X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75210414551E8CD62EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063771C846A5973DEE7E8638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FCCB8A98478281A83EC4B227DE16DAA178229233CFA47A7C43389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C09E967FC778BD48978941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B615519F706774CB6ACC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FC654CE8ED7C2D004275ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE4930A3850AC1BE2E735E41BE69BB3BCB152C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A5E102AE3D8D748FF8CD909570BE76F5353537C57808EAE36AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D340A58BF0C7EAC340F549092441A8555632C88DEACB5FC779DA995E7FDF2276C291106AE680579F7761D7E09C32AA3244C29959B813BBBA0375828FAC4CFFDE2033A92A9747B6CC886927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj2CfMKaWP9xveLL0kiUYHvA== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638228D15BE4A0D35F398B5AB9EFD8BAE07B0DD788429FD8613638ED9BB8B05EE7B3AFB559BB5D741EB96D19CD4E7312BAA970A04DAD6CC59E33667EA787935ED9F1B 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" 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. > > >>> +-- Execute errinj_set_with_enviroment_vars_script.lua >>> +-- via tarantool with presetted environment variables. >>> +local TARANTOOL_PATH = arg[-1] >>> +local set_env_str = 'ERRINJ_TESTING=true ERRINJ_WAL_WRITE_PARTIAL=1 >>> ERRINJ_VY_READ_PAGE_TIMEOUT=2.5' >>> +local script_file = fio.pathjoin( >> >> 2. variable name should reflect a purpose of variable. >> >> name is about script file, when variable contains a path to a file. > 2. Done. Renamed to path_to_test_file.