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 BC7DA686FA; Tue, 2 Feb 2021 23:59:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BC7DA686FA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612299596; bh=31Mq8up+/oohzAavjvZc/WvqDn4zlzodcpQaTZNaPas=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=RExf5BF23RK2NdowJmdfcwILwXVsSvQ7vd/FBm06Vj5Qr03IbxHt2lKj8biugePf+ ABCjkrd9ulv9L9yIwaOdTbuBErBumgeslNzjydHzXJBtTBvMDllm2Kv3UqUJkev/JF nvyApycVPiIasPAgrTQqLzo6sd7dfjZwxmCo0wtc= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 BE14A632DC for ; Tue, 2 Feb 2021 23:57:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BE14A632DC Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1l72kB-0005mg-Q2; Tue, 02 Feb 2021 23:57:52 +0300 To: Sergey Kaplun , Sergey Bronnikov Date: Tue, 2 Feb 2021 23:57:44 +0300 Message-Id: <2db1d3a53682de0bb4231ec494fc44e95acd9a8f.1612291495.git.imun@tarantool.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD953AC099BC0052A9CD238BCF93DF23716D1711D0DDC4F5AC2182A05F53808504026802EC6703483B7B99EF80F50F67BCBA935322636F6860B0886BF65256720F2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7956F10FFCC7409BAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378A9F193E39E334918638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FCDAFBC183B389AD44788BBA50AF79FB1A64D6FFDFC1113724389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0998E19D2343267C68941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6389ED70FDB73D44FCC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FC426E46268278306375ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE4931B544F03EFBC4D5789424AA0EF8DE9BAC4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2BBE337FB72E923155C0AF1600DCBC20B1CE701AD2DEDB67E1722390F07965883 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C823F58AE0C7795A95718F613A8D1A6310BE9BD6611F768A69C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF31C0090ACECF247D699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D341C998A3771F04153B981AE7119810BDDA03D87722D71F32A4876E76FE40D3DAD362A1B94F1FBD2921D7E09C32AA3244CC8B54FD2E9E2E91E0C65F97BD3B7426497FE24653F78E668927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojCSo1BV1mVLbyURAgefYt6g== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822D3D7C13AD08470EFB27CB373CF963DD7A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 4/5] test: fix warnings found with luacheck in misclib* 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Since the regular static analysis has not been enabled for the test chunks in LuaJIT repository yet, the tests for recently implemented features still produce luacheck warnings. The most of the issues are fixed in scope of the commit 8fc103fb1a21c28185a1942e75d8d9485e3aade7 ('test: fix warnings spotted by luacheck') and this patch fixes the remaining ones. Fixes tarantool/tarantool#5631 Part of tarantool/tarantool#4862 Part of tarantool/tarantool#5470 Follows up tarantool/tarantool#5187 Reported-by: Sergey Bronnikov Signed-off-by: Igor Munkin --- .../misclib-getmetrics-capi.test.lua | 22 ++++++--------- .../misclib-getmetrics-lapi.test.lua | 28 +++++++++---------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/test/tarantool-tests/misclib-getmetrics-capi.test.lua b/test/tarantool-tests/misclib-getmetrics-capi.test.lua index c418e9f..d409ea9 100755 --- a/test/tarantool-tests/misclib-getmetrics-capi.test.lua +++ b/test/tarantool-tests/misclib-getmetrics-capi.test.lua @@ -38,29 +38,29 @@ test:ok(testgetmetrics.objcount(function(iterations) } -- Separate objects creations to separate jit traces. - for i = 1, iterations do - table.insert(placeholder.str, tostring(i)) + for _ = 1, iterations do + table.insert(placeholder.str, tostring(_)) end - for i = 1, iterations do - table.insert(placeholder.tab, {i}) + for _ = 1, iterations do + table.insert(placeholder.tab, {_}) end - for i = 1, iterations do + for _ = 1, iterations do table.insert(placeholder.udata, newproxy()) end - for i = 1, iterations do + for _ = 1, iterations do -- Check counting of VLA/VLS/aligned cdata. table.insert(placeholder.cdata, ffi.new("char[?]", 4)) end - for i = 1, iterations do + for _ = 1, iterations do -- Check counting of non-VLA/VLS/aligned cdata. - table.insert(placeholder.cdata, ffi.new("uint64_t", i)) + table.insert(placeholder.cdata, ffi.new("uint64_t", _)) end - placeholder = nil + placeholder = nil -- luacheck: no unused -- Restore default jit settings. jit.opt.start(unpack(jit_opt_default)) end)) @@ -69,15 +69,11 @@ end)) test:ok(testgetmetrics.snap_restores(function() jit.opt.start(0, "hotloop=1") - local old_metrics = misc.getmetrics() - local sum = 0 for i = 1, 20 do sum = sum + i end - local new_metrics = misc.getmetrics() - -- Restore default jit settings. jit.opt.start(unpack(jit_opt_default)) diff --git a/test/tarantool-tests/misclib-getmetrics-lapi.test.lua b/test/tarantool-tests/misclib-getmetrics-lapi.test.lua index 959293d..d54caac 100755 --- a/test/tarantool-tests/misclib-getmetrics-lapi.test.lua +++ b/test/tarantool-tests/misclib-getmetrics-lapi.test.lua @@ -58,10 +58,10 @@ test:test("gc-allocated-freed", function(subtest) until collectgarbage("count") == count -- Bump getmetrics table and string keys allocation. - local old_metrics = misc.getmetrics() + misc.getmetrics() -- Remember allocated size for getmetrics table. - old_metrics = misc.getmetrics() + local old_metrics = misc.getmetrics() collectgarbage("collect") @@ -77,7 +77,7 @@ test:test("gc-allocated-freed", function(subtest) -- (such as concatenation, string.format, table.concat) -- while creating the string. Otherwise gc_freed/gc_allocated -- relations will not be so straightforward. - local str = string.sub("Hello, world", 1, 5) + local str = string.sub("Hello, world", 1, 5) -- luacheck: no unused collectgarbage("collect") new_metrics = misc.getmetrics() @@ -196,29 +196,29 @@ test:test("objcount", function(subtest) } -- Separate objects creations to separate jit traces. - for i = 1, 1000 do - table.insert(placeholder.str, tostring(i)) + for _ = 1, 1000 do + table.insert(placeholder.str, tostring(_)) end - for i = 1, 1000 do - table.insert(placeholder.tab, {i}) + for _ = 1, 1000 do + table.insert(placeholder.tab, {_}) end - for i = 1, 1000 do + for _ = 1, 1000 do table.insert(placeholder.udata, newproxy()) end - for i = 1, 1000 do + for _ = 1, 1000 do -- Check counting of VLA/VLS/aligned cdata. table.insert(placeholder.cdata, ffi.new("char[?]", 4)) end - for i = 1, 1000 do + for _ = 1, 1000 do -- Check counting of non-VLA/VLS/aligned cdata. - table.insert(placeholder.cdata, ffi.new("uint64_t", i)) + table.insert(placeholder.cdata, ffi.new("uint64_t", _)) end - placeholder = nil + placeholder = nil -- luacheck: no unused collectgarbage("collect") local new_metrics = misc.getmetrics() @@ -372,7 +372,7 @@ test:test("strhash", function(subtest) assert(new_metrics.strhash_miss - old_metrics.strhash_miss == 0) old_metrics = new_metrics - local str1 = "strhash".."_hit" + local _ = "strhash".."_hit" new_metrics = misc.getmetrics() assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 20) @@ -384,7 +384,7 @@ test:test("strhash", function(subtest) assert(new_metrics.strhash_miss - old_metrics.strhash_miss == 0) old_metrics = new_metrics - local str2 = "new".."string" + local _ = "new".."string" new_metrics = misc.getmetrics() assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 19) -- 2.25.0