[tarantool-patches] Re: [PATCH] msgpackffi.decode can now be assigned to buf.rpos

  • From: Alexander Turenko <alexander.turenko@xxxxxxxxxxxxx>
  • To: Kirill Yukhin <kyukhin@xxxxxxxxxxxxx>
  • Date: Mon, 13 Jan 2020 18:16:47 +0300

I also found that a dead function appears in the msgpackffi test due to
improper conflict resolution, because of mistake during pushing those
commits (they appears in the reverse order). So I created a follow up
patch (see below) and pushed it to master, 2.3, 2.2 and 1.10.

WBR, Alexander Turenko.

----

commit ec32424744fb2ce69a3f336e353c986bc649bbba
Author: Alexander Turenko <alexander.turenko@xxxxxxxxxxxxx>
Date:   Mon Jan 13 17:22:54 2020 +0300

    test: drop dead code from app-tap/msgpackffi test
    
    It appears due to improper conflict resolution after pushing the
    following commits in the reverse order:
    
    * 2b9ef8d15 lua: don't modify pointer type in msgpack.decode*
    * 84bcba52a lua: keeping the pointer type in msgpackffi.decode()
    
    Originally 84bcba52a (which should land first) fixes the msgpackffi
    module and introduces the test_decode_buffer() function locally for the
    msgpackffi test. Then 2b9ef8d15 fixes the msgpack module in the same
    way, expands and moves the test_decode_buffer() function to
    serializer_test.lua (to use in msgpack and msgpackffi tests both).
    
    After changes made to push the commits in the reverse order, those
    commits doing something weird around tests. However the resulting state
    is different from the right one just in the dead function in
    msgpackffi.test.lua.
    
    Follows up #3926.

diff --git a/test/app-tap/msgpackffi.test.lua b/test/app-tap/msgpackffi.test.lua
index 5aa4e899f..994402d15 100755
--- a/test/app-tap/msgpackffi.test.lua
+++ b/test/app-tap/msgpackffi.test.lua
@@ -116,45 +116,6 @@ local function test_other(test, s)
                  encode_max_depth = max_depth})
 end
 
--- gh-3926: Ensure that a returned pointer has the same cdata type
--- as passed argument.
-local function test_decode_buffer(test, s)
-    local cases = {
-        {
-            'decode_unchecked(cdata<const char *>)',
-            data = ffi.cast('const char *', '\x93\x01\x02\x03'),
-            exp_res = {1, 2, 3},
-            exp_rewind = 4,
-        },
-        {
-            'decode_unchecked(cdata<char *>)',
-            data = ffi.cast('char *', '\x93\x01\x02\x03'),
-            exp_res = {1, 2, 3},
-            exp_rewind = 4,
-        },
-    }
-
-    test:plan(#cases)
-
-    for _, case in ipairs(cases) do
-        test:test(case[1], function(test)
-            test:plan(4)
-            local res, res_buf = s.decode_unchecked(case.data)
-            test:is_deeply(res, case.exp_res, 'verify result')
-            local rewind = res_buf - case.data
-            test:is(rewind, case.exp_rewind, 'verify resulting buffer')
-            -- test:iscdata() is not sufficient here, because it
-            -- ignores 'const' qualifier (because of using
-            -- ffi.istype()).
-            test:is(type(res_buf), 'cdata', 'verify resulting buffer type')
-            local data_ctype = tostring(ffi.typeof(case.data))
-            local res_buf_ctype = tostring(ffi.typeof(res_buf))
-            test:is(res_buf_ctype, data_ctype, 'verify resulting buffer ctype')
-        end)
-    end
-end
-
-
 tap.test("msgpackffi", function(test)
     local serializer = require('msgpackffi')
     test:plan(11)

Other related posts: