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 DC6BBC1E346; Wed, 14 Aug 2024 17:03:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DC6BBC1E346 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1723644212; bh=88cM0xdy5WBoYE5PROp2X86fh3MdMkkXGD8zyF66Jhs=; 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=WytBUO0p2ZquHOQ9rvO0Bs6NGGh2JNkEwVI78SPo3mksagbahnRpm1ldjlCUFbT1U /8QNCbVaYeHOnYANxeQVjj7HxdOUZYOOai0IR6KvYPCEmTkviMB5Ui2VMW5qTtNFte e2+UHjyKwDkmCV28B0mFih35znov6gKd7ZZtHMpM= 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 11FA4C4F424 for ; Wed, 14 Aug 2024 16:56:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 11FA4C4F424 Received: by smtp45.i.mail.ru with esmtpa (envelope-from ) id 1seEUY-00000003nAF-4BAB; Wed, 14 Aug 2024 16:56:47 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Wed, 14 Aug 2024 16:55:55 +0300 Message-ID: <8d787d4027ef517e72eee6b65765f4eacdf00d89.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: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9CB0CA91FF61D77F0FECC69FE2B0083BEDB51CAAD409268F5182A05F5380850404C228DA9ACA6FE2717715D87C837BABBA6D5EE0DB6E1EC8D42E44741C09FD5CD129B12038A8E527C28006A18B89A7667 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72F22E6DC541F75D9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006376E247FA059B8D70F8F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB55337566EC5F2317F763AEE4CCC064ACBA22AA22F39E02DDAE6D8F1DD8009330FC68D5A3389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0ECC8AC47CD0EDEFF8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6E5E764EB5D94DBD4CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C22491A4FA0087C80A78476E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8BDC7AD07F15724E2B3AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735026D3A1080F4EF5CC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A51EF878EC35DA89F45002B1117B3ED69683B8D642FFADE15F406406D89DD9EB8A09CF0A614B9999B12D69E7FE39063EFC1E618B5D5F965AFD844B52986258B1B1B2D1C9E48B6DC60AE2A7E19323554B122E763F503762DF502FCC6C3587AF66184EAF44D9B582CE87C8A4C02DF684249CC203C45FEA855C8F X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFBD3E775C630107E561E8C915F4C6E5A7746267B40EDA7E12FEDA61EE92845036FDDCA1AF55FC97B2470327EB0AC8E69358B7CEDF6B4F8306E98BAB6BFF30A478D88A02BD0AF9FD6CC226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnMg09N3zL/gvBZz5VP2BBw== X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B591410523BED848048A6D5EE0DB6E1EC8D42E44741C09FD5CDB7CBEF92542CD7C88B0A2698F12F5C9EC77752E0C033A69E86920BD37369036789A8C6A0E60D2BB63A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: [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 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 , names the subtests, and adjusts the linenumbers in the assertions to match LuaJIT behaviour and the new code layout. 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 + 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 - -- 2.45.2