[Tarantool-patches] [PATCH luajit v3 12/29] test: adapt PUC-Rio test with count hooks
Sergey Kaplun
skaplun at tarantool.org
Tue Apr 13 16:27:12 MSK 2021
LuaJIT does not check hooks at traces without defined
-DLUAJIT_ENABLE_CHECKHOOK. For more information see <src/lj_record.c>
or commit 6bce6b118eeb2bb7f36157de158e5cccf0ea68e5 (Add compile-time
option LUAJIT_ENABLE_CHECKHOOK. Disabled by default.).
This patch adapts these tests for LuaJIT by disabling JIT while testing
count hooks.
Resolves tarantool/tarantool#5701
Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
test/PUC-Rio-Lua-5.1-tests/db.lua | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
index 6c412170..db69b2df 100644
--- a/test/PUC-Rio-Lua-5.1-tests/db.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
@@ -350,6 +350,18 @@ assert(debug.setupvalue(io.read, 1, 10) == nil)
-- testing count hooks
local a=0
+-- LuaJIT: LuaJIT does not check hooks at traces without defined
+-- -DLUAJIT_ENABLE_CHECKHOOK.
+-- For more information see <src/lj_record.c> or commit
+-- 6bce6b118eeb2bb7f36157de158e5cccf0ea68e5 (Add compile-time
+-- option LUAJIT_ENABLE_CHECKHOOK. Disabled by default.).
+-- See also https://github.com/tarantool/tarantool/issues/5701
+-- Test is adapted for LuaJIT by disabling JIT while
+-- testing count hooks.
+local jit_is_enabled = jit.status()
+if jit_is_enabled then
+ jit.off()
+end
debug.sethook(function (e) a=a+1 end, "", 1)
a=0; for i=1,1000 do end; assert(1000 < a and a < 1012)
debug.sethook(function (e) a=a+1 end, "", 4)
@@ -362,6 +374,9 @@ debug.sethook(print, "", 2^24 - 1) -- count upperbound
local f,m,c = debug.gethook()
assert(({debug.gethook()})[3] == 2^24 - 1)
debug.sethook()
+if jit_is_enabled then
+ jit.on()
+end
-- tests for tail calls
--
2.31.0
More information about the Tarantool-patches
mailing list