[Tarantool-patches] [PATCH v2 luajit 21/26] test: enable <ffi_parse_struct.lua> LuaJIT test

Maxim Kokryashkin m.kokryashkin at tarantool.org
Thu Feb 1 12:16:24 MSK 2024


Hi, Sergey!
Thanks for the patch!
Please consider my comments below.

On Mon, Jan 29, 2024 at 01:45:21PM +0300, Sergey Kaplun wrote:
> This patch changes `dofile()` (which uses an unreliable relative file
> path and mutates `_G` with global functions to be defined) to the
> corresponding `require()` of the helper functions. It adds groups with
> the names of subtests and enables the test in <index>.
>
> Part of tarantool/tarantool#9398
> ---
>  .../LuaJIT-tests/lib/ffi/ffi_parse_struct.lua | 335 +++++++++---------
>  test/LuaJIT-tests/lib/ffi/index               |   1 +
>  2 files changed, 176 insertions(+), 160 deletions(-)
>
> diff --git a/test/LuaJIT-tests/lib/ffi/ffi_parse_struct.lua b/test/LuaJIT-tests/lib/ffi/ffi_parse_struct.lua
> index 16a3d053..cb231c33 100644
> --- a/test/LuaJIT-tests/lib/ffi/ffi_parse_struct.lua
> +++ b/test/LuaJIT-tests/lib/ffi/ffi_parse_struct.lua
> @@ -1,113 +1,123 @@
>  local ffi = require("ffi")
>
> -dofile("../common/ffi_util.inc")
> +local checkfail = require("common.ffi.checkfail")
> +local checktypes = require("common.ffi.checktypes")
> +local fails = require("common.fails")
>
> -checkfail{
> -  "struct",
> -  "struct {",
> -  "struct xx xx {}",
> -  "struct { int x  }",
> -  "struct { int x,  }",
> -  "struct { int x,y  }",
> -  "struct { void x; }",
> -  "struct { int x(void); }",
> -  "struct recursive1 { struct recursive1 { } x; }",
> -  "union",
> -  "union {",
> -  "union xx xx {}",
> -  "union { int x  }",
> -  "union { int x,  }",
> -  "union { int x,y  }",
> -  "union { void x; }",
> -  "union { int x(void); }",
> -  "union recursive1 { union recursive1 { } x; }",
> -}
> +local P = ffi.sizeof("void *")
> +local A = (ffi.arch == "x86" and not ffi.abi("win")) and 4 or 8
> +
> +do --- checkfail
A more elaborate name would be nice.
> +  checkfail{
> +    "struct",
> +    "struct {",
> +    "struct xx xx {}",
> +    "struct { int x  }",
> +    "struct { int x,  }",
> +    "struct { int x,y  }",
> +    "struct { void x; }",
<snipped>


More information about the Tarantool-patches mailing list