[Tarantool-patches] [PATCH v2 luajit 35/45] test: enable <misc/stackovc.lua> LuaJIT test

Sergey Kaplun skaplun at tarantool.org
Thu Aug 22 17:36:50 MSK 2024


Hi, Sergey!
Thanks for the review!
Please consider my answer below.

On 22.08.24, Sergey Bronnikov wrote:
> Sergey,
> 
> On 21.08.2024 11:58, Sergey Kaplun wrote:
> > 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 subtest.
> >
> > Part of tarantool/tarantool#9398
> > ---
> thanks for the patch! LGTM with comment below.
> >   test/LuaJIT-tests/lang/index         |  1 +
> >   test/LuaJIT-tests/lang/stackov_c.lua | 12 ++++++++++++
> May be "stackoverflow_coro.lua"?

I suppose the main idea is the possible stack overflow in the C function
(more accurate built-in function) `unpack`. I prefer to leave the old
name to avoid confusion.

> >   test/LuaJIT-tests/misc/stackovc.lua  |  4 ----
> >   3 files changed, 13 insertions(+), 4 deletions(-)
> >   create mode 100644 test/LuaJIT-tests/lang/stackov_c.lua
> >   delete mode 100644 test/LuaJIT-tests/misc/stackovc.lua
> >
> > diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index
> > index fa6db3c3..8da748d0 100644
> > --- a/test/LuaJIT-tests/lang/index
> > +++ b/test/LuaJIT-tests/lang/index
> > @@ -18,6 +18,7 @@ modulo.lua
> >   concat.lua
> >   self.lua
> >   stackov.lua
> > +stackov_c.lua
> >   table.lua
> >   parse_comp.lua
> >   parse_esc.lua
> > diff --git a/test/LuaJIT-tests/lang/stackov_c.lua b/test/LuaJIT-tests/lang/stackov_c.lua
> > new file mode 100644
> > index 00000000..cea1a09e
> > --- /dev/null
> > +++ b/test/LuaJIT-tests/lang/stackov_c.lua
> > @@ -0,0 +1,12 @@
> > +do --- Too many results to unpack.
> > +  local j = 1e4
> > +  local co = coroutine.create(function()
> > +    local t = {}
> > +    for i = 1, j do
> > +      t[i] = i
> > +    end
> > +    return unpack(t)
> > +  end)
> > +  local ok, err = coroutine.resume(co)
> > +  assert(not ok and string.find(err, "unpack"))
> > +end
> > diff --git a/test/LuaJIT-tests/misc/stackovc.lua b/test/LuaJIT-tests/misc/stackovc.lua
> > deleted file mode 100644
> > index c00bcbd8..00000000
> > --- a/test/LuaJIT-tests/misc/stackovc.lua
> > +++ /dev/null
> > @@ -1,4 +0,0 @@
> > -local j = 1e4
> > -local co = coroutine.create(function() t = {} for i = 1, j do t[i] = i end return unpack(t) end)
> > -local ok, err = coroutine.resume(co)
> > -assert(not ok and string.find(err, "unpack"))

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list