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 BF518EB6489; Tue, 24 Sep 2024 14:16:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BF518EB6489 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1727176581; bh=M3zQyC9pZODZJMUYgq0AAQbRvdltlWXp74tXhor8Ur0=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=mVuBZ90wguy88gmdvm+kmSf4gNno7zKj4kcrpBh6pzkaB7/vk1jlvwuSPpDNNQrDy +DacK0V1gmiUuv8cWViHg9t3XHx0tdmDh7U6s0eJ9P2nMvRj/DzSlvLpx804QcaeRc rg5mamDumv3OQSghqNNANOx9iAP0XGsbjA9q8ZOM= Received: from smtp16.i.mail.ru (smtp16.i.mail.ru [95.163.41.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1B814EB6485 for ; Tue, 24 Sep 2024 14:16:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1B814EB6485 Received: by smtp16.i.mail.ru with esmtpa (envelope-from ) id 1st3Wm-000000035OG-00lP; Tue, 24 Sep 2024 14:16:20 +0300 Content-Type: multipart/alternative; boundary="------------fv5yroZito09IRWBtlFWYOrH" Message-ID: <4c633d2d-2945-4a4a-9571-742c54f8e620@tarantool.org> Date: Tue, 24 Sep 2024 14:16:19 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun , Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org References: <15a3b416520eac8f799a59fa51c6dcd9515ec90b.1727172936.git.skaplun@tarantool.org> In-Reply-To: <15a3b416520eac8f799a59fa51c6dcd9515ec90b.1727172936.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD968D81A599CAF0ABB6BA92BBABE0EB59B5744538ABDB81C5D182A05F538085040A9B10885D4CF84F0A6D5EE0DB6E1EC8D86B72AFEDD2CDF59BA1C620C1488912CA2605A7B24691806 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE745A4951BB4A6F568EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063755C4E610042D29F38638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D88544EB7800F4566FDF209EE314940339646DC422B85826DFCC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637F3E38EE449E3E2AE389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F7900637A6BC3D7070A0091FD81D268191BDAD3DBD4B6F7A4D31EC0BE2F48590F00D11D6D81D268191BDAD3D78DA827A17800CE7EA3A15E3BE8EFD46EC76A7562686271ED91E3A1F190DE8FD2E808ACE2090B5E14AD6D5ED66289B5259CC434672EE63711DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3C8F21CEC4765490D35872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5FE78F9A3474BD33A5002B1117B3ED6960913A3B8069275DD22DFD5397F446790823CB91A9FED034534781492E4B8EEAD85CCBA673D36D1A4BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF37E043DB83C4E93512EF3AA5FBE6640ABD7A95CE0291C11C2CCEDA5C0E834BD4CC55679CEC9B022BA4322FFB9F042FEF4536CD9CEA4E9E9BCF81C59D6A1DE4A2F62A84FCFA487A5C5F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojamSMdo1tbG8d6tvr0v0iAw== X-Mailru-Sender: 520A125C2F17F0B1E52FEF5D219D6140ED396BA6F23995979CED5423E6BDC6808A4FCED3BFDC52E40152A3D17938EB451EB5A0BCEC6A560B3DDE9B364B0DF289BE2DA36745F2EEB5CEBA01FB949A1F1EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 5/7] test: shrink LUA_CPATH and {DY}LD_LIBRARY_PATH 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 Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------fv5yroZito09IRWBtlFWYOrH Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey, thanks for the updated patch! I'm happy to see how much code was removed. See my comments below. On 24.09.2024 13:29, Sergey Kaplun wrote: > This patch sets the unique value of each of these variables for each of > the tests and only where they are needed. Also, it drops the comment > about SIP [1] tricks since it is obsolete after > 29897567ee5ed57e961c730432c056a3dbaa8f09 ("test: stop using > utils.selfrun in tests"). > > [1]:https://support.apple.com/en-us/HT204899 > > Resolves tarantool/tarantool#9898 > --- > test/tarantool-tests/CMakeLists.txt | 85 ++++++++----------- > test/tarantool-tests/ffi-ccall/CMakeLists.txt | 2 +- > .../fix-bit-shift-generation/CMakeLists.txt | 3 +- > .../gh-4427-ffi-sandwich/CMakeLists.txt | 3 +- > .../CMakeLists.txt | 3 +- > .../gh-6189-cur_L/CMakeLists.txt | 3 +- > .../lj-1004-oom-error-frame/CMakeLists.txt | 3 +- > .../CMakeLists.txt | 3 +- > .../lj-1166-error-stitch/CMakeLists.txt | 6 +- > .../lj-416-xor-before-jcc/CMakeLists.txt | 3 +- > .../CMakeLists.txt | 3 +- > .../lj-549-bytecode-loader/CMakeLists.txt | 3 +- > .../CMakeLists.txt | 3 +- > .../lj-601-fix-gc-finderrfunc/CMakeLists.txt | 3 +- > .../lj-727-lightuserdata-itern/CMakeLists.txt | 3 +- > .../CMakeLists.txt | 3 +- > .../lj-flush-on-trace/CMakeLists.txt | 3 +- > .../both/CMakeLists.txt | 4 +- > .../gnuhash/CMakeLists.txt | 4 +- > .../hash/CMakeLists.txt | 4 +- > .../stripped/CMakeLists.txt | 4 +- > 21 files changed, 82 insertions(+), 69 deletions(-) > > diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/CMakeLists.txt > index 5e3493b6..d0964aed 100644 > --- a/test/tarantool-tests/CMakeLists.txt > +++ b/test/tarantool-tests/CMakeLists.txt > @@ -5,17 +5,16 @@ add_custom_target(tarantool-tests-libs > DEPENDS libluajit > ) > > -macro(BuildTestCLib lib sources) > - AddTestLib(${lib} ${sources}) > +macro(BuildTestCLib lib source for_tests) > + AddTestLib(${lib} ${source}) > add_dependencies(tarantool-tests-libs ${lib}) > - # Add the directory where the lib is built to the list with > - # entries for LUA_CPATH environment variable, so LuaJIT can find > - # and load it. See the comment about extending the list in the > - # parent scope few lines above. > - set(LUA_CPATHS "${CMAKE_CURRENT_BINARY_DIR}/?${CMAKE_SHARED_LIBRARY_SUFFIX};${LUA_CPATHS}" 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) > + # Remember libraries for each test to be proceeded with after > + # test targets are created. > + foreach(testname ${for_tests}) > + set(LIBS_${testname} > + "${CMAKE_CURRENT_BINARY_DIR};${LIBS_${testname}}" PARENT_SCOPE > + ) > + endforeach() > endmacro() > > # FIXME: This is used only due to ancient CMake requirements. > @@ -81,46 +80,8 @@ make_lua_path(LUA_PATH > ${LUAJIT_BINARY_DIR}/?.lua > ) > > -# Update LUA_CPATH with the library paths collected within > -# macro. > -make_lua_path(LUA_CPATH PATHS ${LUA_CPATHS}) > - > set(LUA_TEST_SUFFIX .test.lua) > > -# XXX: Since the auxiliary libraries are built as a dynamically > -# loaded modules on MacOS instead of shared libraries as it is > -# done on Linux and BSD, another environment variable should be > -# used to guide while searching the extension. > -# XXX: Be noticed that we shouldn't use `"` here to wrap > -# the variable's content. If we do this, the variable value will > -# contain `"` at the beginning and the end, so this `"` at the > -# beginning will be treated as the directory for the first entry > -# (the last subdirectory added). > -if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") > - # XXX: Apple tries their best to "protect their users from > - # malware". As a result SIP (see the link[1] below) has been > - # designed and released. Now, Apple developers are so protected, > - # that they can load nothing being not installed in the system, > - # since some programs sanitize the environment before they start > - # child processes. Specifically, environment variables starting > - # with DYLD_ and LD_ are unset for child process started by > - # other programs (like `ctest` using for launching tests). > - # For more info, see the docs[2] below. > - # > - # These environment variables are used by FFI machinery to find > - # the proper shared library, hence we can still tweak testing > - # environment before calling . However, the value > - # can't be passed via the standard environment variable, so we > - # use ENVIRONMENT property in `set_tests_properties` to get > - # around SIP magic tricks. > - # > - # [1]:https://support.apple.com/en-us/HT204899 > - # [2]:https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html > - list(APPEND LUA_TEST_ENV_MORE DYLD_LIBRARY_PATH=${LD_LIBRARY_PATH}) > -else() > - list(APPEND LUA_TEST_ENV_MORE LD_LIBRARY_PATH=${LD_LIBRARY_PATH}) > -endif() > - > # Some tests use `LD_PRELOAD` to mock system calls (like > # overwrites > # `mprotect()`. When compiling with ASan support under GCC, it is > @@ -157,7 +118,7 @@ foreach(test_path ${tests}) > # LUA_CPATH and LD_LIBRARY_PATH variables and also > # dependencies list with libraries are set in scope of > # BuildTestLib macro. > - ENVIRONMENT "LUA_PATH=${LUA_PATH};LUA_CPATH=${LUA_CPATH};${LUA_TEST_ENV_MORE}" > + ENVIRONMENT "LUA_PATH=${LUA_PATH};${LUA_TEST_ENV_MORE}" > LABELS ${TEST_SUITE_NAME} > DEPENDS tarantool-tests-deps > ) > @@ -169,4 +130,30 @@ foreach(test_path ${tests}) > LUA_PATH "${PROJECT_SOURCE_DIR}/tools/?.lua\;" > ) > endif() > + > + if(LIBS_${test_name}) > + foreach(path ${LIBS_${test_name}}) > + # Add the directory where the library is built to the list > + # with entries for the LUA_CPATH environment variable, so > + # LuaJIT can find and load it. > + AppendTestEnvVar(${test_title} > + LUA_CPATH "${path}/?${CMAKE_SHARED_LIBRARY_SUFFIX}\;" > + ) > + # Also, add this directory to the LD_LIBRARY_PATH environment > + # variable so FFI machinery can find and load it. > + # XXX: Be noticed that we shouldn't use `"` here to wrap the > + # variable's content. If we do this, the variable value will > + # contain `"` at the beginning and the end, so this `"` at the > + # beginning will be treated as the directory for the entry. > + # XXX: Since the auxiliary libraries are built as dynamically > + # loaded modules on MacOS instead of shared libraries as it is > + # done on Linux and BSD, another environment variable should > + # be used to guide while searching the extension. > + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") > + AppendTestEnvVar(${test_title} DYLD_LIBRARY_PATH ${path}:) > + else() > + AppendTestEnvVar(${test_title} LD_LIBRARY_PATH ${path}:) > + endif() please add unset(LIBS_${test_name}) > + endforeach() > + endif() > endforeach() > diff --git a/test/tarantool-tests/ffi-ccall/CMakeLists.txt b/test/tarantool-tests/ffi-ccall/CMakeLists.txt > index df937bf8..8acd8fe4 100644 > --- a/test/tarantool-tests/ffi-ccall/CMakeLists.txt > +++ b/test/tarantool-tests/ffi-ccall/CMakeLists.txt > @@ -1 +1 @@ > -BuildTestCLib(libfficcall libfficcall.c) > +BuildTestCLib(libfficcall libfficcall.c ffi-ccall-arm64-fp-convention.test.lua) > diff --git a/test/tarantool-tests/fix-bit-shift-generation/CMakeLists.txt b/test/tarantool-tests/fix-bit-shift-generation/CMakeLists.txt > index f85f875b..597b0088 100644 > --- a/test/tarantool-tests/fix-bit-shift-generation/CMakeLists.txt > +++ b/test/tarantool-tests/fix-bit-shift-generation/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(libtestbitshift libtestbitshift.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(libtestbitshift libtestbitshift.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/gh-4427-ffi-sandwich/CMakeLists.txt b/test/tarantool-tests/gh-4427-ffi-sandwich/CMakeLists.txt > index f2be5493..7766373d 100644 > --- a/test/tarantool-tests/gh-4427-ffi-sandwich/CMakeLists.txt > +++ b/test/tarantool-tests/gh-4427-ffi-sandwich/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(libsandwich libsandwich.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(libsandwich libsandwich.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/CMakeLists.txt b/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/CMakeLists.txt > index 361d0cd7..381577fb 100644 > --- a/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/CMakeLists.txt > +++ b/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(libproxy libproxy.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(libproxy libproxy.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/gh-6189-cur_L/CMakeLists.txt b/test/tarantool-tests/gh-6189-cur_L/CMakeLists.txt > index 1e58e560..11dbfa6b 100644 > --- a/test/tarantool-tests/gh-6189-cur_L/CMakeLists.txt > +++ b/test/tarantool-tests/gh-6189-cur_L/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(libcur_L libcur_L.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(libcur_L libcur_L.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/lj-1004-oom-error-frame/CMakeLists.txt b/test/tarantool-tests/lj-1004-oom-error-frame/CMakeLists.txt > index 3bca5df8..865e4d26 100644 > --- a/test/tarantool-tests/lj-1004-oom-error-frame/CMakeLists.txt > +++ b/test/tarantool-tests/lj-1004-oom-error-frame/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(testoomframe testoomframe.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(testoomframe testoomframe.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/lj-1066-fix-cur_L-after-coroutine-resume/CMakeLists.txt b/test/tarantool-tests/lj-1066-fix-cur_L-after-coroutine-resume/CMakeLists.txt > index c8a3731f..7b507b81 100644 > --- a/test/tarantool-tests/lj-1066-fix-cur_L-after-coroutine-resume/CMakeLists.txt > +++ b/test/tarantool-tests/lj-1066-fix-cur_L-after-coroutine-resume/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(libcur_L_coroutine libcur_L_coroutine.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(libcur_L_coroutine libcur_L_coroutine.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/lj-1166-error-stitch/CMakeLists.txt b/test/tarantool-tests/lj-1166-error-stitch/CMakeLists.txt > index 342e438e..658b3b8c 100644 > --- a/test/tarantool-tests/lj-1166-error-stitch/CMakeLists.txt > +++ b/test/tarantool-tests/lj-1166-error-stitch/CMakeLists.txt > @@ -1 +1,5 @@ > -BuildTestCLib(allocinject allocinject.c) > +list(APPEND tests > + lj-1166-error-stitch-oom-ir-buff.test.lua > + lj-1166-error-stitch-oom-snap-buff.test.lua > +) > +BuildTestCLib(allocinject allocinject.c "${tests}") > diff --git a/test/tarantool-tests/lj-416-xor-before-jcc/CMakeLists.txt b/test/tarantool-tests/lj-416-xor-before-jcc/CMakeLists.txt > index 17aa9f9b..e25863a4 100644 > --- a/test/tarantool-tests/lj-416-xor-before-jcc/CMakeLists.txt > +++ b/test/tarantool-tests/lj-416-xor-before-jcc/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(libtestxor testxor.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(libtestxor testxor.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/lj-522-fix-dlerror-return-null/CMakeLists.txt b/test/tarantool-tests/lj-522-fix-dlerror-return-null/CMakeLists.txt > index 903da4d3..c4383b37 100644 > --- a/test/tarantool-tests/lj-522-fix-dlerror-return-null/CMakeLists.txt > +++ b/test/tarantool-tests/lj-522-fix-dlerror-return-null/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(mydlerror mydlerror.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(mydlerror mydlerror.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/lj-549-bytecode-loader/CMakeLists.txt b/test/tarantool-tests/lj-549-bytecode-loader/CMakeLists.txt > index d66c4935..515de667 100644 > --- a/test/tarantool-tests/lj-549-bytecode-loader/CMakeLists.txt > +++ b/test/tarantool-tests/lj-549-bytecode-loader/CMakeLists.txt > @@ -17,5 +17,6 @@ add_custom_target(export_bc > VERBATIM > ) > > -BuildTestCLib(${LIB_NAME} ${C_FILE}) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(${LIB_NAME} ${C_FILE} ${test_name}.test.lua) > add_dependencies(${LIB_NAME} export_bc) > diff --git a/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt b/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt > index 1f3e8fe6..89f8583f 100644 > --- a/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt > +++ b/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt > @@ -27,7 +27,8 @@ macro(BuildTestBCLib file_ext) > VERBATIM > ) > > - BuildTestCLib(${LIB_NAME} ${EXT_SOURCE}) > + get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > + BuildTestCLib(${LIB_NAME} ${EXT_SOURCE} ${test_name}.test.lua) > add_dependencies(${LIB_NAME} export_bc_${file_ext}) > endmacro() > > diff --git a/test/tarantool-tests/lj-601-fix-gc-finderrfunc/CMakeLists.txt b/test/tarantool-tests/lj-601-fix-gc-finderrfunc/CMakeLists.txt > index 3fed6105..31c9fa3b 100644 > --- a/test/tarantool-tests/lj-601-fix-gc-finderrfunc/CMakeLists.txt > +++ b/test/tarantool-tests/lj-601-fix-gc-finderrfunc/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(libmixcframe mixcframe.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(libmixcframe mixcframe.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/lj-727-lightuserdata-itern/CMakeLists.txt b/test/tarantool-tests/lj-727-lightuserdata-itern/CMakeLists.txt > index 564b688b..1161017d 100644 > --- a/test/tarantool-tests/lj-727-lightuserdata-itern/CMakeLists.txt > +++ b/test/tarantool-tests/lj-727-lightuserdata-itern/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(lightuserdata lightuserdata.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(lightuserdata lightuserdata.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/lj-802-panic-at-mcode-protfail/CMakeLists.txt b/test/tarantool-tests/lj-802-panic-at-mcode-protfail/CMakeLists.txt > index 25520a1a..39c7532a 100644 > --- a/test/tarantool-tests/lj-802-panic-at-mcode-protfail/CMakeLists.txt > +++ b/test/tarantool-tests/lj-802-panic-at-mcode-protfail/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(mymprotect mymprotect.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(mymprotect mymprotect.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/lj-flush-on-trace/CMakeLists.txt b/test/tarantool-tests/lj-flush-on-trace/CMakeLists.txt > index 16f1aa8f..7dfea075 100644 > --- a/test/tarantool-tests/lj-flush-on-trace/CMakeLists.txt > +++ b/test/tarantool-tests/lj-flush-on-trace/CMakeLists.txt > @@ -1 +1,2 @@ > -BuildTestCLib(libflush libflush.c) > +get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) > +BuildTestCLib(libflush libflush.c ${test_name}.test.lua) > diff --git a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/both/CMakeLists.txt b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/both/CMakeLists.txt > index ce616fcf..bf980c7d 100644 > --- a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/both/CMakeLists.txt > +++ b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/both/CMakeLists.txt > @@ -1,5 +1,7 @@ > if (NOT(CMAKE_SYSTEM_NAME STREQUAL "Darwin")) > - BuildTestCLib(resboth resboth.c) > + BuildTestCLib(resboth resboth.c > + profilers/gh-5813-resolving-of-c-symbols.test.lua > + ) > # Unfortunately, command is introduced > # since CMake 3.13, so we can't use it now considering ancient > # distros support. Just build linker flags by hands. > diff --git a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/gnuhash/CMakeLists.txt b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/gnuhash/CMakeLists.txt > index 1179601b..b80129a3 100644 > --- a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/gnuhash/CMakeLists.txt > +++ b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/gnuhash/CMakeLists.txt > @@ -1,5 +1,7 @@ > if (NOT(CMAKE_SYSTEM_NAME STREQUAL "Darwin")) > - BuildTestCLib(resgnuhash resgnuhash.c) > + BuildTestCLib(resgnuhash resgnuhash.c > + profilers/gh-5813-resolving-of-c-symbols.test.lua > + ) > # Unfortunately, command is introduced > # since CMake 3.13, so we can't use it now considering ancient > # distros support. Just build linker flags by hands. > diff --git a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/hash/CMakeLists.txt b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/hash/CMakeLists.txt > index e0ad5675..0633f1f3 100644 > --- a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/hash/CMakeLists.txt > +++ b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/hash/CMakeLists.txt > @@ -1,5 +1,7 @@ > if (NOT(CMAKE_SYSTEM_NAME STREQUAL "Darwin")) > - BuildTestCLib(reshash reshash.c) > + BuildTestCLib(reshash reshash.c > + profilers/gh-5813-resolving-of-c-symbols.test.lua > + ) > # Unfortunately, command is introduced > # since CMake 3.13, so we can't use it now considering ancient > # distros support. Just build linker flags by hands. > diff --git a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/stripped/CMakeLists.txt b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/stripped/CMakeLists.txt > index 243902be..2ea0b4ac 100644 > --- a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/stripped/CMakeLists.txt > +++ b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/stripped/CMakeLists.txt > @@ -1,5 +1,7 @@ > if (NOT(CMAKE_SYSTEM_NAME STREQUAL "Darwin")) > - BuildTestCLib(resstripped resstripped.c) > + BuildTestCLib(resstripped resstripped.c > + profilers/gh-5813-resolving-of-c-symbols.test.lua > + ) > # Unfortunately, command is introduced > # since CMake 3.13, so we can't use it now considering ancient > # distros support. Just build linker flags by hands. --------------fv5yroZito09IRWBtlFWYOrH Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey,

thanks for the updated patch!

I'm happy to see how much code was removed.

See my comments below.

On 24.09.2024 13:29, Sergey Kaplun wrote:
This patch sets the unique value of each of these variables for each of
the tests and only where they are needed. Also, it drops the comment
about SIP [1] tricks since it is obsolete after
29897567ee5ed57e961c730432c056a3dbaa8f09 ("test: stop using
utils.selfrun in tests").

[1]: https://support.apple.com/en-us/HT204899

Resolves tarantool/tarantool#9898
---
 test/tarantool-tests/CMakeLists.txt           | 85 ++++++++-----------
 test/tarantool-tests/ffi-ccall/CMakeLists.txt |  2 +-
 .../fix-bit-shift-generation/CMakeLists.txt   |  3 +-
 .../gh-4427-ffi-sandwich/CMakeLists.txt       |  3 +-
 .../CMakeLists.txt                            |  3 +-
 .../gh-6189-cur_L/CMakeLists.txt              |  3 +-
 .../lj-1004-oom-error-frame/CMakeLists.txt    |  3 +-
 .../CMakeLists.txt                            |  3 +-
 .../lj-1166-error-stitch/CMakeLists.txt       |  6 +-
 .../lj-416-xor-before-jcc/CMakeLists.txt      |  3 +-
 .../CMakeLists.txt                            |  3 +-
 .../lj-549-bytecode-loader/CMakeLists.txt     |  3 +-
 .../CMakeLists.txt                            |  3 +-
 .../lj-601-fix-gc-finderrfunc/CMakeLists.txt  |  3 +-
 .../lj-727-lightuserdata-itern/CMakeLists.txt |  3 +-
 .../CMakeLists.txt                            |  3 +-
 .../lj-flush-on-trace/CMakeLists.txt          |  3 +-
 .../both/CMakeLists.txt                       |  4 +-
 .../gnuhash/CMakeLists.txt                    |  4 +-
 .../hash/CMakeLists.txt                       |  4 +-
 .../stripped/CMakeLists.txt                   |  4 +-
 21 files changed, 82 insertions(+), 69 deletions(-)

diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/CMakeLists.txt
index 5e3493b6..d0964aed 100644
--- a/test/tarantool-tests/CMakeLists.txt
+++ b/test/tarantool-tests/CMakeLists.txt
@@ -5,17 +5,16 @@ add_custom_target(tarantool-tests-libs
   DEPENDS libluajit
 )
 
-macro(BuildTestCLib lib sources)
-  AddTestLib(${lib} ${sources})
+macro(BuildTestCLib lib source for_tests)
+  AddTestLib(${lib} ${source})
   add_dependencies(tarantool-tests-libs ${lib})
-  # Add the directory where the lib is built to the list with
-  # entries for LUA_CPATH environment variable, so LuaJIT can find
-  # and load it. See the comment about extending the list in the
-  # parent scope few lines above.
-  set(LUA_CPATHS "${CMAKE_CURRENT_BINARY_DIR}/?${CMAKE_SHARED_LIBRARY_SUFFIX};${LUA_CPATHS}" 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)
+  # Remember libraries for each test to be proceeded with after
+  # test targets are created.
+  foreach(testname ${for_tests})
+    set(LIBS_${testname}
+      "${CMAKE_CURRENT_BINARY_DIR};${LIBS_${testname}}" PARENT_SCOPE
+    )
+  endforeach()
 endmacro()
 
 # FIXME: This is used only due to ancient CMake requirements.
@@ -81,46 +80,8 @@ make_lua_path(LUA_PATH
     ${LUAJIT_BINARY_DIR}/?.lua
 )
 
-# Update LUA_CPATH with the library paths collected within
-# <BuildTestLib> macro.
-make_lua_path(LUA_CPATH PATHS ${LUA_CPATHS})
-
 set(LUA_TEST_SUFFIX .test.lua)
 
-# XXX: Since the auxiliary libraries are built as a dynamically
-# loaded modules on MacOS instead of shared libraries as it is
-# done on Linux and BSD, another environment variable should be
-# used to guide <ffi.load> while searching the extension.
-# XXX: Be noticed that we shouldn't use `"` here to wrap
-# the variable's content. If we do this, the variable value will
-# contain `"` at the beginning and the end, so this `"` at the
-# beginning will be treated as the directory for the first entry
-# (the last subdirectory added).
-if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
-  # XXX: Apple tries their best to "protect their users from
-  # malware". As a result SIP (see the link[1] below) has been
-  # designed and released. Now, Apple developers are so protected,
-  # that they can load nothing being not installed in the system,
-  # since some programs sanitize the environment before they start
-  # child processes. Specifically, environment variables starting
-  # with DYLD_ and LD_ are unset for child process started by
-  # other programs (like `ctest` using for launching tests).
-  # For more info, see the docs[2] below.
-  #
-  # These environment variables are used by FFI machinery to find
-  # the proper shared library, hence we can still tweak testing
-  # environment before calling <ffi.load>. However, the value
-  # can't be passed via the standard environment variable, so we
-  # use ENVIRONMENT property in `set_tests_properties` to get
-  # around SIP magic tricks.
-  #
-  # [1]: https://support.apple.com/en-us/HT204899
-  # [2]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html
-  list(APPEND LUA_TEST_ENV_MORE DYLD_LIBRARY_PATH=${LD_LIBRARY_PATH})
-else()
-  list(APPEND LUA_TEST_ENV_MORE LD_LIBRARY_PATH=${LD_LIBRARY_PATH})
-endif()
-
 # Some tests use `LD_PRELOAD` to mock system calls (like
 # <lj-802-panic-at-mcode-protfail.test.lua> overwrites
 # `mprotect()`. When compiling with ASan support under GCC, it is
@@ -157,7 +118,7 @@ foreach(test_path ${tests})
     # LUA_CPATH and LD_LIBRARY_PATH variables and also
     # dependencies list with libraries are set in scope of
     # BuildTestLib macro.
-    ENVIRONMENT "LUA_PATH=${LUA_PATH};LUA_CPATH=${LUA_CPATH};${LUA_TEST_ENV_MORE}"
+    ENVIRONMENT "LUA_PATH=${LUA_PATH};${LUA_TEST_ENV_MORE}"
     LABELS ${TEST_SUITE_NAME}
     DEPENDS tarantool-tests-deps
   )
@@ -169,4 +130,30 @@ foreach(test_path ${tests})
       LUA_PATH "${PROJECT_SOURCE_DIR}/tools/?.lua\;"
     )
   endif()
+
+  if(LIBS_${test_name})
+    foreach(path ${LIBS_${test_name}})
+      # Add the directory where the library is built to the list
+      # with entries for the LUA_CPATH environment variable, so
+      # LuaJIT can find and load it.
+      AppendTestEnvVar(${test_title}
+        LUA_CPATH "${path}/?${CMAKE_SHARED_LIBRARY_SUFFIX}\;"
+      )
+      # Also, add this directory to the LD_LIBRARY_PATH environment
+      # variable so FFI machinery can find and load it.
+      # XXX: Be noticed that we shouldn't use `"` here to wrap the
+      # variable's content. If we do this, the variable value will
+      # contain `"` at the beginning and the end, so this `"` at the
+      # beginning will be treated as the directory for the entry.
+      # XXX: Since the auxiliary libraries are built as dynamically
+      # loaded modules on MacOS instead of shared libraries as it is
+      # done on Linux and BSD, another environment variable should
+      # be used to guide <ffi.load> while searching the extension.
+      if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+        AppendTestEnvVar(${test_title} DYLD_LIBRARY_PATH ${path}:)
+      else()
+        AppendTestEnvVar(${test_title} LD_LIBRARY_PATH ${path}:)
+      endif()
please add unset(LIBS_${test_name})
+    endforeach()
+  endif()
 endforeach()
diff --git a/test/tarantool-tests/ffi-ccall/CMakeLists.txt b/test/tarantool-tests/ffi-ccall/CMakeLists.txt
index df937bf8..8acd8fe4 100644
--- a/test/tarantool-tests/ffi-ccall/CMakeLists.txt
+++ b/test/tarantool-tests/ffi-ccall/CMakeLists.txt
@@ -1 +1 @@
-BuildTestCLib(libfficcall libfficcall.c)
+BuildTestCLib(libfficcall libfficcall.c ffi-ccall-arm64-fp-convention.test.lua)
diff --git a/test/tarantool-tests/fix-bit-shift-generation/CMakeLists.txt b/test/tarantool-tests/fix-bit-shift-generation/CMakeLists.txt
index f85f875b..597b0088 100644
--- a/test/tarantool-tests/fix-bit-shift-generation/CMakeLists.txt
+++ b/test/tarantool-tests/fix-bit-shift-generation/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(libtestbitshift libtestbitshift.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(libtestbitshift libtestbitshift.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/gh-4427-ffi-sandwich/CMakeLists.txt b/test/tarantool-tests/gh-4427-ffi-sandwich/CMakeLists.txt
index f2be5493..7766373d 100644
--- a/test/tarantool-tests/gh-4427-ffi-sandwich/CMakeLists.txt
+++ b/test/tarantool-tests/gh-4427-ffi-sandwich/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(libsandwich libsandwich.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(libsandwich libsandwich.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/CMakeLists.txt b/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/CMakeLists.txt
index 361d0cd7..381577fb 100644
--- a/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/CMakeLists.txt
+++ b/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(libproxy libproxy.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(libproxy libproxy.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/gh-6189-cur_L/CMakeLists.txt b/test/tarantool-tests/gh-6189-cur_L/CMakeLists.txt
index 1e58e560..11dbfa6b 100644
--- a/test/tarantool-tests/gh-6189-cur_L/CMakeLists.txt
+++ b/test/tarantool-tests/gh-6189-cur_L/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(libcur_L libcur_L.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(libcur_L libcur_L.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/lj-1004-oom-error-frame/CMakeLists.txt b/test/tarantool-tests/lj-1004-oom-error-frame/CMakeLists.txt
index 3bca5df8..865e4d26 100644
--- a/test/tarantool-tests/lj-1004-oom-error-frame/CMakeLists.txt
+++ b/test/tarantool-tests/lj-1004-oom-error-frame/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(testoomframe testoomframe.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(testoomframe testoomframe.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/lj-1066-fix-cur_L-after-coroutine-resume/CMakeLists.txt b/test/tarantool-tests/lj-1066-fix-cur_L-after-coroutine-resume/CMakeLists.txt
index c8a3731f..7b507b81 100644
--- a/test/tarantool-tests/lj-1066-fix-cur_L-after-coroutine-resume/CMakeLists.txt
+++ b/test/tarantool-tests/lj-1066-fix-cur_L-after-coroutine-resume/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(libcur_L_coroutine libcur_L_coroutine.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(libcur_L_coroutine libcur_L_coroutine.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/lj-1166-error-stitch/CMakeLists.txt b/test/tarantool-tests/lj-1166-error-stitch/CMakeLists.txt
index 342e438e..658b3b8c 100644
--- a/test/tarantool-tests/lj-1166-error-stitch/CMakeLists.txt
+++ b/test/tarantool-tests/lj-1166-error-stitch/CMakeLists.txt
@@ -1 +1,5 @@
-BuildTestCLib(allocinject allocinject.c)
+list(APPEND tests
+  lj-1166-error-stitch-oom-ir-buff.test.lua
+  lj-1166-error-stitch-oom-snap-buff.test.lua
+)
+BuildTestCLib(allocinject allocinject.c "${tests}")
diff --git a/test/tarantool-tests/lj-416-xor-before-jcc/CMakeLists.txt b/test/tarantool-tests/lj-416-xor-before-jcc/CMakeLists.txt
index 17aa9f9b..e25863a4 100644
--- a/test/tarantool-tests/lj-416-xor-before-jcc/CMakeLists.txt
+++ b/test/tarantool-tests/lj-416-xor-before-jcc/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(libtestxor testxor.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(libtestxor testxor.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/lj-522-fix-dlerror-return-null/CMakeLists.txt b/test/tarantool-tests/lj-522-fix-dlerror-return-null/CMakeLists.txt
index 903da4d3..c4383b37 100644
--- a/test/tarantool-tests/lj-522-fix-dlerror-return-null/CMakeLists.txt
+++ b/test/tarantool-tests/lj-522-fix-dlerror-return-null/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(mydlerror mydlerror.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(mydlerror mydlerror.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/lj-549-bytecode-loader/CMakeLists.txt b/test/tarantool-tests/lj-549-bytecode-loader/CMakeLists.txt
index d66c4935..515de667 100644
--- a/test/tarantool-tests/lj-549-bytecode-loader/CMakeLists.txt
+++ b/test/tarantool-tests/lj-549-bytecode-loader/CMakeLists.txt
@@ -17,5 +17,6 @@ add_custom_target(export_bc
   VERBATIM
 )
 
-BuildTestCLib(${LIB_NAME} ${C_FILE})
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(${LIB_NAME} ${C_FILE} ${test_name}.test.lua)
 add_dependencies(${LIB_NAME} export_bc)
diff --git a/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt b/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt
index 1f3e8fe6..89f8583f 100644
--- a/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt
+++ b/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt
@@ -27,7 +27,8 @@ macro(BuildTestBCLib file_ext)
     VERBATIM
   )
 
-  BuildTestCLib(${LIB_NAME} ${EXT_SOURCE})
+  get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+  BuildTestCLib(${LIB_NAME} ${EXT_SOURCE} ${test_name}.test.lua)
   add_dependencies(${LIB_NAME} export_bc_${file_ext})
 endmacro()
 
diff --git a/test/tarantool-tests/lj-601-fix-gc-finderrfunc/CMakeLists.txt b/test/tarantool-tests/lj-601-fix-gc-finderrfunc/CMakeLists.txt
index 3fed6105..31c9fa3b 100644
--- a/test/tarantool-tests/lj-601-fix-gc-finderrfunc/CMakeLists.txt
+++ b/test/tarantool-tests/lj-601-fix-gc-finderrfunc/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(libmixcframe mixcframe.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(libmixcframe mixcframe.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/lj-727-lightuserdata-itern/CMakeLists.txt b/test/tarantool-tests/lj-727-lightuserdata-itern/CMakeLists.txt
index 564b688b..1161017d 100644
--- a/test/tarantool-tests/lj-727-lightuserdata-itern/CMakeLists.txt
+++ b/test/tarantool-tests/lj-727-lightuserdata-itern/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(lightuserdata lightuserdata.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(lightuserdata lightuserdata.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/lj-802-panic-at-mcode-protfail/CMakeLists.txt b/test/tarantool-tests/lj-802-panic-at-mcode-protfail/CMakeLists.txt
index 25520a1a..39c7532a 100644
--- a/test/tarantool-tests/lj-802-panic-at-mcode-protfail/CMakeLists.txt
+++ b/test/tarantool-tests/lj-802-panic-at-mcode-protfail/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(mymprotect mymprotect.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(mymprotect mymprotect.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/lj-flush-on-trace/CMakeLists.txt b/test/tarantool-tests/lj-flush-on-trace/CMakeLists.txt
index 16f1aa8f..7dfea075 100644
--- a/test/tarantool-tests/lj-flush-on-trace/CMakeLists.txt
+++ b/test/tarantool-tests/lj-flush-on-trace/CMakeLists.txt
@@ -1 +1,2 @@
-BuildTestCLib(libflush libflush.c)
+get_filename_component(test_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+BuildTestCLib(libflush libflush.c ${test_name}.test.lua)
diff --git a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/both/CMakeLists.txt b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/both/CMakeLists.txt
index ce616fcf..bf980c7d 100644
--- a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/both/CMakeLists.txt
+++ b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/both/CMakeLists.txt
@@ -1,5 +1,7 @@
 if (NOT(CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
-  BuildTestCLib(resboth resboth.c)
+  BuildTestCLib(resboth resboth.c
+    profilers/gh-5813-resolving-of-c-symbols.test.lua
+  )
   # Unfortunately, <target_link_options> command is introduced
   # since CMake 3.13, so we can't use it now considering ancient
   # distros support. Just build linker flags by hands.
diff --git a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/gnuhash/CMakeLists.txt b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/gnuhash/CMakeLists.txt
index 1179601b..b80129a3 100644
--- a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/gnuhash/CMakeLists.txt
+++ b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/gnuhash/CMakeLists.txt
@@ -1,5 +1,7 @@
 if (NOT(CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
-  BuildTestCLib(resgnuhash resgnuhash.c)
+  BuildTestCLib(resgnuhash resgnuhash.c
+    profilers/gh-5813-resolving-of-c-symbols.test.lua
+  )
   # Unfortunately, <target_link_options> command is introduced
   # since CMake 3.13, so we can't use it now considering ancient
   # distros support. Just build linker flags by hands.
diff --git a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/hash/CMakeLists.txt b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/hash/CMakeLists.txt
index e0ad5675..0633f1f3 100644
--- a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/hash/CMakeLists.txt
+++ b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/hash/CMakeLists.txt
@@ -1,5 +1,7 @@
 if (NOT(CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
-  BuildTestCLib(reshash reshash.c)
+  BuildTestCLib(reshash reshash.c
+    profilers/gh-5813-resolving-of-c-symbols.test.lua
+  )
   # Unfortunately, <target_link_options> command is introduced
   # since CMake 3.13, so we can't use it now considering ancient
   # distros support. Just build linker flags by hands.
diff --git a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/stripped/CMakeLists.txt b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/stripped/CMakeLists.txt
index 243902be..2ea0b4ac 100644
--- a/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/stripped/CMakeLists.txt
+++ b/test/tarantool-tests/profilers/gh-5813-resolving-of-c-symbols/stripped/CMakeLists.txt
@@ -1,5 +1,7 @@
 if (NOT(CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
-  BuildTestCLib(resstripped resstripped.c)
+  BuildTestCLib(resstripped resstripped.c
+    profilers/gh-5813-resolving-of-c-symbols.test.lua
+  )
   # Unfortunately, <target_link_options> command is introduced
   # since CMake 3.13, so we can't use it now considering ancient
   # distros support. Just build linker flags by hands.
--------------fv5yroZito09IRWBtlFWYOrH--