From: sergeyb@tarantool.org
To: tarantool-patches@dev.tarantool.org
Cc: o.piskunov@tarantool.org, alexander.turenko@tarantool.org
Subject: [Tarantool-patches] [PATCH v5 11/10] test: fix warnings spotted by luacheck
Date: Tue, 26 May 2020 23:38:58 +0300 [thread overview]
Message-ID: <1c201de753b1e9a755b73190c1032dc3be1a9815.1590524798.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1589275364.git.sergeyb@tarantool.org>
From: Sergey Bronnikov <sergeyb@tarantool.org>
luacheck is integrated in tarantool CI pipeline and respects .luacheckrc
in tarantool repo, so jit global is suppressed there.
Co-authored-by: Igor Munkin <imun@tarantool.org>
Reviewed-by: Igor Munkin <imun@tarantool.org>
---
...gh-4476-fix-string-find-recording.test.lua | 6 ++---
.../lj-494-table-chain-infinite-loop.test.lua | 26 +++++++++----------
test/or-232-unsink-64-kptr.test.lua | 1 +
3 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/test/gh-4476-fix-string-find-recording.test.lua b/test/gh-4476-fix-string-find-recording.test.lua
index 209090a..ef2bb97 100755
--- a/test/gh-4476-fix-string-find-recording.test.lua
+++ b/test/gh-4476-fix-string-find-recording.test.lua
@@ -51,13 +51,13 @@ local err = [[module 'kit.1.10.3-136' not found:
no file '/usr/local/lib64/lua/5.1/kit.so'
no file '/usr/lib64/lua/5.1/kit.so']]
-local at, s, e
+local _, at, e
local count_vm = 0
jit.off()
repeat
- s, e = err:find("\n\t", at, true)
+ _, e = err:find("\n\t", at, true)
at = e
count_vm = count_vm + 1
until not e
@@ -68,7 +68,7 @@ jit.on()
jit.opt.start(0, 'hotloop=1')
repeat
- s, e = err:find("\n\t", at, true)
+ _, e = err:find("\n\t", at, true)
at = e
count_jit = count_jit + 1
assert(count_jit <= count_vm, "Trace goes in cycles")
diff --git a/test/lj-494-table-chain-infinite-loop.test.lua b/test/lj-494-table-chain-infinite-loop.test.lua
index 0daeca3..314eb29 100755
--- a/test/lj-494-table-chain-infinite-loop.test.lua
+++ b/test/lj-494-table-chain-infinite-loop.test.lua
@@ -16,7 +16,7 @@ ffi.cdef("char* strstr(const char*, const char*)")
local strstr = ffi.C.strstr
local cast = ffi.cast
local str_hash_offset = cast("uint32_t*", strstr("*", ""))[-2] == 1 and 3 or 2
-function str_hash(s)
+local function str_hash(s)
return cast("uint32_t*", strstr(s, "")) - str_hash_offset
end
local table_new = require("table.new")
@@ -25,17 +25,17 @@ local table_new = require("table.new")
local victims = {}
local orig_hash = {}
for c in ("abcdef"):gmatch"." do
- v = c .. "{09add58a-13a4-44e0-a52c-d44d0f9b2b95}"
+ local v = c .. "{09add58a-13a4-44e0-a52c-d44d0f9b2b95}"
victims[c] = v
orig_hash[c] = str_hash(v)[0]
end
collectgarbage()
do --- Basic version of the problem
- for k, v in pairs(victims) do
+ for _, v in pairs(victims) do
str_hash(v)[0] = 0
end
- t = table_new(0, 8)
+ local t = table_new(0, 8)
-- Make chain a -> b -> c -> d, all with a as primary
t[victims.a] = true
t[victims.d] = true
@@ -59,10 +59,10 @@ end
collectgarbage()
do --- Just `mn != freenode` can lead to infinite loops
- for k, v in pairs(victims) do
+ for _, v in pairs(victims) do
str_hash(v)[0] = 0
end
- t = table_new(0, 8)
+ local t = table_new(0, 8)
-- Make chain a -> b -> c -> d, all with a as primary
t[victims.a] = true
t[victims.d] = true
@@ -85,10 +85,10 @@ end
collectgarbage()
do --- Just `mn != nn` can lead to infinite loops
- for k, v in pairs(victims) do
+ for _, v in pairs(victims) do
str_hash(v)[0] = 0
end
- t = table_new(0, 8)
+ local t = table_new(0, 8)
-- Make chain a -> b -> c -> d -> e, all with a as primary
t[victims.a] = true
t[victims.e] = true
@@ -113,10 +113,10 @@ end
for i = 0, 10 do --- Non-strings can need rechaining too
collectgarbage()
- k = tonumber((("0x%xp-1074"):format(i)))
+ local k = tonumber((("0x%xp-1074"):format(i)))
str_hash(victims.a)[0] = 0
str_hash(victims.b)[0] = 0
- t = table_new(0, 4)
+ local t = table_new(0, 4)
-- a -> b, both with a as primary
t[victims.a] = true
t[victims.b] = true
@@ -140,10 +140,10 @@ end
for i = 0, 10 do --- Non-strings can be moved to freenode
collectgarbage()
- k = false
+ local k = false
str_hash(victims.a)[0] = 0
str_hash(victims.b)[0] = 0
- t = table_new(0, 4)
+ local t = table_new(0, 4)
-- a -> k -> b, all with a as primary
t[victims.a] = true
t[victims.b] = true
@@ -160,7 +160,7 @@ end
collectgarbage()
do --- Do not forget to advance freenode in the not-string case
- t = table_new(0, 4)
+ local t = table_new(0, 4)
-- Chain of colliding numbers
t[0x0p-1074] = true
t[0x4p-1074] = true
diff --git a/test/or-232-unsink-64-kptr.test.lua b/test/or-232-unsink-64-kptr.test.lua
index d9b3f05..0178a6e 100755
--- a/test/or-232-unsink-64-kptr.test.lua
+++ b/test/or-232-unsink-64-kptr.test.lua
@@ -31,6 +31,7 @@ local array = ffi.new("struct { int x; } [1]")
local function fn(i)
local struct = array[0] -- Load pointer that the JIT will constify.
+ -- luacheck: ignore
if i == 1000 then end -- Force trace exit when i==1000.
struct.x = 0 -- Ensure that 'struct' is live after exit.
end
--
2.23.0
prev parent reply other threads:[~2020-05-26 20:40 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 9:49 [Tarantool-patches] [PATCH v5 00/10] Add static analysis with luacheck sergeyb
2020-05-12 9:49 ` [Tarantool-patches] [PATCH v5 01/10] Add initial luacheck config sergeyb
2020-05-26 22:15 ` Igor Munkin
2020-05-28 15:31 ` Sergey Bronnikov
2020-05-28 16:07 ` Sergey Bronnikov
2020-05-29 11:20 ` Igor Munkin
2020-11-10 14:30 ` Sergey Bronnikov
2020-11-10 14:49 ` Igor Munkin
2020-05-12 9:49 ` [Tarantool-patches] [PATCH v5 02/10] gitlab-ci: enable static analysis with luacheck sergeyb
2020-05-13 14:15 ` Alexander V. Tikhonov
2020-05-13 14:40 ` Sergey Bronnikov
2020-05-26 22:39 ` Igor Munkin
2020-05-28 10:03 ` Sergey Bronnikov
2020-05-12 9:49 ` [Tarantool-patches] [PATCH v5 03/10] Fix luacheck warnings in extra/dist/tarantoolctl.in sergeyb
2020-05-26 23:11 ` Igor Munkin
2020-05-28 10:13 ` Sergey Bronnikov
2020-05-12 9:49 ` [Tarantool-patches] [PATCH v5 04/10] Fix luacheck warnings in src/lua/ sergeyb
2020-05-27 11:22 ` Igor Munkin
2020-05-28 12:22 ` Sergey Bronnikov
2020-05-12 9:50 ` [Tarantool-patches] [PATCH v5 05/10] " sergeyb
2020-05-13 11:13 ` Sergey Bronnikov
2020-05-27 11:22 ` Igor Munkin
2020-05-12 9:50 ` [Tarantool-patches] [PATCH v5 06/10] Fix luacheck warnings in src/box/lua/ sergeyb
2020-05-27 16:54 ` Igor Munkin
2020-05-28 15:16 ` Sergey Bronnikov
2020-05-12 9:50 ` [Tarantool-patches] [PATCH v5 07/10] " sergeyb
2020-05-13 11:14 ` Sergey Bronnikov
2020-05-27 16:54 ` Igor Munkin
2020-05-28 11:19 ` Sergey Bronnikov
2020-05-12 9:50 ` [Tarantool-patches] [PATCH v5 08/10] Fix luacheck warnings in test/ sergeyb
2020-05-29 11:08 ` Igor Munkin
2020-05-29 14:08 ` Sergey Bronnikov
2020-05-12 9:50 ` [Tarantool-patches] [PATCH v5 09/10] Add luacheck supressions for luajit tests sergeyb
2020-05-26 20:45 ` Igor Munkin
2020-05-28 19:25 ` Sergey Bronnikov
2020-05-12 12:28 ` [Tarantool-patches] [PATCH 10/10] build: Enable 'make luacheck' target Sergey Bronnikov
2020-05-26 20:45 ` Igor Munkin
2020-05-28 9:59 ` Sergey Bronnikov
2020-05-26 20:38 ` sergeyb [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c201de753b1e9a755b73190c1032dc3be1a9815.1590524798.git.sergeyb@tarantool.org \
--to=sergeyb@tarantool.org \
--cc=alexander.turenko@tarantool.org \
--cc=o.piskunov@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v5 11/10] test: fix warnings spotted by luacheck' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox