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 56F3A9DB78F; Mon, 29 Jan 2024 13:56:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 56F3A9DB78F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1706525785; bh=bL8/37ZGsyT6grtSY021jcxwVVQKZC41RFgArbelMds=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=NMc86Z9dxkS//AUhhJYGCcLfXcaRIWV6Nrn1rulUJ2dctBCv1K4EddHncTElS1zTZ t2SuiQdk0l9AdiSWxYthMbChYGvrkHNasOh6htc43/cdQntttKkRn5t6BQF4bnbjZA 5jF39fzWj7asgLS27GRKh3xQZEv5TeTHMBlWQiw4= Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [95.163.41.73]) (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 F14C29C203A for ; Mon, 29 Jan 2024 13:49:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F14C29C203A Received: by smtp32.i.mail.ru with esmtpa (envelope-from ) id 1rUPCt-0000000BQ6r-45rT; Mon, 29 Jan 2024 13:49:40 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Mon, 29 Jan 2024 13:45:14 +0300 Message-ID: <45b12cbc615209e0017799101de44ff538f22b64.1706520765.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD96A58C36AA2E996493B59CFE144E5211364883C69D379339B182A05F5380850407EB260B09773F88233594132A326AF8B84F8C96EA34E2A03DCA41764705814781F641D77257F6382 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CB5C87C4C9A74E8BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373BFF7CCD9F2968778638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D85DC45B6E2E77705EBE1BF1E404F07B8E2C5D9366169F719DCC7F00164DA146DAFE8445B8C89999728AA50765F79006375FFD5C25497261569FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C37EF884183F8E4D67117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF6804EF05EF4ADF2A3AA81AA40904B5D9CF19DD082D7633A0C84D3B47A649675F3AA81AA40904B5D98AA50765F7900637EF1F32DBCCB8E3DECD04E86FAF290E2DB606B96278B59C421DD303D21008E29813377AFFFEAFD269176DF2183F8FC7C0FE3A47D6FA29121068655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CE52E467C461EF0E943847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A5E0A75BC615FCC9875002B1117B3ED696B1E0163605A19A4F484B8D70797403F6823CB91A9FED034534781492E4B8EEAD45F93BA578C2B99FC79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFEE24E05BEBAFC4CB3917B5E6C1022EF7826EB58F33650233ABF8AC3D4FADFFCCA53151558601347D8FB01E7B8BF01A69624B6841416D32B1B718120DE96C5CC523290105883B92F5C226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmd9AG1X07oQdtnWvRuaiwQ== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769EEC5345D47C663BD33594132A326AF8B84F8C96EA34E2A03B7CBEF92542CD7C88B0A2698F12F5C9EC77752E0C033A69E86920BD37369036789A8C6A0E60D2BB63A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 luajit 14/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 Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch renames the C library in the `require()` call. It adds groups with the names of subtests and enables the test in . It renames enum definitions to avoid conflicts with cdef in other tests. Part of tarantool/tarantool#9398 --- test/LuaJIT-tests/lib/ffi/ffi_jit_conv.lua | 70 +++++++++++----------- test/LuaJIT-tests/lib/ffi/index | 1 + 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/test/LuaJIT-tests/lib/ffi/ffi_jit_conv.lua b/test/LuaJIT-tests/lib/ffi/ffi_jit_conv.lua index d4707db7..0e64fe75 100644 --- a/test/LuaJIT-tests/lib/ffi/ffi_jit_conv.lua +++ b/test/LuaJIT-tests/lib/ffi/ffi_jit_conv.lua @@ -1,8 +1,8 @@ local ffi = require("ffi") -local ctest = require("ctest") +local ctest = require("libctest") -do +do --- int32_t, narrowed local s = ffi.new("struct { int32_t x; }") s.x = -0x12345678 for i=1,100 do @@ -11,7 +11,7 @@ do assert(s.x == -0x12345678+100) end -do +do --- uint32_t, CONV num.u32 u32.num local s = ffi.new("struct { uint32_t x; }") s.x = 0x81234567 for i=1,100 do @@ -20,7 +20,7 @@ do assert(s.x == 0x81234567+100) end -do +do --- int8_t, CONV.int.i8 forwarding local s = ffi.new("struct { int8_t x; }") s.x = 42 for i=1,100 do @@ -30,7 +30,7 @@ do assert(s.x == 142-256) end -do +do --- uint8_t, CONV.int.u8 forwarding local s = ffi.new("struct { uint8_t x; }") s.x = 200 for i=1,100 do @@ -40,7 +40,7 @@ do assert(s.x == 300-256) end -do +do --- int16_t, CONV.int.i16 forwarding local s = ffi.new("struct { int16_t x; }") s.x = 32700 for i=1,100 do @@ -50,7 +50,7 @@ do assert(s.x == 32800-65536) end -do +do --- uint16_t, CONV.int.u16 forwarding local s = ffi.new("struct { uint16_t x; }") s.x = 65450 for i=1,100 do @@ -60,7 +60,7 @@ do assert(s.x == 65550-65536) end -do +do --- union i32 u32, forwarding num.int num.u32 local s = ffi.new("union { int32_t x; uint32_t y; }") s.x = 0x7fffffff - 60 local x,y = 0,0 @@ -75,7 +75,7 @@ do assert(x == y - 40*2^32) end -do +do --- union i32 u32, forwarding CONV.int.u32 local s = ffi.new("union { int32_t x; uint32_t y; }") local x, z = 0, 2^31 + 42 for i=1,100 do @@ -85,7 +85,7 @@ do assert(x == 100*(-2^31 + 42)) end -do +do --- union i8 u8, forwarding CONV.int.i8 CONV.num.int local s = ffi.new("union { int8_t x; uint8_t y; }") s.x = 42 local x,y = 0,0 @@ -100,7 +100,7 @@ do assert(x == y - (100-(127-42))*256) end -do +do --- tobit + CONV.num.u32, 1 local a = ffi.new("uint32_t[?]", 101) for i=1,100 do a[i] = 0x80000000+i end local x = 0 @@ -110,7 +110,7 @@ do assert(x == 100) end -do +do --- tobit + CONV.num.u32, 2 local a = ffi.new("uint32_t[?]", 101) for i=1,100 do a[i] = 0x80000000+i end local x = 0 @@ -120,7 +120,7 @@ do assert(x == -0x80000000+100) end -do +do --- CONV.num.flt local v = ffi.new("float", 12.5) local x = 0 for i=1,100 do @@ -129,7 +129,7 @@ do assert(x == 100*12.5) end -do +do --- CONV.num.u32 local v = ffi.new("uint32_t", 0x80000000) local x = 0 for i=1,100 do @@ -138,7 +138,7 @@ do assert(x == 100*0x80000000) end -do +do --- CONV.num.i64 local v = ffi.new("int64_t", 0x1234567800000000ll) local x = 0 for i=1,100 do @@ -147,7 +147,7 @@ do assert(x == 100*0x12345678*2^32) end -do +do --- CONV.num.u64 local v = ffi.new("uint64_t", 0x89abcdef00000000ull) local x = 0 for i=1,100 do @@ -156,7 +156,7 @@ do assert(x == 100*0x89abcdef*2^32) end -do +do --- CONV.num.i64, overflow local a = ffi.new("int64_t[?]", 101) for i=1,100 do a[i] = -i end local x = 0 @@ -166,7 +166,7 @@ do assert(x == -5050) end -do +do --- CONV.num.u64, overflow local a = ffi.new("uint64_t[?]", 101) for i=1,100 do a[i] = 2^63+2^32*i end local x = 0 @@ -176,7 +176,7 @@ do assert(x == 2^63*100+2^32*5050) end -do +do --- tonumber(complex) local v = ffi.new("complex", 12.5, -3.25) local x = 0 for i=1,100 do @@ -185,7 +185,7 @@ do assert(x == 100*12.5) end -do +do --- const on trace i64 local s = ffi.new("struct { int64_t x;}") for i=1,100 do s.x = 0x123456789abcdef0LL @@ -193,7 +193,7 @@ do assert(tonumber(s.x) == tonumber(0x123456789abcdef0LL)) end -do +do --- const on trace u64 local s = ffi.new("struct { uint64_t x;}") for i=1,100 do s.x = 0x823456789abcdef0ULL @@ -201,27 +201,27 @@ do assert(tonumber(s.x) == tonumber(0x823456789abcdef0ULL)) end -do +do --- enum recording ffi.cdef[[ - typedef enum { AA, BB, CC = -42 } foo_i; - typedef enum { DD, EE, FF = 0x80000000u } foo_u; + typedef enum { AAA, BBB, CCC = -42 } foo_i; + typedef enum { DDD, EEE, FFF = 0x80000000u } foo_u; ]] local s = ffi.new("struct { foo_i x; foo_u y;}") for i=1,100 do - s.x = "CC" + s.x = "CCC" assert(s.x == -42) - s.x = "BB" + s.x = "BBB" assert(s.x == 1) - s.y = "FF" + s.y = "FFF" assert(s.y == 0x80000000) end local st = ffi.typeof(s) for i=1,100 do s = st() end assert(s.x == 0 and s.y == 0) - for i=1,100 do s = st("CC", "EE") end + for i=1,100 do s = st("CCC", "EEE") end assert(s.x == -42 and s.y == 1) - local ei = ffi.new("foo_i", "CC") - local eu = ffi.new("foo_u", "EE") + local ei = ffi.new("foo_i", "CCC") + local eu = ffi.new("foo_u", "EEE") for i=1,100 do s = st(ei, eu) end assert(s.x == -42 and s.y == 1) local x @@ -229,7 +229,7 @@ do assert(x == -42) end -do +do --- const char* recording local s = ffi.new("struct { const char *x; const char *y;}") local a, tmp = "abcd", "ab" for i=1,100 do @@ -240,7 +240,7 @@ do assert(ffi.string(s.y) == "ab") end -do +do --- bool int double recording local s = ffi.new("struct { bool b[200]; int i[200]; double d[200];}") for i=0,199 do s.i[i] = i-100; s.d[i] = i-100 end for i=0,99 do s.b[i] = 0 end @@ -253,13 +253,13 @@ do for i=0,199 do assert(s.b[i] == (i ~= 100)) end end -do +do --- int16_t array arithmetic local a = ffi.new("int16_t[100]", 1) for i=1,99 do a[i] = a[i] + a[i-1] end assert(a[99] == 100) end -do +do --- ligud to pointer local ud = ctest.lightud(12345678) local s = ffi.new("struct { void *p; }") for i=1,100 do @@ -269,7 +269,7 @@ do assert(ffi.cast("uintptr_t", s.p) == 12345678) end -do +do --- reference type initialization local x = ffi.new("struct { int & x;}", ffi.new("int[1]", 42)) local z for i=1,100 do z = x.x end diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index index d6e2b64a..71def57b 100644 --- a/test/LuaJIT-tests/lib/ffi/index +++ b/test/LuaJIT-tests/lib/ffi/index @@ -12,6 +12,7 @@ ffi_enum.lua ffi_gcstep_recursive.lua ffi_jit_arith.lua ffi_jit_call.lua +ffi_jit_conv.lua istype.lua jit_array.lua jit_complex.lua -- 2.43.0