<!DOCTYPE html>
<html data-lt-installed="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="padding-bottom: 1px;">
<p>Hi, Sergey!</p>
<p>thanks for the patch!<br>
</p>
<div class="moz-cite-prefix">On 14.08.2024 16:55, Sergey Kaplun
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:5913e9693652ea13ca55be9de17697144df81749.1723638851.git.skaplun@tarantool.org">
<pre class="moz-quote-pre" wrap="">This patch moves the aforementioned test from the <misc> to the <lang/></pre>
</blockquote>
It is not clear why do you move it to another suite/dir.<br>
<blockquote type="cite"
cite="mid:5913e9693652ea13ca55be9de17697144df81749.1723638851.git.skaplun@tarantool.org">
<pre class="moz-quote-pre" wrap="">
directory (with slightly renaming to be consistent with other names),
includes it in <index>, and names the subtest.
Also, it changes the number of iterations to trigger the GC since the
number of objects is different when running the test as a part of the
LuaJIT test suite.
</pre>
</blockquote>
<p>the patch contains minor changes related to formatting.</p>
<p>please describe it in commit message.<br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:5913e9693652ea13ca55be9de17697144df81749.1723638851.git.skaplun@tarantool.org">
<pre class="moz-quote-pre" wrap="">
Part of tarantool/tarantool#9398
---
.../{misc/debug_gc.lua => lang/gc_debug.lua} | 31 ++++++++++++-------
test/LuaJIT-tests/lang/index | 1 +
2 files changed, 20 insertions(+), 12 deletions(-)
rename test/LuaJIT-tests/{misc/debug_gc.lua => lang/gc_debug.lua} (63%)
diff --git a/test/LuaJIT-tests/misc/debug_gc.lua b/test/LuaJIT-tests/lang/gc_debug.lua
similarity index 63%
rename from test/LuaJIT-tests/misc/debug_gc.lua
rename to test/LuaJIT-tests/lang/gc_debug.lua
index 30fb2b99..bb30adc1 100644
--- a/test/LuaJIT-tests/misc/debug_gc.lua
+++ b/test/LuaJIT-tests/lang/gc_debug.lua
@@ -1,12 +1,7 @@
-
--- Do not run this test unless the JIT compiler is turned off.
-if jit and jit.status and jit.status() then return end
-
local caught, caught_line, caught_mm
local function gcmeta()
if caught ~= "end" then
--- print(debug.traceback())
-- This may point to the wrong instruction if in a JIT trace.
-- But there's no guarantee if, when or where any GC steps occur.
local dbg = debug.getinfo(2)
@@ -22,7 +17,7 @@ local function testgc(mm, f)
local u = newproxy(true)
getmetatable(u).__gc = gcmeta
u = nil
- for i=1,100000 do
+ for i = 1, 1e7 do
f(i)
-- This check may be hoisted. __gc is not supposed to have side-effects.
if caught then break end
@@ -38,10 +33,22 @@ local function testgc(mm, f)
end
end
-local x
-testgc("__gc", function(i) x = {} end)
-testgc("__gc", function(i) x = {1} end)
-testgc("__gc", function(i) x = function() end end)
-testgc("__concat", function(i) x = i.."" end)
+do --- Test __gc metamethod info
+ -- Do not run this test unless the JIT compiler is turned off.
+ local jit_need_restore = false
+ if jit and jit.status and jit.status() then
+ jit_need_restore = true
+ jit.off()
+ end
+
+ local x
+ testgc("__gc", function(i) x = {} end)
+ testgc("__gc", function(i) x = {1} end)
+ testgc("__gc", function(i) x = function() end end)
+ testgc("__concat", function(i) x = i.."" end)
-caught = "end"
+ caught = "end"
+ if jit_need_restore then
+ jit.on()
+ end
+end
diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index
index 803f32d8..4d9feafd 100644
--- a/test/LuaJIT-tests/lang/index
+++ b/test/LuaJIT-tests/lang/index
@@ -17,5 +17,6 @@ upvalue
tail_recursion.lua
vararg_jit.lua
gc.lua
+gc_debug.lua
goto.lua +goto
meta
</pre>
</blockquote>
</body>
<lt-container></lt-container>
</html>