[Tarantool-patches] [PATCH v2 luajit 09/30] test: disable Lua suite tests for line hook

Igor Munkin imun at tarantool.org
Thu Apr 1 01:59:29 MSK 2021


Sergey,

Thanks for the patch! Please consider the comments below.

On 26.03.21, Sergey Kaplun wrote:
> FIXME: LuaJIT interprets a return from a new function loaded by

Typo: FIXME is excess here (looks like the comment copy-paste).

> `loadstring()` with a change line number for bytecode position
> unlike Lua does. This looks like "implementation-defined behaviour"

Sorry, I can't understand what is written here, though I understand that
there is a difference between Lua and LuaJIT behaviour and the example
below. Could you please clarify the sentence above?

> mentioned in https://luajit.org/status.html.
> 
> All tests checked the debug hook for a new line of code are affected

Typo: s/tests checked/tests checking/.

> and disabled by this patch.
> 
> Relates to tarantool/tarantool#5693
> Part of tarantool/tarantool#5845
> Part of tarantool/tarantool#4473
> ---
>  test/PUC-Lua-5.1-tests/db.lua | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/test/PUC-Lua-5.1-tests/db.lua b/test/PUC-Lua-5.1-tests/db.lua
> index 9d2c86f..a8c7196 100644
> --- a/test/PUC-Lua-5.1-tests/db.lua
> +++ b/test/PUC-Lua-5.1-tests/db.lua
> @@ -95,6 +95,23 @@ repeat
>    assert(g(f) == 'a')
>  until 1
>  
> +-- FIXME: LuaJIT interprets a return from calling result of
> +-- `loadstring()` with a new line number unlike Lua does.

Meh, I also failed to understand the wording here...

> +-- Here is an example (it is joined in one line intend):
> +--[[
> +debug.sethook(function(_, l) print("LINE: "..l) end, "l") loadstring("\n\ns=nil")() debug.sethook()
> +--]]
> +-- This chunk prints for LuaJIT:
> +--[[
> +LINE: 3
> +LINE: 1
> +--]]
> +-- But for Lua 5.1 it is only "LINE: 3" in the output.
> +-- See also https://github.com/tarantool/tarantool/issues/5693.
> +-- Considering implementation-defined behaviour diference

Typo: s/diference/difference/.

> +-- (see also https://luajit.org/status.html) test is disabled for
> +-- LuaJIT.
> +--[=[
>  test([[if
>  math.sin(1)
>  then
> @@ -149,7 +166,7 @@ end
>  ]], {1,2,1,2,1,3})
>  
>  test([[for i=1,4 do a=1 end]], {1,1,1,1,1})
> -
> +--]=]
>  
>  
>  print'+'
> -- 
> 2.31.0
> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list