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 B0953C6C77E; Thu, 15 Aug 2024 16:42:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B0953C6C77E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1723729361; bh=gZSCBxX6x/6RJo5Kbwz7+4TZ8uK4g843MnHStve3uwk=; 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=QYv2w1vTy3ZIn/s2jNCjtDJT96kHeg4Du39CGCaTAZnMhCnxBTcTW2FMCfkCMwSbm LPVRbQK95zS70GhuZJu1SJewwLlqp1lFdE5YiuHvyy6gQ6j5lnzGrSJ8E2u84+q/IK 1iXTfv4WKzF0NlVwoEf0SExci1dFoXGdtNCCJMzA= Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [95.163.41.80]) (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 67F26C6C767 for ; Thu, 15 Aug 2024 16:42:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 67F26C6C767 Received: by smtp39.i.mail.ru with esmtpa (envelope-from ) id 1seakR-00000005zfB-02fD; Thu, 15 Aug 2024 16:42:39 +0300 Content-Type: multipart/alternative; boundary="------------0CDovhukULJTF66o0iDTPTe9" Message-ID: <57a01fd4-2b69-48e3-8318-579ba6398a81@tarantool.org> Date: Thu, 15 Aug 2024 16:42:38 +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: <8d787d4027ef517e72eee6b65765f4eacdf00d89.1723638851.git.skaplun@tarantool.org> In-Reply-To: <8d787d4027ef517e72eee6b65765f4eacdf00d89.1723638851.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9F97E3C14763C38E2B49BF32E3CF5E697820AD0F0F569587B182A05F538085040170CFE161D13A884D27678DDAA806314691590EAE60F7031680876344559C0AD30CA33227962A514 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B9FBA884A7C9B8BAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063761A26A2A89ED60DE8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D83AAB19C14CFE897128891121E164CDA4318649D7FFB6BC67CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637D0FEED2715E18529389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F79006371FBD97495A8723EBD32BA5DBAC0009BE395957E7521B51C2330BD67F2E7D9AF1090A508E0FED6299176DF2183F8FC7C096C9B5BF839F39F6B3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B9BFB91CAEB05C77775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A55245A30131FED81A5002B1117B3ED6965D644AEF948703993E67C18142C611B7823CB91A9FED034534781492E4B8EEADA91A6E18C88C5E2F X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFAE52D9D015739630A6C298DBA33E63107EC09DD835D1661FC71D87822A783F1DD753EA1A396000B0470327EB0AC8E693B6F1157EAB71F153C977885B3348A2D3FFD14CD2ABF506325F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojD5rM0r3KxnHvhT2qWZOyhw== X-Mailru-Sender: 520A125C2F17F0B1E52FEF5D219D614006011943E085D3811E0EC1A5AE8B1473832DFDE5BE0CABFD0152A3D17938EB451EB5A0BCEC6A560B3DDE9B364B0DF289BE2DA36745F2EEB5CEBA01FB949A1F1EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 13/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 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. --------------0CDovhukULJTF66o0iDTPTe9 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey thanks for the patch! see my comments below. On 14.08.2024 16:55, Sergey Kaplun wrote: > This patch moves the aforementioned test from the to the why and not a "debug" suite? > directory, includes it in , names the subtests, and adjusts the > linenumbers in the assertions to match LuaJIT behaviour and the new code Split "linenumbers" to two words, or wrap with backticks (I suspect you mean a field in getinfo). > layout. + formatting changes > > Part of tarantool/tarantool#9398 > --- > test/LuaJIT-tests/lang/hook_line.lua | 44 ++++++++++++++++++++++++++++ > test/LuaJIT-tests/lang/index | 1 + > test/LuaJIT-tests/misc/hook_line.lua | 41 -------------------------- > 3 files changed, 45 insertions(+), 41 deletions(-) > create mode 100644 test/LuaJIT-tests/lang/hook_line.lua > delete mode 100644 test/LuaJIT-tests/misc/hook_line.lua > > diff --git a/test/LuaJIT-tests/lang/hook_line.lua b/test/LuaJIT-tests/lang/hook_line.lua > new file mode 100644 > index 00000000..bb89c4b8 > --- /dev/null > +++ b/test/LuaJIT-tests/lang/hook_line.lua > @@ -0,0 +1,44 @@ > +local lines = {} > +local function hook() > + lines[#lines + 1] = debug.getinfo(2).currentline > +end > + > +local function dummy() > +end -- <-- line 7 > + > +do --- Base test: cycles, function calls. > + debug.sethook(hook, "l", 0) > + -- <-- line 11 > + local x > + dummy() > + local y = 1 > + dummy() dummy() > + local z = 2; local r = true > + while y < 4 do y = y + 1 end > + while z < 4 do > + z = z + 1 > + end > + -- <-- line 21 > + local v > + debug.sethook(nil, "", 0) > + > + assert(#lines > 0) > + while lines[1] < 10 do table.remove(lines, 1) end > + while lines[#lines] > 20 do table.remove(lines) end > + > + local s = table.concat(lines, " ") > + assert(s == "12 13 7 14 15 7 7 16 17 17 17 17 18 19 18 19 18" or > + s == "12 13 7 14 15 7 15 7 16 17 17 17 17 18 19 18 19 18") > +end > + > +do --- Not visited the end of the function definition. > + lines = {} > + local function f() > + if true then return end > + local function x() end > + end -- <-- line 39 test depends on a number of lines in the file, please add a note about it at the beginning of the file > + debug.sethook(hook, "l", 0) > + f() > + debug.sethook(nil, "", 0) > + for i = 1, #lines do assert(lines[i] ~= 39) end > +end > diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index > index 8cecfa08..ae59bc56 100644 > --- a/test/LuaJIT-tests/lang/index > +++ b/test/LuaJIT-tests/lang/index > @@ -9,6 +9,7 @@ constant > dualnum.lua > for.lua > hook_active.lua > +hook_line.lua > length.lua > lightud.lua > modulo.lua > diff --git a/test/LuaJIT-tests/misc/hook_line.lua b/test/LuaJIT-tests/misc/hook_line.lua > deleted file mode 100644 > index 36f71080..00000000 > --- a/test/LuaJIT-tests/misc/hook_line.lua > +++ /dev/null > @@ -1,41 +0,0 @@ > -local lines = {} > -local function hook() > - lines[#lines+1] = debug.getinfo(2).currentline > -end > - > -local function dummy() > -end -- <-- line 7 > - > -debug.sethook(hook, "l", 0) > --- <-- line 10 > -local x > -dummy() > -local y = 1 > -dummy() dummy() > -local z = 2; local r = true > -while y < 4 do y = y + 1 end > -while z < 4 do > - z = z + 1 > -end > --- <-- line 20 > -local v > -debug.sethook(nil, "", 0) > - > -assert(#lines > 0) > -while lines[1] < 10 do table.remove(lines, 1) end > -while lines[#lines] > 20 do table.remove(lines) end > - > -local s = table.concat(lines, " ") > -assert(s == "11 12 7 13 14 7 7 15 16 16 16 16 17 18 17 18 17" or > - s == "11 12 7 13 14 7 14 7 15 16 16 16 16 17 18 17 18 17") > - > -lines = {} > -local function f() > - if true then return end > - local function x() end > -end -- <-- line 36 > -debug.sethook(hook, "l", 0) > -f() > -debug.sethook(nil, "", 0) > -for i=1,#lines do assert(lines[i] ~= 36) end > - --------------0CDovhukULJTF66o0iDTPTe9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey

thanks for the patch! see my comments below.


On 14.08.2024 16:55, Sergey Kaplun wrote:
This patch moves the aforementioned test from the <misc> to the <lang/>
why <lang> and not a "debug" suite?
directory, includes it in <index>, names the subtests, and adjusts the
linenumbers in the assertions to match LuaJIT behaviour and the new code
Split "linenumbers" to two words, or wrap with backticks (I suspect you mean a field in getinfo).
layout.

+ formatting changes



Part of tarantool/tarantool#9398
---
 test/LuaJIT-tests/lang/hook_line.lua | 44 ++++++++++++++++++++++++++++
 test/LuaJIT-tests/lang/index         |  1 +
 test/LuaJIT-tests/misc/hook_line.lua | 41 --------------------------
 3 files changed, 45 insertions(+), 41 deletions(-)
 create mode 100644 test/LuaJIT-tests/lang/hook_line.lua
 delete mode 100644 test/LuaJIT-tests/misc/hook_line.lua

diff --git a/test/LuaJIT-tests/lang/hook_line.lua b/test/LuaJIT-tests/lang/hook_line.lua
new file mode 100644
index 00000000..bb89c4b8
--- /dev/null
+++ b/test/LuaJIT-tests/lang/hook_line.lua
@@ -0,0 +1,44 @@
+local lines = {}
+local function hook()
+  lines[#lines + 1] = debug.getinfo(2).currentline
+end
+
+local function dummy()
+end -- <-- line 7
+
+do --- Base test: cycles, function calls.
+  debug.sethook(hook, "l", 0)
+  -- <-- line 11
+  local x
+  dummy()
+  local y = 1
+  dummy() dummy()
+  local z = 2; local r = true
+  while y < 4 do y = y + 1 end
+  while z < 4 do
+    z = z + 1
+  end
+  -- <-- line 21
+  local v
+  debug.sethook(nil, "", 0)
+
+  assert(#lines > 0)
+  while lines[1] < 10 do table.remove(lines, 1) end
+  while lines[#lines] > 20 do table.remove(lines) end
+
+  local s = table.concat(lines, " ")
+  assert(s == "12 13 7 14 15 7 7 16 17 17 17 17 18 19 18 19 18" or
+         s == "12 13 7 14 15 7 15 7 16 17 17 17 17 18 19 18 19 18")
+end
+
+do --- Not visited the end of the function definition.
+  lines = {}
+  local function f()
+    if true then return end
+    local function x() end
+  end -- <-- line 39

test depends on a number of lines in the file, please add a note about it at the beginning of the file


+  debug.sethook(hook, "l", 0)
+  f()
+  debug.sethook(nil, "", 0)
+  for i = 1, #lines do assert(lines[i] ~= 39) end
+end
diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index
index 8cecfa08..ae59bc56 100644
--- a/test/LuaJIT-tests/lang/index
+++ b/test/LuaJIT-tests/lang/index
@@ -9,6 +9,7 @@ constant
 dualnum.lua
 for.lua
 hook_active.lua
+hook_line.lua
 length.lua
 lightud.lua
 modulo.lua
diff --git a/test/LuaJIT-tests/misc/hook_line.lua b/test/LuaJIT-tests/misc/hook_line.lua
deleted file mode 100644
index 36f71080..00000000
--- a/test/LuaJIT-tests/misc/hook_line.lua
+++ /dev/null
@@ -1,41 +0,0 @@
-local lines = {}
-local function hook()
-  lines[#lines+1] = debug.getinfo(2).currentline
-end
-
-local function dummy()
-end -- <-- line 7
-
-debug.sethook(hook, "l", 0)
--- <-- line 10
-local x
-dummy()
-local y = 1
-dummy() dummy()
-local z = 2; local r = true
-while y < 4 do y = y + 1 end
-while z < 4 do
-  z = z + 1
-end
--- <-- line 20
-local v
-debug.sethook(nil, "", 0)
-
-assert(#lines > 0)
-while lines[1] < 10 do table.remove(lines, 1) end
-while lines[#lines] > 20 do table.remove(lines) end
-
-local s = table.concat(lines, " ")
-assert(s == "11 12 7 13 14 7 7 15 16 16 16 16 17 18 17 18 17" or
-       s == "11 12 7 13 14 7 14 7 15 16 16 16 16 17 18 17 18 17")
-
-lines = {}
-local function f()
-  if true then return end
-  local function x() end
-end -- <-- line 36
-debug.sethook(hook, "l", 0)
-f()
-debug.sethook(nil, "", 0)
-for i=1,#lines do assert(lines[i] ~= 36) end
-
--------------0CDovhukULJTF66o0iDTPTe9--