From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 7AF246FF9D; Fri, 26 Mar 2021 10:44:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7AF246FF9D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616744679; bh=AAWpvARx4+Ck11VuQakBL4fX69ikdqbA+RsLXzsjazU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=RTXPTuEoDve7fT39qmEPDdN5ODYFzaB8z1bsDU6PZ5OFhnBDZDRTEyOgui4hcA12Z qe3jrS3eb9suWD6BI0tX9cPatZ2oy8iqxmr0+SV8qQrWlNJgNIdSaV3IydekH4VwWA 3PfEkvk3TDqrbETq1ingUxsa8Q88ypTFAC8UlXsE= Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3B9C76FF9D for ; Fri, 26 Mar 2021 10:44:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3B9C76FF9D Received: by smtp63.i.mail.ru with esmtpa (envelope-from ) id 1lPh8b-00042u-86; Fri, 26 Mar 2021 10:44:09 +0300 To: Sergey Ostanevich , Igor Munkin Date: Fri, 26 Mar 2021 10:42:45 +0300 Message-Id: X-Mailer: git-send-email 2.31.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9064ADF4728AA0EE919EF87AC0718675712B828C563C11F50182A05F53808504043FD772ABD45E4A86BA0BE29BAC59E8BB0A28A2CA693F937FDAC8E3EAA0DA4B5 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7C4FDA87F74E4A9F6EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373103A56A89D9083FEA1F7E6F0F101C67CDEEF6D7F21E0D1D174C73DBBBFC7664522CCF267CC2B9BFD539AF3B196859C8DDA6B4AB36FFC8D2389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C078FCF50C7EAF9C588941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B66EA1BA7CA28B4A74CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB86D1867E19FE14079C09775C1D3CA48CFC5EA940A35A165FF2DBA43225CD8A89F890A246B268E114EC6EABA9B74D0DA47B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C5DD32608FC869F5D79D9FBA60F4D0E81B73866190D8F99E19C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFF532FBFD8162E58C699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3490011A262ADAEDFEA2890121748D09C59A97BFD816C95035E9C2FC8B6801F030D140B4EAA402DC5B1D7E09C32AA3244C2A91D56861B5F53C23D223AA4C90370FCE0B41342B755BCD927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojapPp7P/VpAid6Zit5kHcxQ== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB4267075CF515FA239C37CE200D0FCECB7A00EAB127A1825D7F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 luajit 02/30] test: add compiling for C libs from PUC-Rio-Lua5.1 X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch adds commands to create additional LuaC libraries for tests in . Also, it renames `luaL_reg` to `luaL_Reg` in and 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 +# Set PUC-Lua-5.1-tests-prepare target that contains rules +# for libraries compilation and creates # 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