Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Bronnikov <estetus@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] test: disable cases in PUC-Rio tests for debug line hook
Date: Mon, 6 Feb 2023 11:31:04 +0300	[thread overview]
Message-ID: <Y+C6yA5mfS7kKdfg@root> (raw)
In-Reply-To: <821de7208007ffc8f10222761dd264cf0c4a0bb4.1675669159.git.sergeyb@tarantool.org>

Hi, Sergey!

Thanks for the patch!
Please consider my comments below.

On 06.02.23, Sergey Bronnikov wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> In order to fix issue [1] it is required to introduce a wrapper for
> `__pairs()`. This wrapper breaks a couple of tests for builtin debug

IINM, it's not for the metamethod `__pairs`, but for the built-in
function `pairs()`.

> module.
          ^ Those tests rely on specific backtrace, which is changed by
  an additional wrapper for `pairs()`.

>         Patch disables testcases when running under Tarantool.
> 
> 1. https://github.com/tarantool/tarantool/issues/2867
> ---
>  test/PUC-Rio-Lua-5.1-tests/db.lua | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
> index b148c2dd..b05075bb 100644
> --- a/test/PUC-Rio-Lua-5.1-tests/db.lua
> +++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
> @@ -169,10 +169,12 @@ test([[for i=1,3 do
>  end
>  ]], {1,2,1,2,1,2,1,3})
>  
> +if not _TARANTOOL then

Minor: It will be nice to add the comment about the wrapper for
`pairs()` in Tarantool here.

>  test([[for i,v in pairs{'a','b'} do
>    a=i..v
>  end
>  ]], {1,2,1,2,1,3})
> +end
>  
>  -- Test is adapted to the behaviour of LuaJIT, as it generates
>  -- only four line events, unlike Lua, which generates five
> @@ -411,7 +413,9 @@ function g1(x) g(x) end
>  
>  local function h (x) local f=g1; return f(x) end
>  
> +if not _TARANTOOL then
>  h(true)
> +end

These changes don't fix the problem for the test in LuaJIT [1]:

| src/luajit: test/PUC-Rio-Lua-5.1-tests/db.lua:403: assertion failed!
| stack traceback:
|         [C]: in function 'assert'
|         test/PUC-Rio-Lua-5.1-tests/db.lua:403: in function 'g'
|         test/PUC-Rio-Lua-5.1-tests/db.lua:412: in function 'h'
|         test/PUC-Rio-Lua-5.1-tests/db.lua:417: in function '_dofile'
|         test/PUC-Rio-Lua-5.1-tests/all.lua:89: in main chunk
|         [C]: at 0x56039b641064
As far as the linedefined number for `g1()` function is changed.

I suggest the following patch (without comments to add) (haven't checked
it on Tarantool):
===================================================================
diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua
index b05075bb..550debdc 100644
--- a/test/PUC-Rio-Lua-5.1-tests/db.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/db.lua
@@ -400,7 +400,7 @@ local function f (x)
   if x then
     assert(debug.getinfo(1, "S").what == "Lua")
     local tail = debug.getinfo(2)
-    assert(tail.what == "Lua" and tail.linedefined == 410 and tail.func == g1)
+    assert(tail.what == "Lua" and tail.linedefined == 412 and tail.func == g1)
     assert(getfenv(3))
     assert(debug.getinfo(3, "S").what == "main")
     print"+"
@@ -413,9 +413,7 @@ function g1(x) g(x) end
 
 local function h (x) local f=g1; return f(x) end
 
-if not _TARANTOOL then
 h(true)
-end
 
 local b = {}
 debug.sethook(function (e) table.insert(b, e) end, "cr")
===================================================================

>  
>  local b = {}
>  debug.sethook(function (e) table.insert(b, e) end, "cr")
> -- 
> 2.34.1
> 

[1]: https://github.com/tarantool/luajit/actions/runs/4101439522/jobs/7073225472

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2023-02-06  8:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06  7:44 Sergey Bronnikov via Tarantool-patches
2023-02-06  8:31 ` Sergey Kaplun via Tarantool-patches [this message]
2023-02-06 12:17   ` Sergey Bronnikov via Tarantool-patches
2023-02-06 13:24     ` Sergey Kaplun via Tarantool-patches
2023-02-06 14:01       ` Sergey Bronnikov via Tarantool-patches
2023-02-08 17:23 ` Alexander Turenko via Tarantool-patches
2023-02-09  7:39   ` Sergey Kaplun via Tarantool-patches
2023-02-10 16:18 ` Igor Munkin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+C6yA5mfS7kKdfg@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=estetus@gmail.com \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] test: disable cases in PUC-Rio tests for debug line hook' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox