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 17CF1C5968D; Fri, 23 Aug 2024 18:17:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 17CF1C5968D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1724426238; bh=hyzO6LIoCJbUAP8zv1cpwqQH5WEbxahv7jkPbCsod/U=; 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=XeIyCPl9ieDTB5f0IVbGDqYZK95Ehy3VwgGo2p+7uHRAN9l/zm2wORNmOSo0HIzfG PVS3TUVMcgTT4W1gJhQoaj6hDiNMlik2oRfjM5saZUdR+prKk4447iVdX9shEX+6ek jbfZ4q3rEWYH84HZbFxEc/8DqFfLBXzuXDfj1K30= Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [95.163.41.87]) (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 9AAF6C59681 for ; Fri, 23 Aug 2024 18:17:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9AAF6C59681 Received: by smtp51.i.mail.ru with esmtpa (envelope-from ) id 1shW2N-0000000HE5V-28CZ; Fri, 23 Aug 2024 18:17:16 +0300 Content-Type: multipart/alternative; boundary="------------a06DNUG6TuaeAq58Xjc1ZV09" Message-ID: <3d0293d0-2198-41d1-814f-905cc57f2bd5@tarantool.org> Date: Fri, 23 Aug 2024 18:17:15 +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: 4F1203BC0FB41BD9A67092BE052B1D9E8EC46B20539565FBAAD54790EDBD605A182A05F538085040D3A339F9FEB9D66A89CEA9C911D09995E967E1B9CBD58D2DAE61B31A8F196B69F9A1BFFC5DE7340A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75644E22E05AA81AEB287FD4696A6DC2FA8DF7F3B2552694A4E2F5AFA99E116B42401471946AA11AF1661749BA6B97735780BADBB53F1FA598F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB55337566470FDDF56E548F8EE4C5092028D0FC5135E5A175782E9EF6CFA1B773547C25C4389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0ECC8AC47CD0EDEFF8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C0275BD81545649B2F7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F9647ADFADE5905B1FCE65BE3358055BDB3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B654CE8ED7C2D004275ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A58823BAE7ACEED25A5002B1117B3ED696EA343CB902BB10A05D145BB8EF0DE66B823CB91A9FED034534781492E4B8EEAD21D4E6D365FE45D1BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFA9818867BA78A65E87C49EF5635B74D567947E9FAED90E4E07708DB7AE4BD72A8657CCA151A12AF52FB0CAD32ADFBF84AE444735147FBD31987EFD79A9A889EAD6485BBEEC5D27625F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojPqZSx9J9Ex0pUj6nrLaIoQ== X-Mailru-Sender: 520A125C2F17F0B1E52FEF5D219D61400F6B21CFA304E82B56165D9D8BA5DB9576AA228A3A5263D90152A3D17938EB451EB5A0BCEC6A560B3DDE9B364B0DF289BE2DA36745F2EEB5CEBA01FB949A1F1EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 20/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. --------------a06DNUG6TuaeAq58Xjc1ZV09 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 , and names the subtests. > > Part of tarantool/tarantool#9398 > --- thanks for the patch! LGTM > test/LuaJIT-tests/lang/hook_top.lua | 59 +++++++++++++++++++++++++++++ > test/LuaJIT-tests/lang/index | 1 + > test/LuaJIT-tests/misc/hook_top.lua | 55 --------------------------- > 3 files changed, 60 insertions(+), 55 deletions(-) > create mode 100644 test/LuaJIT-tests/lang/hook_top.lua > delete mode 100644 test/LuaJIT-tests/misc/hook_top.lua > > diff --git a/test/LuaJIT-tests/lang/hook_top.lua b/test/LuaJIT-tests/lang/hook_top.lua > new file mode 100644 > index 00000000..4cab2559 > --- /dev/null > +++ b/test/LuaJIT-tests/lang/hook_top.lua > @@ -0,0 +1,59 @@ > +local t = {} > +for i = 1, 26 do t[i] = string.char(96 + i) end > + > +local function tcheck(t1, t2) > + assert(#t1 == #t2) > + for i = 1, #t1 do assert(t1[i] == t2[i]) end > +end > + > +local function foo1(...) -- VARG RETM > + return ... > +end > + > +local function foo2(...) -- VARG UCLO RETM > + local function dummy() end > + return ... > +end > + > +local function foo3(...) -- VARG UCLO -> RETM > + do return ... end > + local function dummy() end > +end > + > +local function foo4() -- UCLO UCLO RET > + do > + local x > + local function dummy() return x end > + end > +end > + > +local function foo5(a) > + assert(a == "bar") > +end > + > +do --- Run hook on each bytecode instruction. > + local called = false > + debug.sethook(function() local x = "wrong"; called = true end, "", 1) > + tcheck(t, {foo1(unpack(t))}) -- CALLM TSETM > + assert(called) > + called = false > + tcheck(t, {foo2(unpack(t))}) > + assert(called) > + called = false > + tcheck(t, {foo3(unpack(t))}) > + assert(called) > + called = false > + foo4() > + assert(called) > + debug.sethook(nil) > +end > + > +do --- Set local variable given to a function inside the hook. > + debug.sethook(function() > + local name, val = debug.getlocal(2, 1) > + assert(name == "a" and val == nil) > + debug.setlocal(2, 1, "bar") > + debug.sethook(nil) > + end, "c") > + foo5() > +end > diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index > index ae59bc56..327b40fe 100644 > --- a/test/LuaJIT-tests/lang/index > +++ b/test/LuaJIT-tests/lang/index > @@ -10,6 +10,7 @@ dualnum.lua > for.lua > hook_active.lua > hook_line.lua > +hook_top.lua > length.lua > lightud.lua > modulo.lua > diff --git a/test/LuaJIT-tests/misc/hook_top.lua b/test/LuaJIT-tests/misc/hook_top.lua > deleted file mode 100644 > index f809fcea..00000000 > --- a/test/LuaJIT-tests/misc/hook_top.lua > +++ /dev/null > @@ -1,55 +0,0 @@ > - > -local t = {} > -for i=1,26 do t[i] = string.char(96+i) end > - > -local function tcheck(t1, t2) > - assert(#t1 == #t2) > - for i=1,#t1 do assert(t1[i] == t2[i]) end > -end > - > -local function foo1(...) -- VARG RETM > - return ... > -end > - > -local function foo2(...) -- VARG UCLO RETM > - local function dummy() end > - return ... > -end > - > -local function foo3(...) -- VARG UCLO -> RETM > - do return ... end > - local function dummy() end > -end > - > -local function foo4() -- UCLO UCLO RET > - do > - local x > - local function dummy() return x end > - end > -end > - > -called = false > -debug.sethook(function() local x = "wrong"; called = true end, "", 1) > -tcheck(t, {foo1(unpack(t))}) -- CALLM TSETM > -assert(called) > -called = false > -tcheck(t, {foo2(unpack(t))}) > -assert(called) > -called = false > -tcheck(t, {foo2(unpack(t))}) > -assert(called) > -called = false > -foo4() > -assert(called) > - > -debug.sethook(function() > - local name, val = debug.getlocal(2, 1) > - assert(name == "a" and val == nil) > - debug.setlocal(2, 1, "bar") > - debug.sethook(nil) > -end, "c") > -local function foo5(a) > - assert(a == "bar") > -end > -foo5() > - --------------a06DNUG6TuaeAq58Xjc1ZV09 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>, and names the subtests.

Part of tarantool/tarantool#9398
---
thanks for the patch! LGTM
 test/LuaJIT-tests/lang/hook_top.lua | 59 +++++++++++++++++++++++++++++
 test/LuaJIT-tests/lang/index        |  1 +
 test/LuaJIT-tests/misc/hook_top.lua | 55 ---------------------------
 3 files changed, 60 insertions(+), 55 deletions(-)
 create mode 100644 test/LuaJIT-tests/lang/hook_top.lua
 delete mode 100644 test/LuaJIT-tests/misc/hook_top.lua

diff --git a/test/LuaJIT-tests/lang/hook_top.lua b/test/LuaJIT-tests/lang/hook_top.lua
new file mode 100644
index 00000000..4cab2559
--- /dev/null
+++ b/test/LuaJIT-tests/lang/hook_top.lua
@@ -0,0 +1,59 @@
+local t = {}
+for i = 1, 26 do t[i] = string.char(96 + i) end
+
+local function tcheck(t1, t2)
+  assert(#t1 == #t2)
+  for i = 1, #t1 do assert(t1[i] == t2[i]) end
+end
+
+local function foo1(...) -- VARG RETM
+  return ...
+end
+
+local function foo2(...) -- VARG UCLO RETM
+  local function dummy() end
+  return ...
+end
+
+local function foo3(...) -- VARG UCLO -> RETM
+  do return ... end
+  local function dummy() end
+end
+
+local function foo4() -- UCLO UCLO RET
+  do
+    local x
+    local function dummy() return x end
+  end
+end
+
+local function foo5(a)
+  assert(a == "bar")
+end
+
+do --- Run hook on each bytecode instruction.
+  local called = false
+  debug.sethook(function() local x = "wrong"; called = true end, "", 1)
+  tcheck(t, {foo1(unpack(t))}) -- CALLM TSETM
+  assert(called)
+  called = false
+  tcheck(t, {foo2(unpack(t))})
+  assert(called)
+  called = false
+  tcheck(t, {foo3(unpack(t))})
+  assert(called)
+  called = false
+  foo4()
+  assert(called)
+  debug.sethook(nil)
+end
+
+do --- Set local variable given to a function inside the hook.
+  debug.sethook(function()
+    local name, val = debug.getlocal(2, 1)
+    assert(name == "a" and val == nil)
+    debug.setlocal(2, 1, "bar")
+    debug.sethook(nil)
+  end, "c")
+  foo5()
+end
diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index
index ae59bc56..327b40fe 100644
--- a/test/LuaJIT-tests/lang/index
+++ b/test/LuaJIT-tests/lang/index
@@ -10,6 +10,7 @@ dualnum.lua
 for.lua
 hook_active.lua
 hook_line.lua
+hook_top.lua
 length.lua
 lightud.lua
 modulo.lua
diff --git a/test/LuaJIT-tests/misc/hook_top.lua b/test/LuaJIT-tests/misc/hook_top.lua
deleted file mode 100644
index f809fcea..00000000
--- a/test/LuaJIT-tests/misc/hook_top.lua
+++ /dev/null
@@ -1,55 +0,0 @@
-
-local t = {}
-for i=1,26 do t[i] = string.char(96+i) end
-
-local function tcheck(t1, t2)
-  assert(#t1 == #t2)
-  for i=1,#t1 do assert(t1[i] == t2[i]) end
-end
-
-local function foo1(...) -- VARG RETM
-  return ...
-end
-
-local function foo2(...) -- VARG UCLO RETM
-  local function dummy() end
-  return ...
-end
-
-local function foo3(...) -- VARG UCLO -> RETM
-  do return ... end
-  local function dummy() end
-end
-
-local function foo4() -- UCLO UCLO RET
-  do
-    local x
-    local function dummy() return x end
-  end
-end
-
-called = false
-debug.sethook(function() local x = "wrong"; called = true end, "", 1)
-tcheck(t, {foo1(unpack(t))}) -- CALLM TSETM
-assert(called)
-called = false
-tcheck(t, {foo2(unpack(t))})
-assert(called)
-called = false
-tcheck(t, {foo2(unpack(t))})
-assert(called)
-called = false
-foo4()
-assert(called)
-
-debug.sethook(function()
-  local name, val = debug.getlocal(2, 1)
-  assert(name == "a" and val == nil)
-  debug.setlocal(2, 1, "bar")
-  debug.sethook(nil)
-end, "c")
-local function foo5(a)
-  assert(a == "bar")
-end
-foo5()
-
--------------a06DNUG6TuaeAq58Xjc1ZV09--