Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>,
	Maxim Kokryashkin <m.kokryashkin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 08/25] test: enable <ffi_convert.lua> in LuaJIT-tests
Date: Tue, 23 Jan 2024 12:39:58 +0300	[thread overview]
Message-ID: <9005e02f-1188-4003-9ac3-e3de0adf2344@tarantool.org> (raw)
In-Reply-To: <546d36fb21e4f1df4dd908aeeeffb20be527cbe9.1705661401.git.skaplun@tarantool.org>

Hi, Sergey!

thanks for the patch!

see comments below

On 1/19/24 14:32, Sergey Kaplun wrote:
> This patch changes `dofile()` to the corresponding require and renames
> the C library in the `require()` call. It adds groups with the names of
> subtests and enables the test in <index>. It renames structure and enum
> typedefs to avoid conflicts with cdef in other tests. The GC threshold
> is increased since all tests run in a single process, so the number of
> GC objects is greater.
>
> Part of tarantool/tarantool#9398
> ---
>   test/LuaJIT-tests/lib/ffi/ffi_convert.lua | 35 +++++++++++------------
>   test/LuaJIT-tests/lib/ffi/index           |  1 +
>   2 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/test/LuaJIT-tests/lib/ffi/ffi_convert.lua b/test/LuaJIT-tests/lib/ffi/ffi_convert.lua
> index bd3fb1f9..284f2b53 100644
> --- a/test/LuaJIT-tests/lib/ffi/ffi_convert.lua
> +++ b/test/LuaJIT-tests/lib/ffi/ffi_convert.lua
> @@ -1,8 +1,7 @@
>   local ffi = require("ffi")
>   
> -local ctest = require("ctest")
> -
> -dofile("../common/ffi_util.inc")
> +local ctest = require("libctest")
> +local fails = require("common.fails")
>   
>   local tonumber = tonumber
>   
> @@ -32,15 +31,15 @@ typedef struct arrinc_t {
>     int a[];
>   } arrinc_t;
>   
> -typedef enum uenum_t {
> +typedef enum uenum_convert_t {
>     UE0, UE71 = 71, UE72
> -} uenum_t;
> +} uenum_convert_t;
>   
> -typedef enum ienum_t {
> +typedef enum ienum_convert_t {
>     IE0, IEM12 = -12, IEM11
> -} ienum_t;
> +} ienum_convert_t;
>   
> -typedef struct foo_t {
> +typedef struct foo_convert_t {
>     bool b;
>     int8_t i8;
>     uint8_t u8;
> @@ -79,9 +78,9 @@ typedef struct foo_t {
>     int si_guard;
>     nest_t sn;
>     uni_t ui;
> -  uenum_t ue;
> -  ienum_t ie;
> -} foo_t;
> +  uenum_convert_t ue;
> +  ienum_convert_t ie;
> +} foo_convert_t;
>   
>   char *strcpy(char *dest, const char *src);
>   typedef struct FILE FILE;
> @@ -89,11 +88,11 @@ int fileno(FILE *stream);
>   int _fileno(FILE *stream);
>   ]]
>   
> -do
> -  local foo_t = ffi.typeof("foo_t")
> -  local sz = ffi.sizeof(foo_t)
> -  local x = foo_t()
> -  local y = foo_t()
> +do --- misc
why three dashes?
> +  local foo_convert_t = ffi.typeof("foo_convert_t")
> +  local sz = ffi.sizeof(foo_convert_t)
> +  local x = foo_convert_t()
> +  local y = foo_convert_t()
>     ffi.fill(x, sz, 0xff)
>     ffi.fill(y, sz, 0xee)
>   
> @@ -769,7 +768,7 @@ do
>     x.ppf = ffi.C.strcpy
>   end
>   
> -do
> +do --- GC cdata __index
why three dashes?
>     collectgarbage()
>     local oc = collectgarbage("count")
>     local cd = ffi.new"struct { struct { int a; } x;}"
> @@ -780,7 +779,7 @@ do
>     for i=1,2 do
>       f(cd)
>       local nc = collectgarbage("count")
> -    assert(nc < oc + 200, "GC step missing for cdata __index")
> +    assert(nc < oc * 3, "GC step missing for cdata __index")
Hm, why?
>       jit.off(f)
>     end
>   end
> diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index
> index 0a72daed..5c2be87f 100644
> --- a/test/LuaJIT-tests/lib/ffi/index
> +++ b/test/LuaJIT-tests/lib/ffi/index
> @@ -7,6 +7,7 @@ ffi_bitfield.lua
>   ffi_call.lua
>   ffi_callback.lua
>   ffi_const.lua
> +ffi_convert.lua
>   istype.lua
>   jit_array.lua
>   jit_complex.lua

  reply	other threads:[~2024-01-23  9: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 ` [Tarantool-patches] [PATCH luajit 06/25] test: enable <ffi_callback.lua> " Sergey Kaplun via Tarantool-patches
2024-01-23  9:36   ` 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 [this message]
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=9005e02f-1188-4003-9ac3-e3de0adf2344@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 08/25] test: enable <ffi_convert.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