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 2A478C99695; Wed, 14 Aug 2024 17:10:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2A478C99695 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1723644633; 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=eg2IQ46BGzDL7A3qPuEaxaBCOIofGFrHWix7cGl0G/sBn7Jk45dmyE8zZWrjcQSAp xt6lNuferHzDoAbf1f6OU3m4uf7pBuzqicqox3yR2h860OMatWB739CWQ/Bww8/w99 2RwnblOwHOUexeGUpRE2OTpFKnLn94En45e/FE2g= Received: from smtp45.i.mail.ru (smtp45.i.mail.ru [95.163.41.83]) (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 7963CC4F43B for ; Wed, 14 Aug 2024 16:57:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7963CC4F43B Received: by smtp45.i.mail.ru with esmtpa (envelope-from ) id 1seEVK-00000003nAF-2DAF; Wed, 14 Aug 2024 16:57:34 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Wed, 14 Aug 2024 16:56:09 +0300 Message-ID: <1b85929f6437b1ac82a0fd54b668e5135ece50bc.1723638851.git.skaplun@tarantool.org> 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: 4F1203BC0FB41BD9D7B6E71A78C20FB96B382944D737B485278D98DAE9CD6B8D182A05F538085040F3C39F5E51C39776A6D5EE0DB6E1EC8DF9ED7501147C2E0A129B12038A8E527CA63584AFBF2A4F42 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE742D9BD90C58D50E0EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006379347C0682FC030B08638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D834733704B3DA8FD892FDB6FC48C14056DD0B9262B54BFC39CC7F00164DA146DAFE8445B8C89999728AA50765F7900637DCE3DBD6F8E38AFD389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8ED96AA85C75E140D117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CFF1165EFABA1780A676E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8BCFF48519C1EE79E1D81D268191BDAD3D3666184CF4C3C14F3FC91FA280E0CE3D1A620F70A64A45A98AA50765F7900637F9425D8FA97DB4396D1867E19FE1407978DA827A17800CE773BC869C69ECC1572DBA43225CD8A89FB26E97DCB74E625235872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A53EE4828251354CD95002B1117B3ED69612B5EAE684E3E488ED71F038FC046993823CB91A9FED034534781492E4B8EEADADEF88395FA75C5FC79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF79089422E5B08B6703BC49FC3A346B77EC86BE1353D6A148D4A050F560686809744A43F78FC6FA90470327EB0AC8E693B75B3D668A507D5CE98BAB6BFF30A478D0A9C588D7F02F65C226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnMg09N3zL/htDoLJVCBBnw== X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B59C5BA180C86F4693CA6D5EE0DB6E1EC8DF9ED7501147C2E0AB7CBEF92542CD7C88B0A2698F12F5C9EC77752E0C033A69E86920BD37369036789A8C6A0E60D2BB63A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 27/36] 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