[Tarantool-patches] [PATCH v2 luajit 05/26] test: enable <ffi_bitfield.lua> in LuaJIT-tests
Sergey Kaplun
skaplun at tarantool.org
Tue Feb 6 14:54:41 MSK 2024
Hi, Maxim!
Thanks for the review!
Fixed your comment and force-pushed the branch.
On 31.01.24, Maxim Kokryashkin wrote:
> Hi, Sergey!
> Thanks for the patch!
> LGTM, except for the single nit below.
>
> On Mon, Jan 29, 2024 at 01:45:05PM +0300, Sergey Kaplun wrote:
> > This patch removes unused `dofile()`. Also, it names the only one test
> > as "misc" and includes the test in <index>.
> >
> > Part of tarantool/tarantool#9398
> > ---
| test: enable <ffi_bitfield.lua> in LuaJIT-tests
|
| This patch removes unused `dofile()`. Also, it splits the test case into
| several and includes the test in <index>.
|
| Part of tarantool/tarantool#9398
> > test/LuaJIT-tests/lib/ffi/ffi_bitfield.lua | 4 +---
> > test/LuaJIT-tests/lib/ffi/index | 1 +
> > 2 files changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/test/LuaJIT-tests/lib/ffi/ffi_bitfield.lua b/test/LuaJIT-tests/lib/ffi/ffi_bitfield.lua
> > index cd0b1815..fa74e45d 100644
> > --- a/test/LuaJIT-tests/lib/ffi/ffi_bitfield.lua
> > +++ b/test/LuaJIT-tests/lib/ffi/ffi_bitfield.lua
> > @@ -1,8 +1,6 @@
> > local ffi = require("ffi")
> >
> > -dofile("../common/ffi_util.inc")
> > -
> > -do
> > +do --- misc
> Nit: Maybe `misc bitfield tests` then for it to be more elaborate?
> Or maybe it should be spplitted according to the sections inside the
> test.
I've prefered to split this test into several. See the iterative patch
below.
===================================================================
diff --git a/test/LuaJIT-tests/lib/ffi/ffi_bitfield.lua b/test/LuaJIT-tests/lib/ffi/ffi_bitfield.lua
index fa74e45d..e8efc82c 100644
--- a/test/LuaJIT-tests/lib/ffi/ffi_bitfield.lua
+++ b/test/LuaJIT-tests/lib/ffi/ffi_bitfield.lua
@@ -1,17 +1,16 @@
local ffi = require("ffi")
-do --- misc
- local x = ffi.new([[
- union {
- uint32_t u;
- struct { int a:10,b:10,c:11,d:1; };
- struct { unsigned int e:10,f:10,g:11,h:1; };
- struct { int8_t i:4,j:5,k:5,l:3; };
- struct { _Bool b0:1,b1:1,b2:1,b3:1; };
- }
- ]])
+local x = ffi.new([[
+ union {
+ uint32_t u;
+ struct { int a:10,b:10,c:11,d:1; };
+ struct { unsigned int e:10,f:10,g:11,h:1; };
+ struct { int8_t i:4,j:5,k:5,l:3; };
+ struct { _Bool b0:1,b1:1,b2:1,b3:1; };
+ }
+]])
- -- bitfield access
+do --- bitfield access
x.u = 0xffffffff
assert(x.a == -1 and x.b == -1 and x.c == -1 and x.d == -1)
assert(x.e == 1023 and x.f == 1023 and x.g == 2047 and x.h == 1)
@@ -41,8 +40,9 @@ do --- misc
assert(x.i == -2 and x.j == -6 and x.k == 1 and x.l == -2)
assert(x.b0 == true and x.b1 == true and x.b2 == true and x.b3 == false)
end
+end
- -- bitfield insert
+do --- bitfield insert
x.u = 0xffffffff
x.a = 0
if ffi.abi("le") then
@@ -71,8 +71,9 @@ do --- misc
else
assert(x.u == 0x003ff000)
end
+end
- -- cumulative bitfield insert
+do --- cumulative bitfield insert
x.u = 0xffffffff
if ffi.abi("le") then
x.a = -392; x.b = 277; x.c = 291; x.d = 0
@@ -101,6 +102,4 @@ do --- misc
else
assert(x.u == 0xa0000000)
end
-
end
-
===================================================================
> > local x = ffi.new([[
> > union {
> > uint32_t u;
> > diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index
> > index 7e046908..8d833107 100644
> > --- a/test/LuaJIT-tests/lib/ffi/index
> > +++ b/test/LuaJIT-tests/lib/ffi/index
> > @@ -3,6 +3,7 @@ cdata_var.lua
> > copy_fill.lua
> > err.lua
> > ffi_arith_ptr.lua
> > +ffi_bitfield.lua
> > istype.lua
> > jit_array.lua
> > jit_complex.lua
> > --
> > 2.43.0
> >
--
Best regards,
Sergey Kaplun
More information about the Tarantool-patches
mailing list