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 56D2F6FC8F; Thu, 25 Mar 2021 00:28:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 56D2F6FC8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616621319; bh=hWoJGzqgcKm0FrAFamYhORxnPXqvrYia7zYU05RF5jo=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=dp/xmGYc2xzmxH6i0/SzC4mwPLahBBOB8mazjhQiNkeON/mfzJuq7kGa6xn9JswiA 64BoOxBee+eCUFSOq11+KPPfM1SjNbIcwUK6m40FpwCmPsZzCXAwRIBouGCUD/EKYa 3Mh191l6Q4YZvH56F5RzDCLGRgiSN+g+Bp2MkP50= Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id B50FA6B467 for ; Thu, 25 Mar 2021 00:24:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B50FA6B467 Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1lPAzd-0004ib-4U; Thu, 25 Mar 2021 00:24:45 +0300 To: tarantool-patches@dev.tarantool.org, kyukhin@tarantool.org Date: Wed, 24 Mar 2021 22:24:28 +0100 Message-Id: <2b737eb1ab19804bb57540e02f1d46b616be0b38.1616620860.git.v.shpilevoy@tarantool.org> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9064ADF4728AA0EE919EF87AC0718675712B828C563C11F50182A05F53808504048E240A8880DB9C163C047FF5D4BA32C908E2C5A0757B5312050D39338A708C1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7DC4D3EB6E237C32AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BA5555A0C16230F4EA1F7E6F0F101C67CDEEF6D7F21E0D1D174C73DBBBFC76641763F9D2EFCE7A1AF0BD969B83654107F39801BA5852F0AA389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92A417C69337E82CC2CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249CA7DD71A7B3575AE76E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8BA2B54A7B8506A0603AA81AA40904B5D9DBF02ECDB25306B2201CA6A4E26CD07C3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B091A620F70A64A45A99449624AB7ADAF372E808ACE2090B5E1725E5C173C3A84C33D321E7403792E343D7D993A0B92D134F5D81C698A659EA775ECD9A6C639B01BC09775C1D3CA48CFBE90F13D913F449135872C767BF85DA22EF20D2F80756B5F40A5AABA2AD3711975ECD9A6C639B01B78DA827A17800CE76D0F27F7E6A6C418731C566533BA786A40A5AABA2AD371193C9F3DD0FB1AF5EB417FD7EC7EC0BD913C9F3DD0FB1AF5EB4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24A6D60772A99906F8E1CD14B953EB46D6D84A47D13FF9D46355D89D7DBCDD132 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C5DD32608FC869F5D75C55FA8F53F85D6F18C1CDE35D4E0599C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AA8975497C7004E88B12BB0CB6EF5B04AD6493CE0E3DEF3B3A7E7194B26D64E0412CA54E41BCA49F1D7E09C32AA3244CA1485A23879D1900904F593561D287DA408A6A02710B7304729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojjqzNotmU+gcrrZkTHxdm/Q== X-Mailru-Sender: 504CC1E875BF3E7D9BC0E5172ADA3110A906815429F9D96012228B85D337323533762C596EDE2BB807784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH 02/15] test: don't use IBUF_SHARED in the 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" In msgpack test it is used only to check that 'struct ibuf *' can be passed to encode() functions. But soon IBUF_SHARED will be deleted, and its alternative won't be yield-tolerant. This means it can't be used in this test. There are yields between the buffer usages. In varbinary test it is used in a too complicated way to be able to put it back normally. And otherwise its usage does not make much sense - without put() it is going to be created from the scratch on non-first usage until a yield. In the module_api test it is used to check if some function works with 'struct ibuf *'. Can be done without IBUF_SHARED. Part of #5632 (cherry picked from commit d0f0fc4772bc05de8557094832d6df94740a0055) --- test/app-tap/module_api.test.lua | 3 ++- test/app/msgpack.result | 7 +++++-- test/app/msgpack.test.lua | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/app-tap/module_api.test.lua b/test/app-tap/module_api.test.lua index 23b62f115..a181e7492 100755 --- a/test/app-tap/module_api.test.lua +++ b/test/app-tap/module_api.test.lua @@ -45,13 +45,14 @@ local function test_buffers(test, module) local ibuf = buffer.ibuf() local pbuf = ibuf:alloc(128) + local ibuf_ptr = ffi.cast('struct ibuf *', ibuf) test:ok(not module.toibuf(nil), 'toibuf of nil') test:ok(not module.toibuf({}), 'toibuf of {}') test:ok(not module.toibuf(1LL), 'toibuf of 1LL') test:ok(not module.toibuf(box.NULL), 'toibuf of box.NULL') test:ok(not module.toibuf(buffer.reg1), 'toibuf of reg1') - test:ok(module.toibuf(buffer.IBUF_SHARED), "toibuf of ibuf*") + test:ok(module.toibuf(ibuf_ptr), "toibuf of ibuf*") test:ok(module.toibuf(ibuf), 'toibuf of ibuf') test:ok(not module.toibuf(pbuf), 'toibuf of pointer to ibuf data') end diff --git a/test/app/msgpack.result b/test/app/msgpack.result index 54714a59d..e7031e281 100644 --- a/test/app/msgpack.result +++ b/test/app/msgpack.result @@ -214,10 +214,10 @@ msgpack.decode(ffi.cast('char *', '\x04\x05\x06'), -1) - error: 'msgpack.decode: size can''t be negative' ... -- Provide a buffer. Try both 'struct ibuf' and 'struct ibuf *'. -buf = buffer.IBUF_SHARED +buf_storage = buffer.ibuf() --- ... -buf:reset() +buf = ffi.cast('struct ibuf *', buf_storage) --- ... size = msgpack.encode({a = 1, b = 2}, buf) @@ -227,6 +227,9 @@ size = msgpack.encode({a = 1, b = 2}, buf) --- - {'a': 1, 'b': 2} ... +buf_storage = nil +--- +... buf = buffer.ibuf() --- ... diff --git a/test/app/msgpack.test.lua b/test/app/msgpack.test.lua index f501b1bf1..4193e2312 100644 --- a/test/app/msgpack.test.lua +++ b/test/app/msgpack.test.lua @@ -71,10 +71,11 @@ msgpack.decode(buf.rpos, buf:size() - 1) msgpack.decode(ffi.cast('char *', '\x04\x05\x06'), -1) -- Provide a buffer. Try both 'struct ibuf' and 'struct ibuf *'. -buf = buffer.IBUF_SHARED -buf:reset() +buf_storage = buffer.ibuf() +buf = ffi.cast('struct ibuf *', buf_storage) size = msgpack.encode({a = 1, b = 2}, buf) (msgpack.decode(buf.rpos, size)) +buf_storage = nil buf = buffer.ibuf() size = msgpack.encode({c = 3, d = 4}, buf) (msgpack.decode(buf.rpos, size)) -- 2.24.3 (Apple Git-128)