Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Bronnikov <sergeyb@tarantool.org>,
	tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v7] test: fix luacheck warnings in test/long_run-py
Date: Thu, 14 Jan 2021 22:46:40 +0100	[thread overview]
Message-ID: <df61c5e2-27a2-554a-5dbc-8225541ab314@tarantool.org> (raw)
In-Reply-To: <6fd57789-56ce-6ce3-fc95-f946beda5bee@tarantool.org>

>>> 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.
> 
> It is still not unclear for me why luacheck complains here.
> 
> result table declared before a loop and scope for it is a whole function body, what's wrong?
> 
> Similar lua chunk successfully executed by puc lua:
> 
> local result = {}
> local i = 0
> while i == 0 do
>     result[i] = 1
> end

Your chunk is similar, but not the same. Originally you used 'local result[i] = ...'
expression which is obviously wrong. You can't "declare" a table member as local.
'result[i]' is not a valid variable name, so it can't be used with 'local' keyword
to declare it as a variable.

>>> 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 ';'.
>>
> Fixed in a branch.

I realized suite.lua functions are never used. The file is imported in
long_run-py/box.lua, but the imported functions are not used. I deleted
it and the tests pass. I suggest you to delete this file entirely:

====================
diff --git a/test/long_run-py/box.lua b/test/long_run-py/box.lua
index b4f65dcdb..354e680b4 100644
--- a/test/long_run-py/box.lua
+++ b/test/long_run-py/box.lua
@@ -1,7 +1,5 @@
 #!/usr/bin/env tarantool
 
-require('suite')
-
 os.execute("rm -rf vinyl_test")
 os.execute("mkdir -p vinyl_test")
 
diff --git a/test/long_run-py/suite.ini b/test/long_run-py/suite.ini
index 110bbb548..7561fdb5a 100644
--- a/test/long_run-py/suite.ini
+++ b/test/long_run-py/suite.ini
@@ -5,7 +5,6 @@ script = box.lua
 long_run =  finalizers.test.py
 valgrind_disabled =
 release_disabled =
-lua_libs = suite.lua
 use_unix_sockets = True
 use_unix_sockets_iproto = True
 is_parallel = True

+ delete suite.lua file.

  parent reply	other threads:[~2021-01-14 21:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 14:35 Sergey Bronnikov via Tarantool-patches
2021-01-13 17:04 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-14  8:13   ` Sergey Bronnikov via Tarantool-patches
2021-01-14  8:24     ` Sergey Bronnikov via Tarantool-patches
2021-01-14 21:46     ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-01-15  9:47       ` Sergey Bronnikov via Tarantool-patches
2021-01-15 22:20 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-18 13:43 ` Kirill Yukhin via Tarantool-patches

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=df61c5e2-27a2-554a-5dbc-8225541ab314@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v7] test: fix luacheck warnings in test/long_run-py' \
    /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