Hi, Sergey
thanks for the patch!
Please describe a reason.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 --- .../{misc/gc_trace.lua => trace/gc.lua} | 27 +++++++++---------- test/LuaJIT-tests/trace/index | 1 + 2 files changed, 14 insertions(+), 14 deletions(-) rename test/LuaJIT-tests/{misc/gc_trace.lua => trace/gc.lua} (60%) diff --git a/test/LuaJIT-tests/misc/gc_trace.lua b/test/LuaJIT-tests/trace/gc.lua similarity index 60% rename from test/LuaJIT-tests/misc/gc_trace.lua rename to test/LuaJIT-tests/trace/gc.lua index bc38ce0c..4d984ed6 100644 --- a/test/LuaJIT-tests/misc/gc_trace.lua +++ b/test/LuaJIT-tests/trace/gc.lua @@ -1,18 +1,18 @@ +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() + for _ = 1, 100 do + loadstring("for _ = 1, 100 do end")() + end + 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 @@ -24,7 +24,7 @@ do end end jit.attach(reccb, "record") - for i=1,200 do + for i = 1, 200 do if i % 5 == 0 then f = function() end elseif f then @@ -34,4 +34,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