[Tarantool-patches] [PATCH v2 luajit 22/26] test: enable <ffi_tabov.lua> LuaJIT test
Sergey Kaplun
skaplun at tarantool.org
Tue Feb 6 17:37:08 MSK 2024
Hi, Maxim!
Thanks for the review!
Fixed your comments below.
On 01.02.24, Maxim Kokryashkin wrote:
> Hi, Sergey!
> Thanks for the patch!
> Please consider my comments below.
>
> On Mon, Jan 29, 2024 at 01:45:22PM +0300, Sergey Kaplun wrote:
> > This patch moves the <ffi_tabov.lua> test from the LuaJIT-tests suite to
> > the tarantool-tests suite, because this test should be run separately to
> > avoid overflow of the table with ctypes for other tests from
> > LuaJIT-tests suite.
> >
> > Part of tarantool/tarantool#9398
> > ---
> > test/LuaJIT-tests/lib/ffi/ffi_tabov.lua | 12 -----------
> > test/tarantool-tests/ffi-tabov.test.lua | 27 +++++++++++++++++++++++++
> > 2 files changed, 27 insertions(+), 12 deletions(-)
> > delete mode 100644 test/LuaJIT-tests/lib/ffi/ffi_tabov.lua
> > create mode 100644 test/tarantool-tests/ffi-tabov.test.lua
> >
> > diff --git a/test/LuaJIT-tests/lib/ffi/ffi_tabov.lua b/test/LuaJIT-tests/lib/ffi/ffi_tabov.lua
> > deleted file mode 100644
> > index ba621960..00000000
> > --- a/test/LuaJIT-tests/lib/ffi/ffi_tabov.lua
> > +++ /dev/null
> > @@ -1,12 +0,0 @@
> > -local ffi = require("ffi")
> > -
> > -local last = 0
> > -
> > -assert(pcall(function()
> > - for i=1,65536 do
> > - last = i
> > - ffi.typeof"struct {}"
> > - end
> > -end) == false)
> > -
> > -assert(last > 20000)
> > diff --git a/test/tarantool-tests/ffi-tabov.test.lua b/test/tarantool-tests/ffi-tabov.test.lua
> > new file mode 100644
> > index 00000000..7ea8b24b
> > --- /dev/null
> > +++ b/test/tarantool-tests/ffi-tabov.test.lua
> > @@ -0,0 +1,27 @@
> > +local tap = require('tap')
> > +local ffi = require('ffi')
> > +
> > +-- This test is moved here from the LuaJIT-tests suite since it
> > +-- should be run separately because it exhausts the ctype table.
> > +local test = tap.test('ffi-tabov')
> > +
> > +test:plan(3)
> > +
> > +-- XXX: Amount of ctypes available to the user of a platform.
> Where does this number comes from? Drop a comment.
As you can see it was declared in the suite. I suppose this number is
something empirical. So, I've mentioned that this was declared in the
previous suite.
> > +local MIN_AVAILABLE_CTYPES = 20000
> > +
> > +local last = 0
> > +
> > +local res, errmsg = pcall(function()
> > + for i = 1, 2^16 do
> Drop a comment explaining the number of iterations.
Added, good suggestion! See the iterative patch below.
===================================================================
diff --git a/test/tarantool-tests/ffi-tabov.test.lua b/test/tarantool-tests/ffi-tabov.test.lua
index 7ea8b24b..7de7794d 100644
--- a/test/tarantool-tests/ffi-tabov.test.lua
+++ b/test/tarantool-tests/ffi-tabov.test.lua
@@ -8,12 +8,15 @@ local test = tap.test('ffi-tabov')
test:plan(3)
-- XXX: Amount of ctypes available to the user of a platform.
+-- Was declared in the LuaJIT-tests suite.
local MIN_AVAILABLE_CTYPES = 20000
+-- Maximum available amount of ctypes.
+local CTID_MAX = 2^16
local last = 0
local res, errmsg = pcall(function()
- for i = 1, 2^16 do
+ for i = 1, CTID_MAX do
last = i
ffi.typeof('struct {}')
end
===================================================================
> > + last = i
<snipped>
> >
--
Best regards,
Sergey Kaplun
More information about the Tarantool-patches
mailing list