From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 667529A88D9; Mon, 5 Feb 2024 16:03:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 667529A88D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1707138205; bh=vdLFYNlMPvP/zObjaPYz02dTGpsxO3YHOBMjjYJyRiA=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=GW2Vp3I+pGnDIfNTE0azoIp6VuZ02bKNRaBIIijep6eXc5Y0PuSA/FHLgCwXbTyzS h+Og9EcqtTJxvWvGVjG55jt6oTjedRTrc9P57bRhcRFnbKKRfYUjXr8M4j5JOmSSMp WM9kwZeYuJTzbEbhJEZiej+Y5hpjeFyLlkH8toXE= Received: from smtp17.i.mail.ru (smtp17.i.mail.ru [95.163.41.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 9EDAB9A88E8 for ; Mon, 5 Feb 2024 16:03:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9EDAB9A88E8 Received: by smtp17.i.mail.ru with esmtpa (envelope-from ) id 1rWyd8-00000006QTj-14kv; Mon, 05 Feb 2024 16:03:22 +0300 Message-ID: Date: Mon, 5 Feb 2024 16:03:22 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun , Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD94C460F083DF69F51F243EDEE97DB63500C35E1C1BBCAAE16182A05F538085040504E3335549A2E462EB5D77EF37489D1C7FBFC715962A256434675A7731556E593E494D66C88D90D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE78FF511FAAD1B1E98C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7627B7646117F0BF3EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38B73AB1701401CD871E9459869C6FD06A2B8EB579952D440DCEC92F297B8E61D4FA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3CA5A41EBD8A3A0199FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE7DBD65F756F41B00DD32BA5DBAC0009BE395957E7521B51C2330BD67F2E7D9AF1090A508E0FED6299176DF2183F8FC7C0AD9B849CFF6E855BCD04E86FAF290E2DB606B96278B59C421DD303D21008E29813377AFFFEAFD269176DF2183F8FC7C0FE3A47D6FA29121068655334FD4449CB33AC447995A7AD18262FEC7FBD7D1F5BD5E8D9A59859A8B602CFACCC19C6E7D3089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A55E0609E4A184C1605002B1117B3ED69691633AC525B2DA30CA7E60A991436CA2823CB91A9FED034534781492E4B8EEAD1E02C13459908652BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF8B81B589C16BCD138B4A72D5E7AE631EFD55591B0BA8894A600CD3C859321F8B66401EE05C14F77D14BC176DD269F15EA45C3447193D25D0847E78BCFF45258420549C5C0199DE7A5F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj0TrRSEWQ3Vli1AcBnXUVBg== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769DA03DE0CFC716A3D2EB5D77EF37489D1C7FBFC715962A256B7CBEF92542CD7C8795FA72BAB74744FC77752E0C033A69EA16A481184E8BB1C9B38E6EA4F046BE03A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 17/26] test: enable in LuaJIT-tests X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey thanks for the patch! LGTM with minor comments On 1/29/24 13:45, 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 function. It adds groups with the > names of subtests and enables the test in . It renames structures > 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_new.lua | 50 +++++++++++++-------------- > test/LuaJIT-tests/lib/ffi/index | 1 + > 2 files changed, 26 insertions(+), 25 deletions(-) > > diff --git a/test/LuaJIT-tests/lib/ffi/ffi_new.lua b/test/LuaJIT-tests/lib/ffi/ffi_new.lua > index 9cdbd538..e5b19053 100644 > --- a/test/LuaJIT-tests/lib/ffi/ffi_new.lua > +++ b/test/LuaJIT-tests/lib/ffi/ffi_new.lua > @@ -1,37 +1,37 @@ > local ffi = require("ffi") > local bit = require("bit") > > -dofile("../common/ffi_util.inc") > +local fails = require("common.fails") > > ffi.cdef([[ > -typedef struct { int a,b,c; } foo1_t; > -typedef int foo2_t[?]; > +typedef struct { int a,b,c; } foo1_new_t; > +typedef int foo2_new_t[?]; > void *malloc(size_t size); > void free(void *ptr); > ]]) > > -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" same below > + assert(ffi.sizeof("foo1_new_t") == 12) > + local cd = ffi.new("foo1_new_t") > assert(ffi.sizeof(cd) == 12) > - local foo1_t = ffi.typeof("foo1_t") > - assert(ffi.sizeof(foo1_t) == 12) > - cd = foo1_t() > + local foo1_new_t = ffi.typeof("foo1_new_t") > + assert(ffi.sizeof(foo1_new_t) == 12) > + cd = foo1_new_t() > assert(ffi.sizeof(cd) == 12) > end > > -do > - assert(ffi.sizeof("foo2_t", 3) == 12) > - local cd = ffi.new("foo2_t", 3) > +do --- foo2_new_t > + assert(ffi.sizeof("foo2_new_t", 3) == 12) > + local cd = ffi.new("foo2_new_t", 3) > assert(ffi.sizeof(cd) == 12) > - local foo2_t = ffi.typeof("foo2_t") > - fails(ffi.sizeof, foo2_t) > - assert(ffi.sizeof(foo2_t, 3) == 12) > - cd = foo2_t(3) > + local foo2_new_t = ffi.typeof("foo2_new_t") > + fails(ffi.sizeof, foo2_new_t) > + assert(ffi.sizeof(foo2_new_t, 3) == 12) > + cd = foo2_new_t(3) > assert(ffi.sizeof(cd) == 12) > end > > -do > +do --- byte to int cast > local tpi = ffi.typeof("int") > local tpb = ffi.typeof("uint8_t") > local t = {} > @@ -42,7 +42,7 @@ do > assert(x == 199*257 + 1) > end > > -do > +do --- aligned structure GC > local oc = collectgarbage("count") > for al=0,15 do > local align = 2^al -- 1, 2, 4, ..., 32768 > @@ -54,17 +54,17 @@ do > end > end > local nc = collectgarbage("count") > - assert(nc < oc + 3000, "GC step missing for ffi.new") > + assert(nc < oc * 10, "GC step missing for ffi.new") > end > > -do > +do --- VLA > 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 > +do --- VLS > local t = {} > local ct = ffi.typeof("struct { double x; int y[?];}") > for i=1,100 do t[i] = ct(i) end > @@ -72,7 +72,7 @@ do > for i=0,99 do assert(t[100].y[i] == 0) end > end > > -do > +do --- aligned(16) structure exit from trace > local ct = ffi.typeof("struct __attribute__((aligned(16))) { int x; }") > local y > for i=1,200 do > @@ -82,7 +82,7 @@ do > assert(bit.band(ffi.cast("intptr_t", ffi.cast("void *", y)), 15) == 0) > end > > -do > +do --- cdata resurrecting > local q > local p = ffi.gc(ffi.new("int[1]"), function(x) q = x end) > p = nil > @@ -93,13 +93,13 @@ do > assert(q == nil) > end > > -do > +do --- GC malloc free > local p = ffi.gc(ffi.C.malloc(2^20), ffi.C.free) > p = nil > collectgarbage() > end > > -do > +do --- test lua_close() cleanup > local p = ffi.gc(ffi.new("int[1]"), function(x) assert(type(x) == "cdata") end) > -- test for lua_close() cleanup. > end > diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index > index 338a6930..e6c1fd0f 100644 > --- a/test/LuaJIT-tests/lib/ffi/index > +++ b/test/LuaJIT-tests/lib/ffi/index > @@ -15,6 +15,7 @@ ffi_jit_call.lua > ffi_jit_conv.lua > ffi_lex_number.lua > ffi_metatype.lua > +ffi_new.lua > istype.lua > jit_array.lua > jit_complex.lua