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 DE8B86ECF7; Mon, 2 Nov 2026 03:00:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DE8B86ECF7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1793577634; bh=KxVTErKStDLew2HbbpzC7HQZvRBayaz448bPPJdWFZE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=jFtRpOd9YKEuDv8f6ko7ySJ55ICGdqvtrrUC1P2p5Baf0imUIvxqwz3UIV1ga3K50 xHaVa8BUEFoAcxFBWiErfZTllaiInSyxMLSV7fCwBnCeQiUzU8Sn67bTu2PdUMhfvO e/gSCDPG6g84UW5WJHZL5a1mVrpmdZcfWuidVH0M= Received: from send149.i.mail.ru (send149.i.mail.ru [89.221.237.244]) (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 E403B6ECFD for ; Mon, 2 Nov 2026 03:00:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E403B6ECFD Received: by exim-smtp-675c6798c6-rgnsv with esmtpa (envelope-from ) id 1xNfT2-00000000HuQ-3Vuc; Mon, 02 Nov 2026 03:00:05 +0300 To: Sergey Kaplun , Sergey Bronnikov Date: Mon, 2 Nov 2026 02:59:58 +0300 Message-ID: <51f5c0e5d584e825054581da9152a39df9fd9eb9.1793574664.git.e.temirgaleev@tarantool.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD995934D660C27459B93E8EAFB6055382E92E7E98B6F287DAE182A05F5380850402684F90D75E7E8393DE06ABAFEAF670569EB011C0DE6937E4C29320517C55D90408B34B1CBA95A7D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE712EB008F780777E9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F88016AB904663428638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B22DE370093D68F5AE2E070BE324C7D3C4BF1FE480ADF12207F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0C26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A127C277FBC8AE2E8B73D4B00E7A7DD9B73AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FCF1175FABE1C0F9B6E2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B3C8E47F88C55FA0575ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A52BA14CFBC3D538D35002B1117B3ED69638F9DE25065F265EC89B063BDC7FAC35823CB91A9FED034534781492E4B8EEAD528DE7AA5F2BD788C79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE1918E10F71CB4DF9F96AB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D6591B13ACCE531862B7849880E500A066CDA00BACEB9B71961E8D143F6670FB39ADC7C0134865B80E1DB8341EE9D5BE9A0ABED879AC4BED3E4BB9E1BF928990B357E6BC69F8DAB99801C7CEAA0681F5848F4C41F94D744909CEEF9E35A692215F79327F81E6EEE0AEB67A0F9F91F029B6AF33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXOcIETfglQORZ0zpDET4Zrk3igikrdHlWCxBJZBkFf8im5/lFOSIJYM= X-Mailru-Sender: 015BA6FC0EFA223A63A6570A1A031285560DFC321E46C67CB951B70A5BD4BD8E91ED49321159B5053C72AD0B1D2E52B0E62B12C1FE0372A178274A4A9E9E44FD2A114EDA040D8818F01FF9DF31C397A372D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: [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" 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 'Improve CLI signal handling on POSIX' patch. After the test simplification the shell script helper was wiped out, but the refactoring was already done. 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) + 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, }, { __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 = ('