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 6C7E6C608F5; Wed, 21 Aug 2024 12:16:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6C7E6C608F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1724231763; bh=ngc+6xkL8Zenaypeba0feJkFzfgc1QrD3XBcxUH6m1Y=; 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=KopR1yEXuQUrzCPNu/fKICHqKM24QfX+uET8L3k7S6sGND/vtbFMv8UWvsmzovEX+ YxUw2i0zSmj3T56mF4RPAEm8N890QqI450wM8P7dYw56cQHnjNk9tyjRn89sERVFMs JWCoVvXWm1F/mv6oXpo6z8VDy48O1JHDLojgEjI4= Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [95.163.41.76]) (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 885CEC619A8 for ; Wed, 21 Aug 2024 12:00:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 885CEC619A8 Received: by smtp35.i.mail.ru with esmtpa (envelope-from ) id 1sghCs-00000005aRz-0bu8; Wed, 21 Aug 2024 12:00:42 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Wed, 21 Aug 2024 11:58:37 +0300 Message-ID: X-Mailer: git-send-email 2.45.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: 4F1203BC0FB41BD93D5A650E6D4F687EB9FCDE9F6FB1F93F052CE53FECB6A5C2182A05F5380850405977FDD28668CA3FD27678DDAA80631424D36F7AE29D2B1DEFF80BD07D1CDB79F8A48EF99929F69E X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70043D879A87EF1BCEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E88AB9B4A10918C78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D860B476DB21BB162FC1F3096FD6B0A5BA648B7F09F78233B0CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F3E38EE449E3E2AE389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8989FD0BDF65E50FBF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BB9CEE4F2B4A90F8475ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5FA7AAA99E43AC6D65002B1117B3ED6967EBBA77FED42A5B8957033528158102E823CB91A9FED034534781492E4B8EEAD27E9584FBD6BDD31C79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFB655CAC747961703F3E6E0C36891F47741CA298EE5D00B3E67CA596DBFA928C1A54F2CFF063EE8C0D14E51FF79EEE60325F4527AA00359E6B2A94BCD9D7316CE1A5F21ADE7469A34C226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojegttVMu7AX8S/bRYzT1OOQ== X-DA7885C5: 5834E87C0A6CF857F255D290C0D534F9320329A1B04D9A4A3F554DCB3AC5130BEFB9B91BAFF8B7E55B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393C6D0B12EA33CAA9B5595EE4677DC8067DAC77899D9C4377F1EF388EC12107D3CE49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 luajit 34/45] test: enable LuaJIT test 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 Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch moves the aforementioned test from the to the directory, includes it in , names the subtests, and adds testing of the error message for all non-tail call cases. Part of tarantool/tarantool#9398 --- test/LuaJIT-tests/lang/index | 1 + test/LuaJIT-tests/lang/stackov.lua | 48 ++++++++++++++++++++++++++++++ test/LuaJIT-tests/misc/stackov.lua | 40 ------------------------- 3 files changed, 49 insertions(+), 40 deletions(-) create mode 100644 test/LuaJIT-tests/lang/stackov.lua delete mode 100644 test/LuaJIT-tests/misc/stackov.lua diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index index b262c555..fa6db3c3 100644 --- a/test/LuaJIT-tests/lang/index +++ b/test/LuaJIT-tests/lang/index @@ -17,6 +17,7 @@ lightud.lua modulo.lua concat.lua self.lua +stackov.lua table.lua parse_comp.lua parse_esc.lua diff --git a/test/LuaJIT-tests/lang/stackov.lua b/test/LuaJIT-tests/lang/stackov.lua new file mode 100644 index 00000000..21ae40b6 --- /dev/null +++ b/test/LuaJIT-tests/lang/stackov.lua @@ -0,0 +1,48 @@ +local function f() + f() +end + +local function g(i) + g(i) +end + +local function vtail(...) + return vtail(1, ...) +end + +local function vcall(...) + vcall(1, ...) +end + +local function test_error_msg(func, s) + local first = string.match(s, "[^\n]+") + local line = debug.getinfo(func, "S").linedefined + 1 + assert(string.match(first, ":" .. line .. ": stack overflow$")) + + local n = 1 + for _ in string.gmatch(s, "\n") do n = n + 1 end + assert(n == 1 + 1 + 11 + 1 + 10) +end + +do --- Base test. + local err, s = xpcall(f, debug.traceback) + assert(err == false) + test_error_msg(f, s) +end + +do --- Stack overflow with non-empty arg list. + local err, s = xpcall(g, debug.traceback, 1) + assert(err == false) + test_error_msg(g, s) +end + +do --- Vararg tail call with non-empty arg list. +slow + local err, s = xpcall(vtail, debug.traceback, 1) + assert(err == false) +end + +do --- Vararg non-tail call. + local err, s = xpcall(vcall, debug.traceback, 1) + assert(err == false) + test_error_msg(vcall, s) +end diff --git a/test/LuaJIT-tests/misc/stackov.lua b/test/LuaJIT-tests/misc/stackov.lua deleted file mode 100644 index ef105af6..00000000 --- a/test/LuaJIT-tests/misc/stackov.lua +++ /dev/null @@ -1,40 +0,0 @@ - -local function f() - f() -end - -local err, s = xpcall(f, debug.traceback) -assert(err == false) - -local first = string.match(s, "[^\n]+") -local line = debug.getinfo(f, "S").linedefined+1 -assert(string.match(first, ":"..line..": stack overflow$")) - -local n = 1 -for _ in string.gmatch(s, "\n") do n = n + 1 end -assert(n == 1+1+11+1+10) - -local function g(i) - g(i) -end - -local err, s = xpcall(g, debug.traceback, 1) -assert(err == false) - ---[[ --- too slow -local function vtail(...) - return vtail(1, ...) -end - -local err, s = xpcall(vtail, debug.traceback, 1) -assert(err == false) ---]] - -local function vcall(...) - vcall(1, ...) -end - -local err, s = xpcall(vcall, debug.traceback, 1) -assert(err == false) - -- 2.45.2