[Tarantool-patches] [PATCH luajit v3 14/29] test: adapt PUC-Rio test with activeline check

Sergey Kaplun skaplun at tarantool.org
Tue Apr 13 16:27:14 MSK 2021


LuaJIT does not report the 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.

This patch excludes the last line of the function from the check,
considering LuaJIT's behaviour.

Resolves tarantool/tarantool#5708
Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
 test/PUC-Rio-Lua-5.1-tests/db.lua | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
index f81b86cf..9ad58264 100644
--- a/test/PUC-Rio-Lua-5.1-tests/db.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
@@ -495,7 +495,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: LuaJIT does not report the 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.
+-- 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