[Tarantool-patches] [PATCH v2 luajit 17/26] test: enable <ffi_new.lua> in LuaJIT-tests

Sergey Kaplun skaplun at tarantool.org
Tue Feb 6 16:58:50 MSK 2024


Hi, Sergey!
Thanks for the review!
Fixed your comments below.

On 05.02.24, Sergey Bronnikov wrote:
> Hi, Sergey
> 
> thanks for the patch! LGTM with minor comments
> 
> On 1/29/24 13:45, Sergey Kaplun wrote:

<snipped>

> > -do
> > -  assert(ffi.sizeof("foo1_t") == 12)
> > -  local cd = ffi.new("foo1_t")
> > +do --- foo1_new_t
> 
> test desc says nothing about what test tests.
> 
> I would rename to something like "ffi.sizeof with custom struct"

Renamed as the following:

===================================================================
diff --git a/test/LuaJIT-tests/lib/ffi/ffi_new.lua b/test/LuaJIT-tests/lib/ffi/ffi_new.lua
index 17578995..ec18e324 100644
--- a/test/LuaJIT-tests/lib/ffi/ffi_new.lua
+++ b/test/LuaJIT-tests/lib/ffi/ffi_new.lua
@@ -10,7 +10,7 @@ void *malloc(size_t size);
 void free(void *ptr);
 ]])
 
-do --- new_foo1_t
+do --- ffi.sizeof with custom struct new_foo1_t
   assert(ffi.sizeof("new_foo1_t") == 12)
   local cd = ffi.new("new_foo1_t")
   assert(ffi.sizeof(cd) == 12)
@@ -20,7 +20,7 @@ do --- new_foo1_t
   assert(ffi.sizeof(cd) == 12)
 end
 
-do --- new_foo2_t
+do --- ffi.sizeof with custom struct new_foo2_t
   assert(ffi.sizeof("new_foo2_t", 3) == 12)
   local cd = ffi.new("new_foo2_t", 3)
   assert(ffi.sizeof(cd) == 12)
@@ -57,14 +57,14 @@ do --- aligned structure GC
   assert(nc < oc * 10, "GC step missing for ffi.new")
 end
 
-do --- VLA
+do --- VLA initialization
   local t = {}
   for i=1,100 do t[i] = ffi.new("int[?]", i) end
   assert(ffi.sizeof(t[100]) == 400)
   for i=0,99 do assert(t[100][i] == 0) end
 end
 
-do --- VLS
+do --- VLS initialization
   local t = {}
   local ct = ffi.typeof("struct { double x; int y[?];}")
   for i=1,100 do t[i] = ct(i) end
===================================================================

> 
> same below
> 
> > +  assert(ffi.sizeof("foo1_new_t") == 12)

<snipped>

> >   jit_complex.lua

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list