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 A0E63988E57; Fri, 19 Jan 2024 14:40:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A0E63988E57 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1705664404; bh=+daV4qbYoJKkFxqdV/6tSdTM/ojuNErWOHDpFNRQjIQ=; 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=lhj7UuMZgztE4aQ+5XM3nb3WJhuHUi3aDkDqkH1rxTdRe9i4pv6bmnfOLLO+DdQxR jfzw61it5KGjuY9/vVYQXVI87q2ULjPj94a2u7i87ckwT/5IrdxCjKI2Hbsj2E3DiQ vktRaZ2CVG5DPctIHqALkL/khfBoPJstDU4nPmFQ= Received: from smtp16.i.mail.ru (smtp16.i.mail.ru [95.163.41.69]) (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 6C4799885F1 for ; Fri, 19 Jan 2024 14:37:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6C4799885F1 Received: by smtp16.i.mail.ru with esmtpa (envelope-from ) id 1rQnBJ-00FDC7-2p; Fri, 19 Jan 2024 14:37:06 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Fri, 19 Jan 2024 14:32:29 +0300 Message-ID: <8254ae42f1f9e872efecf156cfa0885156c934d9.1705661401.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: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9AE5B4AFB3AE2A5909B38FFCAAE1FB38606686B0B5065941A182A05F5380850407FADC94CE5179A7ECD49626DD364B07CB8AFAAEA6CDFA4AF1B1764EB37687C52 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE712EB008F780777E9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637ED4AC1F45ACA54B08638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D88A222CE9CABDD4E5F080574D3184FF40117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC292D688DDAD4E7BC389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8A9FF340AA05FB58CF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE33AC447995A7AD187441229DB5CFFAA63A03B725D353964B2FFDA4F57982C5F435872C767BF85DA227C277FBC8AE2E8B9C5AF73B5E338C8A75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5E80BD2A1D195F3653DE3FD803DF40A2F897F5DAB0EDFE483F87CCE6106E1FC07E67D4AC08A07B9B0632EDEA9CD5989A39C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF663542A8C126797A6F62B2FDD06F8BE63B71F94F80F57F04429574DC66AD206B49BEE304256398FC6197189FEE4B1C7A57647D0B500A963665CCAC8ACD50BAECA74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojJsr4kcGAUCM0OhTaZ1H+0g== X-DA7885C5: 5B6218FE11935F9A22358C9D20223E7B6EB23D915B87CE1DB2D054833B1E0376262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F7393590D8C940224AE33039EF144B04C770EAFF5ABAB67AFDB7C0FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 06/25] 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 | 33 +++++++++++----------- test/LuaJIT-tests/lib/ffi/index | 1 + 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/test/LuaJIT-tests/lib/ffi/ffi_callback.lua b/test/LuaJIT-tests/lib/ffi/ffi_callback.lua index 1fd14bd0..253bf1d9 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,7 +19,7 @@ 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) == @@ -37,11 +37,13 @@ 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) @@ -51,7 +53,7 @@ do 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) @@ -67,8 +69,7 @@ if jit.arch == "x86" then 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 --- cb.free cb.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 --- string.byte assert(ffi.cast("int (*)()", function() return string.byte"A" end)() == 65) end -do +do --- debug.traceback debug.sethook 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