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 14DB06EC44; Mon, 9 Nov 2026 05:16:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 14DB06EC44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1794190584; bh=8d9osJXTOjRhHOpDlOOx2h6uSPfm5AJ83w6fqcU5e0k=; 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=G+b2vVTwoL6t/N+9Ocl/8WNR9LFEGcNEwdBOPpRAlNMtMCcusUtQ4pK7mePI0ow8F 5AKUxq8j+thp8mONaEFRKrMBpQu/h9JFQ77gwtbmiI1gQSflO7ZrHbylQMukcv6J+w bJWn97phGdrcuYEnhinAzUVfcWhUqSHL+HeYvI/4= Received: from send172.i.mail.ru (send172.i.mail.ru [95.163.59.11]) (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 808706EC44 for ; Mon, 9 Nov 2026 05:16:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 808706EC44 Received: by exim-smtp-5cc8b577fd-hcqcf with esmtpa (envelope-from ) id 1xQEvl-00000000Jzr-0bAw; Mon, 09 Nov 2026 05:16:21 +0300 Message-ID: Date: Mon, 9 Nov 2026 05:16:20 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Sergey Bronnikov , 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: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD96F2D5E088614A2376C80A0B5F5F107E5304032A18A642583182A05F5380850403FBACE6CE7E7D0013DE06ABAFEAF6705EF49F7E596141CFE268B5CCAF89C9C4105BE0A135E0BBF8B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70043D879A87EF1BCEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F88016AB904663428638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2E52F04B4371E2A052E070BE324C7D3C472D5302EE26A2D80F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0ECC8AC47CD0EDEFF8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D36D5E8D9A59859A8B68D7B544A52A5B28B76E601842F6C81A1F004C906525384303E02D724532EE2C3F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C393D8082C41EC15443847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A5F9DFD42D5584F0AC5002B1117B3ED6965BFD40171B0D06AF30E4A65F242F5898823CB91A9FED034534781492E4B8EEAD0D89974173551D4FBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE1918E10F71CB4DF9F96AB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659471E9720C7EC0F48758F2926D3F0F65ADD1F456463446F95598BF8513B6B9A2C5BCBA7E228117890B8341EE9D5BE9A0A79597C3495AEF5820910345ECBC78CE1BF604387E086D4D8C7CEAA0681F5848F4C41F94D744909CEEF9E35A692215F79327F81E6EEE0AEB67A0F9F91F029B6AF33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXOcIETfglQORZ0zpDET4Zrk3igikrdHlWGmyx8oWigZre+eya20PhEY= X-Mailru-Sender: 015BA6FC0EFA223A63A6570A1A03128507A1E5E902781160B951B70A5BD4BD8EF0E0C1762DDE0F2F4C683740FFAD31F6E62B12C1FE0372A178274A4A9E9E44FD2A114EDA040D8818F01FF9DF31C397A372D6B4FCE48DF648AE208404248635DF 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" Thanks for the comments! Please see my answers and fixes. The fixes was force pushed to the branch. New changes: - two tests refactored to use utils.exec; - one of them uses new utils.exec.makecmd_exec() -> example removed from commit message; - args type checks in the 'exec' module slightly refactored. On 11/6/26 5:37 PM, Sergey Bronnikov wrote: > Hi, > > please see my comment below. > > >  test: refactored utils.exec.makecmd > > Tarantool's developers guide asks for an imperative title; "refactored" > is past tense. > Would `test: refactor utils.exec.makecmd` be better? > Fixed. > Sergey > > On 11/2/26 02:59, 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 > s/allow executing of the arbitrary commands/allow executing arbitrary > commands/ Rewritten. >> if the test object is supplied. See the example below. >> >> Initially this patch was prepared for tests in the follows up >> 'Improve CLI signal handling on POSIX' patch. After the test >> simplification the shell script helper was wiped out, but the >> refactoring was already done. >  The new `test_data()` helper and the changed `makecmd()` object fields > are >   not mentioned. Nothing in the tree reads the removed `LUABIN`/`SCRIPT` >   (checked), so the change is safe, but it is an interface change worth a >   line in the message. Rewritten. >> >> How to use new 'utils.exec.makecmd_exec()' to run arbitrary >> shell script: > s/arbitrary/an arbitrary/ Removed. >> >> ``` >> 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 >> }) > typo: s/t =/tap =/ Removed. >> >> 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) >> ``` > > Usually we don't put code examples to the commit messages. > > Yes, it was an exceptional case. Removed due to the example appears in the code (refactored 'test/tarantool-tests/lj-586-debug-non-string-error.test.lua' test). >> --- >>   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) >> +  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)), > `PERMARGS` already starts each argument with a space while the template > also > has a space before ``: `makecmd()` now builds ` luabin   script` > (three spaces) instead of the old two. Harmless for the shell, but the > command is printed in the diagnostics now, so the extra whitespace is > user-visible. Would letting one place own the separator -- e.g. > `PERMARGS = table.concat(perm_args, ' ')` with the template's space kept -- > read simpler and produce a clean command line? Yes! Done. >> +    t = opts and opts.t, >>     }, { >>       __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 = (' >>