Hi, Sergey

thanks for the patch! LGTM


On 14.08.2024 16:55, Sergey Kaplun wrote:
This patch moves the aforementioned test from the <misc> to the <trace/>
directory, includes it in <index>, and names the subtest.

The test is adjusted to be runable in the test suite by adding the
`jit.flush()` to avoid collisions of traces.

Part of tarantool/tarantool#9398
---
 test/LuaJIT-tests/misc/hook_norecord.lua  | 12 ------------
 test/LuaJIT-tests/trace/hook_norecord.lua | 12 ++++++++++++
 test/LuaJIT-tests/trace/index             |  1 +
 3 files changed, 13 insertions(+), 12 deletions(-)
 delete mode 100644 test/LuaJIT-tests/misc/hook_norecord.lua
 create mode 100644 test/LuaJIT-tests/trace/hook_norecord.lua

diff --git a/test/LuaJIT-tests/misc/hook_norecord.lua b/test/LuaJIT-tests/misc/hook_norecord.lua
deleted file mode 100644
index 8e7cba05..00000000
--- a/test/LuaJIT-tests/misc/hook_norecord.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-
-if not jit or not jit.status or not jit.status() then return end
-
-local called = false
-local function f() local x = "wrong"; called = true end
-jit.off(f)
-debug.sethook(f, "", 5)
-for i=1,1000 do local a,b,c,d,e,f=1,2,3,4,5,6 end
-assert(called)
--- Check that no trace was generated.
-assert(require("jit.util").traceinfo(1) == nil)
-
diff --git a/test/LuaJIT-tests/trace/hook_norecord.lua b/test/LuaJIT-tests/trace/hook_norecord.lua
new file mode 100644
index 00000000..4c39bade
--- /dev/null
+++ b/test/LuaJIT-tests/trace/hook_norecord.lua
@@ -0,0 +1,12 @@
+do --- Abort trace recording on any hook call.
+  local called = false
+  local function f() local x = "wrong"; called = true end
+  jit.off(f)
+  jit.flush()
+  debug.sethook(f, "", 5)
+  for _ = 1, 1000 do local a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 end
+  assert(called)
+  -- Check that no trace was generated.
+  assert(require("jit.util").traceinfo(1) == nil)
+  debug.sethook()
+end
diff --git a/test/LuaJIT-tests/trace/index b/test/LuaJIT-tests/trace/index
index 46c8f5d2..595a71d2 100644
--- a/test/LuaJIT-tests/trace/index
+++ b/test/LuaJIT-tests/trace/index
@@ -3,6 +3,7 @@ exit_growstack.lua
 exit_jfuncf.lua
 gc.lua
 gc64_slot_revival.lua
+hook_norecord.lua
 phi
 snap.lua
 stitch.lua