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 386156ECE2; Wed, 25 Nov 2026 13:41:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 386156ECE2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1795603297; bh=n8yjwtHDQsfXNFZ/4BKLdq6uN+NiTwKNy1SXX3c28aM=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=vxqWDlwATV0WRMXWfZOxYCf0mMEqv+vLs+mCPsD3cbtxGagZCGni39SmCMYLWZfO/ QCXwDW73lXNLIDjSM3V3f+Rjofay/qcvwCiGzgAK19HWpwapTT7FYPFwUTv+fclqcQ p7FMV2DJSYNfZv4HUxY84lhcUicD+OJ6+N4IITAk= Received: from send151.i.mail.ru (send151.i.mail.ru [89.221.237.246]) (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 920176ECE2 for ; Wed, 25 Nov 2026 13:41:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 920176ECE2 Received: by exim-smtp-56bb8ff957-pxvjf with esmtpa (envelope-from ) id 1xWARR-00000000Jne-40A1; Wed, 25 Nov 2026 13:41:34 +0300 Message-ID: Date: Wed, 25 Nov 2026 13:41:33 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Evgeniy Temirgaleev , Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <48dc0df395bb6c6b22924cf95bbf45dc70a4a09c.1795529449.git.e.temirgaleev@tarantool.org> Content-Language: en-US In-Reply-To: <48dc0df395bb6c6b22924cf95bbf45dc70a4a09c.1795529449.git.e.temirgaleev@tarantool.org> 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: 4F1203BC0FB41BD977B76FDA87AFA8B9D6E08FE5750B3DD3974472DAFC8E4935182A05F538085040CED478E8167DE8593DE06ABAFEAF67059AF0F55B9A7D5483972F5AF84DC0E01B3FE2B8E3424E27AE X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73B44982FA5E78411EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006379BF04B24BEB7B2D58638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2C8BB5A49A839E7052E070BE324C7D3C416888C3DC6915997F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C05A64D9A1E9CA65708941B15DA834481F9449624AB7ADAF37BA3038C0950A5D36D5E8D9A59859A8B6B0E9FD5D4288160E3AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73589424AA0EF8DE9BAC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A552531BFB95A2BD2D5002B1117B3ED6965C3BCBF657B07FAAF09842853758E9E5823CB91A9FED034534781492E4B8EEAD17AEC49845D0B908 X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659ECE7E9AFA7C1F5759E016EA8CAE9821A2BAEB5BFC7CFBC5FF09A266C62D86CB47CFA5B60027D1351B8341EE9D5BE9A0A15DE4A6A2CFC6A98DD81D9E2A65689719A0D353A74101B466536EB022892E5344C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXOcIETfglQORZ0zpDET4Zrk3igikrdHlWElriAPZnfHytEW4g7DlDWI= X-Mailru-Sender: 520A125C2F17F0B17094CDC02B85F11BE2A8DCF4A2F940A53DE06ABAFEAF67059AF0F55B9A7D5483B7CBEF92542CD7C8795FA72BAB74744FC77752E0C033A69EA16A481184E8BB1C9B38E6EA4F046BE03A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v4 1/2] test: refactor 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: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hello, thanks for the fixes! I think the patch with refactoring makes code more complicated. It would be better to drop the patch at all and fix the test for the backported patch: --- a/test/tarantool-tests/lj-noticket-fix-cli-posix-sigint-handling.test.lua +++ b/test/tarantool-tests/lj-noticket-fix-cli-posix-sigint-handling.test.lua @@ -32,7 +32,7 @@ local SIGINT = 2  test:plan(1)  local utils = require('utils') -local script = utils.exec.test_data(arg, 'script.lua') +local script = arg[0]:gsub('%.test%.lua$', '/script.lua')  local cmd = ('exec %s %s 2>&1'):format(utils.exec.luacmd(arg), script)  local proc = io.popen(cmd) Sergey On 11/24/26 17:22, Evgeniy Temirgaleev wrote: > From: Temir Galeev > > The 'utils.exec.makecmd()' was refactored. The common > 'utils.exec.makecmd_exec()' added to allow executing arbitrary > commands and the 'makecmd()' is implemented on top of it. > The command object's 'LUABIN' field renamed to 'BIN', the > 'SCRIPT' field with script filename replaced with 'PERMARGS' > field, containing all command arguments, which are passed on > every call, and the 'trace' callback option is added for > additional processing of the generated command and it > output. > > Also added the 'makecmd_tap_trace()' and 'test_data()' helpers. > > Test [1] was refactored to use 'makecmd()' as usual. > Test [2] was refactored to use common 'makecmd_exec()'. > > 1. test/tarantool-tests/lj-962-stack-overflow-report.test.lua > 2. test/tarantool-tests/lj-586-debug-non-string-error.test.lua > > Initially the patch for exec utils was prepared for tests in > the follow up 'Improve CLI signal handling on POSIX' patch. > After it's test simplification, the shell script helper was > wiped out, but the refactoring was already done. this paragraph is not needed > --- > .../lj-586-debug-non-string-error.test.lua | 34 ++++----- > .../commands.lua | 2 + > .../lj-962-stack-overflow-report.test.lua | 6 +- > test/tarantool-tests/utils/exec.lua | 72 +++++++++++++++---- > 4 files changed, 81 insertions(+), 33 deletions(-) > create mode 100644 test/tarantool-tests/lj-586-debug-non-string-error/commands.lua > > diff --git a/test/tarantool-tests/lj-586-debug-non-string-error.test.lua b/test/tarantool-tests/lj-586-debug-non-string-error.test.lua > index 67869708..fe2b4b87 100644 > --- a/test/tarantool-tests/lj-586-debug-non-string-error.test.lua > +++ b/test/tarantool-tests/lj-586-debug-non-string-error.test.lua > @@ -6,20 +6,18 @@ test:plan(1) > > -- XXX: This is quite an exotic test case in that point of view > -- that testing the debug interactive interface always ends with > --- sending commands to another instance via stdin. However, the > --- module with test helpers lacks the suitable routine. > --- `utils.makecmd()` doesn't fit for this, since `debug.debug()` > --- captures `io.stdin` and waits at `fgets()` in debug busy loop. > --- As it's already mentioned, such tests are not usual, so there > --- is no need to introduce a new helper to utils module (at least > --- for now). Hence, we use `utils.luacmd()` function to obtain the > --- interpreter command, run `debug.debug()` with it, send two > --- commands via pipeline to the launched process, capture its > --- stdout and stderr and test the resulting output against the > --- expected one. > +-- sending commands to another instance via stdin. > +-- Since `debug.debug()` captures `io.stdin` and waits at > +-- `fgets()` in debug busy loop, we use `utils.exec.luacmd()` > +-- function to obtain the interpreter command, run > +-- `debug.debug()` with it, send two commands from the > +-- `utils.exec.test_data('commands.lua')` file redirecting it to > +-- the process stdin, capture its stdout and stderr and test the > +-- resulting output against the expected one. > -- > -- Debugger prompt. > local ldb = 'lua_debug> ' > +-- The magic number is passed via MAGIC environment variable. > local magic = 42 > local luabin = utils.exec.luacmd(arg) > local stderr = { > @@ -37,11 +35,13 @@ local stderr = { > -- errors are yielded before the magic given to `print()` command > local expected = table.concat(stderr)..magic > > -local cmd = ([[cat <&1 > -error({}) > -print(%d) > -EOF]]):format(luabin, magic) > - > -local res = io.popen(cmd):read('*all'):gsub('%s+$', '') > +local dbg_commands_file = utils.exec.test_data(arg, 'commands.lua') > +local command = utils.exec.makecmd_exec(luabin, { > + env = {MAGIC = magic}, > + redirect = ('2>&1 <%s'):format(dbg_commands_file), > + args = {'-e', "'debug.debug()'"}, > + trace = utils.exec.makecmd_tap_trace(test), > +}) > +local res = command() > test:ok(res == expected, 'handle non-string error in debug.debug()') > test:done(true) > diff --git a/test/tarantool-tests/lj-586-debug-non-string-error/commands.lua b/test/tarantool-tests/lj-586-debug-non-string-error/commands.lua > new file mode 100644 > index 00000000..a27aaee7 > --- /dev/null > +++ b/test/tarantool-tests/lj-586-debug-non-string-error/commands.lua > @@ -0,0 +1,2 @@ > +error({}) > +print(tonumber(os.getenv('MAGIC'))) > diff --git a/test/tarantool-tests/lj-962-stack-overflow-report.test.lua b/test/tarantool-tests/lj-962-stack-overflow-report.test.lua > index 848f4ead..14ffea10 100644 > --- a/test/tarantool-tests/lj-962-stack-overflow-report.test.lua > +++ b/test/tarantool-tests/lj-962-stack-overflow-report.test.lua > @@ -4,8 +4,8 @@ local tap = require('tap') > local test = tap.test('lj-962-stack-overflow-report') > test:plan(1) > > -local LUABIN = require('utils').exec.luabin(arg) > -local SCRIPT = arg[0]:gsub('%.test%.lua$', '/script.lua') > -local output = io.popen(LUABIN .. ' 2>&1 ' .. SCRIPT, 'r'):read('*all') > +local utils = require('utils') > +local script = utils.exec.makecmd(arg, {redirect = '2>&1'}) > +local output = script() > test:like(output, 'stack overflow', 'stack overflow reported correctly') > test:done(true) > diff --git a/test/tarantool-tests/utils/exec.lua b/test/tarantool-tests/utils/exec.lua > index 49f8ef06..1b79bd63 100644 > --- a/test/tarantool-tests/utils/exec.lua > +++ b/test/tarantool-tests/utils/exec.lua > @@ -22,6 +22,7 @@ end > > local function makeenv(tabenv) > if tabenv == nil then return '' end > + assert(type(tabenv) == 'table') > local flatenv = {} > for var, value in pairs(tabenv) do > if var == 'LD_PRELOAD' then > @@ -43,33 +44,78 @@ 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 opts.trace function(event, value) for additional > +-- command/output processing. > +function M.makecmd_exec(bin, opts) > + assert(type(bin) == 'string') > + opts = opts or {} > + assert(type(opts) == 'table') > + local redirect = opts.redirect or '' > + assert(type(redirect) == 'string') > + local perm_args = opts.args or {} > + assert(type(perm_args) == 'table') > + assert(opts.trace == nil or type(opts.trace) == 'function') > return setmetatable({ > - LUABIN = M.luacmd(arg), > - SCRIPT = opts and opts.script or arg[0]:gsub('%.test%.lua$', '/script.lua'), > - ENV = opts and makeenv(opts.env) or '', > - REDIRECT = opts and opts.redirect or '', > + BIN = bin, > + ENV = makeenv(opts.env), > + REDIRECT = redirect, > + PERMARGS = table.concat(perm_args, ' '), > + trace = opts.trace, > }, { > __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 = ('