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 luajit 18/25] test: enable <ffi_parse_basic.lua> in LuaJIT-tests
Date: Fri, 19 Jan 2024 14:32:41 +0300	[thread overview]
Message-ID: <8140d4775dec4e19bcbc692db304cc04acb4532c.1705661401.git.skaplun@tarantool.org> (raw)
In-Reply-To: <cover.1705661401.git.skaplun@tarantool.org>

This patch changes `dofile()` 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
---
 test/LuaJIT-tests/lib/ffi/ffi_parse_basic.lua | 251 +++++++++---------
 test/LuaJIT-tests/lib/ffi/index               |   1 +
 2 files changed, 132 insertions(+), 120 deletions(-)

diff --git a/test/LuaJIT-tests/lib/ffi/ffi_parse_basic.lua b/test/LuaJIT-tests/lib/ffi/ffi_parse_basic.lua
index c054bcfb..3b49648c 100644
--- a/test/LuaJIT-tests/lib/ffi/ffi_parse_basic.lua
+++ b/test/LuaJIT-tests/lib/ffi/ffi_parse_basic.lua
@@ -1,131 +1,142 @@
 local ffi = require("ffi")
 
-dofile("../common/ffi_util.inc")
+local checkfail = require("common.ffi.checkfail")
+local checktypes = require("common.ffi.checktypes")
 
-checkfail{
-  "",
-  " ",
-  "\n",
-  "1",
-  ".",
-  ";",
-  ",",
-  "*",
-  "[]",
-  "()",
-  "(*)",
-  "//",
-  "/*",
-  "xyz",
-  "const",
-  "volatile",
-  "typedef",
-  "extern",
-  "static",
-  "auto",
-  "register",
-  "struct",
-  "union",
-  "sizeof",
-  "int int",
-  "int char",
-  "int double",
-  "int;",
-}
+do --- checkfail
+  checkfail{
+    "",
+    " ",
+    "\n",
+    "1",
+    ".",
+    ";",
+    ",",
+    "*",
+    "[]",
+    "()",
+    "(*)",
+    "//",
+    "/*",
+    "xyz",
+    "const",
+    "volatile",
+    "typedef",
+    "extern",
+    "static",
+    "auto",
+    "register",
+    "struct",
+    "union",
+    "sizeof",
+    "int int",
+    "int char",
+    "int double",
+    "int;",
+  }
+end
 
-checktypes{
-  1,	1,	"char",
-  1,	1,	" \n\r\t\vchar \n\r\t\v",
-  1,	1,	"ch\\\nar",
-  1,	1,	"char /* abc */",
-  1,	1,	"char /* abc */ const",
-  1,	1,	"char // abc\n const",
-}
+do --- char newlines
+  checktypes{
+    1,	1,	"char",
+    1,	1,	" \n\r\t\vchar \n\r\t\v",
+    1,	1,	"ch\\\nar",
+    1,	1,	"char /* abc */",
+    1,	1,	"char /* abc */ const",
+    1,	1,	"char // abc\n const",
+  }
+end
 
-checktypes{
-  nil,	1,	"void",
-  1,	1,	"bool",
-  1,	1,	"_Bool",
-  4,	4,	"_Bool int",
-  1,	1,	"char",
-  1,	1,	"signed char",
-  1,	1,	"unsigned char",
-  2,	2,	"short",
-  2,	2,	"signed short",
-  2,	2,	"unsigned short",
-  4,	4,	"int",
-  4,	4,	"signed int",
-  4,	4,	"unsigned int",
-  4,	4,	"signed",
-  4,	4,	"unsigned",
-  4,	4,	"float",
-  8,	8,	"long long",
-  8,	8,	"signed long long",
-  8,	8,	"unsigned long long",
-  8,	8,	"double",
-  -- NYI: long double is architecture- and compiler-specific.
-  8,	4,	"_Complex float",
-  16,	8,	"_Complex",
-  16,	8,	"_Complex double",
-}
+do --- base types
+  checktypes{
+    nil,	1,	"void",
+    1,	1,	"bool",
+    1,	1,	"_Bool",
+    4,	4,	"_Bool int",
+    1,	1,	"char",
+    1,	1,	"signed char",
+    1,	1,	"unsigned char",
+    2,	2,	"short",
+    2,	2,	"signed short",
+    2,	2,	"unsigned short",
+    4,	4,	"int",
+    4,	4,	"signed int",
+    4,	4,	"unsigned int",
+    4,	4,	"signed",
+    4,	4,	"unsigned",
+    4,	4,	"float",
+    8,	8,	"long long",
+    8,	8,	"signed long long",
+    8,	8,	"unsigned long long",
+    8,	8,	"double",
+    -- NYI: long double is architecture- and compiler-specific.
+    8,	4,	"_Complex float",
+    16,	8,	"_Complex",
+    16,	8,	"_Complex double",
+  }
+end
 
--- mode/vector_size attributes
-checktypes{
-  1,	1,	"int __attribute__((mode(QI)))",
-  2,	2,	"int __attribute__((mode(HI)))",
-  4,	4,	"int __attribute__((mode(SI)))",
-  8,	8,	"int __attribute__((mode(DI)))",
-  16,	16,	"int __attribute__((mode(TI)))",
-  32,	16,	"int __attribute__((mode(OI)))",
-  4,	4,	"float __attribute__((mode(SF)))",
-  8,	8,	"float __attribute__((mode(DF)))",
-  2,	2,	"int __attribute__((mode(V2QI)))",
-  16,	16,	"float __attribute__((mode(V4SF)))",
-  32,	16,	"double __attribute__((mode(V8SF)))",
-  8,	8,	"char __attribute__((vector_size(8)))",
-  16,	16,	"int __attribute__((vector_size(16)))",
-  32,	16,	"double __attribute__((vector_size(32)))",
-  64,	16,	"double __attribute__((vector_size(64)))",
-}
+do --- mode/vector_size attributes
+  checktypes{
+    1,	1,	"int __attribute__((mode(QI)))",
+    2,	2,	"int __attribute__((mode(HI)))",
+    4,	4,	"int __attribute__((mode(SI)))",
+    8,	8,	"int __attribute__((mode(DI)))",
+    16,	16,	"int __attribute__((mode(TI)))",
+    32,	16,	"int __attribute__((mode(OI)))",
+    4,	4,	"float __attribute__((mode(SF)))",
+    8,	8,	"float __attribute__((mode(DF)))",
+    2,	2,	"int __attribute__((mode(V2QI)))",
+    16,	16,	"float __attribute__((mode(V4SF)))",
+    32,	16,	"double __attribute__((mode(V8SF)))",
+    8,	8,	"char __attribute__((vector_size(8)))",
+    16,	16,	"int __attribute__((vector_size(16)))",
+    32,	16,	"double __attribute__((vector_size(32)))",
+    64,	16,	"double __attribute__((vector_size(64)))",
+  }
+end
 
--- ABI-specific types:
-local L = (ffi.abi("32bit") or ffi.abi("win")) and 4 or 8
-local P = ffi.abi("32bit") and 4 or 8
-local W = ffi.abi("win") and 2 or 4
+do --- ABI-specific types:
+  local L = (ffi.abi("32bit") or ffi.abi("win")) and 4 or 8
+  local P = ffi.abi("32bit") and 4 or 8
+  local W = ffi.abi("win") and 2 or 4
 
-checktypes{
-  L,	L,	"long",
-  L,	L,	"signed long",
-  L,	L,	"unsigned long",
-  P,	P,	"int *",
-  P,	P,	"int **",
-  4,	4,	"int * __ptr32",
-}
+  checktypes{
+    L,	L,	"long",
+    L,	L,	"signed long",
+    L,	L,	"unsigned long",
+    P,	P,	"int *",
+    P,	P,	"int **",
+    4,	4,	"int * __ptr32",
+  }
 
-checktypes{
-  P,	P,	"ptrdiff_t",
-  P,	P,	"size_t",
-  W,	W,	"wchar_t",
-  1,	1,	"int8_t",
-  2,	2,	"int16_t",
-  4,	4,	"int32_t",
-  8,	8,	"int64_t",
-  1,	1,	"uint8_t",
-  2,	2,	"uint16_t",
-  4,	4,	"uint32_t",
-  8,	8,	"uint64_t",
-  P,	P,	"intptr_t",
-  P,	P,	"uintptr_t",
-}
+  checktypes{
+    P,	P,	"ptrdiff_t",
+    P,	P,	"size_t",
+    W,	W,	"wchar_t",
+    1,	1,	"int8_t",
+    2,	2,	"int16_t",
+    4,	4,	"int32_t",
+    8,	8,	"int64_t",
+    1,	1,	"uint8_t",
+    2,	2,	"uint16_t",
+    4,	4,	"uint32_t",
+    8,	8,	"uint64_t",
+    P,	P,	"intptr_t",
+    P,	P,	"uintptr_t",
+  }
+end
 
-checktypes{
-  1,	8,	"char __attribute__((aligned(8)))",
-  1,	8,	"char __attribute((aligned(8)))",
-  1,	8,	"char __attribute__((__aligned__(8)))",
-  1,	8,	"__attribute__((aligned(8))) char",
-  1,	8,	"char __declspec(align(8))",
-  1,	8,	"__declspec(align(8)) char",
-  1,	2,	"char __attribute__((aligned(8))) const __attribute__((aligned(2)))",
-  1,	16,	"char __attribute__((aligned(8))) const __attribute__((aligned(16)))",
-}
+do --- attributes
+  checktypes{
+    1,	8,	"char __attribute__((aligned(8)))",
+    1,	8,	"char __attribute((aligned(8)))",
+    1,	8,	"char __attribute__((__aligned__(8)))",
+    1,	8,	"__attribute__((aligned(8))) char",
+    1,	8,	"char __declspec(align(8))",
+    1,	8,	"__declspec(align(8)) char",
+    1,	2,	"char __attribute__((aligned(8))) const __attribute__((aligned(2)))",
+    1,	16,	"char __attribute__((aligned(8))) const __attribute__((aligned(16)))",
+  }
+end
 
diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index
index 89773c0c..a805bdd0 100644
--- a/test/LuaJIT-tests/lib/ffi/index
+++ b/test/LuaJIT-tests/lib/ffi/index
@@ -17,6 +17,7 @@ ffi_lex_number.lua
 ffi_metatype.lua
 ffi_new.lua
 ffi_parse_array.lua
+ffi_parse_basic.lua
 istype.lua
 jit_array.lua
 jit_complex.lua
-- 
2.43.0


  parent reply	other threads:[~2024-01-19 11:46 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
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 ` Sergey Kaplun via Tarantool-patches [this message]
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=8140d4775dec4e19bcbc692db304cc04acb4532c.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 18/25] test: enable <ffi_parse_basic.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