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 056ED6F3C7; Fri, 26 Mar 2021 17:26:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 056ED6F3C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616768795; bh=U8YtijQcmKwsgf0RKXYAvYKU1P/Up9w5WqCfL4dMSk4=; 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=zJe2k3shrYRYsDrTg+WqdrZpOhanfIWG8mzn33OYJXmmtZP63JoM9ToTu7BvZiPJB veXVRhFS/kCXEHGcoHP5RBvJ0BRBkv8ULKUUDTenYjS47YldLK68eZGDvamWAY0CUG VTqG29uRo1OlVVPd4a/+ZpR2xk5XM6XulQ52YJ7g= Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (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 21B926F3C7 for ; Fri, 26 Mar 2021 17:26:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 21B926F3C7 Received: by smtp16.mail.ru with esmtpa (envelope-from ) id 1lPnQ1-0002fI-2Z; Fri, 26 Mar 2021 17:26:33 +0300 Date: Fri, 26 Mar 2021 17:25:40 +0300 To: Sergey Ostanevich Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32941B7C4A78AC10F96A7797F60C25BD4B06182A05F53808504063F0132423A4BE7B25721DBD7D6DB4D0ED5BD4377B3A7E56A31C0D5947440C8F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A4C4638C9DDF45FCEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063770398A047C76876C8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C5DD32608FC869F5D00001FB0951E3396D1EDAE0AF23DAA71A471835C12D1D9774AD6D5ED66289B5259CC434672EE6371117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA71A620F70A64A45A98AA50765F790063735872C767BF85DA227C277FBC8AE2E8B654CE8ED7C2D004275ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A52E8825089F2D9395C0538C6B9730F3DC58000F8A3ED3760ED59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3473457D764E1CDE7708A6C16FCAAF9AA11DD89959A92B9CD4D48E75889D5F3017AAD12673001212FF1D7E09C32AA3244C11BDE08B504649F742C8D48F9CDB2BF363871F383B54D9B3FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojapPp7P/VpAiJAuDfCJR+mA== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB4DC34BAA09011FA884165D5D0E68AD5672319BAC72B65BB30F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 03/30] test: adapt Lua 5.1 suite for out-of-source build 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! Thanks for the review! On 26.03.21, Sergey Ostanevich wrote: > LGTM, just minor changes to commit message. > > Sergos > > > > On 26 Mar 2021, at 10:42, Sergey Kaplun wrote: > > > > When tests are run out-of-source redefined `dofile()` function > ^ I had problem reading here the > ‘out-of-source redefined’. Can you put the ‘when..’ to the appropriate > place at the end of the sentence? ’The redefined … when … ‘ Fixed. The new committ message is the following (branch is force-pushed): =================================================================== test: adapt Lua 5.1 suite for out-of-source build When tests are run out-of-source redefined `dofile()` function failed to find the test file to load. So, fullpath is detected considering `arg[0]` value. Moreover, some tests use `loadfile()` instead, so their argument is adjusted to the full path to the files. However, test in creates a temporary file and executes it via `dofile()` too, so this case is handled by the second argument -- `prefix` equals an empty string for current working directory. Part of tarantool/tarantool#5845 Part of tarantool/tarantool#4473 =================================================================== > > > failed to find file to load. So, fullpath is detected considering > > `arg[0]` value. Moreover, some tests use `loadfile()` instead, so > > their argument is adjusted to the full path to the files. > > > > However, test in creates a temporary file > > and executes it via `dofile()` too, so this case is handled by > > the second argument -- `prefix` equals an empty string for > > current working directory. > > > > Part of tarantool/tarantool#5845 > > Part of tarantool/tarantool#4473 > > --- > > test/PUC-Lua-5.1-tests/all.lua | 17 +++++++++++++---- > > test/PUC-Lua-5.1-tests/verybig.lua | 4 +++- > > 2 files changed, 16 insertions(+), 5 deletions(-) > > > > diff --git a/test/PUC-Lua-5.1-tests/all.lua b/test/PUC-Lua-5.1-tests/all.lua > > index 8c4afac..85beff8 100755 > > --- a/test/PUC-Lua-5.1-tests/all.lua > > +++ b/test/PUC-Lua-5.1-tests/all.lua > > @@ -58,9 +58,18 @@ end > > -- > > -- redefine dofile to run files through dump/undump > > -- > > -dofile = function (n) > > +-- LuaJIT: Adapt tests for testing with out-of-source build. > > +-- XXX: Test in creates a temporary file > > +-- and executes it via `dofile()` too, so this case is handled by > > +-- the second argument -- `prefix` equals an empty string for > > +-- current working directory. > > +-- is in the same directory, where are other common > > +-- executed files situated. > > +local path_to_sources = arg[0]:gsub('([^/]+)%.lua$', '') > > +dofile = function (n, prefix) > > + local pr = prefix or path_to_sources > > showmem() > > - local f = assert(loadfile(n)) > > + local f = assert(loadfile(pr..n)) > > local b = string.dump(f) > > f = assert(loadstring(b)) > > return f() > > @@ -77,7 +86,7 @@ do > > end > > end > > > > -local f = assert(loadfile('gc.lua')) > > +local f = assert(loadfile(path_to_sources..'gc.lua')) > > f() > > dofile('db.lua') > > assert(dofile('calls.lua') == deep and deep) > > @@ -88,7 +97,7 @@ assert(dofile('locals.lua') == 5) > > dofile('constructs.lua') > > dofile('code.lua') > > do > > - local f = coroutine.wrap(assert(loadfile('big.lua'))) > > + local f = coroutine.wrap(assert(loadfile(path_to_sources..'big.lua'))) > > assert(f() == 'b') > > assert(f() == 'a') > > end > > diff --git a/test/PUC-Lua-5.1-tests/verybig.lua b/test/PUC-Lua-5.1-tests/verybig.lua > > index 59e0142..edb170d 100644 > > --- a/test/PUC-Lua-5.1-tests/verybig.lua > > +++ b/test/PUC-Lua-5.1-tests/verybig.lua > > @@ -93,7 +93,9 @@ for s in string.gmatch(prog, "$([^$]+)") do > > if not n then io.write(s) else F[n]() end > > end > > io.close() > > -result = dofile(file) > > +-- LuaJIT: Adapt test for testing with out-of-source build. > > +-- See comment in near `dofile()` redefinition. > > +result = dofile(file, "") > > assert(os.remove(file)) > > print'OK' > > return result > > -- > > 2.31.0 > > > -- Best regards, Sergey Kaplun