From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Maxim Kokryashkin <m.kokryashkin@tarantool.org>, Sergey Bronnikov <sergeyb@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH luajit 06/25] test: enable <ffi_callback.lua> in LuaJIT-tests Date: Fri, 19 Jan 2024 14:32:29 +0300 [thread overview] Message-ID: <8254ae42f1f9e872efecf156cfa0885156c934d9.1705661401.git.skaplun@tarantool.org> (raw) In-Reply-To: <cover.1705661401.git.skaplun@tarantool.org> This patch names all subtests and includes the test in <index>. 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
next prev parent reply other threads:[~2024-01-19 11:40 UTC|newest] Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-19 11:32 [Tarantool-patches] [PATCH luajit 00/25] More tests from LuaJIT-tests, part 1 Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 01/25] test: prepare lauxilarily libs for LuaJIT-tests Sergey Kaplun via Tarantool-patches 2024-01-23 9:10 ` Sergey Bronnikov via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 02/25] test: separate LuaJIT helpers from ffi_util.inc Sergey Kaplun via Tarantool-patches 2024-01-23 9:17 ` Sergey Bronnikov via Tarantool-patches 2024-01-23 12:35 ` Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 03/25] test: enable <ffi_arith_ptr.lua> in LuaJIT-tests Sergey Kaplun via Tarantool-patches 2024-01-23 9:21 ` Sergey Bronnikov via Tarantool-patches 2024-01-23 13:10 ` Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 04/25] test: enable <ffi_bitfield.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 05/25] test: enable <ffi_call.lua> " Sergey Kaplun via Tarantool-patches 2024-01-23 9:32 ` Sergey Bronnikov via Tarantool-patches 2024-01-23 12:46 ` Sergey Kaplun via Tarantool-patches 2024-01-24 11:05 ` Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` Sergey Kaplun via Tarantool-patches [this message] 2024-01-23 9:36 ` [Tarantool-patches] [PATCH luajit 06/25] test: enable <ffi_callback.lua> " Sergey Bronnikov via Tarantool-patches 2024-01-23 12:01 ` Sergey Bronnikov via Tarantool-patches 2024-01-23 12:58 ` Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 07/25] test: enable <ffi_const.lua> " Sergey Kaplun via Tarantool-patches 2024-01-23 9:38 ` Sergey Bronnikov via Tarantool-patches 2024-01-23 11:59 ` Sergey Bronnikov via Tarantool-patches 2024-01-23 12:52 ` Sergey Kaplun via Tarantool-patches 2024-01-23 12:49 ` Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 08/25] test: enable <ffi_convert.lua> " Sergey Kaplun via Tarantool-patches 2024-01-23 9:39 ` Sergey Bronnikov via Tarantool-patches 2024-01-23 12:51 ` Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 09/25] test: enable <ffi_enum.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 10/25] test: enable <ffi_gcstep_recursive.lua> Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 11/25] test: enable <ffi_jit_arith.lua> in LuaJIT-tests Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 12/25] test: enable <ffi_jit_call.lua> " Sergey Kaplun via Tarantool-patches 2024-01-24 14:43 ` Sergey Bronnikov via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 13/25] test: enable <ffi_jit_conv.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 14/25] test: enable <ffi_lex_number.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 15/25] test: enable <ffi_metatype.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 16/25] test: enable <ffi_new.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 17/25] test: enable <ffi_parse_array.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 18/25] test: enable <ffi_parse_basic.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 19/25] test: enable <ffi_parse_cdef.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 20/25] test: enable <ffi_parse_struct.lua> LuaJIT test Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 21/25] test: enable <ffi_tabov.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 22/25] test: enable <lightud.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 23/25] test: enable <api_call.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 24/25] test: enable <catch_wrap.lua> " Sergey Kaplun via Tarantool-patches 2024-01-19 11:32 ` [Tarantool-patches] [PATCH luajit 25/25] test: enable <catch_cpp.lua> " Sergey Kaplun via Tarantool-patches 2024-01-23 9:01 ` [Tarantool-patches] [PATCH luajit 00/25] More tests from LuaJIT-tests, part 1 Sergey Bronnikov via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=8254ae42f1f9e872efecf156cfa0885156c934d9.1705661401.git.skaplun@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=m.kokryashkin@tarantool.org \ --cc=sergeyb@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit 06/25] test: enable <ffi_callback.lua> in LuaJIT-tests' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox