[Tarantool-patches] [PATCH luajit v3 20/29] test: disable PUC-Rio test for getfenv in tailcall
Sergey Kaplun
skaplun at tarantool.org
Tue Apr 13 16:27:20 MSK 2021
Tail calls are not taken into account for call-level counting. So,
`getfenv()` behaviour in LuaJIT is different from Lua 5.1 in tailcalls.
LuaJIT doesn't create an additional frame for tailcalls, just uses
the previous one.
This patch disables test for the return result of `getfenv()` tailcall.
Default value (equals to 1) of `getfenv()` function's argument (function
level) is invalid for this tailcall -- LuaJIT can't provide necessary
debug information for the frame.
Relates to tarantool/tarantool#5713
Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
test/PUC-Rio-Lua-5.1-tests/closure.lua | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/test/PUC-Rio-Lua-5.1-tests/closure.lua b/test/PUC-Rio-Lua-5.1-tests/closure.lua
index fdcfe934..551fe70d 100644
--- a/test/PUC-Rio-Lua-5.1-tests/closure.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/closure.lua
@@ -174,7 +174,15 @@ f = coroutine.wrap(foo)
local a = {}
assert(f(a) == _G)
local a,b = pcall(f)
-assert(a and b == _G)
+-- FIXME: LuaJIT doesn't take into account tail calls for
+-- call-level counting, so `getfenv()` behaviour is different
+-- in tail calls. For example, this `pcall()` returns false,
+-- because `getfenv()` default level is 1 which is invalid for
+-- this case when is called from tail call (`lj_debug_frame()`
+-- returns NULL).
+-- See also https://github.com/tarantool/tarantool/issues/5713.
+-- Test is disabled for LuaJIT for now.
+-- assert(a and b == _G)
-- tests for multiple yield/resume arguments
--
2.31.0
More information about the Tarantool-patches
mailing list