Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Ostanevich <sergos@tarantool.org>,
	Igor Munkin <imun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v2 luajit 02/30] test: add compiling for C libs from PUC-Rio-Lua5.1
Date: Fri, 26 Mar 2021 10:42:45 +0300	[thread overview]
Message-ID: <cae4edac952300c3cede10aef2d83f9c15f90736.1616743343.git.skaplun@tarantool.org> (raw)
In-Reply-To: <cover.1616743343.git.skaplun@tarantool.org>

This patch adds commands to create additional LuaC libraries for tests
in <attrib.lua>. Also, it renames `luaL_reg` to `luaL_Reg` in <lib1.c>
and <lib2.c> to be consistent with the current LuaJIT's LuaC API.

Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
 test/PUC-Lua-5.1-tests/CMakeLists.txt      |  3 +-
 test/PUC-Lua-5.1-tests/libs/CMakeLists.txt | 48 +++++++++++++++++++++-
 test/PUC-Lua-5.1-tests/libs/lib1.c         |  2 +-
 test/PUC-Lua-5.1-tests/libs/lib2.c         |  2 +-
 4 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/test/PUC-Lua-5.1-tests/CMakeLists.txt b/test/PUC-Lua-5.1-tests/CMakeLists.txt
index 773db0d..3c31aae 100644
--- a/test/PUC-Lua-5.1-tests/CMakeLists.txt
+++ b/test/PUC-Lua-5.1-tests/CMakeLists.txt
@@ -16,7 +16,8 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
 # variable as proposed in the first case.
 set(LUA_PATH "?\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua")
 
-# Set PUC-Lua-5.1-tests-prepare target that creates <libs/P1>
+# Set PUC-Lua-5.1-tests-prepare target that contains rules
+# for <libs/*> libraries compilation and creates <libs/P1>
 # subdirectory.
 add_subdirectory(libs)
 
diff --git a/test/PUC-Lua-5.1-tests/libs/CMakeLists.txt b/test/PUC-Lua-5.1-tests/libs/CMakeLists.txt
index f24e7f3..aa64a44 100644
--- a/test/PUC-Lua-5.1-tests/libs/CMakeLists.txt
+++ b/test/PUC-Lua-5.1-tests/libs/CMakeLists.txt
@@ -4,11 +4,57 @@
 # See the rationale in the root CMakeLists.txt.
 cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
 
+# Build additional C libraries for tests.
+macro(BuildTestCLib lib sources)
+  add_library(${lib} SHARED EXCLUDE_FROM_ALL ${sources})
+  target_include_directories(${lib} PRIVATE
+    ${LUAJIT_SOURCE_DIR}
+  )
+  set_target_properties(${lib} PROPERTIES
+    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+    PREFIX ""
+  )
+  # XXX: The dynamic libraries are loaded with LuaJIT binary and
+  # use symbols from it. So it is totally OK to have unresolved
+  # symbols at build time.
+  if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+    set_target_properties(${lib} PROPERTIES
+      LINK_FLAGS "-undefined dynamic_lookup"
+    )
+  elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    # XXX: This is necessary mostly for openSUSE builds, see also
+    # https://bugzilla.suse.com/show_bug.cgi?id=1012388.
+    # Just strip out the linker flag to suppress this linker
+    # option.
+    string(REPLACE "-Wl,--no-undefined" ""
+      CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}"
+    )
+  endif()
+  list(APPEND TESTLIBS ${lib})
+endmacro()
+
+BuildTestCLib(lib1  lib1.c)
+BuildTestCLib(lib11 lib1.c lib11.c)
+BuildTestCLib(lib2  lib2.c)
+BuildTestCLib(lib21 lib2.c lib21.c)
+
+# Create exact copy of the lib2 library for tests in attrib.lua.
+set(LIB2ORIG "${CMAKE_CURRENT_BINARY_DIR}/lib2${CMAKE_SHARED_LIBRARY_SUFFIX}")
+set(LIB2COPY "${CMAKE_CURRENT_BINARY_DIR}/-lib2${CMAKE_SHARED_LIBRARY_SUFFIX}")
+add_custom_command(
+  OUTPUT ${LIB2COPY}
+  COMMENT "Copying lib2 to -lib2 for PUC-Rio Lua 5.1 tests"
+  COMMAND ${CMAKE_COMMAND} -E copy ${LIB2ORIG} ${LIB2COPY}
+  DEPENDS ${TESTLIBS}
+  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
+list(APPEND TESTLIBS ${LIB2COPY})
+
 # The original tarball contains subdirectory "libs" with an empty
 # subdirectory "libs/P1", to be used by tests.
 # Instead of tracking empty directory with some anchor-file for
 # git, create this directory via CMake.
-add_custom_target(PUC-Lua-5.1-tests-prepare)
+add_custom_target(PUC-Lua-5.1-tests-prepare DEPENDS ${TESTLIBS})
 add_custom_command(TARGET PUC-Lua-5.1-tests-prepare
   COMMENT "Create directory for PUC-Rio Lua 5.1 tests"
   COMMAND ${CMAKE_COMMAND} -E make_directory P1
diff --git a/test/PUC-Lua-5.1-tests/libs/lib1.c b/test/PUC-Lua-5.1-tests/libs/lib1.c
index 812bb9a..22fe6de 100644
--- a/test/PUC-Lua-5.1-tests/libs/lib1.c
+++ b/test/PUC-Lua-5.1-tests/libs/lib1.c
@@ -14,7 +14,7 @@ static int id (lua_State *L) {
 }
 
 
-static const struct luaL_reg funcs[] = {
+static const struct luaL_Reg funcs[] = {
   {"id", id},
   {NULL, NULL}
 };
diff --git a/test/PUC-Lua-5.1-tests/libs/lib2.c b/test/PUC-Lua-5.1-tests/libs/lib2.c
index 9972cbe..876a212 100644
--- a/test/PUC-Lua-5.1-tests/libs/lib2.c
+++ b/test/PUC-Lua-5.1-tests/libs/lib2.c
@@ -12,7 +12,7 @@ static int id (lua_State *L) {
 }
 
 
-static const struct luaL_reg funcs[] = {
+static const struct luaL_Reg funcs[] = {
   {"id", id},
   {NULL, NULL}
 };
-- 
2.31.0


  parent reply	other threads:[~2021-03-26  7:44 UTC|newest]

Thread overview: 153+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26  7:42 [Tarantool-patches] [PATCH v2 luajit 00/30] Adapt PUC-Rio Lua 5.1 test suite Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 01/30] test: add " Sergey Kaplun via Tarantool-patches
2021-03-26 10:14   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:13   ` Igor Munkin via Tarantool-patches
2021-04-01  8:11     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` Sergey Kaplun via Tarantool-patches [this message]
2021-03-26 11:01   ` [Tarantool-patches] [PATCH v2 luajit 02/30] test: add compiling for C libs from PUC-Rio-Lua5.1 Sergey Ostanevich via Tarantool-patches
2021-03-30 22:14   ` Igor Munkin via Tarantool-patches
2021-04-01  8:21     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 03/30] test: adapt Lua 5.1 suite for out-of-source build Sergey Kaplun via Tarantool-patches
2021-03-26 11:07   ` Sergey Ostanevich via Tarantool-patches
2021-03-26 14:25     ` Sergey Kaplun via Tarantool-patches
2021-03-31 22:58       ` Igor Munkin via Tarantool-patches
2021-04-01  8:43         ` Sergey Kaplun via Tarantool-patches
2021-03-31 22:58   ` Igor Munkin via Tarantool-patches
2021-04-01  8:40     ` Sergey Kaplun via Tarantool-patches
2021-04-06 16:56       ` Igor Munkin via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 04/30] test: remove quotes in progname from <main.lua> Sergey Kaplun via Tarantool-patches
2021-03-26 11:12   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 22:58   ` Igor Munkin via Tarantool-patches
2021-04-01  8:50     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 05/30] test: adapt arg availability test from Lua suite Sergey Kaplun via Tarantool-patches
2021-03-26 11:22   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 22:58   ` Igor Munkin via Tarantool-patches
2021-04-01  9:37     ` Sergey Kaplun via Tarantool-patches
2021-04-06 15:24       ` Igor Munkin via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 06/30] test: disable PUC Lua tests confused by -v output Sergey Kaplun via Tarantool-patches
2021-03-26 11:26   ` Sergey Ostanevich via Tarantool-patches
2021-03-26 14:31     ` Sergey Kaplun via Tarantool-patches
2021-03-31 22:58   ` Igor Munkin via Tarantool-patches
2021-04-01  9:56     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 07/30] test: disable Lua tests for bytecode with header Sergey Kaplun via Tarantool-patches
2021-03-26 11:30   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 22:59   ` Igor Munkin via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 08/30] test: disable JIT for GC step counting tests Sergey Kaplun via Tarantool-patches
2021-03-26 11:32   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:14   ` Igor Munkin via Tarantool-patches
2021-04-01 10:10     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 09/30] test: disable Lua suite tests for line hook Sergey Kaplun via Tarantool-patches
2021-03-26 11:35   ` Sergey Ostanevich via Tarantool-patches
2021-03-26 14:33     ` Sergey Kaplun via Tarantool-patches
2021-03-31 22:59   ` Igor Munkin via Tarantool-patches
2021-04-01 10:06     ` Sergey Kaplun via Tarantool-patches
2021-04-06 19:45       ` Igor Munkin via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 10/30] test: adapt test for debug.setlocal in Lua suite Sergey Kaplun via Tarantool-patches
2021-03-26 11:44   ` Sergey Ostanevich via Tarantool-patches
2021-03-26 14:45     ` Sergey Kaplun via Tarantool-patches
2021-03-30 22:14   ` Igor Munkin via Tarantool-patches
2021-04-01 10:16     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 11/30] test: adapt getlocal PUC test for vararg func Sergey Kaplun via Tarantool-patches
2021-03-26 11:47   ` Sergey Ostanevich via Tarantool-patches
2021-03-26 14:52     ` Sergey Kaplun via Tarantool-patches
2021-03-30 22:15   ` Igor Munkin via Tarantool-patches
2021-04-01 11:37     ` Sergey Kaplun via Tarantool-patches
2021-04-06 20:09       ` Igor Munkin via Tarantool-patches
2021-04-06 20:40         ` Igor Munkin via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 12/30] test: adapt PUC Lua test with count hooks Sergey Kaplun via Tarantool-patches
2021-03-26 11:49   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:15   ` Igor Munkin via Tarantool-patches
2021-04-01 11:42     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 13/30] test: disable PUC Lua test for tail call info Sergey Kaplun via Tarantool-patches
2021-03-26 14:43   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:15   ` Igor Munkin via Tarantool-patches
2021-04-01 11:52     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 14/30] test: adapt activeline check in the PUC Lua test Sergey Kaplun via Tarantool-patches
2021-03-26 14:50   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:15   ` Igor Munkin via Tarantool-patches
2021-04-01 11:58     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 15/30] test: disable PUC-Lua test for per-coroutine hooks Sergey Kaplun via Tarantool-patches
2021-03-26 14:54   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:16   ` Igor Munkin via Tarantool-patches
2021-04-01 12:03     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:42 ` [Tarantool-patches] [PATCH v2 luajit 16/30] test: adapt PUC Lua test for %q in fmt for LuaJIT Sergey Kaplun via Tarantool-patches
2021-03-26 14:56   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:16   ` Igor Munkin via Tarantool-patches
2021-04-01 12:33     ` Sergey Kaplun via Tarantool-patches
2021-04-06 21:37       ` Igor Munkin via Tarantool-patches
2021-04-07 15:50         ` Sergey Kaplun via Tarantool-patches
2021-04-07 16:31           ` Igor Munkin via Tarantool-patches
2021-04-08  8:51             ` Sergey Kaplun via Tarantool-patches
2021-04-12 10:26               ` Igor Munkin via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 17/30] test: disable locale-depended tests for Lua suite Sergey Kaplun via Tarantool-patches
2021-03-26 14:58   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:16   ` Igor Munkin via Tarantool-patches
2021-04-01 19:12     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 18/30] test: replace math.mod to math.fmod for Lua tests Sergey Kaplun via Tarantool-patches
2021-03-26 15:12   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:17     ` Igor Munkin via Tarantool-patches
2021-03-26 15:16   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:16   ` Igor Munkin via Tarantool-patches
2021-04-01 19:36     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 19/30] test: remove assert for string.gfind check Sergey Kaplun via Tarantool-patches
2021-03-26 15:14   ` Sergey Ostanevich via Tarantool-patches
2021-03-30 22:17   ` Igor Munkin via Tarantool-patches
2021-04-02  7:05     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 20/30] test: adapt PUC Lua test for args in vararg func Sergey Kaplun via Tarantool-patches
2021-03-26 14:54   ` Sergey Kaplun via Tarantool-patches
2021-03-26 15:22     ` Sergey Ostanevich via Tarantool-patches
2021-03-31  9:51   ` Igor Munkin via Tarantool-patches
2021-04-02  7:21     ` Sergey Kaplun via Tarantool-patches
2021-04-06 20:45       ` Igor Munkin via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 21/30] test: disable test for getfenv in closure tailcall Sergey Kaplun via Tarantool-patches
2021-03-26 15:41   ` Sergey Ostanevich via Tarantool-patches
2021-03-31  9:51   ` Igor Munkin via Tarantool-patches
2021-04-02  7:40     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 22/30] test: disable PUC Lua test for var names in error Sergey Kaplun via Tarantool-patches
2021-03-26 15:44   ` Sergey Ostanevich via Tarantool-patches
2021-03-26 16:01     ` Sergey Kaplun via Tarantool-patches
2021-03-31 19:23   ` Igor Munkin via Tarantool-patches
2021-04-02  7:48     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 23/30] test: disable PUC Lua test for fast function name Sergey Kaplun via Tarantool-patches
2021-03-26 15:45   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 19:23   ` Igor Munkin via Tarantool-patches
2021-04-02  8:14     ` Sergey Kaplun via Tarantool-patches
2021-04-06 21:37       ` Igor Munkin via Tarantool-patches
2021-04-07 16:06         ` Sergey Kaplun via Tarantool-patches
2021-04-07 16:11           ` Igor Munkin via Tarantool-patches
2021-04-07 19:57             ` Sergey Kaplun via Tarantool-patches
2021-04-12  9:36               ` Igor Munkin via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 24/30] test: disable PUC Lua test for non-asci identifier Sergey Kaplun via Tarantool-patches
2021-03-26 15:46   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 19:23   ` Igor Munkin via Tarantool-patches
2021-04-02  8:20     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 25/30] test: disable PUC Lua error test for syntax level Sergey Kaplun via Tarantool-patches
2021-03-26 15:52   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 19:24   ` Igor Munkin via Tarantool-patches
2021-04-02  8:30     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 26/30] test: disable tests with multiple -l options Sergey Kaplun via Tarantool-patches
2021-03-26 15:56   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 19:24   ` Igor Munkin via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 27/30] test: disable PUC Lua test for checking arg layout Sergey Kaplun via Tarantool-patches
2021-03-26 15:58   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 19:24   ` Igor Munkin via Tarantool-patches
2021-04-02  8:35     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 28/30] test: disable PUC Lua test checking -h option Sergey Kaplun via Tarantool-patches
2021-03-26 15:58   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 19:24   ` Igor Munkin via Tarantool-patches
2021-04-02  8:39     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 29/30] test: disable PUC Lua hanging GC test Sergey Kaplun via Tarantool-patches
2021-03-26 16:03   ` Sergey Ostanevich via Tarantool-patches
2021-03-31 19:24     ` Igor Munkin via Tarantool-patches
2021-03-31 19:24   ` Igor Munkin via Tarantool-patches
2021-04-02  8:45     ` Sergey Kaplun via Tarantool-patches
2021-03-26  7:43 ` [Tarantool-patches] [PATCH v2 luajit 30/30] test: disable too depth recursive PUC Lua test Sergey Kaplun via Tarantool-patches
2021-03-26 16:28   ` Sergey Ostanevich via Tarantool-patches
2021-03-26 16:45     ` Sergey Kaplun via Tarantool-patches
2021-03-31 19:24   ` Igor Munkin via Tarantool-patches
2021-04-02  8:47     ` Sergey Kaplun via Tarantool-patches
2021-03-26 11:09 ` [Tarantool-patches] [PATCH v2 luajit 00/30] Adapt PUC-Rio Lua 5.1 test suite Sergey Ostanevich via Tarantool-patches
2021-03-26 14:12   ` Sergey Kaplun via Tarantool-patches
2021-03-30 22:17 ` Igor Munkin via Tarantool-patches
2021-03-31  9:41   ` Sergey Kaplun via Tarantool-patches
2021-03-31 10:49     ` Igor Munkin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cae4edac952300c3cede10aef2d83f9c15f90736.1616743343.git.skaplun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 luajit 02/30] test: add compiling for C libs from PUC-Rio-Lua5.1' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox