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 9A32557A520; Sun, 25 Feb 2024 13:54:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9A32557A520 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1708858472; bh=6FTs1apmAC71FVRBwsAEIkieSM4toGtR22/hOeBBams=; 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=Gymp3ycTZe1YOkOXedgHAYElUVj0FG+Anw3Yws6280FDnVT/ECFlrICcKi0k/j4nq qDGFY4G2GIlJ30CGff8V8P+78Bl09ENqjXnPnm0SPFqL0cgcWgTXr6MtxZF1lkEYh0 42/C8IvmviAYwnovnHYpHYE6MLsW2xtbIdGL1sUs= Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [95.163.41.100]) (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 ED7C057A520 for ; Sun, 25 Feb 2024 13:54:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ED7C057A520 Received: by smtp63.i.mail.ru with esmtpa (envelope-from ) id 1reC8u-00000002LRd-39Ma; Sun, 25 Feb 2024 13:54:01 +0300 To: Maxim Kokryashkin , Sergey Kaplun Date: Sun, 25 Feb 2024 10:41:06 +0000 Message-Id: <24af2ffde3f76e954582ae298a6ed5b5262d74d5.1708856482.git.imun@tarantool.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD90B4B6FE9E606E496B13B223944A5355FC88E6918661E7E0B00894C459B0CD1B9533D96340FBF93902AD5C4874F525AA3F35D895086CAC138E9D26329E21FC6A5750FC9643A608EC1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72E4E5201E1C2E308EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637991D0D3E51C637188F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB5533756633C711F3E236B4F0864A1C6845BEF9EBF54C02DF7AE1B7F3060C05EECDB61734389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0F60A601881DBAB3C8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6B737A621A50BC793CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249C2DE32F7C1AA431B76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B1D9A11CA0D2880DE3AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC8C7ADC89C2F0B2A5E2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B82259E19AF10636475ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A51E7941C5979F98CF5002B1117B3ED6968B24444777F35E3A250A03108B67251B823CB91A9FED034534781492E4B8EEADC0A73878EBD0941BC79554A2A72441328621D336A7BC284946AD531847A6065A17B107DEF921CE79BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF2E67F63D823B4690B5268B324EA3C538BEAE9B80862ECF45FFA0901342EC935AA96D85E4AF70DF37A653534C7294CACCD5169E5E57EF2CDE5852327424993501525D91ECF63F309CC226CC413062362A913E6812662D5F2A74A26541E23E71317A83BD0C44CE203720ABEDE4BBDD9CDD X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojhcsd5OwWmoj3/3DcXr8zWg== X-Mailru-Sender: 2FEBA92C8E508479FE7B9A1DF348D5310D1A11ACD1E4B27AA7CF1FCFAF80C0E9D9ACE8ABF27DAC30767802952795315CF5EE5212A79745119D086FC03DADA47A24EDF3BD9585A06DEEABBE9EE6587A054198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 1/2] test: introduce routine to build error message 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" LuaJIT modules yields the plain errors, but LuaJIT binary adds 'luajit:' prefix to it, so 411-luajit.t test in lua-Harness suite expects the error message with the aforementioned prefix in the corresponding assertions. At the same time, Tarantool prepends nothing to the error produced by LuaJIT module. To tweak the pattern to be used within the 411-luajit.t chunk, the auxiliary error building function is introduced in this patch. Signed-off-by: Igor Munkin --- test/lua-Harness-tests/411-luajit.t | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/lua-Harness-tests/411-luajit.t b/test/lua-Harness-tests/411-luajit.t index 6cfd6837..1b2da729 100755 --- a/test/lua-Harness-tests/411-luajit.t +++ b/test/lua-Harness-tests/411-luajit.t @@ -31,6 +31,15 @@ if not jit or ujit or _TARANTOOL then skip_all("only with LuaJIT") end +-- XXX: Unfortunately, Lua patterns do not support optional +-- capture groups, so the helper below implements poor man's +-- optional capture groups for the patters matching LuaJIT CLI +-- error messages. +local function errbuild(message) + local eprefix = _TARANTOOL and "" or "[^:]+: " + return table.concat({"^", eprefix, message}) +end + local lua = _retrieve_progname() if not pcall(io.popen, lua .. [[ -e "a=1"]]) then @@ -158,13 +167,13 @@ f = io.popen(cmd) if compiled_with_jit then equals(f:read'*l', 'Hello World', "-jon") else - matches(f:read'*l', "^[^:]+: JIT compiler permanently disabled by build option", "no jit") + matches(f:read'*l', errbuild("JIT compiler permanently disabled by build option"), "no jit") end f:close() cmd = lua .. " -j bad hello-411.lua 2>&1" f = io.popen(cmd) -matches(f:read'*l', "^[^:]+: unknown luaJIT command or jit%.%* modules not installed", "-j bad") +matches(f:read'*l', errbuild("unknown luaJIT command or jit%.%* modules not installed"), "-j bad") f:close() if compiled_with_jit then @@ -190,12 +199,12 @@ if compiled_with_jit then cmd = lua .. " -O+bad hello-411.lua 2>&1" f = io.popen(cmd) - matches(f:read'*l', "^[^:]+: unknown or malformed optimization flag '%+bad'", "-O+bad") + matches(f:read'*l', errbuild("unknown or malformed optimization flag '%+bad'"), "-O+bad") f:close() else cmd = lua .. " -O0 hello-411.lua 2>&1" f = io.popen(cmd) - matches(f:read'*l', "^[^:]+: attempt to index a nil value") + matches(f:read'*l', errbuild("attempt to index a nil value")) f:close() end -- 2.39.2