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

Sergey Ostanevich sergos at tarantool.org
Fri Mar 26 14:35:29 MSK 2021


Follow-up ticket ?

LGTM.
Sergos

> On 26 Mar 2021, at 10:42, Sergey Kaplun <skaplun at tarantool.org> wrote:
> 
> FIXME: LuaJIT interprets a return from a new function loaded by
> `loadstring()` with a change line number for bytecode position
> unlike Lua does. This looks like "implementation-defined behaviour"
> mentioned in https://luajit.org/status.html.
> 
> All tests checked the debug hook for a new line of code are affected
> 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.
> +-- 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
> +-- (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
> 



More information about the Tarantool-patches mailing list