[Tarantool-patches] [PATCH] test: disable cases in PUC-Rio tests for debug line hook
Sergey Kaplun
skaplun at tarantool.org
Mon Feb 6 11:31:04 MSK 2023
Hi, Sergey!
Thanks for the patch!
Please consider my comments below.
On 06.02.23, Sergey Bronnikov wrote:
> From: Sergey Bronnikov <sergeyb at 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
More information about the Tarantool-patches
mailing list