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 62A1C64672; Wed, 13 Jan 2021 20:04:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 62A1C64672 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1610557471; bh=3wyPC/L0Pg1ax29Wg5yUT0YX1xwpYHZdXMZIHQncbzI=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=jJvTj0ljYDf5HZaKiyWpOrI0FNjlboEFuuADZDvob/LApNDOvoawIMB2FbIfz2jL8 Cq0Ii4BGFsZBLMVNa5JIiHrsRBQNH9e+vxUIxfZ/gGkdflGg4u9U/y2gFapnLZPIBc to8DQEOroQOK3Dlvjtm1Fd3LeIfa8hfLE8XT/GnU= 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 CD29564672 for ; Wed, 13 Jan 2021 20:04:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CD29564672 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1kzjZ0-00070l-RN; Wed, 13 Jan 2021 20:04:07 +0300 To: sergeyb@tarantool.org, tarantool-patches@dev.tarantool.org References: Message-ID: <1b302a98-cd94-bee3-ee7d-2e64f328bfde@tarantool.org> Date: Wed, 13 Jan 2021 18:04:05 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D0E79FBC973162CD520EA9A9E182CF906B1BCD0E5756442500894C459B0CD1B945AB5A27957E01D0223DA2547E38AECB52642B82240B4E35C9D0755C5AE02EC7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74378043A27BE1642EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637680B37D8C6EC627A8638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC51A6DB544064DD4545D4DEC515A0BC1ABD3A5ECF720A1FDC389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92A417C69337E82CC2CC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FCECD345639C7F4A9E75ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE4930A3850AC1BE2E735AD05CC21270DE0F1C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0FECB2555BB02FD5A93B503F486389A921A5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A50DC1CBBDBD8A8596000A73A6B71ACB0808CCDBB31000FF97D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA758F9E841AEAEC4F2C410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34D9DC20663B80603FD88E505641D3F4D6D819A1F9FF8132DBB49E7FC3013CD4DB3DFBFED70D5BFB171D7E09C32AA3244CC5267B2C78A138BB38DD539570F5C70669B6CAE0477E908DFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj4exXbGs3yZo7m5XP6YenQQ== X-Mailru-Sender: 689FA8AB762F73937240DDB2502DDB70BFB00F58368674595D98134A7E3798103841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v7] test: fix luacheck warnings in test/long_run-py 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! See 3 comments below. On 13.01.2021 15:35, sergeyb@tarantool.org wrote: > From: Sergey Bronnikov > > Closes #5460 > > Reviewed-by: Vladislav Shpilevoy > Reviewed-by: Igor Munkin > > Co-authored-by: Vladislav Shpilevoy > Co-authored-by: Igor Munkin > --- > > Changelog v7: > > - updated an exclusion mask in .luacheckrc > > Changelog v6: > > - splitted patch in test/ for patches per sub-directory > - adjusted supressions in .luacheckrc > - fixed formatting issues in .luacheckrc > > Gitlab CI: https://gitlab.com/tarantool/tarantool/-/pipelines/241108315 > Issue: https://github.com/tarantool/tarantool/issues/5460 > Branch: ligurio/gh-5460-luacheck-warnings-test-long_run-py > > .luacheckrc | 2 +- > test/long_run-py/lua/finalizers.lua | 8 +++----- > test/long_run-py/suite.lua | 16 +++++++++------- > 3 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/.luacheckrc b/.luacheckrc > index 4b829f3dc..68736d8db 100644 > --- a/.luacheckrc > +++ b/.luacheckrc > @@ -37,7 +37,7 @@ exclude_files = { > "test/box-tap/**/*.lua", > "test/engine/**/*.lua", > "test/engine_long/**/*.lua", > - "test/long_run-py/**/*.lua", > + "test/long_run-py/lua/finalizers.lua", 1. Why did you leave it in 'exclude' and yet you fix it? I tried to remove it, and found that it says your change in the next hunk is not correct. When I fixed it, I saw it says the 'result' variable is not used but only mutated. Then I tried to 'read' result somehow after the loop, but it says the code is unreachable. Then I made the loop look like it can end, and now it seems to be working. ==================== diff --git a/.luacheckrc b/.luacheckrc index 68736d8db..3f4913df3 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -37,7 +37,6 @@ exclude_files = { "test/box-tap/**/*.lua", "test/engine/**/*.lua", "test/engine_long/**/*.lua", - "test/long_run-py/lua/finalizers.lua", "test/luajit-tap/**/*.lua", "test/replication/**/*.lua", "test/replication-py/**/*.lua", diff --git a/test/long_run-py/lua/finalizers.lua b/test/long_run-py/lua/finalizers.lua index cb6400363..88bd7734c 100644 --- a/test/long_run-py/lua/finalizers.lua +++ b/test/long_run-py/lua/finalizers.lua @@ -7,10 +7,14 @@ local function test_finalizers() local result = {} local i = 1 local ffi = require('ffi') - while true do - local result[i] = ffi.gc(ffi.cast('void *', 0), on_gc) + while i ~= 0 do + result[i] = ffi.gc(ffi.cast('void *', 0), on_gc) i = i + 1 end + -- Fake-read 'result' to calm down 'luacheck' complaining that the variable + -- is never used. + assert(#result ~= 0) + return "done" end; test_finalizers() ==================== It looks a bit ugly maybe, because i ~= 0 is always true, and because there is unreachable code after the loop. I suggest to either find a better way to fix the warning; or don't change finalizers.lua at all and keep the whole file ignored; or apply my diff, or revert your 'local' usage in the next diff hunk, and silence this single warning about 'result' being not used. > "test/luajit-tap/**/*.lua", > "test/replication/**/*.lua", > "test/replication-py/**/*.lua", > diff --git a/test/long_run-py/lua/finalizers.lua b/test/long_run-py/lua/finalizers.lua > index 69146a323..cb6400363 100644 > --- a/test/long_run-py/lua/finalizers.lua > +++ b/test/long_run-py/lua/finalizers.lua > @@ -1,19 +1,17 @@ > #!/usr/bin/env tarantool > > -function on_gc(t) > +local function on_gc() > end; > > -function test_finalizers() > +local function test_finalizers() > local result = {} > local i = 1 > local ffi = require('ffi') > while true do > - result[i] = ffi.gc(ffi.cast('void *', 0), on_gc) > + local result[i] = ffi.gc(ffi.cast('void *', 0), on_gc) 2. This change is not correct. Even luacheck tells it, if you don't ignore this file. You assign a value to a table member, not declare a variable. > i = i + 1 > end > - return "done" > end; > > test_finalizers() > test_finalizers() > - > diff --git a/test/long_run-py/suite.lua b/test/long_run-py/suite.lua > index 0b33dec7d..7a09dd2b8 100644 > --- a/test/long_run-py/suite.lua > +++ b/test/long_run-py/suite.lua > @@ -109,3 +106,8 @@ function delete_insert(engine_name) > box.space.tester:drop() > return {counter, string_value_2} > end > + > +return { > + delete_replace_update = delete_replace_update; > + delete_insert = delete_insert; 3. Please, use ',' instead of ';'. > +} >