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 4D3E86EC44; Thu, 5 Nov 2026 18:24:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4D3E86EC44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1793892267; bh=aR3HPwi1bv5P1RBuZAKGv/6Fw1KytF2SC76yyrYLJS8=; 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=eS1vSihAWcqXnUKE8+q7OBRoy1BqX34GmG2fwL3VuoS25VUU1PYVXbMZd0aQAYQMB +AfnrVW+izSOBe03XtaTBekLmZ+SIFT69ruyFju1HoYz66IAC8A+x6EAQDgE+JkZXF /Ne3pdhI1HUN6RctARg4EpsM4nvKk//DqgJxAQio= Received: from send174.i.mail.ru (send174.i.mail.ru [95.163.59.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 544E76EC44 for ; Thu, 5 Nov 2026 18:24:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 544E76EC44 Received: by exim-smtp-5cc8b577fd-b7jlc with esmtpa (envelope-from ) id 1xOzKB-00000000IJs-1bfL; Thu, 05 Nov 2026 18:24:23 +0300 Message-ID: Date: Thu, 5 Nov 2026 18:24:23 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Sergey Kaplun References: <51f5c0e5d584e825054581da9152a39df9fd9eb9.1793574664.git.e.temirgaleev@tarantool.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9F9FCDF30EE40D57CFE497EE0926BFB8AAE19C63E9F5BEBDB182A05F5380850404CF0A88A1282ED713DE06ABAFEAF6705C0EA84CDD05AC85AFB02A2FD26F4AECAB6BD4AB1FA1FD6A3 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77E216A0E97507353EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637B5932F77F0041FFB8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B27DDA9152ECD4D8C72E070BE324C7D3C49A0EE549E3722D4DF6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0ECC8AC47CD0EDEFF8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D36D5E8D9A59859A8B69635D8547803368176E601842F6C81A1F004C906525384303E02D724532EE2C3F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C26B9191E2D567F0EC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5D0EECDDAF5B0120E5002B1117B3ED696CC6D862E50EC8603A9DAB4B68AE4D22F823CB91A9FED034534781492E4B8EEAD8D8BB953E4894305BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE1918E10F71CB4DF9F96AB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D6590E9D12D019FD3C8D33E8776636EE17508734CDE22A0FAF7BAD929EE509E22D7943CAC144959754D6B8341EE9D5BE9A0A7ECF57486B1066E35FC47F13C27AC07404B168C570706198C7CEAA0681F5848F4C41F94D744909CEEF9E35A692215F79327F81E6EEE0AEB67A0F9F91F029B6AF33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXOcIETfglQORZ0zpDET4Zrk3igikrdHlWKKd9BUjwgQy3KofJT2Itw4= X-Mailru-Sender: 015BA6FC0EFA223A63A6570A1A0312859A790F04D4E54324B951B70A5BD4BD8E30F92F5D6E9BF17B8E4CA490B7F9407AE62B12C1FE0372A178274A4A9E9E44FD2A114EDA040D8818F01FF9DF31C397A372D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v3 1/2] test: refactored utils.exec.makecmd 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: Evgeniy Temirgaleev via Tarantool-patches Reply-To: Evgeniy Temirgaleev Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for review! Please, see my answers. Fixes are made and force pushed. On 11/3/26 2:55 PM, Sergey Kaplun wrote: > Hi, Evgeniy! > Thanks for the patch! > Please consider my comments below. > > On 02.11.26, Evgeniy Temirgaleev wrote: >> From: Temir Galeev >> >> The 'utils.exec.makecmd()' was refactored to allow executing of the >> arbitrary commands. Also, the diagnostic messages may be enabled >> if the test object is supplied. See the example below. >> >> Initially this patch was prepared for tests in the follows up > > Typo: s/follows up/follow up/ > Fixed. >> 'Improve CLI signal handling on POSIX' patch. After the test >> simplification the shell script helper was wiped out, but the > > Typo: s/simplification/simplification,/ > Fixed. >> refactoring was already done. > > This refactoring looks OK, but the second patch doesn't use the newly > introduced function. So it is questionable: do we need it right now? > I don't understand what benefits will we have with it (since the testing > of CLI is a unique case, as you can see). > The other tests uses the 'utils.exec.makecmd()' func. The refactoring makes it's code more clear to understand and in consequence more easy to use. We can postpone the export of 'makecmd_exec()' function until it will be really need, but the refactoring is a part of work which is wasteful to reject due to it is done already. >> >> How to use new 'utils.exec.makecmd_exec()' to run arbitrary >> shell script: >> >> ``` >> local tap = require('tap') >> local test = tap.test('example') >> local utils = require('utils') >> local script = utils.exec.makecmd_exec('/bin/sh', { >> args = {'-c'}, >> redirect = '2>&1', >> t = test, -- shows cmd and it's output for diagnostic >> }) >> >> test:plan(2) >> local output >> output = script("'echo 1'") >> test:is(output, '1') >> output = script("'echo 2'") >> test:is(output, '23') -- see the on-failure output >> test:done(true) >> ``` >> --- >> test/tarantool-tests/utils/exec.lua | 56 +++++++++++++++++++++++------ >> 1 file changed, 45 insertions(+), 11 deletions(-) >> >> diff --git a/test/tarantool-tests/utils/exec.lua b/test/tarantool-tests/utils/exec.lua >> index 49f8ef06..b435e084 100644 >> --- a/test/tarantool-tests/utils/exec.lua >> +++ b/test/tarantool-tests/utils/exec.lua >> @@ -43,33 +43,67 @@ local function makeenv(tabenv) >> return table.concat(flatenv, ' ') >> end >> >> --- creates a command that runs %testname%/script.lua by >> --- with the given environment, launch options >> --- and CLI arguments. The function yields an object (i.e. table) >> --- with the aforementioned parameters. To launch the command just >> --- call the object. >> -function M.makecmd(arg, opts) >> +-- creates a command that runs given binary >> +-- with the given environment, launch options and zero or >> +-- more permanent arguments. >> +-- The function yields an object (i.e. table) with the >> +-- aforementioned parameters. To launch the command just call >> +-- the object. Additional arguments which may vary from call >> +-- to call are the `__call` args. >> +-- Pass tap.test() object as opts.t for diagnostic. >> +function M.makecmd_exec(bin, opts) > > This refactoring looks OK, but the second patch doesn't use the newly > introduced function. So it is questionable: do we need it right now? > If not, I suppose the debug adjustment (and default script value) may be > done in the scope of the old `makecmd()` helper. > The same. >> + assert(type(bin) == 'string') >> + assert(opts == nil or type(opts) == 'table') >> + local perm_args = opts and opts.args or {} >> + assert(type(perm_args) == 'table') >> return setmetatable({ >> - LUABIN = M.luacmd(arg), >> - SCRIPT = opts and opts.script or arg[0]:gsub('%.test%.lua$', '/script.lua'), >> + BIN = bin, >> ENV = opts and makeenv(opts.env) or '', >> REDIRECT = opts and opts.redirect or '', >> + PERMARGS = (' %s'):rep(#perm_args):format(unpack(perm_args)), >> + t = opts and opts.t, > > Maybe name it tap instead? > Renamed. >> }, { >> __call = function(self, ...) >> -- This line just makes the command for by the >> -- following steps: >> -- 1. Replace the placeholders with the corresponding values >> - -- given to the command constructor (e.g. script, env). >> + -- given to the command constructor (e.g. bin, env). >> -- 2. Join all CLI arguments given to the __call metamethod. >> -- 3. Concatenate the results of step 1 and step 2 to obtain >> -- the resulting command. >> - local cmd = ('