[Tarantool-patches] [PATCH v2 luajit 09/30] test: disable Lua suite tests for line hook

Sergey Kaplun skaplun at tarantool.org
Thu Apr 1 13:06:09 MSK 2021


Igor,

Thanks for the review!

On 01.04.21, Igor Munkin wrote:
> Sergey,
> 
> Thanks for the patch! Please consider the comments below.
> 
> On 26.03.21, Sergey Kaplun wrote:
> > FIXME: LuaJIT interprets a return from a new function loaded by
> 
> Typo: FIXME is excess here (looks like the comment copy-paste).

Fixed.

> 
> > `loadstring()` with a change line number for bytecode position
> > unlike Lua does. This looks like "implementation-defined behaviour"
> 
> Sorry, I can't understand what is written here, though I understand that
> there is a difference between Lua and LuaJIT behaviour and the example
> below. Could you please clarify the sentence above?

===================================================================
test: disable Lua suite tests for line hook

The LuaJIT's virtual machine interprets the bytecode following the
return from function (i.e. the one succeeding the call made) and located
on the line other than that return bytecode, as a new line trigger for
line hooks, unlike Lua does. This looks like "implementation-defined
behaviour" mentioned in https://luajit.org/status.html.

All tests checking the debug hook for a new line of code are affected
and disabled by this patch.

Relates to tarantool/tarantool#5693
Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
===================================================================

> 
> > mentioned in https://luajit.org/status.html.
> > 
> > All tests checked the debug hook for a new line of code are affected
> 
> Typo: s/tests checked/tests checking/.

Fixed.

> 
> > and disabled by this patch.
> > 
> > Relates to tarantool/tarantool#5693
> > Part of tarantool/tarantool#5845
> > Part of tarantool/tarantool#4473
> > ---
> >  test/PUC-Lua-5.1-tests/db.lua | 19 ++++++++++++++++++-
> >  1 file changed, 18 insertions(+), 1 deletion(-)
> > 
> > diff --git a/test/PUC-Lua-5.1-tests/db.lua b/test/PUC-Lua-5.1-tests/db.lua
> > index 9d2c86f..a8c7196 100644
> > --- a/test/PUC-Lua-5.1-tests/db.lua
> > +++ b/test/PUC-Lua-5.1-tests/db.lua
> > @@ -95,6 +95,23 @@ repeat
> >    assert(g(f) == 'a')
> >  until 1
> >  
> > +-- FIXME: LuaJIT interprets a return from calling result of
> > +-- `loadstring()` with a new line number unlike Lua does.
> 
> Meh, I also failed to understand the wording here...

Reformulated as:

===================================================================
-- FIXME: The LuaJIT's virtual machine interprets the bytecode
-- following the return from function (i.e. the one succeeding
-- the call made) and located on the line other than that return
-- bytecode, as a new line trigger for line hooks,
-- unlike Lua does.
===================================================================

> 
> > +-- Here is an example (it is joined in one line intend):
> > +--[[
> > +debug.sethook(function(_, l) print("LINE: "..l) end, "l") loadstring("\n\ns=nil")() debug.sethook()
> > +--]]
> > +-- This chunk prints for LuaJIT:
> > +--[[
> > +LINE: 3
> > +LINE: 1
> > +--]]
> > +-- But for Lua 5.1 it is only "LINE: 3" in the output.
> > +-- See also https://github.com/tarantool/tarantool/issues/5693.
> > +-- Considering implementation-defined behaviour diference
> 
> Typo: s/diference/difference/.

Fixed, thanks!

> 
> > +-- (see also https://luajit.org/status.html) test is disabled for
> > +-- LuaJIT.
> > +--[=[
> >  test([[if
> >  math.sin(1)
> >  then
> > @@ -149,7 +166,7 @@ end
> >  ]], {1,2,1,2,1,3})
> >  
> >  test([[for i=1,4 do a=1 end]], {1,1,1,1,1})
> > -
> > +--]=]
> >  
> >  
> >  print'+'
> > -- 
> > 2.31.0
> > 
> 
> -- 
> Best regards,
> IM

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list