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 EE2AEC1E359; Wed, 14 Aug 2024 17:05:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EE2AEC1E359 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1723644303; bh=8hBYDb0J/HqwvCftQxvqfeCMN6f0uinkx+b2iC0COGw=; 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=S0nBm+fwFmbkZh8nl8AoV1ZJ7jFA3O+vBPG6MIsvPej3iVEnVLuQ1Hg5t9XNNinUT v8b/pOe3vtuZp1RxHpBv12LKWx92G2y4GWgsMreD/l5MVTAeTit1RIoh2zQJh55gRe Fyw3XOc2Y25+MFWSCgcCwUfX0MLlrE5jjY5L5LHg= 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 69F5CC4F427 for ; Wed, 14 Aug 2024 16:56:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 69F5CC4F427 Received: by smtp45.i.mail.ru with esmtpa (envelope-from ) id 1seEUf-00000003nAF-1bR0; Wed, 14 Aug 2024 16:56:53 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Wed, 14 Aug 2024 16:55:58 +0300 Message-ID: <9dffe32018493c60b7a832f715dbc17f359fa96d.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: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D7B6E71A78C20FB96B382944D737B4853B5E28541AFB4802182A05F5380850405128CFCF02C90E84A6D5EE0DB6E1EC8DD5486AFD269BB13A129B12038A8E527C88175C04187C9AB8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE751DD1FEBB966604DEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063748D05F5E01EE6C998638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D812E5550B4D02C69092FDB6FC48C1405698B62B89E07D4688CC7F00164DA146DAFE8445B8C89999728AA50765F7900637CAEE156C82D3D7D9389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8ED96AA85C75E140D117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CFADEF88395FA75C5F76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8BCF01C05423B8DB1BD81D268191BDAD3D3666184CF4C3C14F3FC91FA280E0CE3D1A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F616AD31D0D18CD5CC6EABA9B74D0DA47B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A51C72BFAFAEB9C7DB5002B1117B3ED696FF8DDE565C12BD1B4869453249F34FA4823CB91A9FED034534781492E4B8EEAD1DEE520572A35377C79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF6467DB1C79DF0E567ECCCB560B757863D78F3CC1FB1C6C6E8900E5DB8C3DB8D2C69CBF34C6AF1FF5470327EB0AC8E6932A7EC3C8521DDA49E98BAB6BFF30A478915BC6ADABA85598C226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnMg09N3zL/hmuUgWB1r2Lw== X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B595FF9D8807BBCF486A6D5EE0DB6E1EC8DD5486AFD269BB13AB7CBEF92542CD7C88B0A2698F12F5C9EC77752E0C033A69E86920BD37369036789A8C6A0E60D2BB63A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 16/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 , and names the subtests. Part of tarantool/tarantool#9398 --- 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() - -- 2.45.2