[Tarantool-patches] [PATCH v2 luajit 19/45] test: enable <misc/hook_record.lua> LuaJIT test
Sergey Kaplun
skaplun at tarantool.org
Wed Aug 21 11:58:22 MSK 2024
This patch moves the aforementioned test from the <misc> to the <trace/>
directory, includes it in <index>, and names the subtest. Also, it
slightly refactors the code to make it closer to our code style.
The test is adjusted to be runable in the test suite by adding the
`jit.flush()` to avoid collisions of traces. Also, the number of
iterations for the compiled loop inside the hook is increased to avoid
hotcount collisions.
Part of tarantool/tarantool#9398
---
test/LuaJIT-tests/misc/hook_record.lua | 8 --------
test/LuaJIT-tests/trace/hook_record.lua | 7 +++++++
test/LuaJIT-tests/trace/index | 1 +
3 files changed, 8 insertions(+), 8 deletions(-)
delete mode 100644 test/LuaJIT-tests/misc/hook_record.lua
create mode 100644 test/LuaJIT-tests/trace/hook_record.lua
diff --git a/test/LuaJIT-tests/misc/hook_record.lua b/test/LuaJIT-tests/misc/hook_record.lua
deleted file mode 100644
index 6f1646de..00000000
--- a/test/LuaJIT-tests/misc/hook_record.lua
+++ /dev/null
@@ -1,8 +0,0 @@
-
-if not jit or not jit.status or not jit.status() then return end
-
-debug.sethook(function() for i=1,100 do end end, "", 10)
-for i=1,10 do end
-debug.sethook()
-assert((require("jit.util").traceinfo(1)))
-
diff --git a/test/LuaJIT-tests/trace/hook_record.lua b/test/LuaJIT-tests/trace/hook_record.lua
new file mode 100644
index 00000000..684e1139
--- /dev/null
+++ b/test/LuaJIT-tests/trace/hook_record.lua
@@ -0,0 +1,7 @@
+do --- Recording traces inside the hook.
+ jit.flush()
+ debug.sethook(function() for _ = 1, 1000 do end end, "", 10)
+ for _ = 1, 10 do end
+ debug.sethook()
+ assert((require("jit.util").traceinfo(1)))
+end
diff --git a/test/LuaJIT-tests/trace/index b/test/LuaJIT-tests/trace/index
index 595a71d2..63af7870 100644
--- a/test/LuaJIT-tests/trace/index
+++ b/test/LuaJIT-tests/trace/index
@@ -4,6 +4,7 @@ exit_jfuncf.lua
gc.lua
gc64_slot_revival.lua
hook_norecord.lua
+hook_record.lua
phi
snap.lua
stitch.lua
--
2.45.2
More information about the Tarantool-patches
mailing list