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 882936EFDA; Thu, 2 Jun 2022 11:51:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 882936EFDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1654159910; bh=nOMZO1TKuFYOrK6LoIA7VCOaTiiH3Z9stu/1nS7W/QI=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=O+Q/l4OM/+6+HOyuWH5y+BLtVP0DXdiPSAZFOyO9KtHIFdPV1WB+DSJiKxFoHgmX2 ZwUj0HYrPb63NP+n4tmMiqpURCH4NW19hAiovqKBZrmpT2OVnGm2C5uGB312Lqa3+J /U3UgASCUm/Y0EriJ2Yx+WYY2iHEj317EGtf8ixc= Received: from smtp56.i.mail.ru (smtp56.i.mail.ru [217.69.128.36]) (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 C531B6EFDA for ; Thu, 2 Jun 2022 11:51:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C531B6EFDA Received: by smtp56.i.mail.ru with esmtpa (envelope-from ) id 1nwgYW-0002yX-4Y; Thu, 02 Jun 2022 11:51:48 +0300 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) In-Reply-To: Date: Thu, 2 Jun 2022 11:51:46 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Sergey Kaplun X-Mailer: Apple Mail (2.3696.80.82.1.1) X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD93ED3C6BF6FFA701F68F180765CA68B1DA674C23F8D6D84AC182A05F5380850407FD0420A6E45C2A6BF170C59F098F8AAA7295C85B981C4309B4F813CA7E5BC49 X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 0D63561A33F958A502CE768CB3F6C7740943653F6339DFD04F3A7BE87F09B0A1D59269BC5F550898D99A6476B3ADF6B4886A5961035A09600383DAD389E261318FB05168BE4CE3AF X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349F4E6BC39AAD02BBB741C233A030DA5AC213FE6740E7760701BDBA90B53D30A5BEFA85802BC53DCE1D7E09C32AA3244CD7CD561198D61C265AA11E1D0FFC737B9CA7333006C390A0FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojRxBGqISLOzBb69NRELgR/Q== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE4073E39B09B40D69D186DB19F1A1AA44134435BF7CFC3C427CF19381EE24192DF5555834048F03EF5D4C9A814A92B2E3B1BA4250FC3964EA4964198E0F3ECE9B5443453F38A29522196 X-Mras: OK Subject: Re: [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: sergos via Tarantool-patches Reply-To: sergos Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch, I can=E2=80=99t find any problems in it, although = I couldn=E2=80=99t apply it on the latest luajit. Sergos. > On 9 Dec 2021, at 13:24, Sergey Kaplun wrote: >=20 > 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. >=20 > 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(-) >=20 > 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/Concept= ual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtection= s.html > - list(APPEND LUA_TEST_ENV = TEST_DYLD_LIBRARY_PATH=3D"${LD_LIBRARY_PATH}") > + list(APPEND LUA_TEST_ENV_MORE = DYLD_LIBRARY_PATH=3D"${LD_LIBRARY_PATH}") > else() > - list(APPEND LUA_TEST_ENV LD_LIBRARY_PATH=3D"${LD_LIBRARY_PATH}") > + list(APPEND LUA_TEST_ENV_MORE LD_LIBRARY_PATH=3D"${LD_LIBRARY_PATH}")= > endif() >=20 > # 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 =3D require('utils') > -- Disabled on *BSD due to #4819. > utils.skipcond(jit.os =3D=3D 'BSD', 'Disabled due to #4819') >=20 > --- XXX: Tweak the process environment to get around SIP. > --- See the comment in suite CMakeLists.txt for more info. > -utils.tweakenv(jit.os =3D=3D 'OSX', 'DYLD_LIBRARY_PATH') > - > utils.selfrun(arg, { > { > arg =3D { > 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 =3D require('utils') > -- Disabled on *BSD due to #4819. > utils.skipcond(jit.os =3D=3D 'BSD', 'Disabled due to #4819') >=20 > --- XXX: Tweak the process environment to get around SIP. > --- See the comment in suite CMakeLists.txt for more info. > -utils.tweakenv(jit.os =3D=3D 'OSX', 'DYLD_LIBRARY_PATH') > - > utils.selfrun(arg, { > { > arg =3D { > 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 =3D {} >=20 > -local ffi =3D require('ffi') > local tap =3D require('tap') > local bc =3D require('jit.bc') >=20 > -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 =3D -2 > @@ -78,18 +73,6 @@ function M.skipcond(condition, message) > os.exit(test:check() and 0 or 1) > end >=20 > -function M.tweakenv(condition, variable) > - if not condition or os.getenv(variable) then return end > - local testvar =3D 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) =3D=3D 'function', 'argument #1 should be a = function') > assert(type(bytecode) =3D=3D 'string', 'argument #2 should be a = string') > --=20 > 2.33.1 >=20