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 A34696EC56; Sat, 20 Mar 2021 03:47:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A34696EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616201247; bh=6R5ZAdOhoIlsptOa6rBOYwg8SKyHR4Cm/aN8ialwP2w=; 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=zfoT0wTIlz3dPXEbfyztWTjQgaZDBYbiJckaG0fOeK869fZzG7XIEWW5r+luWFK6Q tIZQXsea5bdkaU9s4PRGn0PWosog7JlEAyu5wWmCguei6FWso3bfzob0SLiaKQ86qu wVdxyxItT0E/WlvF0eEdZmCZ8rfUO3V8fChkEUq8= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 AE8BD6EC5A for ; Sat, 20 Mar 2021 03:43:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AE8BD6EC5A Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lNPhj-00076U-SH; Sat, 20 Mar 2021 03:43:00 +0300 To: tarantool-patches@dev.tarantool.org, gorcunov@gmail.com, sergepetrenko@tarantool.org Date: Sat, 20 Mar 2021 01:42:39 +0100 Message-Id: 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: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD95D6E7CC48CB1F5F1DDD90A25A8FA528D0BFD61B598B81272182A05F5380850407B2965FD4691966CF73FB49561E9E08C1E08453DCDE77F26C35E95870F2B4274 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F10A50E66C9A7FE8C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7798B95EC47D21699EA1F7E6F0F101C67CDEEF6D7F21E0D1D174C73DBBBFC7664D0E9B0F0329DBC1D8BB01F01BFB829670CE07BBBB76CCBFE389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92A417C69337E82CC2CC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FC9149C560DC76099D75ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE4930A3850AC1BE2E7353650B6F8DE40EA5FC4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0FECB2555BB02FD5A93B503F486389A921A5CC5B56E945C8DA X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2BBE337FB72E923155C0AF1600DCBC20BD3311767B7455A3371244AF4446153EF X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C81A23F326053F8274AF3782D5937B387BD684CC655C97B649C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFF532FBFD8162E58C699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34FA5A4D623E7343BB4CFF8A2EAA90235C1853704C8F84DDFF0F7B62AB7F900E9D74110AB1A6986DCA1D7E09C32AA3244C7ADC95220146CE4CC94FC7784D05E87D3A92A9747B6CC886FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj8xHC0Ak4ylbGIdCB10EbLA== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638220D829FA2538C3209B1D61971F9CA91983841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 02/16] 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 --- test/app-tap/module_api.test.lua | 4 +++- test/app/msgpack.result | 7 +++++-- test/app/msgpack.test.lua | 5 +++-- test/box/varbinary_type.result | 3 +-- test/box/varbinary_type.test.lua | 3 +-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/test/app-tap/module_api.test.lua b/test/app-tap/module_api.test.lua index c43d8eacd..28e33a02d 100755 --- a/test/app-tap/module_api.test.lua +++ b/test/app-tap/module_api.test.lua @@ -1,5 +1,6 @@ #!/usr/bin/env tarantool +local ffi = require('ffi') local fio = require('fio') box.cfg{log = "tarantool.log"} @@ -45,6 +46,7 @@ local function test_buffers(test, module) local bufalloc = buffer.static_alloc("char", 128) 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 {}') @@ -52,7 +54,7 @@ local function test_buffers(test, module) test:ok(not module.toibuf(box.NULL), 'toibuf of box.NULL') test:ok(not module.toibuf(buffer.reg1), 'toibuf of reg1') test:ok(not module.toibuf(bufalloc), 'toibuf of allocated buffer') - 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 ddf06fc9d..faee66029 100644 --- a/test/app/msgpack.result +++ b/test/app/msgpack.result @@ -206,10 +206,10 @@ msgpack.decode(buf.rpos, buf:size() - 1) - error: 'msgpack.decode: invalid MsgPack' ... -- 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) @@ -219,6 +219,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 17e05df5c..f5299f550 100644 --- a/test/app/msgpack.test.lua +++ b/test/app/msgpack.test.lua @@ -65,10 +65,11 @@ msgpack.encode({1, 2, 3}, buf) msgpack.decode(buf.rpos, buf:size() - 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)) diff --git a/test/box/varbinary_type.result b/test/box/varbinary_type.result index 9620ee39e..5aa2996df 100644 --- a/test/box/varbinary_type.result +++ b/test/box/varbinary_type.result @@ -40,8 +40,7 @@ test_run:cmd("setopt delimiter ';'") - true ... function encode_bin(bytes) - local tmpbuf = buffer.IBUF_SHARED - tmpbuf:reset() + local tmpbuf = buffer.ibuf() local p = tmpbuf:alloc(3 + #bytes) p[0] = 0x91 p[1] = 0xC4 diff --git a/test/box/varbinary_type.test.lua b/test/box/varbinary_type.test.lua index 3c6b66246..7b9a1e721 100644 --- a/test/box/varbinary_type.test.lua +++ b/test/box/varbinary_type.test.lua @@ -16,8 +16,7 @@ ffi = require('ffi') test_run:cmd("setopt delimiter ';'") function encode_bin(bytes) - local tmpbuf = buffer.IBUF_SHARED - tmpbuf:reset() + local tmpbuf = buffer.ibuf() local p = tmpbuf:alloc(3 + #bytes) p[0] = 0x91 p[1] = 0xC4 -- 2.24.3 (Apple Git-128)