From 7ec7ced604a83c7cf228d2ff643b295ea72ab0d5 Mon Sep 17 00:00:00 2001 From: Igor Munkin <imun@tarantool.org> Date: Thu, 20 Feb 2020 17:44:27 +0300 Subject: [PATCH] build: disable LUAJIT_ENABLE_PAIRSMM Since this build flag has been removed as a result of reverting the tarantool/luajit@d4e985a, its definition in the corresponding Tarantool cmake file is irrelevant. Furthermore, considering the breakage faced in #4770 the following tests are introduced: * the check whether space __pairs metamethod is set to space.pairs to create a Lua Fun iterator that handles __pairs manually underneath. * the check whether pairs builtin behaviour doesn't change when __pairs is set e.g. on space object. Follow-up #4560 Closes #4770 Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Signed-off-by: Igor Munkin <imun@tarantool.org> --- cmake/luajit.cmake | 1 - ...4770-broken-pairs-for-space-objects.result | 30 +++++++++++++++++++ ...70-broken-pairs-for-space-objects.test.lua | 13 ++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/box/gh-4770-broken-pairs-for-space-objects.result create mode 100644 test/box/gh-4770-broken-pairs-for-space-objects.test.lua diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake index 072db8269a..10df633d57 100644 --- a/cmake/luajit.cmake +++ b/cmake/luajit.cmake @@ -217,7 +217,6 @@ macro(luajit_build) add_definitions(-DLUAJIT_USE_ASAN=1) set (luajit_ldflags ${luajit_ldflags} -fsanitize=address) endif() - add_definitions(-DLUAJIT_ENABLE_PAIRSMM=1) add_definitions(-DLUAJIT_SMART_STRINGS=1) # Add all COMPILE_DEFINITIONS to xcflags get_property(defs DIRECTORY PROPERTY COMPILE_DEFINITIONS) diff --git a/test/box/gh-4770-broken-pairs-for-space-objects.result b/test/box/gh-4770-broken-pairs-for-space-objects.result new file mode 100644 index 0000000000..6ab778d1a4 --- /dev/null +++ b/test/box/gh-4770-broken-pairs-for-space-objects.result @@ -0,0 +1,30 @@ +-- test-run result file version 2 +-- +-- gh-4770: Iteration through space with Lua builtin pairs routine +-- +s = box.schema.create_space('test') + | --- + | ... +-- Check whether __pairs is set for the space object, since Lua Fun +-- handles it manually underneath. +getmetatable(s).__pairs == s.pairs + | --- + | - true + | ... +-- Check whether pairs builtin behaviour doesn't change when the +-- __pairs is set. +keys = {} + | --- + | ... +for k, v in pairs(s) do keys[k] = true end + | --- + | ... +keys.name, keys.id, keys.engine + | --- + | - true + | - true + | - true + | ... +s:drop() + | --- + | ... diff --git a/test/box/gh-4770-broken-pairs-for-space-objects.test.lua b/test/box/gh-4770-broken-pairs-for-space-objects.test.lua new file mode 100644 index 0000000000..8c36bd3050 --- /dev/null +++ b/test/box/gh-4770-broken-pairs-for-space-objects.test.lua @@ -0,0 +1,13 @@ +-- +-- gh-4770: Iteration through space with Lua builtin pairs routine +-- +s = box.schema.create_space('test') +-- Check whether __pairs is set for the space object, since Lua Fun +-- handles it manually underneath. +getmetatable(s).__pairs == s.pairs +-- Check whether pairs builtin behaviour doesn't change when the +-- __pairs is set. +keys = {} +for k, v in pairs(s) do keys[k] = true end +keys.name, keys.id, keys.engine +s:drop() -- GitLab