From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id D57C62DCE9F; Mon, 6 Feb 2023 16:27:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D57C62DCE9F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1675690077; bh=W4MAMKswBKv0HmXnI7M8B5AOLXfHtABGEIS6g8zIQ0g=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Id9VpfGLSosUcCYQdLneGowHAIcg41NlK601Uqe346++zuvS/p7tVv6K/Az0EA9lE Lwux8kQ+x3fcY0BREC1fHQQ+wGM6asjI46W6cGMaG/mnGs9rMfaOP8N1Qw11S+o3bq mBF/si+JsqyU73Svk08wgN+sJH4EWp4nsH/1jRcM= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E305B70370 for ; Mon, 6 Feb 2023 16:27:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E305B70370 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1pP1XH-0007UT-1O; Mon, 06 Feb 2023 16:27:55 +0300 Date: Mon, 6 Feb 2023 16:24:25 +0300 To: Sergey Bronnikov Message-ID: References: <821de7208007ffc8f10222761dd264cf0c4a0bb4.1675669159.git.sergeyb@tarantool.org> <75948070-a905-9807-a6d3-44347e80ecc3@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <75948070-a905-9807-a6d3-44347e80ecc3@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9D919194CF4FC660488DBEAA600CFE3E750760201CE27B4E7182A05F538085040689A5A271785044F4B8B4070FBDE40B903C0C2799477F6BAB0C314D3AACD9F34 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7DB6A86BDF2D5A895EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637C59BB75D821356298638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D81E864CC2BEF8121869E91BD75D30B2CE117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3733B5EC72352B9FA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520C24E1E72F37C03A0C26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6C94F115956DE4A7A089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34980A6B448CFD1B8A4D968469644A40C96E7D4CD31A841BB9E531B9A7BAB263FF576AE9664596D6371D7E09C32AA3244C92C0D6F20EE6757BC6CE1C3E961E198A64EE5813BBCA3A9D927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj6shc/GkzDh0urtF/AQG4KQ== X-DA7885C5: 3D43D1B33AF3AA21595B944A2081C433D81A74E7CF5AD1B6DC50CFFD12C4B565262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73933AF1F914F131DBF53F62B0F70383263A5AAE9CD8AB9436070FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH] test: disable cases in PUC-Rio tests for debug line hook X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: Sergey Bronnikov , tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the fixes! LGTM, after fixing a few more nits. On 06.02.23, Sergey Bronnikov wrote: > Hi, Sergey! > > Thanks for a quick review! > > See my answers inline. > > On 2/6/23 11:31, Sergey Kaplun wrote: > > Hi, Sergey! > > > > Thanks for the patch! > > Please consider my comments below. > > > > On 06.02.23, Sergey Bronnikov wrote: > >> From: Sergey Bronnikov > >> > >> 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()`. > Right! Updated  commit message. > > > >> module. > > ^ Those tests rely on specific backtrace, which is changed by > > an additional wrapper for `pairs()`. > > Added to commit message. Nit: "tests" should be in plural form in those sentences as far as the only one test (the one with `pairs()` usage) is broken after introducing `pairs()` wrapper. > > > > > >> 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. > > > Added: > > "Tarantool has a wrapper around builtin function `pairs()`, see see gh-2867. > Testcase below relies on a specific backtrace, which is changed by an > introduced wrapper for `pairs()`." Nit: Please, use `--` comment stile, like elsewhere in this file. Multiline comments are used for debug tests and for quoting some chunks output. Friendly reminder: Don't forget to change linedefined below:). > > > > >> 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") > > =================================================================== > > Reverted a change around call of h() function, updated line number and > added a message to assert with useful information: > > >    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 == 418 and tail.func > == g1, > +           ("linedefined %s, what %s"):format(tail.linedefined, tail.what)) >      assert(getfenv(3)) >      assert(debug.getinfo(3, "S").what == "main") >      print"+" > > > >> > >> 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