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 C14B49CBDDE; Mon, 5 Feb 2024 16:27:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C14B49CBDDE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1707139627; bh=yWFc6w7M8HZJnXFq6cIUv0MzihIty4JZJePmoWvz5Kk=; 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=Pg6rUxm0c8N6mcuRfutK07G5YGRuMTofSwYvDEOGoaOndkrt1NYLbA937OpT2U0kc ThwGteM1ysCjM+7MhUkA0r/9hf0R6oiS8xgXwp4VmWDgOdJUO4jZmHUV995YgMEoHB IfjXlClO9EQJFph7iK1ND/GiifqOJ8nlr6fd9CYM= Received: from smtp31.i.mail.ru (smtp31.i.mail.ru [95.163.41.72]) (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 B49A89CBDDE for ; Mon, 5 Feb 2024 16:27:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B49A89CBDDE Received: by smtp31.i.mail.ru with esmtpa (envelope-from ) id 1rWz04-00000008bk8-16di; Mon, 05 Feb 2024 16:27:04 +0300 Message-ID: <8092297e-4e30-4ec4-9b1f-5f5034e78e8b@tarantool.org> Date: Mon, 5 Feb 2024 16:27:03 +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: <82bbfc368ccb9f8d7188a10dfc69dae16eec47d1.1706520765.git.skaplun@tarantool.org> In-Reply-To: <82bbfc368ccb9f8d7188a10dfc69dae16eec47d1.1706520765.git.skaplun@tarantool.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9DE389E818B66C7AEF74583E9BFD0023CE34868C9E9FB1C391867C24CE74E72BB5FE18E9CBFBE7C07EBCB14D25944BE039F5B7192741D1EED2D9C57C53CB7A8FA1CA1C761B40C1C42074A40F52AF1438D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7696D01AF671C4816EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006375E280A1EC162AD7D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D80FAA73D609308BAC01C07E99C434EED0281AAA337563F6B6CC7F00164DA146DAFE8445B8C89999728AA50765F79006372A3B24BF85B2E607389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8D2DCF9CF1F528DBCF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C632EDEA9CD5989A36136E347CC761E074AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3CF39425AD3EEC986BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CFE478A468B35FE7671DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C31BC2FD6A5287AC5335872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A55565870C531ED3155002B1117B3ED6963BE6FB91182E1243B2920F75BA9A967F823CB91A9FED034534781492E4B8EEAD73D4B72E5887FF4D X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFF72F80C9E553F53D2E3368FA554425ECD76A68EDF9DEDD86F0CEE55B524CA10214625291CC5E48B914BC176DD269F15E3FF4A1DC932A0AA4F2CA2E1BA3F35205D3F1C04EF4603F805F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj0TrRSEWQ3Vn4a35pooeE5g== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769D157432BE30D5AEEC7A4B249DE6549FD94D55F44D4B027A5B7CBEF92542CD7C8795FA72BAB74744FC77752E0C033A69EA16A481184E8BB1C9B38E6EA4F046BE03A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 23/26] test: enable LuaJIT test 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 On 1/29/24 13:45, Sergey Kaplun wrote: > This patch moves the test from the to > directory, includes it in , and names subtests. Also, it enables > tests for all arches and fixes tests for 47-bit lightuserdata because it > is available since the commit > 2cacfa8e7ffefb715abf55dc5b0c708c63251868 ("Add support for full-range 64 > bit lightuserdata.") > > Part of tarantool/tarantool#9398 > --- > test/LuaJIT-tests/lang/index | 1 + > test/LuaJIT-tests/lang/lightud.lua | 89 ++++++++++++++++++++++++++++++ > test/LuaJIT-tests/misc/lightud.lua | 88 ----------------------------- > 3 files changed, 90 insertions(+), 88 deletions(-) > create mode 100644 test/LuaJIT-tests/lang/lightud.lua > delete mode 100644 test/LuaJIT-tests/misc/lightud.lua > > diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index > index 88e2edfa..60cbecfb 100644 > --- a/test/LuaJIT-tests/lang/index > +++ b/test/LuaJIT-tests/lang/index > @@ -5,6 +5,7 @@ compare_nan.lua > constant > for.lua > length.lua > +lightud.lua > modulo.lua > concat.lua > self.lua > diff --git a/test/LuaJIT-tests/lang/lightud.lua b/test/LuaJIT-tests/lang/lightud.lua > new file mode 100644 > index 00000000..aee9e85c > --- /dev/null > +++ b/test/LuaJIT-tests/lang/lightud.lua > @@ -0,0 +1,89 @@ > +local ctest = require("libctest") > + > +local lightud = ctest.lightud > +local assert = assert > + > +-- x64 lightud tests > +do --- light userdata comparison and tostring +x64 > + local ud1 = lightud(0x12345678) > + local ud2 = lightud(0x12345678) > + assert(ud1 == ud2) > + assert(tostring(ud1) == "userdata: 0x12345678") > +end > + > +do --- unequal light userdata comparison +x64 > + local ud1 = lightud(1) > + local ud2 = lightud(2) > + assert(ud1 ~= ud2) > +end > + > +do --- big light userdata comparison and tostring +x64 > + local ud1 = lightud(2^47-1) > + local ud2 = lightud(2^47-1) > + assert(ud1 == ud2) > + assert(tostring(ud1) == "userdata: 0x7fffffffffff") > +end > + > +do --- unequal light userdata comparison JIT +x64 > + local ud1 = lightud(0x12345678+123*2^32) > + local ud2 = lightud(0x12345678+456*2^32) > + for i=1,100 do assert(ud1 ~= ud2) end > +end > + > +do --- 47 bits light userdata +x64 > + assert(tostring(lightud(0x5abc*2^32 + 0xdef01234)) == "userdata: 0x5abcdef01234") > + -- Now more than 47 bits are available. > + assert(pcall(lightud, 2^47) == true) > + assert(pcall(lightud, 2^64-2048) == true) > +end > + > +do --- metatable check > + assert(getmetatable(lightud(1)) == nil) > +end > + > +do --- lightuserdata SLOAD value and HREF key > + local ud = lightud(12345) > + local t = {[ud] = 42} > + for i=1,100 do > + assert(t[ud] == 42) > + end > +end > + > +do --- lightuserdata NEWREF key > + local ud = lightud(12345) > + for i=1,100 do > + local t = {[ud] = 42} > + assert(t[ud] == 42) > + end > +end > + > +do --- lightuserdata ASTORE/HSTORE value > + local ud = lightud(12345) > + local t = {} > + for i=1,100 do > + t[i] = ud > + end > + assert(t[100] == ud) > +end > + > +do --- lightuserdata sync to stack > + local ud = lightud(12345) > + local x = nil > + for j=1,20 do > + for i=1,50 do > + x = ud > + end > + assert(x == ud) > + end > +end > + > +do --- lightuserdata vs. number type check > + local t = {} > + for i=1,200 do t[i] = i end > + t[180] = lightud(12345) > + local x = 0 > + assert(not pcall(function(t) > + for i=1,200 do x = x + t[i] end > + end, t)) > + assert(x == 16110) > +end > diff --git a/test/LuaJIT-tests/misc/lightud.lua b/test/LuaJIT-tests/misc/lightud.lua > deleted file mode 100644 > index 4974d50f..00000000 > --- a/test/LuaJIT-tests/misc/lightud.lua > +++ /dev/null > @@ -1,88 +0,0 @@ > -local ctest = require("ctest") > - > -local lightud = ctest.lightud > -local assert = assert > - > --- x64 lightud tests > -if jit and jit.arch == "x64" then > - do > - local ud1 = lightud(0x12345678) > - local ud2 = lightud(0x12345678) > - assert(ud1 == ud2) > - assert(tostring(ud1) == "userdata: 0x12345678") > - end > - do > - local ud1 = lightud(1) > - local ud2 = lightud(2) > - assert(ud1 ~= ud2) > - end > - do > - local ud1 = lightud(2^47-1) > - local ud2 = lightud(2^47-1) > - assert(ud1 == ud2) > - assert(tostring(ud1) == "userdata: 0x7fffffffffff") > - end > - do > - local ud1 = lightud(0x12345678+123*2^32) > - local ud2 = lightud(0x12345678+456*2^32) > - for i=1,100 do assert(ud1 ~= ud2) end > - end > - assert(tostring(lightud(0x5abc*2^32 + 0xdef01234)) == "userdata: 0x5abcdef01234") > - assert(pcall(lightud, 2^47) == false) > - assert(pcall(lightud, 2^64-2048) == false) > -end > - > -assert(getmetatable(lightud(1)) == nil) > - > --- lightuserdata SLOAD value and HREF key > -do > - local ud = lightud(12345) > - local t = {[ud] = 42} > - for i=1,100 do > - assert(t[ud] == 42) > - end > -end > - > --- lightuserdata NEWREF key > -do > - local ud = lightud(12345) > - for i=1,100 do > - local t = {[ud] = 42} > - assert(t[ud] == 42) > - end > -end > - > --- lightuserdata ASTORE/HSTORE value > -do > - local ud = lightud(12345) > - local t = {} > - for i=1,100 do > - t[i] = ud > - end > - assert(t[100] == ud) > -end > - > --- lightuserdata sync to stack > -do > - local ud = lightud(12345) > - local x = nil > - for j=1,20 do > - for i=1,50 do > - x = ud > - end > - assert(x == ud) > - end > -end > - > --- lightuserdata vs. number type check > -do > - local t = {} > - for i=1,200 do t[i] = i end > - t[180] = lightud(12345) > - local x = 0 > - assert(not pcall(function(t) > - for i=1,200 do x = x + t[i] end > - end, t)) > - assert(x == 16110) > -end > -