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 6C74570310; Mon, 8 Feb 2021 18:05:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6C74570310 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612796748; bh=1zeVbcvIK3e6HAOFoW33cx1TEJTsuw9n3gpHY2eMNmk=; h=To:Cc:References:In-Reply-To:Date:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=StFW0WnULmjG9v7SuOrZuzZK0hoe1sq+5HLhYCvgdMhlsa1corB/6/ivMZEb6P+VW CnBNn6+jpP2CUhHK1sexOkHGUhuuRAKTZxtOBCl/1an7Uwjv9msNHAD/GIQzUFXQ26 CEvgC7RH4bjirZB6kOvyNYhl0lpmzlM1KN764oi8= Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (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 8A80270310 for ; Mon, 8 Feb 2021 18:05:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8A80270310 Received: by smtp34.i.mail.ru with esmtpa (envelope-from ) id 1l986g-0006Tu-EU; Mon, 08 Feb 2021 18:05:42 +0300 To: "'Igor Munkin'" , "'Sergey Kaplun'" Cc: References: <6a03d693204cacc5791c75e1003efc150abb2979.1612291495.git.imun@tarantool.org> In-Reply-To: <6a03d693204cacc5791c75e1003efc150abb2979.1612291495.git.imun@tarantool.org> Date: Mon, 8 Feb 2021 18:05:40 +0300 Message-ID: <01d401d6fe2b$dd80c160$98824420$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJPfenCWrjRxS0krGRZARdqgOlJ3gIL945VqUzSu6A= Content-Language: ru X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD953AC099BC0052A9CD238BCF93DF23716D1711D0DDC4F5AC2182A05F538085040A624F1BA5CCF0BD5EEC20BC3401ED7454EBF7BDE87DD64E18F3142493ECB5EFF X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7444CB0504BAF4550EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373745FD4183B699148638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC92A7252287DEBD85CF8F3A1C9081926D8972A297EC6442DB389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0D9442B0B5983000E8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD2691661749BA6B977359D765CF6BB0EE041D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE381F3E54FD4568659BA3038C0950A5D36B5C8C57E37DE458B92C30CA92C8B5C6467F23339F89546C55F5C1EE8F4F765FCCD7FADA94ADF7EACA7F4EDE966BC389F395957E7521B51C24C7702A67D5C33162DBA43225CD8A89F616AD31D0D18CD5CCE5475246E174218B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DBA1CE242F1348D5363B503F486389A921A5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A5244022916F709B901ECDDFD64CCE86C80A74B04B45CA9EDAD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34ECB3E21D3CD9CB4F52BB9A1068E88D00DDCAA0B3EDBD95D180507738B7F6C94A5598010FD2262C091D7E09C32AA3244C7A92C40D60AF13802084A5B392C04ACD408A6A02710B7304FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojMxr0zTsJFiTeOyImoMS3ww== X-Mailru-Sender: 6CA451E36783D721CBEA96CEA26D325DECDA8C95DD0C5F0BD323B61D252F74E1B7CBEF92542CD7C82F97C478340294DCC77752E0C033A69E0F0C7111264B8915FF1320A92A5534336C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 3/5] test: run LuaJIT tests via CMake 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: Timur Safin via Tarantool-patches Reply-To: Timur Safin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Some code changes proposals below... : From: Igor Munkin : Subject: [PATCH luajit 3/5] test: run LuaJIT tests via CMake :=20 : diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool- : tests/CMakeLists.txt : new file mode 100644 : index 0000000..0be4b34 : --- /dev/null : +++ b/test/tarantool-tests/CMakeLists.txt : @@ -0,0 +1,92 @@ : +# Test suite that has been moved from Tarantool repository in : +# scope of https://github.com/tarantool/tarantool/issues/4478. : + : +# See the rationale in the root CMakeLists.txt. : +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) : + : +find_program(PROVE prove) : +if(NOT PROVE) : + message(WARNING "`prove' is not found, so tarantool-tests target is = not : generated") : + return() : +endif() : + : +macro(BuildTestLib lib sources) : + add_library(${lib} SHARED EXCLUDE_FROM_ALL ${sources}) : + target_include_directories(${lib} PRIVATE : + ${LUAJIT_SOURCE_DIR} : + ${CMAKE_CURRENT_SOURCE_DIR} : + ) ... : + # XXX: Append the lib to be built to the dependecy list. : + # Unfortunately, CMake is a crap and there is no other way to : + # extend the list in parent scope but join two strings with : + # semicolon. If one finds the normal way to make it work, feel : + # free to reach me. : + set(TESTLIBS "${lib};${TESTLIBS}" PARENT_SCOPE) I don't like this. It reminds me of bad examples of this note in the libev code like "this is so uncontrollably lame" which actually distract users. We should rather put comments in more neutral way (IMVHO).=20 : + # Add the directory where the lib is built to the LUA_CPATH : + # environment variable, so interpreter can find and load it. : + # XXX: Here we see the other side of the coin. If one joins two : + # strings with semicolon, the value automatically becomes the : + # list. I have no idea what is wrong with this tool, but I found : + # a single working solution to make LUA_CPATH be a string via : + # "escaping" the semicolon right in string interpolation. : + set(LUA_CPATH : = "${CMAKE_CURRENT_BINARY_DIR}/?${CMAKE_SHARED_LIBRARY_SUFFIX}\;${LUA_CPATH= }" : PARENT_SCOPE) : + # Also add this directory to LD_LIBRARY_PATH environment : + # variable, so FFI machinery can find and load it. : + set(LD_LIBRARY_PATH = "${CMAKE_CURRENT_BINARY_DIR}:${LD_LIBRARY_PATH}" : PARENT_SCOPE) : +endmacro() : + : +add_subdirectory(gh-4427-ffi-sandwich) : +add_subdirectory(lj-flush-on-trace) : +add_subdirectory(misclib-getmetrics-capi) I liked you introduced globs for test files addition (blow),=20 but unfortunately you didn't complete this with subdirectory addition Please see my proposed patch (with reworded comments and new macro) here = https://gist.github.com/tsafin/6c7505c0c764ab2b474667bf0d65fb45. : + : +# The part of memory profiler toolchain is located in tools : +# directory and auxiliary tests-related modules are located in the : +# current directory (but tests are run in the binary directory), : +# so LUA_PATH need to be updated. : +set(LUA_PATH : + = "${CMAKE_CURRENT_SOURCE_DIR}/?.lua\;${PROJECT_SOURCE_DIR}/tools/?.lua" : +) : +set(LUA_TEST_SUFFIX .test.lua) : +file(GLOB TEST_DEPS ${CMAKE_CURRENT_SOURCE_DIR}/*${LUA_TEST_SUFFIX}) : + : +# LUA_CPATH and LD_LIBRARY_PATH variables and also TESTLIBS list : +# with dependecies are set in scope of BuildTestLib macro. : +add_custom_command( : + COMMENT "Running Tarantool tests" : + OUTPUT tests.ok : + DEPENDS ${LUAJIT_TEST_BINARY} ${TESTLIBS} ${TEST_DEPS} : + COMMAND : + env : + LUA_PATH=3D"${LUA_PATH}\;\;" : + LUA_CPATH=3D"${LUA_CPATH}\;\;" : + LD_LIBRARY_PATH=3D"${LD_LIBRARY_PATH}" : + ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR} : + --exec ${LUAJIT_TEST_BINARY} : + --ext ${LUA_TEST_SUFFIX} : + --failures --shuffle : + && touch tests.ok : + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} : +) : + : +add_custom_target(tarantool-tests DEPENDS tests.ok) The major part of suggested patch is like this one: -------------------------------------------------- -add_subdirectory(gh-4427-ffi-sandwich) -add_subdirectory(lj-flush-on-trace) -add_subdirectory(misclib-getmetrics-capi) +macro(add_all_subdirectories) + file(GLOB entries RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*") + foreach(entry ${entries}) + if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${entry}) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${entry}) + endif() + endforeach() +endmacro() + +add_all_subdirectories() ------------------------------------------------- Regards, Timur