-
Notifications
You must be signed in to change notification settings - Fork 3
tests/lapi: add string.buffer tests #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d0a24a8
to
36e5ef8
Compare
26ef371
to
0837c06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, Sergey!
Thanks for the patch!
Please consider my comments below.
a59da3c
to
ddee305
Compare
Also, updated --- a/tests/lapi/string_buffer_torture_test.lua
+++ b/tests/lapi/string_buffer_torture_test.lua
@@ -74,14 +74,16 @@ local function buffer_putf(self)
self.buf:putf("%s", str)
end
--- Appends the given len number of bytes from the memory pointed
+-- Appends the given `len` number of bytes from the memory pointed
-- to by the FFI cdata object to the buffer. The object needs to
-- be convertible to a (constant) pointer.
-- Usage: buf = buf:putcdata(cdata, len)
local function buffer_putcdata(self)
local n = self.fdp:consume_integer(1, test_lib.MAX_INT)
local cdata = ffi.new("uint8_t", n)
- self.buf:putcdata(cdata, ffi.sizeof(cdata))
+ -- The function may throw an error "cannot convert
+ -- 'unsigned char' to 'const void *'".
+ pcall(self.buf.putcdata, self.buf, cdata, ffi.sizeof(cdata))
end
-- This method allows zero-copy consumption of a string or an FFI |
9c2fbc7
to
863dc3f
Compare
The commit "tests/lapi: add string.buffer tests" [1]. 1. ligurio/lua-c-api-tests#148 Follows up ligurio/lua-c-api-tests#148 Related to tarantool/tarantool#11470 Related to tarantool/tarantool#11301
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sergey,
Thanks for the fixes!
LGTM, after resolving the discussions above.
The patch add tests for LuaJIT's string buffer library [1]. Note, as it is stated in documentation [1] this serialization format is designed for internal use by LuaJIT applications, and this format is explicitly not intended to be a 'public standard' for structured data interchange across computer languages (like JSON or MessagePack). The purpose of the proposed tests is testing the library because other LuaJIT components relies on it and also the proposed tests indirectly tests FFI library. 1. https://luajit.org/ext_buffer.html
863dc3f
to
4198abb
Compare
Lua is not supported by OSS-Fuzz [1]. 1. google/oss-fuzz#13782
a9386f3
to
f7bd674
Compare
The patch add tests for LuaJIT's string buffer library.
Blocked by ligurio/luzer#62