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 4F01BEC2CC0; Fri, 23 Aug 2024 17:38:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4F01BEC2CC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1724423886; bh=olVb8N56X6eHyXZSCffJPX035vIM/jCmVbSD1XzwyCw=; 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=K3c1ZRtZ1CPat6YBoEd0bIRlCHBzoLFt9OMXH8M0j8K94odQeBV4NDBJjfDx/xkTz rWmJ8H1dN1jo9+xirC2T2FhL8Kc7M23lNvsUanrBZSobd3+FfyHI18EYRPX1kmgj82 Prymh4Z2LMeNsC92DsZLuplv1Rwk6qmqRSz4UrBU= Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [95.163.41.78]) (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 ED505EC2CC0 for ; Fri, 23 Aug 2024 17:38:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ED505EC2CC0 Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1shVQR-0000000A5w6-1anG; Fri, 23 Aug 2024 17:38:03 +0300 Content-Type: multipart/alternative; boundary="------------4KGg6DX3hm00hBpC97Uyfad2" Message-ID: Date: Fri, 23 Aug 2024 17:38:03 +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: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9A67092BE052B1D9E8EC46B20539565FBAAD54790EDBD605A182A05F538085040B80CB7266DD6C1B7C591814E25D11F9F3A38B07D301E508D52C09F2BC8B774E990F08FC34D31E8A7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BC08626EA5717D14EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F72512A705E00D288638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D840D71620D04792EAE92F4EFFAA9A90B87462EDF2838F5C65CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637CAEE156C82D3D7D9389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F790063790495A4AD0498982D81D268191BDAD3DBD4B6F7A4D31EC0BE2F48590F00D11D6D81D268191BDAD3D78DA827A17800CE72B056A9979167638EC76A7562686271ED91E3A1F190DE8FD2E808ACE2090B5E14AD6D5ED66289B5259CC434672EE63711DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3CD42BCEBB57B85E635872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5564665EFF3BBF1F25002B1117B3ED6965CD642DCFB5F5991219207EC0A953D2C823CB91A9FED034534781492E4B8EEAD47A3109F1ACFD409BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF94226A15B0C90B079362079D6F33968E3AA30D6CD6B1A7D4522A46C599200A15C52D74DAEBEB42922FB0CAD32ADFBF84F641320920B1B5DE8E4AF0D10FA5077F6B5FD998B4FFF20D5F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojPqZSx9J9Ex1HCmPvCu6J7A== X-Mailru-Sender: 520A125C2F17F0B1E52FEF5D219D614092DA3AC25D68B19F75D97F51FC3E644FE777A8A17D4B12680152A3D17938EB451EB5A0BCEC6A560B3DDE9B364B0DF289BE2DA36745F2EEB5CEBA01FB949A1F1EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 17/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. --------------4KGg6DX3hm00hBpC97Uyfad2 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 adjusts the > line numbers in the assertions and filters to match LuaJIT behaviour and > the new code layout. Also, it slightly refactors the code to make it > closer to our code style. > > Part of tarantool/tarantool#9398 > --- thanks for the patch! LGTM with a minor comment. > test/LuaJIT-tests/lang/hook_line.lua | 45 ++++++++++++++++++++++++++++ > test/LuaJIT-tests/lang/index | 1 + > test/LuaJIT-tests/misc/hook_line.lua | 41 ------------------------- > 3 files changed, 46 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..733e5513 > --- /dev/null > +++ b/test/LuaJIT-tests/lang/hook_line.lua > @@ -0,0 +1,45 @@ > +-- The test depends on the number of lines in the file. > +local lines = {} > +local function hook() > + lines[#lines + 1] = debug.getinfo(2).currentline > +end > + > +local function dummy() > +end -- <-- line 8 > + > +do --- Base test: cycles, function calls. > + debug.sethook(hook, "l", 0) > + -- <-- line 12 > + local x > + dummy() > + local y = 1 > + dummy() dummy() I would place a second call to a separate line. Feel free to ignore. > + local z = 2; local r = true > + while y < 4 do y = y + 1 end > + while z < 4 do > + z = z + 1 > + end > + -- <-- line 22 > + local v > + debug.sethook(nil, "", 0) > + > + assert(#lines > 0) > + while lines[1] < 12 do table.remove(lines, 1) end > + while lines[#lines] > 22 do table.remove(lines) end > + > + local s = table.concat(lines, " ") > + assert(s == "13 14 8 15 16 8 8 17 18 18 18 18 19 20 19 20 19" or > + s == "13 14 8 15 16 8 16 8 17 18 18 18 18 19 20 19 20 19") > +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 40 > + debug.sethook(hook, "l", 0) > + f() > + debug.sethook(nil, "", 0) > + for i = 1, #lines do assert(lines[i] ~= 40) 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 > - --------------4KGg6DX3hm00hBpC97Uyfad2 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 adjusts the
line numbers in the assertions and filters to match LuaJIT behaviour and
the new code layout. Also, it slightly refactors the code to make it
closer to our code style.

Part of tarantool/tarantool#9398
---
thanks for the patch! LGTM with a minor comment.
 test/LuaJIT-tests/lang/hook_line.lua | 45 ++++++++++++++++++++++++++++
 test/LuaJIT-tests/lang/index         |  1 +
 test/LuaJIT-tests/misc/hook_line.lua | 41 -------------------------
 3 files changed, 46 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..733e5513
--- /dev/null
+++ b/test/LuaJIT-tests/lang/hook_line.lua
@@ -0,0 +1,45 @@
+-- The test depends on the number of lines in the file.
+local lines = {}
+local function hook()
+  lines[#lines + 1] = debug.getinfo(2).currentline
+end
+
+local function dummy()
+end -- <-- line 8
+
+do --- Base test: cycles, function calls.
+  debug.sethook(hook, "l", 0)
+  -- <-- line 12
+  local x
+  dummy()
+  local y = 1
+  dummy() dummy()

I would place a second call to a separate line. Feel free to ignore.



+  local z = 2; local r = true
+  while y < 4 do y = y + 1 end
+  while z < 4 do
+    z = z + 1
+  end
+  -- <-- line 22
+  local v
+  debug.sethook(nil, "", 0)
+
+  assert(#lines > 0)
+  while lines[1] < 12 do table.remove(lines, 1) end
+  while lines[#lines] > 22 do table.remove(lines) end
+
+  local s = table.concat(lines, " ")
+  assert(s == "13 14 8 15 16 8 8 17 18 18 18 18 19 20 19 20 19" or
+         s == "13 14 8 15 16 8 16 8 17 18 18 18 18 19 20 19 20 19")
+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 40
+  debug.sethook(hook, "l", 0)
+  f()
+  debug.sethook(nil, "", 0)
+  for i = 1, #lines do assert(lines[i] ~= 40) 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
-
--------------4KGg6DX3hm00hBpC97Uyfad2--