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 D63EB9DC625; Mon, 29 Jan 2024 13:52:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D63EB9DC625 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1706525574; bh=Ps/NSY+BI0iuEa6nrBiOtMw47QedsbpOEcMV3GyGJl8=; 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=InGVDEBK6thbHayyG41+8+BCgsvlfBZO/K5NvWJMGtkwTXP34wUK/GXgSIm5ChX57 ZMlg6hk62Ct2BiZ6HXeBdIX8NcDtrFOAZaDVXrUDNHaCF1fMrL84RVBrcm4t4uoRT6 oJui8jTTXpS3AslaRRZOY1SlsqTda6X7s2NNkfWs= Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [95.163.41.73]) (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 44D839C2032 for ; Mon, 29 Jan 2024 13:49:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 44D839C2032 Received: by smtp32.i.mail.ru with esmtpa (envelope-from ) id 1rUPCi-0000000BQ6r-25z6; Mon, 29 Jan 2024 13:49:28 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Mon, 29 Jan 2024 13:45:07 +0300 Message-ID: <6530fdfc363b7d0e2ace9c8951d0025d4d3f152d.1706520765.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9A2BFDE4DD2630CDA5F99C8985E3DD4BF24CBCDD037658F52182A05F5380850404C228DA9ACA6FE271433A5B447FCB23C33594132A326AF8B7656844B229C0660DCA4176470581478049A14F81E47D748 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F65C230EDDCD559EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006372F19B29C465B909E8F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB55337566743E074EEF98C24107D309B9F395FC22CB8E2F64A37354FDD835A84779E1C0F8389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C04CF195F1528592878941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B636DA1BED736F9328CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C22493427788C0EDF01CF76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8BC629BAA09222F4953AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC2EE5AD8F952D28FBE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BF62623862A568E3375ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5E2F9E0AD2D79959D5002B1117B3ED696B4E747CD8825066F7E0012C66AE17B00823CB91A9FED034534781492E4B8EEAD01200A96CB7104FFC79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF18FF7F1B5E254991FB0672D540478EF9F9C289FAC425D7ED71E933362AF7946320A397324AFDE1B88FB01E7B8BF01A69BBC3D590A7FFB07AB718120DE96C5CC5E61875943E908913C226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmd9AG1X07oSDfP4yC+i3MA== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769D51EDB915434AAD433594132A326AF8B7656844B229C0660B7CBEF92542CD7C88B0A2698F12F5C9EC77752E0C033A69E86920BD37369036789A8C6A0E60D2BB63A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 luajit 07/26] test: enable in LuaJIT-tests 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 names all subtests and includes the test in . The test with calls with 10 arguments with sizes less than 8 bits are dummy for M1. This suite lacks a mechanism to skip subtests satisfying complicated conditions, so it is done manually by the corresponding `if` check. Part of tarantool/tarantool#9398 --- test/LuaJIT-tests/lib/ffi/ffi_callback.lua | 45 +++++++++++----------- test/LuaJIT-tests/lib/ffi/index | 1 + 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/test/LuaJIT-tests/lib/ffi/ffi_callback.lua b/test/LuaJIT-tests/lib/ffi/ffi_callback.lua index 1fd14bd0..44fac680 100644 --- a/test/LuaJIT-tests/lib/ffi/ffi_callback.lua +++ b/test/LuaJIT-tests/lib/ffi/ffi_callback.lua @@ -6,7 +6,7 @@ void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const uint8_t *, const uint8_t *)); ]] -do +do --- blacklisted callback local cb = ffi.cast("int (*)(int, int, int)", function(a, b, c) return a+b+c end) @@ -19,11 +19,11 @@ do end end -do +do --- cast to function assert(ffi.cast("int64_t (*)(int64_t, int64_t, int64_t)", function(a, b, c) return a+b+c - end)(12345678901234567LL, 70000000000000001LL, 10000000909090904LL) == - 12345678901234567LL+70000000000000001LL+10000000909090904LL) + end)(12345678901234567LL, 70000000000000001LL, 10000000909090904LL) == + 12345678901234567LL + 70000000000000001LL + 10000000909090904LL) assert(ffi.cast("double (*)(double, float, double)", function(a, b, c) return a+b+c @@ -37,21 +37,23 @@ do return a+b+c end)(7.125, -123.25, 9999.33) == 9883.205078125) - assert(ffi.cast("int (*)(int, int, int, int, int, int, int, int, int, int)", - function(a, b, c, d, e, f, g, h, i, j) - return a+b+c+d+e+f+g+h+i+j - end)(-42, 17, 12345, 9987, -100, 11, 51, 0x12345678, 338, -78901234) == - -42+17+12345+9987-100+11+51+0x12345678+338-78901234) + if not (jit.os == "OSX" and jit.arch == "arm64") then -- NYI + assert(ffi.cast("int (*)(int, int, int, int, int, int, int, int, int, int)", + function(a, b, c, d, e, f, g, h, i, j) + return a+b+c+d+e+f+g+h+i+j + end)(-42, 17, 12345, 9987, -100, 11, 51, 0x12345678, 338, -78901234) == + -42 + 17 + 12345 + 9987 - 100 + 11 + 51 + 0x12345678 + 338 - 78901234) + end assert(ffi.cast("double (*)(double, double, double, double, double, double, double, double, double, double)", function(a, b, c, d, e, f, g, h, i, j) return a+b+c+d+e+f+g+h+i+j - end)(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x12345678, 338, -78901234.75) == - -42.5+17.125+12345.5+9987-100.625+11+51+0x12345678+338-78901234.75) + end)(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x12345678, 338, -78901234.75) == + -42.5 + 17.125 + 12345.5 + 9987 - 100.625 + 11 + 51 + 0x12345678 + 338 - 78901234.75) end -- Target-specific tests. -if jit.arch == "x86" then +do --- cast with fastcall attribute +x86 assert(ffi.cast("__fastcall int (*)(int, int, int)", function(a, b, c) return a+b+c end)(10, 99, 13) == 122) @@ -63,12 +65,11 @@ if jit.arch == "x86" then -- Test reordering. assert(ffi.cast("int64_t __fastcall (*)(int64_t, int, int)", function(a, b, c) return a+b+c - end)(12345678901234567LL, 12345, 989797123) == - 12345678901234567LL+12345+989797123) + end)(12345678901234567LL, 12345, 989797123) == + 12345678901234567LL + 12345 + 989797123) end --- Error handling. -do +do --- error handling local function f() return end -- Error for result conversion triggered here. @@ -84,7 +85,7 @@ do assert(pcall(ffi.cast("int (*)(int,int,int,int, int,int,int,int, int)", function() error("test") end), 1,1,1,1, 1,1,1,1, 1) == false) end -do +do --- qsort local function cmp(pa, pb) local a, b = pa[0], pb[0] if a < b then @@ -102,7 +103,7 @@ do for i=0,254 do assert(arr[i] <= arr[i+1]) end end -if ffi.abi"win" then +do --- EnumWindows +windows ffi.cdef[[ typedef int (__stdcall *WNDENUMPROC)(void *hwnd, intptr_t l); int EnumWindows(WNDENUMPROC func, intptr_t l); @@ -123,7 +124,7 @@ if ffi.abi"win" then assert(count > 10) end -do +do --- callback free, callback set local cb = ffi.cast("int(*)(void)", function() return 1 end) assert(cb() == 1) cb:free() @@ -136,7 +137,7 @@ do assert(cb() == 3) end -do +do --- compiled free of function local ft = ffi.typeof("void(*)(void)") local function f() end local t = {} @@ -146,11 +147,11 @@ do end end -do +do --- fast function cast string.byte assert(ffi.cast("int (*)()", function() return string.byte"A" end)() == 65) end -do +do --- debug.traceback cast local f = ffi.cast("void (*)(void)", function() debug.traceback() end) debug.sethook(function() debug.sethook(nil, "", 0); f() end, "", 1) local x diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index index 599a0182..9a22104a 100644 --- a/test/LuaJIT-tests/lib/ffi/index +++ b/test/LuaJIT-tests/lib/ffi/index @@ -5,6 +5,7 @@ err.lua ffi_arith_ptr.lua ffi_bitfield.lua ffi_call.lua +ffi_callback.lua istype.lua jit_array.lua jit_complex.lua -- 2.43.0