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

Sergey Kaplun skaplun at tarantool.org
Wed Aug 14 16:55:53 MSK 2024


This patch moves the aforementioned test from the <misc> to the <lang/>
directory (with slightly renaming to be consistent with other names),
includes it in <index>, and names the subtests.

Part of tarantool/tarantool#9398
---
 test/LuaJIT-tests/lang/gc_step.lua | 39 ++++++++++++++++++++++++++++++
 test/LuaJIT-tests/lang/index       |  1 +
 test/LuaJIT-tests/misc/gcstep.lua  | 33 -------------------------
 3 files changed, 40 insertions(+), 33 deletions(-)
 create mode 100644 test/LuaJIT-tests/lang/gc_step.lua
 delete mode 100644 test/LuaJIT-tests/misc/gcstep.lua

diff --git a/test/LuaJIT-tests/lang/gc_step.lua b/test/LuaJIT-tests/lang/gc_step.lua
new file mode 100644
index 00000000..756d7a61
--- /dev/null
+++ b/test/LuaJIT-tests/lang/gc_step.lua
@@ -0,0 +1,39 @@
+local function testgc(what, func)
+  collectgarbage()
+  local oc = gcinfo()
+  func()
+  local nc = gcinfo()
+  assert(nc < oc * 4, "GC step missing for " .. what)
+end
+
+do --- TNEW
+  testgc("TNEW", function()
+    for _ = 1, 10000 do
+      local _ = {}
+    end
+  end)
+end
+
+do --- TDUP
+  testgc("TDUP", function()
+    for _ = 1, 10000 do
+      local _ = {1}
+    end
+  end)
+end
+
+do --- FNEW
+  testgc("FNEW", function()
+    for _ = 1, 10000 do
+      local function _() end
+    end
+  end)
+end
+
+do --- CAT
+  testgc("CAT", function()
+    for i = 1, 10000 do
+      local _ = "x" .. i
+    end
+  end)
+end
diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index
index b0e7f073..274425bf 100644
--- a/test/LuaJIT-tests/lang/index
+++ b/test/LuaJIT-tests/lang/index
@@ -19,5 +19,6 @@ tail_recursion.lua
 vararg_jit.lua
 gc.lua
 gc_debug.lua
+gc_step.lua
 goto.lua +goto
 meta
diff --git a/test/LuaJIT-tests/misc/gcstep.lua b/test/LuaJIT-tests/misc/gcstep.lua
deleted file mode 100644
index 533356b7..00000000
--- a/test/LuaJIT-tests/misc/gcstep.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-
-local function testgc(what, func)
-  collectgarbage()
-  local oc = gcinfo()
-  func()
-  local nc = gcinfo()
-  assert(nc < oc*4, "GC step missing for "..what)
-end
-
-testgc("TNEW", function()
-  for i=1,10000 do
-    local t = {}
-  end
-end)
-
-testgc("TDUP", function()
-  for i=1,10000 do
-    local t = {1}
-  end
-end)
-
-testgc("FNEW", function()
-  for i=1,10000 do
-    local function f() end
-  end
-end)
-
-testgc("CAT", function()
-  for i=1,10000 do
-    local s = "x"..i
-  end
-end)
-
-- 
2.45.2



More information about the Tarantool-patches mailing list