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 DF8A76EC56; Mon, 15 Mar 2021 21:34:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DF8A76EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1615833262; bh=rQOhKdDMFSMngfz+F3bJ1nSpjSWfLlYT71uHMhs9h2c=; 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=BjGvRUfEJvcrJ7QHw0rvrfzOXnLICAJKESppeVuuzu6jlqZeSNvRxi0LrOZ8P3+I8 VEWiFka4E4tpRjDQUjEKs3wIdF5G5sDwv+6h/lC7CqJaaDYet20PFR6UoyZddqw+e7 J76Kl5rA3df4EP06l+VHr87UqhV+IvhrcArA+dpc= Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (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 08E646EC56 for ; Mon, 15 Mar 2021 21:34:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 08E646EC56 Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1lLs2m-0006Sl-45; Mon, 15 Mar 2021 21:34:20 +0300 Date: Mon, 15 Mar 2021 21:33:30 +0300 To: Igor Munkin Message-ID: <20210315183330.GC16737@root> References: <4e3445b32f5bcf94acc7c87c360aeb68ff0c399c.1615819534.git.skaplun@tarantool.org> <20210315173950.GF9042@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210315173950.GF9042@tarantool.org> X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D3134714A9BDB69B63430D3F1B4C5913A95494451A5CA18200894C459B0CD1B989431997B495151BEC0F4BC8AFD6656DD56280D2DEE079FF705A2F0185E57886 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AED985C8E545F588EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370BEBC60587DC626C8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C7FF294EE7CC9FD50C023FD57BA4B2C00231AC5B7AA17389CA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3E478A468B35FE767117882F4460429728AD0CFFFB425014E868A13BD56FB6657A7F4EDE966BC389F9E8FC8737B5C22495B4C35AC65A386B3089D37D7C0E48F6CCF19DD082D7633A0E7DDDDC251EA7DABAAAE862A0553A39223F8577A6DFFEA7CE1AEB6AF2DA18B6243847C11F186F3C5E7DDDDC251EA7DABCC89B49CDF41148FA8EF81845B15A4842623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2BBE337FB72E923155C0AF1600DCBC20BC34632CCC2A66CABFCB840F5D244F756 X-C1DE0DAB: 0D63561A33F958A514F25754D1811B462AA42A8EB4354B0FB75266FC8DB7D2FCD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75F04B387B5D7535DE410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349BD6FB698A487E7E8AFCB696A691C048737313740D0163A12C9FC9039A4C0A1C0D0D1FC7D65197911D7E09C32AA3244C31F1F7F6CE8F821774E7C2F11701A35C05AB220A9D022EBCFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmD8gqPF9k0n1hwahb/vbRQ== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB4A3D1EAF09FC60620EB357C231FE3B04D594FB4C9F0DBF412F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 2/5] test: adjust lua-Harness suite for LuaJIT 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" Igor, Thanks for the review! On 15.03.21, Igor Munkin wrote: > Sergey, > > Thanks for the patch! > > This is why it's so important to take the suite intact at first: I > didn't even notice these changes in the previous series and now I regret > a bit regarding the solution with LUAJIT_TEST_INIT: for this case it > occurs to be ugly a little. Nevertheless, I believe Francois would be > interested in this use case, so it's worth to file a bug against > lua-Harness, IMHO. I don't think so -- usage [1] declares the way to launch the suite. It is our problem, that we don't use it. > > On 15.03.21, Sergey Kaplun wrote: > > LUAJIT_TEST_COMMAND always extends an amount of line argument by two > > causing child test failures. > > I don't get the line above. I guess you mind something similar to this: > | LUAJIT_TEST_COMMAND always extends table containing command line > | arguments by two. It leads to child test failures, since Lua > | interpreter name is misfetched from the table. Updated commit message considering your proposal. > > > So, a new universal way to detect program name is required. > > > > This patch introduces the new function `get_lua_binary_name()` inside > > lua-Harness tap.lua module to get binary for test execution correctly. > > Side note: I doubt the function location is right, but I guess there is > no other place that is required by all test chunks. > > > > > The following tests are adjusted with the new function: > > * 241-standalone.t > > * 242-luac.t > > * 301-basic.t > > * 308-io.t > > * 309-os.t > > * 320-stdin.t > > * 411-luajit.t > > > > Part of tarantool/tarantool#5844 > > Part of tarantool/tarantool#4473 > > --- > > test/lua-Harness-tests/241-standalone.t | 2 +- > > test/lua-Harness-tests/242-luac.t | 2 +- > > test/lua-Harness-tests/301-basic.t | 2 +- > > test/lua-Harness-tests/308-io.t | 2 +- > > test/lua-Harness-tests/309-os.t | 2 +- > > test/lua-Harness-tests/320-stdin.t | 2 +- > > test/lua-Harness-tests/411-luajit.t | 2 +- > > test/lua-Harness-tests/tap.lua | 9 +++++++++ > > 8 files changed, 16 insertions(+), 7 deletions(-) > > > > > > > diff --git a/test/lua-Harness-tests/tap.lua b/test/lua-Harness-tests/tap.lua > > index 08a99b8..5ce95e6 100644 > > --- a/test/lua-Harness-tests/tap.lua > > +++ b/test/lua-Harness-tests/tap.lua > > @@ -195,6 +195,15 @@ function todo (reason, count) > > todo_reason = reason > > end > > > > +-- The last arg element is guaranteed name of tested binary. > > Typo: s/last/least/. > Typo: s/guaranteed name of tested/guaranteed to be the name of the tested/. Thanks, update the branch. See the iterative patch below. =================================================================== diff --git a/test/lua-Harness-tests/tap.lua b/test/lua-Harness-tests/tap.lua index 5ce95e6..e527687 100644 --- a/test/lua-Harness-tests/tap.lua +++ b/test/lua-Harness-tests/tap.lua @@ -195,7 +195,8 @@ function todo (reason, count) todo_reason = reason end --- The last arg element is guaranteed name of tested binary. +-- The least arg element is guaranteed to be the name +-- of the tested binary. function get_lua_binary_name () local i = 0 while arg[i] do =================================================================== > > > +function get_lua_binary_name () > > + local i = 0 > > + while arg[i] do > > You make an excess lookup to a _G for each iteration. It's better to > pass as an argument to this function. Furthermore, it makes the > signature clearer, so user knows you're using to detect the > interpreter name. This economy looks unnecessary -- there are only 6 calls to this function from the whole suite. You can provide time measurement to prove me wrong. I disagreed that it makes signature clearer, because there is no way to use something instead `arg` variable anyway. Please, give me an example, when usage of custom array is preferable than usage `arg` variable. If this function *always* uses `arg` variable only, why we should move it outside this function? > > > + i = i - 1 > > + end > > + return arg[i + 1] > > +end > > + > > -- > > -- Copyright (c) 2009-2018 Francois Perrad > > -- > > -- > > 2.28.0 > > > > -- > Best regards, > IM [1]: https://fperrad.frama.io/lua-Harness/usage/ -- Best regards, Sergey Kaplun