Tarantool development patches archive
 help / color / mirror / Atom feed
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 v2 luajit 13/26] test: enable <ffi_jit_call.lua> in LuaJIT-tests
Date: Mon, 29 Jan 2024 13:45:13 +0300	[thread overview]
Message-ID: <47242e634e89e7d1973aabfd32ced7585bcf086b.1706520765.git.skaplun@tarantool.org> (raw)
In-Reply-To: <cover.1706520765.git.skaplun@tarantool.org>

This patch uses the basename of the ctest library to be loaded via FFI.
It adds groups with the names of subtests and enables the test in
<index>. The corresponding conditions are changed to the tags checked by
analogy with other tests. Tests 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_jit_call.lua | 70 ++++++++++++----------
 test/LuaJIT-tests/lib/ffi/index            |  1 +
 2 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/test/LuaJIT-tests/lib/ffi/ffi_jit_call.lua b/test/LuaJIT-tests/lib/ffi/ffi_jit_call.lua
index b79d60b1..ee9dd5f0 100644
--- a/test/LuaJIT-tests/lib/ffi/ffi_jit_call.lua
+++ b/test/LuaJIT-tests/lib/ffi/ffi_jit_call.lua
@@ -35,33 +35,37 @@ double __stdcall stdcall_dd(double a, double b);
 float __stdcall stdcall_ff(float a, float b);
 ]]
 
-local lib = ffi.load("../clib/ctest")
-
-do
-  local x
-  for i=1,100 do
-    x = lib.call_10i(-42, 17, 12345, 9987, -100, 11, 51, 0x12345678, 338, -78901234)
+local lib = ffi.load("ctest")
+
+do --- 10 int args
+  if not (jit.os == "OSX" and jit.arch == "arm64") then -- NYI
+    local x
+    for i=1,100 do
+      x = lib.call_10i(-42, 17, 12345, 9987, -100, 11, 51, 0x12345678, 338, -78901234)
+    end
+    assert(x == -42 + 17 + 12345 + 9987 - 100 + 11 + 51 + 0x12345678 + 338 - 78901234)
   end
-  assert(x == -42+17+12345+9987-100+11+51+0x12345678+338-78901234)
 end
 
-do
+do --- 17 double args
   for i=1,100 do
     pcall(lib.call_max, i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i)
   end
 end
 
-if ffi.abi("64bit") then
-  local y = ffi.cast("void *", 0x123456789abcdefLL)
-  local x
-  for i=1,100 do
-    lib.call_10j_p(0,0,0,0,0,0,0,0,0, y)
-    x = lib.call_10j_p(0,0,0,0,0,0,0,0,0, nil)
+do --- 10 ints 1 pointer args +abi64
+  if not (jit.os == "OSX" and jit.arch == "arm64") then -- NYI
+    local y = ffi.cast("void *", 0x123456789abcdefLL)
+    local x
+    for i=1,100 do
+      lib.call_10j_p(0,0,0,0,0,0,0,0,0, y)
+      x = lib.call_10j_p(0,0,0,0,0,0,0,0,0, nil)
+    end
+    assert(x == 0)
   end
-  assert(x == 0)
 end
 
-do
+do --- int, int64_t args
   local x = 0
   for i=1,100 do
     x = x + lib.call_ij(100+i, i*0x300000002LL)
@@ -69,7 +73,7 @@ do
   assert(x == 0x3b2e0000623eLL)
 end
 
-do
+do --- 10 double args
   local x
   for i=1,100 do
     x = lib.call_10d(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x12345678, 338, -78901234.75)
@@ -77,15 +81,17 @@ do
   assert(x == -42.5+17.125+12345.5+9987-100.625+11+51+0x12345678+338-78901234.75)
 end
 
-do
-  local x
-  for i=1,100 do
-    x = lib.call_10f(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x123456, 338, -789012.75)
+do --- 10 float args
+  if not (jit.os == "OSX" and jit.arch == "arm64") then -- NYI
+    local x
+    for i=1,100 do
+      x = lib.call_10f(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x123456, 338, -789012.75)
+    end
+    assert(x == -42.5+17.125+12345.5+9987-100.625+11+51+0x123456+338-789012.75)
   end
-  assert(x == -42.5+17.125+12345.5+9987-100.625+11+51+0x123456+338-789012.75)
 end
 
-do
+do --- boolean result
   local x
   for i=-100,100 do
     if not lib.call_b(i) then x = i end
@@ -100,14 +106,14 @@ do
   assert(x == 90)
 end
 
-do
+do --- boolean result, tail call
   local function tail(x)
     return lib.call_b(x)
   end
   for i=1,100 do local a,b,c = tail(1), tail(1), tail(1) end
 end
 
-do
+do --- int8_t, uint8_t, int16_t, uint16_t args and results
   local x = 0
   for i=0x01010080,0x010100ff do x = x + lib.call_i_i8(i) end
   assert(x == -8128)
@@ -135,7 +141,7 @@ do
 end
 
 -- target-specific
-if jit.arch == "x86" then
+do --- fastcall +x86
   for i=1,100 do assert(lib.fastcall_i(-42) == -41) end
   for i=1,100 do assert(lib.fastcall_ii(-42, 17) == -42+17) end
   for i=1,100 do assert(lib.fastcall_iii(-42, 17, 139) == -42+17+139) end
@@ -143,12 +149,12 @@ if jit.arch == "x86" then
   for i=1,100 do assert(lib.fastcall_dd(12.5, -3.25) == 12.5-3.25) end
   local x = lib.fastcall_ji
   for i=1,100 do assert(x(0x123456789LL, -17) == 0x123456789LL-17) end
+end
 
-  if jit.os == "Windows" then
-    for i=1,100 do assert(lib.stdcall_i(-42) == -41) end
-    for i=1,100 do assert(lib.stdcall_ii(-42, 17) == -42+17) end
-    for i=1,100 do assert(lib.stdcall_dd(12.5, -3.25) == 12.5-3.25) end
-    for i=1,100 do assert(lib.stdcall_ff(12.5, -3.25) == 12.5-3.25) end
-  end
+do --- stdcall +x86 +windows
+  for i=1,100 do assert(lib.stdcall_i(-42) == -41) end
+  for i=1,100 do assert(lib.stdcall_ii(-42, 17) == -42+17) end
+  for i=1,100 do assert(lib.stdcall_dd(12.5, -3.25) == 12.5-3.25) end
+  for i=1,100 do assert(lib.stdcall_ff(12.5, -3.25) == 12.5-3.25) end
 end
 
diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index
index 0c1e5e66..d6e2b64a 100644
--- a/test/LuaJIT-tests/lib/ffi/index
+++ b/test/LuaJIT-tests/lib/ffi/index
@@ -11,6 +11,7 @@ ffi_convert.lua
 ffi_enum.lua
 ffi_gcstep_recursive.lua
 ffi_jit_arith.lua
+ffi_jit_call.lua
 istype.lua
 jit_array.lua
 jit_complex.lua
-- 
2.43.0


  parent reply	other threads:[~2024-01-29 10:55 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 10:45 [Tarantool-patches] [PATCH v2 luajit 00/26] More tests from LuaJIT-tests, part 1 Sergey Kaplun via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 01/26] cmake: introduce AddTestLib macro Sergey Kaplun via Tarantool-patches
2024-01-31 11:25   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 11:23     ` Sergey Kaplun via Tarantool-patches
2024-02-09 14:48       ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 14:20   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 02/26] test: prepare lauxilarily libs for LuaJIT-tests Sergey Kaplun via Tarantool-patches
2024-01-31 11:48   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 11:24     ` Sergey Kaplun via Tarantool-patches
2024-02-09 14:50       ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 14:23   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 03/26] test: separate LuaJIT helpers from ffi_util.inc Sergey Kaplun via Tarantool-patches
2024-01-31 11:58   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 11:47     ` Sergey Kaplun via Tarantool-patches
2024-02-09 14:51       ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 15:45   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 11:48     ` Sergey Kaplun via Tarantool-patches
2024-02-07  6:49       ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 04/26] test: enable <ffi_arith_ptr.lua> in LuaJIT-tests Sergey Kaplun via Tarantool-patches
2024-01-31 12:21   ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 15:50   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 05/26] test: enable <ffi_bitfield.lua> " Sergey Kaplun via Tarantool-patches
2024-01-31 12:26   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 11:54     ` Sergey Kaplun via Tarantool-patches
2024-02-09 14:52       ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 15:52   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 11:55     ` Sergey Kaplun via Tarantool-patches
2024-02-07  6:50       ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 06/26] test: enable <ffi_call.lua> " Sergey Kaplun via Tarantool-patches
2024-01-31 12:34   ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 15:58   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 12:01     ` Sergey Kaplun via Tarantool-patches
2024-02-07  6:50       ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 07/26] test: enable <ffi_callback.lua> " Sergey Kaplun via Tarantool-patches
2024-01-31 13:02   ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 16:01   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 08/26] test: enable <ffi_const.lua> " Sergey Kaplun via Tarantool-patches
2024-01-31 14:32   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 12:09     ` Sergey Kaplun via Tarantool-patches
2024-02-09 14:52       ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 14:32   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 12:10     ` Sergey Kaplun via Tarantool-patches
2024-02-07  6:52       ` Sergey Bronnikov via Tarantool-patches
2024-02-01 16:02   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 09/26] test: enable <ffi_convert.lua> " Sergey Kaplun via Tarantool-patches
2024-01-31 14:55   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 13:11     ` Sergey Kaplun via Tarantool-patches
2024-02-06 14:03       ` Sergey Kaplun via Tarantool-patches
2024-02-09 14:58       ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 16:06   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 13:13     ` Sergey Kaplun via Tarantool-patches
2024-02-01 16:19   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 10/26] test: enable <ffi_enum.lua> " Sergey Kaplun via Tarantool-patches
2024-01-31 14:59   ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 16:07   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 11/26] test: enable <ffi_gcstep_recursive.lua> Sergey Kaplun via Tarantool-patches
2024-01-31 15:07   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 13:23     ` Sergey Kaplun via Tarantool-patches
2024-02-09 14:58       ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 16:10   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 12/26] test: enable <ffi_jit_arith.lua> in LuaJIT-tests Sergey Kaplun via Tarantool-patches
2024-01-31 15:15   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 13:29     ` Sergey Kaplun via Tarantool-patches
2024-02-09 14:59       ` Maxim Kokryashkin via Tarantool-patches
2024-02-01 16:12   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` Sergey Kaplun via Tarantool-patches [this message]
2024-02-01  8:30   ` [Tarantool-patches] [PATCH v2 luajit 13/26] test: enable <ffi_jit_call.lua> " Maxim Kokryashkin via Tarantool-patches
2024-02-01 16:15   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 14/26] test: enable <ffi_jit_conv.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  8:32   ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 12:51   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 13:33     ` Sergey Kaplun via Tarantool-patches
2024-02-07  6:53       ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 15/26] test: enable <ffi_lex_number.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  8:38   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 13:39     ` Sergey Kaplun via Tarantool-patches
2024-02-09 16:03       ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 12:53   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 16/26] test: enable <ffi_metatype.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  8:40   ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 12:58   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 13:48     ` Sergey Kaplun via Tarantool-patches
2024-02-07  7:01       ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 17/26] test: enable <ffi_new.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  8:43   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 13:55     ` Sergey Kaplun via Tarantool-patches
2024-02-09 16:09       ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:03   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 13:58     ` Sergey Kaplun via Tarantool-patches
2024-02-07  7:51       ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 18/26] test: enable <ffi_parse_array.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  9:01   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 14:11     ` Sergey Kaplun via Tarantool-patches
2024-02-09 16:11       ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:08   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 14:12     ` Sergey Kaplun via Tarantool-patches
2024-02-07  8:04       ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 19/26] test: enable <ffi_parse_basic.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  9:03   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 14:15     ` Sergey Kaplun via Tarantool-patches
2024-02-09 16:12       ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:10   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 20/26] test: enable <ffi_parse_cdef.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  9:05   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 14:21     ` Sergey Kaplun via Tarantool-patches
2024-02-09 16:12       ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:11   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 21/26] test: enable <ffi_parse_struct.lua> LuaJIT test Sergey Kaplun via Tarantool-patches
2024-02-01  9:16   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 14:23     ` Sergey Kaplun via Tarantool-patches
2024-02-09 16:13       ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:14   ` Sergey Bronnikov via Tarantool-patches
2024-02-06 14:25     ` Sergey Kaplun via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 22/26] test: enable <ffi_tabov.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  9:19   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 14:37     ` Sergey Kaplun via Tarantool-patches
2024-02-09 16:13       ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:20   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 23/26] test: enable <lightud.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  9:23   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 14:43     ` Sergey Kaplun via Tarantool-patches
2024-02-09 16:14       ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:27   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 24/26] test: enable <api_call.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  9:25   ` Maxim Kokryashkin via Tarantool-patches
2024-02-06 14:44     ` Sergey Kaplun via Tarantool-patches
2024-02-09 16:15       ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:28   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 25/26] test: enable <catch_wrap.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  9:31   ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:32   ` Sergey Bronnikov via Tarantool-patches
2024-01-29 10:45 ` [Tarantool-patches] [PATCH v2 luajit 26/26] test: enable <catch_cpp.lua> " Sergey Kaplun via Tarantool-patches
2024-02-01  9:32   ` Maxim Kokryashkin via Tarantool-patches
2024-02-05 13:32   ` Sergey Bronnikov via Tarantool-patches
2024-02-01 16:32 ` [Tarantool-patches] [PATCH v2 luajit 00/26] More tests from LuaJIT-tests, part 1 Sergey Bronnikov via Tarantool-patches
2024-02-06 17:03   ` Sergey Kaplun via Tarantool-patches
2024-02-07  8:06     ` Sergey Bronnikov via Tarantool-patches
2024-02-07  8:14 ` Sergey Bronnikov via Tarantool-patches
2024-02-15 12:49 ` Sergey Kaplun via Tarantool-patches
2024-02-18 11:48   ` Maxim Kokryashkin via Tarantool-patches
2024-02-18 11:54     ` Sergey Kaplun via Tarantool-patches
2024-02-19  8:56       ` Maxim Kokryashkin via Tarantool-patches
2024-02-20  8:10   ` Sergey Bronnikov via Tarantool-patches
2024-02-28 18:25 ` Sergey Kaplun 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=47242e634e89e7d1973aabfd32ced7585bcf086b.1706520765.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 v2 luajit 13/26] test: enable <ffi_jit_call.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