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 94B8F6ECC0; Thu, 9 Dec 2021 13:26:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 94B8F6ECC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1639045592; bh=enhM9tVTaKCDzYTAwCvnPhXHQ8DlYFDB5DDNh2MiVH0=; 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=cQUkmx6WJVIXK83UY4w3uysroaXhPSjY5yXgiXvMC2Lta6qPpIWbdDxOGyiDcoAft D9kDgcV8+damrH+Fq3xLbzcjoT03plJZscGrTF5HtRFuPSbgFfEAQhxMB3KgsCq4lT 0KcizWRadNOqQlNyanxGZGmIym2/b0YI/Uh0Eb6U= Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (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 E300E6ECDE for ; Thu, 9 Dec 2021 13:26:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E300E6ECDE Received: by smtp50.i.mail.ru with esmtpa (envelope-from ) id 1mvGck-0003gI-2i; Thu, 09 Dec 2021 13:26:02 +0300 To: Sergey Ostanevich , Igor Munkin Date: Thu, 9 Dec 2021 13:24:02 +0300 Message-Id: X-Mailer: git-send-email 2.33.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD99816DF0F5D64E804DD11F3B756615DE2CDAB71F3CDD6900B182A05F5380850404C228DA9ACA6FE27BE0EC8358C93951370C8BF4D8AAF1C6A4149CA3713E3321DD9CF1FDD36E6D678 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7FBCED7D376B82B5EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637C2758D7B951FF54D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D809F1C3BB6EDE0544A12DD105636130F2117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD182CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C4C7A0BC55FA0FE5FCAA813A7B1C2A557F08BA1A61ADD9A3C0D9FB049E8EA15F95B1881A6453793CE9C32612AADDFBE061C61BE10805914D3804EBA3D8E7E5B87ABF8C51168CD8EBDBF87214F1A954108EDC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34181D1E89D5A0B42F75235B29960FEF61321DF239812D9063816BA6509C516EE08E7E1F63FD60C6FF1D7E09C32AA3244CDF7D47C840209D66F540F0B8EBA89D6D39C99C45E8D137E9927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioja3eBVivI1t21tap11lnj7g== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB427AE671CD8137BACFB6B013CB891BD51535D5C2A1D059F94F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A84198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 1/2] test: set DYLD_LIBRARY_PATH environment variable 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 allows to use tests with `ffi.load()` without usage of `utils.selfrun()` by setting the DYLD_LIBRARY_PATH variable for the process directly via additional env command. Also, this commit "reverts" part of the commit fae1681dd1c117a913f99cbeed0ca2b87cf581a1 ('test: fix dynamic modules loading on MacOS') since there is no need to tweak environment while running those tests. Needed for tarantool/tarantool#6548 --- test/tarantool-tests/CMakeLists.txt | 19 +++++++++++-------- .../gh-4427-ffi-sandwich.test.lua | 4 ---- .../lj-flush-on-trace.test.lua | 4 ---- test/tarantool-tests/utils.lua | 17 ----------------- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/CMakeLists.txt index a872fa5e..992556d9 100644 --- a/test/tarantool-tests/CMakeLists.txt +++ b/test/tarantool-tests/CMakeLists.txt @@ -94,22 +94,21 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # 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 - # system programs (like /usr/bin/env used for preparing testing - # environment). For more info, see the docs[2] below. + # other programs (like /usr/bin/prove --exec using for launching + # test suite). 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 - # prepend TEST_ prefix to its name to get around SIP magic - # tricks. Finally, to set the variable required by FFI machinery - # the introduced routine is used. + # use env call in prove's --exec flag value 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 TEST_DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}") + list(APPEND LUA_TEST_ENV_MORE DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}") else() - list(APPEND LUA_TEST_ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}") + list(APPEND LUA_TEST_ENV_MORE LD_LIBRARY_PATH="${LD_LIBRARY_PATH}") endif() # LUA_CPATH and LD_LIBRARY_PATH variables and also TESTLIBS list @@ -120,10 +119,14 @@ add_custom_target(tarantool-tests add_custom_command(TARGET tarantool-tests COMMENT "Running Tarantool tests" COMMAND + # XXX: We can't move everything to the "inner" env, since there + # are some issues with escaping ';' for different shells. As + # a result LUA_PATH/LUA_CPATH variables are set via the "outer" + # env, since they are not stripped by SIP like LD_*/DYLD_* are. env ${LUA_TEST_ENV} ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR} - --exec '${LUAJIT_TEST_COMMAND}' + --exec 'env ${LUA_TEST_ENV_MORE} ${LUAJIT_TEST_COMMAND}' --ext ${LUA_TEST_SUFFIX} ${LUA_TEST_FLAGS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua b/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua index 3e6801a5..dd02130c 100644 --- a/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua +++ b/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua @@ -3,10 +3,6 @@ local utils = require('utils') -- Disabled on *BSD due to #4819. utils.skipcond(jit.os == 'BSD', 'Disabled due to #4819') --- XXX: Tweak the process environment to get around SIP. --- See the comment in suite CMakeLists.txt for more info. -utils.tweakenv(jit.os == 'OSX', 'DYLD_LIBRARY_PATH') - utils.selfrun(arg, { { arg = { diff --git a/test/tarantool-tests/lj-flush-on-trace.test.lua b/test/tarantool-tests/lj-flush-on-trace.test.lua index 81fd6e8f..c46b93f0 100644 --- a/test/tarantool-tests/lj-flush-on-trace.test.lua +++ b/test/tarantool-tests/lj-flush-on-trace.test.lua @@ -3,10 +3,6 @@ local utils = require('utils') -- Disabled on *BSD due to #4819. utils.skipcond(jit.os == 'BSD', 'Disabled due to #4819') --- XXX: Tweak the process environment to get around SIP. --- See the comment in suite CMakeLists.txt for more info. -utils.tweakenv(jit.os == 'OSX', 'DYLD_LIBRARY_PATH') - utils.selfrun(arg, { { arg = { diff --git a/test/tarantool-tests/utils.lua b/test/tarantool-tests/utils.lua index 5bd42b30..3b809515 100644 --- a/test/tarantool-tests/utils.lua +++ b/test/tarantool-tests/utils.lua @@ -1,13 +1,8 @@ local M = {} -local ffi = require('ffi') local tap = require('tap') local bc = require('jit.bc') -ffi.cdef([[ - int setenv(const char *name, const char *value, int overwrite); -]]) - local function luacmd(args) -- arg[-1] is guaranteed to be not nil. local idx = -2 @@ -78,18 +73,6 @@ function M.skipcond(condition, message) os.exit(test:check() and 0 or 1) end -function M.tweakenv(condition, variable) - if not condition or os.getenv(variable) then return end - local testvar = assert(os.getenv('TEST_' .. variable), - ('Neither %s nor auxiliary TEST_%s variables are set') - :format(variable, variable)) - -- XXX: The third argument of setenv(3) is set to zero to forbid - -- overwriting the . Since there is the check above - -- whether this is set in the process environment, it - -- just makes this solution foolproof. - ffi.C.setenv(variable, testvar, 0) -end - function M.hasbc(f, bytecode) assert(type(f) == 'function', 'argument #1 should be a function') assert(type(bytecode) == 'string', 'argument #2 should be a string') -- 2.33.1