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 4C6506ECC0; Thu, 16 Dec 2021 17:36:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4C6506ECC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1639665360; bh=fgmXscjkTldiAC1xg4cYlQVV9dXTNCwdXApuXEeNQB4=; 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=WfgJyGisVI6alQNAG44VqeOM1YZnhMd2I1zK0xglnExrMufTbazI/AmtZ7ZJ5Pl8S PrUyMtMzxmpHvHSL/xPIgZxaeyMW1jhFHNdf1BGecxz68/ewiyVOu15mZ4YK/xNOPa vAhgv2yF3KFdyumtc3kzoFogk/0jJD3bpabsgwQ0= Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (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 C3FC96ECC0 for ; Thu, 16 Dec 2021 17:35:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C3FC96ECC0 Received: by smtp51.i.mail.ru with esmtpa (envelope-from ) id 1mxrrQ-0000O7-MY; Thu, 16 Dec 2021 17:35:57 +0300 Date: Thu, 16 Dec 2021 17:34:07 +0300 To: Maxim Kokryashkin Message-ID: References: <20211006130444.3031234-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211006130444.3031234-1-m.kokryashkin@tarantool.org> X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9FFF274446F725B74E2F491ACE130867A35CF0AA67CC42EA9182A05F5380850403AE5C947BF538D2E3F899C0EF2C0ACB657140BB8A24B52D016A38D1B1E0525EB X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79173C6E970493712EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006375448D590B04CE87D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8B488AEC10C16806388A749BDFDA0B67B117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18E5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6BF3059D42242344A089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A55B8DF8A27E0362F4C4340F7C2DA81B06213A71065760A51DD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA759D2A03B9C34326B3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34753B45383CEFF204C56BC86C5542E184A5509D7F18E8AEEA0DDBC41A1E38B928258B6D04914498F41D7E09C32AA3244C9A9BBB3439C8368261249F8BAC2F17D79CA7333006C390A083B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojwI6cKrhU01JXivvRt/os4Q== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB41FC98AD7D39548EC1995DA826D246FFB94C7F056D0A0333CF2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A84198E0F3ECE9B5443453F38A29522196 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: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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. > +assert(a and b == _G) > > > -- tests for multiple yield/resume arguments > -- > 2.33.0 > -- Best regards, Sergey Kaplun