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 C2744CE2D59; Thu, 22 Aug 2024 16:51:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C2744CE2D59 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1724334717; bh=SwLX+JG97wPOXfgGXZ/E3H208i8z7jXI8fLEgJWPUsg=; 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=UpGEpb+d/WptCvv/c+R4x8S00aVE10W7wXPMmqmUnPeI9SUxbOkwnjP9UrNjICsKa JYFoz+3CmRDquiJLvamk38KwukfGC8izt7C9SSp458AvRfDZiY0bSHos5E5hPWUt3z 7B6F6juYAfrmBw7LBUhsKEfvlAusojvm04bpFHlo= Received: from smtp40.i.mail.ru (smtp40.i.mail.ru [95.163.41.81]) (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 1F1CACE2D5A for ; Thu, 22 Aug 2024 16:51:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1F1CACE2D5A Received: by smtp40.i.mail.ru with esmtpa (envelope-from ) id 1sh8EG-0000000F1w6-1lya; Thu, 22 Aug 2024 16:51:56 +0300 Content-Type: multipart/alternative; boundary="------------jti6XEHDP70cKgRIv6m0AqGE" Message-ID: <358fec19-25ee-49c2-a6a8-d40b999a92f5@tarantool.org> Date: Thu, 22 Aug 2024 16:51:56 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun , Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org References: In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9A67092BE052B1D9E988EDBF7D8158B96DA772C8D70101687182A05F538085040C78ADDD863CA91DD411046492FDDF80677A8E3AADC56497882BBE18FB0487B48ACCB5262BB561CA2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AED985C8E545F588EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063736901D4B68B3D4FF8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8489EBA4C6F070F4A4E7D68C18CC2BC0171B1EABF98D7A28ACC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637F3E38EE449E3E2AE389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F7900637F609FDC7BF3E55A5D81D268191BDAD3DBD4B6F7A4D31EC0BE2F48590F00D11D6D81D268191BDAD3D78DA827A17800CE7D36F53DD076E3CB7EC76A7562686271ED91E3A1F190DE8FD2E808ACE2090B5E14AD6D5ED66289B5259CC434672EE63711DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3045DD857D6FE754135872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A522F34317620A0CA55002B1117B3ED696FFC0ACFFA88AC6A4250A03108B67251B823CB91A9FED034534781492E4B8EEADA91A6E18C88C5E2F X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFB66E040713ED287900C6CAF869F30F13FDAD7D95CA318420E25023E4DA643E3931E81B06003A5D532FB0CAD32ADFBF840A3E4B8A34072372381ABBACAF5977AA2BEBEB74CF5030315F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbUwDRTee1XoChsl+ZxMFZw== X-Mailru-Sender: 520A125C2F17F0B1E52FEF5D219D6140116B9BCC29CBD8E83D09A35B3CA2EBDB71FF5980767AFB900152A3D17938EB451EB5A0BCEC6A560B3DDE9B364B0DF289BE2DA36745F2EEB5CEBA01FB949A1F1EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [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 Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------jti6XEHDP70cKgRIv6m0AqGE Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sergey, On 21.08.2024 11:58, Sergey Kaplun wrote: > 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 > --- thanks for the patch! LGTM with a minor comment below. > test/LuaJIT-tests/lang/index | 1 + > test/LuaJIT-tests/lang/stackov.lua | 48 ++++++++++++++++++++++++++++++ Probably filename "stack_overflow.lua" will be better. Feel free to ignore. > 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) > - --------------jti6XEHDP70cKgRIv6m0AqGE Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Sergey,

On 21.08.2024 11:58, Sergey Kaplun wrote:
This patch moves the aforementioned test from the <misc> to the <lang/>
directory, includes it in <index>, names the subtests, and adds testing
of the error message for all non-tail call cases.

Part of tarantool/tarantool#9398
---
thanks for the patch! LGTM with a minor comment below.
 test/LuaJIT-tests/lang/index       |  1 +
 test/LuaJIT-tests/lang/stackov.lua | 48 ++++++++++++++++++++++++++++++
Probably filename "stack_overflow.lua" will be better. Feel free to ignore.
 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)
-
--------------jti6XEHDP70cKgRIv6m0AqGE--