[Tarantool-patches] [PATCH luajit 26/36] test: enable <misc/stack_purge.lua> LuaJIT test

Sergey Kaplun skaplun at tarantool.org
Wed Aug 14 16:56:08 MSK 2024


This patch moves the aforementioned test from the <misc> to the <trace/>
directory, includes it in <index>, and names the subtest.

Part of tarantool/tarantool#9398
---
 test/LuaJIT-tests/trace/index                     |  1 +
 test/LuaJIT-tests/{misc => trace}/stack_purge.lua | 14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)
 rename test/LuaJIT-tests/{misc => trace}/stack_purge.lua (74%)

diff --git a/test/LuaJIT-tests/trace/index b/test/LuaJIT-tests/trace/index
index 3ab095a7..4826f429 100644
--- a/test/LuaJIT-tests/trace/index
+++ b/test/LuaJIT-tests/trace/index
@@ -8,4 +8,5 @@ hook_record.lua
 jit_flush.lua
 phi
 snap.lua
+stack_purge.lua
 stitch.lua
diff --git a/test/LuaJIT-tests/misc/stack_purge.lua b/test/LuaJIT-tests/trace/stack_purge.lua
similarity index 74%
rename from test/LuaJIT-tests/misc/stack_purge.lua
rename to test/LuaJIT-tests/trace/stack_purge.lua
index bfaee0f3..e4108b20 100644
--- a/test/LuaJIT-tests/misc/stack_purge.lua
+++ b/test/LuaJIT-tests/trace/stack_purge.lua
@@ -1,4 +1,3 @@
-
 -- Must preserve the modified function slot in the RET snapshot.
 local function a()
   local _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_
@@ -12,14 +11,15 @@ local function b()
 end
 
 local function c()
-  for j=1,10 do
-    for i=1,50 do b() b() b() end
+  for _ = 1, 10 do
+    for _ = 1, 50 do b() b() b() end
     collectgarbage()
     local t = {}
-    for i=1,50 do t = {t} end
+    for _ = 1, 50 do t = {t} end
   end
 end
 
-jit.off(c)
-c()
-
+do --- Don't purge the function to return from SNAP.
+  jit.off(c)
+  c()
+end
-- 
2.45.2



More information about the Tarantool-patches mailing list