[Tarantool-patches] [PATCH v2 luajit 13/30] test: disable PUC Lua test for tail call info

Sergey Ostanevich sergos at tarantool.org
Fri Mar 26 17:43:47 MSK 2021


LGTM.
Sergos

> On 26 Mar 2021, at 10:42, Sergey Kaplun <skaplun at tarantool.org> wrote:
> 
> LuaJIT does not provide information about tail calls in debug.getinfo(),
> unlike Lua does. This missed feature is described in
> https://luajit.org/status.html.
> 
> This patch disables tests for tail call checks and getfenv() checks,
> because tail calls do not provide an additional level for LuaJIT
> and level number given to getfenv() should be changed.
> 
> Relates to tarantool/tarantool#5702
> Relates to tarantool/tarantool#5703
> Part of tarantool/tarantool#5845
> Part of tarantool/tarantool#4473
> ---
> test/PUC-Lua-5.1-tests/db.lua | 30 ++++++++++++++++++++++--------
> 1 file changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/test/PUC-Lua-5.1-tests/db.lua b/test/PUC-Lua-5.1-tests/db.lua
> index c1a635a..b363abc 100644
> --- a/test/PUC-Lua-5.1-tests/db.lua
> +++ b/test/PUC-Lua-5.1-tests/db.lua
> @@ -400,19 +400,29 @@ function g1(x) g(x) end
> 
> local function h (x) local f=g1; return f(x) end
> 
> -h(true)
> +-- LuaJIT does not provide information about tail calls,
> +-- unlike Lua does. See also https://luajit.org/status.html.
> +-- getfenv() behaviour is also different here,
> +-- because tail calls do not provide additional level for LuaJIT
> +-- and level number should be changed.
> +-- FIXME: Test is disabled for LuaJIT.
> +-- See also https://github.com/tarantool/tarantool/issues/5702.
> +-- h(true)
> 
> local b = {}
> -debug.sethook(function (e) table.insert(b, e) end, "cr")
> -h(false)
> -debug.sethook()
> +-- Behavior is different for LuaJIT. See the comment above.
> +-- FIXME: Test is disabled for LuaJIT.
> +-- debug.sethook(function (e) table.insert(b, e) end, "cr")
> +-- h(false)
> +-- debug.sethook()
> local res = {"return",   -- first return (from sethook)
>   "call", "call", "call", "call",
>   "return", "tail return", "return", "tail return",
>   "call",    -- last call (to sethook)
> }
> -for _, k in ipairs(res) do assert(k == table.remove(b, 1)) end
> -
> +-- Behavior is different for LuaJIT. See the comment above.
> +-- FIXME: Test is disabled for LuaJIT.
> +-- for _, k in ipairs(res) do assert(k == table.remove(b, 1)) end
> 
> lim = 30000
> local function foo (x)
> @@ -423,7 +433,9 @@ local function foo (x)
>   end
> end
> 
> -foo(lim)
> +-- Behavior is different for LuaJIT. See the comment above.
> +-- FIXME: Test is disabled for LuaJIT.
> +-- foo(lim)
> 
> 
> print"+"
> @@ -459,7 +471,9 @@ end
> 
> local co = coroutine.create(f)
> coroutine.resume(co, 3)
> -checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"})
> +-- Behavior is different for LuaJIT. See the comment to h() above.
> +-- FIXME: Test is disabled for LuaJIT.
> +-- checktraceback(co, {"yield", "db.lua", "tail", "tail", "tail"})
> 
> 
> co = coroutine.create(function (x)
> -- 
> 2.31.0
> 



More information about the Tarantool-patches mailing list