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 959246F879; Thu, 27 Jan 2022 01:35:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 959246F879 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1643236520; bh=STtCuVIdDz+d58CkhmGHqAukA21WDJOhfzD9UFJNd9o=; 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=V1B67sxXBY1PAVQi68APJEJbVfeobAY+gbYrXEztwnBunQkOs8sxUkvyMe1MGjuoc KtIwFjGizCdydZEHBWzFYs94TQBCyloE1nohW7AqrlcWvVlSLehE+OGTyw9mEpIIRS qWcLuZv11aUd8SnSuGGxZboXWzJhPUxeXLX7IupM= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 C62176F879 for ; Thu, 27 Jan 2022 01:35:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C62176F879 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1nCqsn-0005ry-Ns; Thu, 27 Jan 2022 01:35:18 +0300 Date: Thu, 27 Jan 2022 01:33:53 +0300 To: =?utf-8?B?0JzQsNC60YHQuNC8INCa0L7RgNGP0LrRiNC40L0=?= Message-ID: References: <20211006130444.3031234-1-m.kokryashkin@tarantool.org> <1642462945.143863816@f326.i.mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1642462945.143863816@f326.i.mail.ru> X-Clacks-Overhead: GNU Terry Pratchett X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9AA78FDF62ECAE61F7A922168D8AD45D749A6A71140E6560E182A05F538085040B2D48787590BBDA6D64C89522F9585222691A091EBB143CA43D81877CD901104 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7063907D3CC1FF486EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BB46061768088B55EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BEBC5CAB6D411FFA6B49FA5571DBE83ED33F6C8547B7615E6CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F924B32C592EA89F389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8A9FF340AA05FB58CF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B15F90BA389C56CD675ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A597642FC9F3D1E2F05FDF1CB9F628B4E7082F5DAC259BE3F5D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75968C9853642EB7C3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3483E1FCD56FEA62E6AB10C3AEA44FB2F8E77C1223C39BAB39043AEEFF360A232029B09402927C09101D7E09C32AA3244C6F4893F33F33B77BCF36BBA73CE1704CB018FE5BB746DCD183B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojUxqqD3NEEG2Dl7GGX69vnQ== X-Mailru-Sender: 689FA8AB762F739339CABD9B3CA9A7D6D9B93F5F5C4C4E848403B6067BA77934A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E3365FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] test: adapt test checking global environment 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: Maxim Kokryashkin , tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Max, Thanks for the patch! LGTM, except a couple of typos. On 18.01.22, Максим Корякшин wrote: > > Hello, Sergey! > Thanks for the review! >   > Here is the new commit message: > ================================================================================ > test: adapt test checking global environment >   > LuaJIT doesn't take into account tail calls for > call-level counting, so `getfenv()` behaviour is different > in tail calls. getfenv()` default level is 1 which is invalid for Typo: s/getfenv()`/`getfenv()`/. > the test case when is called from tail call (`lj_debug_frame()` > returns NULL). >   > This commits adds local variables, so there is no tail call any more. >   > Part of tarantool/tarantool#5870 > Resolves tarantool/tarantool#5713 Typo: "Resolves" should go prior to all other GitHub tags ("Part of" in our case). > ================================================================================ >   > And the diff for the comment fix: > ================================================================================ > diff --git a/test/PUC-Rio-Lua-5.1-tests/closure.lua b/test/PUC-Rio-Lua-5.1-tests/closure.lua > index 86f6ad87..c4491dcf 100644 > --- a/test/PUC-Rio-Lua-5.1-tests/closure.lua > +++ b/test/PUC-Rio-Lua-5.1-tests/closure.lua > @@ -170,9 +170,10 @@ local function foo (a) >   >  -- LuaJIT doesn't take into account tail calls for >  -- call-level counting, so `getfenv()` behaviour is different > --- in tail calls. For example, `pcall()` to this functon returns false > --- in case of tailcall, because `getfenv()` default level is 1 which > --- is invalid for this case (`lj_debug_frame()` returns NULL). > +-- in tail calls. For example, `pcall()` to this functon returns Typo: s/functon/function/. > +-- false in case of tailcall, because `getfenv()` default level Typo: "tailcall", but "tail calls". Please choose one option for consistency (at least within a single comment). > +-- is 1 which is invalid for this case (`lj_debug_frame()` > +-- returns NULL). >  -- See also https://github.com/tarantool/tarantool/issues/5713. >    local env = getfenv() >    return env > ================================================================================ >   > Best regards, > Maxim Kokryashkin >   > >  > >>Hi, Maxim! > >> > >>Thanks for the fixes! > >> > >>LGTM, except a few nits below. > >> > >>On 06.10.21, Maxim Kokryashkin wrote: > >>> LuaJIT doesn't take into account tail calls for > >>> call-level counting, so `getfenv()` behaviour is different > >>> in tail calls. getfenv()` default level is 1 which is invalid for > >>> the test case when is called from tail call (`lj_debug_frame()` > >>> returns NULL). > >>> > >>> This commits adds local varibles, so there is no tail call any more. > >> > >>Typo: s/varibles/variables/ > >> > >>> > >>> Part of tarantool/tarantool#5870 > >> > >>It's OK to mention that this patch "Resolves tarantool/tarantool#5713". > >> > >>> --- > >>> Issue: https://github.com/tarantool/tarantool/issues/5713 > >>> GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5713-adapt-test-global-environment-PUC-Rio > >>> CI: https://github.com/tarantool/tarantool/tree/fckxorg/gh-5713-adapt-test-global-environment-PUC-Rio > >>> > >>> test/PUC-Rio-Lua-5.1-tests/closure.lua | 21 +++++++++++---------- > >>> 1 file changed, 11 insertions(+), 10 deletions(-) > >>> > >>> diff --git a/test/PUC-Rio-Lua-5.1-tests/closure.lua b/test/PUC-Rio-Lua-5.1-tests/closure.lua > >>> index 551fe70d..86f6ad87 100644 > >>> --- a/test/PUC-Rio-Lua-5.1-tests/closure.lua > >>> +++ b/test/PUC-Rio-Lua-5.1-tests/closure.lua > >>> @@ -167,22 +167,23 @@ local function foo (a) > >>> assert(getfenv(0) == a) > >>> assert(getfenv(1) == _G) > >>> assert(getfenv(loadstring"") == a) > >>> - return getfenv() > >>> + > >>> +-- LuaJIT doesn't take into account tail calls for > >>> +-- call-level counting, so `getfenv()` behaviour is different > >>> +-- in tail calls. For example, `pcall()` to this functon returns false > >>> +-- in case of tailcall, because `getfenv()` default level is 1 which > >>> +-- is invalid for this case (`lj_debug_frame()` returns NULL). > >>> +-- See also https://github.com/tarantool/tarantool/issues/5713 . > >> > >>Minor: linewidth for comments is 66 symbols. > >> > >>> + local env = getfenv() > >>> + return env > >>> end > >>> > >>> f = coroutine.wrap(foo) > >>> local a = {} > >>> assert(f(a) == _G) > >>> local a,b = pcall(f) > >>> --- FIXME: LuaJIT doesn't take into account tail calls for > >>> --- call-level counting, so `getfenv()` behaviour is different > >>> --- in tail calls. For example, this `pcall()` returns false, > >>> --- because `getfenv()` default level is 1 which is invalid for > >>> --- this case when is called from tail call (`lj_debug_frame()` > >>> --- returns NULL). > >>> --- See also https://github.com/tarantool/tarantool/issues/5713 . > >>> --- Test is disabled for LuaJIT for now. > >>> --- assert(a and b == _G) > >>> +-- Test is adapted to the behavior LuaJIT. See the comment above. Typo: either s/behavior LuaJIT/LuaJIT behavior/ or s/behavior LuaJIT/behavior of LuaJIT/ for this case. > >>> +assert(a and b == _G) > >>> > >>> > >>> -- tests for multiple yield/resume arguments > >>> -- > >>> 2.33.0 > >>> > >> > >>-- > >>Best regards, > >>Sergey Kaplun > >  -- Best regards, IM