Sergey,

On 21.08.2024 11:58, Sergey Kaplun wrote:
This patch moves the aforementioned test from the <misc> to the <trace/>
directory, includes it in <index>, and names subtests.

The first test is adjusted to be runable in the test suite.

Part of tarantool/tarantool#9398
---
thanks for the patch! LGTM
 .../{misc/gc_trace.lua => trace/gc.lua}       | 30 +++++++++++--------
 test/LuaJIT-tests/trace/index                 |  1 +
 2 files changed, 18 insertions(+), 13 deletions(-)
 rename test/LuaJIT-tests/{misc/gc_trace.lua => trace/gc.lua} (56%)

diff --git a/test/LuaJIT-tests/misc/gc_trace.lua b/test/LuaJIT-tests/trace/gc.lua
similarity index 56%
rename from test/LuaJIT-tests/misc/gc_trace.lua
rename to test/LuaJIT-tests/trace/gc.lua
index bc38ce0c..43d7ae55 100644
--- a/test/LuaJIT-tests/misc/gc_trace.lua
+++ b/test/LuaJIT-tests/trace/gc.lua
@@ -1,18 +1,23 @@
+local jutil = require("jit.util")
 
-if not jit or not jit.status or not jit.status() then return end
-
-collectgarbage()
-for j=1,100 do
-  loadstring("for i=1,100 do end")()
+do --- Collect dead traces.
+  jit.flush()
+  collectgarbage()
+  -- Prevent the creation of side traces.
+  jit.off()
+  for j=1,100 do
+    jit.on()
+    loadstring("for i=1,100 do end")()
+    jit.off()
+  end
+  jit.on()
+  collectgarbage()
+  assert(jutil.traceinfo(1) == nil)
+  assert(jutil.traceinfo(2) == nil)
+  assert(jutil.traceinfo(3) == nil)
 end
-local jutil = require("jit.util")
-assert(jutil.traceinfo(90) == nil)
-collectgarbage()
-assert(jutil.traceinfo(1) == nil)
-assert(jutil.traceinfo(2) == nil)
-assert(jutil.traceinfo(3) == nil)
 
-do
+do --- Check KGC marking.
   local f
   local function reccb(tr)
     if f == nil then
@@ -34,4 +39,3 @@ do
   end
   jit.attach(reccb)
 end
-
diff --git a/test/LuaJIT-tests/trace/index b/test/LuaJIT-tests/trace/index
index ea7a22e0..46c8f5d2 100644
--- a/test/LuaJIT-tests/trace/index
+++ b/test/LuaJIT-tests/trace/index
@@ -1,6 +1,7 @@
 exit_frame.lua
 exit_growstack.lua
 exit_jfuncf.lua
+gc.lua
 gc64_slot_revival.lua
 phi
 snap.lua