[Tarantool-patches] [PATCH v2 luajit 14/30] test: adapt activeline check in the PUC Lua test

Sergey Ostanevich sergos at tarantool.org
Fri Mar 26 17:50:42 MSK 2021


LGTM.
Sergos

> On 26 Mar 2021, at 10:42, Sergey Kaplun <skaplun at tarantool.org> wrote:
> 
> LuaJIT does not report line with single "end" statement
> (the last line of the function) as an active line in
> debug.getinfo(), unlike Lua does. There is no bytecode
> related to this line, so it is "unreachable” and
> c be considered not active.
> 
> This patch excludes the last line of a function from the check,
> considering LuaJIT's behaviour.
> 
> Closes tarantool/tarantool#5708
> Part of tarantool/tarantool#5845
> Part of tarantool/tarantool#4473
> ---
> test/PUC-Lua-5.1-tests/db.lua | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/test/PUC-Lua-5.1-tests/db.lua b/test/PUC-Lua-5.1-tests/db.lua
> index b363abc..c704877 100644
> --- a/test/PUC-Lua-5.1-tests/db.lua
> +++ b/test/PUC-Lua-5.1-tests/db.lua
> @@ -491,7 +491,15 @@ local _, l = coroutine.resume(co, 10)
> local x = debug.getinfo(co, 1, "lfLS")
> assert(x.currentline == l.currentline and x.activelines[x.currentline])
> assert(type(x.func) == "function")
> -for i=x.linedefined + 1, x.lastlinedefined do
> +-- LuaJIT does not report line with single "end" statement
> +-- (the last line of the function) as an active line in
> +-- debug.getinfo(), unlike Lua does. There is no bytecode
> +-- related to this line, so it is "unreachable" and
> +-- may be considered not active.
> +-- See also https://github.com/tarantool/tarantool/issues/5708.
> +-- LuaJIT: Test is adapted for LuaJIT's behaviour by avoiding
> +-- the last line check.
> +for i=x.linedefined + 1, x.lastlinedefined - 1 do
>   assert(x.activelines[i])
>   x.activelines[i] = nil
> end
> -- 
> 2.31.0
> 



More information about the Tarantool-patches mailing list