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 4EAA098C102; Fri, 19 Jan 2024 14:43:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4EAA098C102 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1705664614; 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=ww4GUj93UmgAZh6kDhap3+Auk4zKS28VcJIC5oKU1pAP+6oiWVurlXhIKVdPe1H46 jwC4ynBylaQZlGO/mgJ2yQAZLEEoXmJdO4kIRxx+iOerHlqm8nbN1Fqm6N91e93vuv 2Rn7+vxVwzb1SIMuoxLi9GLcABN69WbZnVWETohA= Received: from smtp16.i.mail.ru (smtp16.i.mail.ru [95.163.41.69]) (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 56A479885F9 for ; Fri, 19 Jan 2024 14:37:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 56A479885F9 Received: by smtp16.i.mail.ru with esmtpa (envelope-from ) id 1rQnBT-00FDC7-1t; Fri, 19 Jan 2024 14:37:16 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Fri, 19 Jan 2024 14:32:36 +0300 Message-ID: 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: 4F1203BC0FB41BD9AE5B4AFB3AE2A5901BC4398A727BA7D301D3C5293A0FB75F182A05F5380850403C432F2C3AC38DAC77CA480E2D39EF6F0D0458E0391944CA5713716DB2E207F7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7EA4B66823129EB3CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D8FE4B420C2EEC248638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8D42E898C075742F321CA058E3C57E6FE117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC292D688DDAD4E7BC389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC821E93C0F2A571C7BF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE33AC447995A7AD187441229DB5CFFAA63A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73533F64B4C514AF25EC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A56ECE9FBC778D45AE3DE3FD803DF40A2FC242296A78A6679AF87CCE6106E1FC07E67D4AC08A07B9B067F1C1C3ABB44F3A9C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF4430FC2357C9BBF3C1FBE9F07FE49C4FF404C4A8B148DDC48F252AAB003C4A3E2DF5FAC740BFE7CD6197189FEE4B1C7A3A956498743AFB6CC34D8744F138F5D8A74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojJsr4kcGAUCM3y7qUe6xE2Q== X-DA7885C5: 6F1CC9DC7C4FE75422358C9D20223E7B4983230723F82330F8C2FA9E729A0B81262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F7393590D8C940224AE33C6A614B4F57D527836A1AD2F180AD0930FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 13/25] 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