Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>,
	Maxim Kokryashkin <m.kokryashkin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 3/7] cmake: introduce AppendTestEnvVar macro
Date: Mon, 23 Sep 2024 10:51:39 +0300	[thread overview]
Message-ID: <329f67f8-a7b7-4753-96e2-bbc4f2574de3@tarantool.org> (raw)
In-Reply-To: <ad488f5df41ab008ff0596ea61a2bdc7451439e8.1727074292.git.skaplun@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]

Hi, Sergey,

thanks for the patch! See comments below.

On 23.09.2024 10:18, Sergey Kaplun wrote:
> It is useful to update the environment variable for some tests. For
> CMake versions >= 3.22, we can use ENVIRONMENT_MODIFICATION [1] instead.
> But unless we bump the CMake version, this macro is a workaround.
>
> [1]:https://cmake.org/cmake/help/latest/prop_test/ENVIRONMENT_MODIFICATION.html
>
> Part of tarantool/tarantool#9898
> ---
>   test/tarantool-tests/CMakeLists.txt | 23 +++++++++++++++++++++++
>   1 file changed, 23 insertions(+)
>
> diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/CMakeLists.txt
> index 11a84496..4530c9fd 100644
> --- a/test/tarantool-tests/CMakeLists.txt
> +++ b/test/tarantool-tests/CMakeLists.txt
> @@ -18,6 +18,29 @@ macro(BuildTestCLib lib sources)
>     set(LD_LIBRARY_PATH "${CMAKE_CURRENT_BINARY_DIR}:${LD_LIBRARY_PATH}" PARENT_SCOPE)
>   endmacro()
>   
> +# FIXME: This is used only due to ancient CMake requirements.
> +# If we update to CMake >= 3.22, we can use
> +# ENVIRONMENT_MODIFICATION [1] instead.
> +# [1]:https://cmake.org/cmake/help/latest/prop_test/ENVIRONMENT_MODIFICATION.html
I would add a small description for a macro.
> +macro(AppendTestEnvVar testname var value)

I would rename macro to something like "ModifyTestEnv"

because it appends env var when variable with the same name was not found

and modifies it when variable exist.


> +  get_test_property(${testname} ENVIRONMENT old_env)
> +  foreach(loopvar "${old_env}")
> +    if(loopvar MATCHES "^${var}=(.*)")
> +      set(envvar_found TRUE)
> +      set(loopvar "${var}=${value}${CMAKE_MATCH_1}")
> +    endif()
> +    list(APPEND new_env "${loopvar}")
> +  endforeach()
> +  if(NOT "${envvar_found}")
> +    list(APPEND new_env "${var}=${value}")
> +  endif()
> +  set_tests_properties(${testname} PROPERTIES ENVIRONMENT "${new_env}")
> +
> +  unset(envvar_found)
> +  unset(old_env)
> +  unset(new_env)
> +endmacro()
> +
>   add_subdirectory(ffi-ccall)
>   add_subdirectory(fix-bit-shift-generation)
>   add_subdirectory(gh-4427-ffi-sandwich)

[-- Attachment #2: Type: text/html, Size: 3157 bytes --]

  reply	other threads:[~2024-09-23  7:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23  7:18 [Tarantool-patches] [PATCH luajit 0/7] Shrink test env and fix flaky tests Sergey Kaplun via Tarantool-patches
2024-09-23  7:18 ` [Tarantool-patches] [PATCH luajit 1/7] test: move profilers tests to subdirectory Sergey Kaplun via Tarantool-patches
2024-09-23  7:40   ` Sergey Bronnikov via Tarantool-patches
2024-09-23  7:51     ` Sergey Kaplun via Tarantool-patches
2024-09-23  7:18 ` [Tarantool-patches] [PATCH luajit 2/7] test: rename <arm64-ccall-fp-convention.test.lua> Sergey Kaplun via Tarantool-patches
2024-09-23  7:45   ` Sergey Bronnikov via Tarantool-patches
2024-09-23  7:18 ` [Tarantool-patches] [PATCH luajit 3/7] cmake: introduce AppendTestEnvVar macro Sergey Kaplun via Tarantool-patches
2024-09-23  7:51   ` Sergey Bronnikov via Tarantool-patches [this message]
2024-09-23  8:18     ` Sergey Kaplun via Tarantool-patches
2024-09-23  7:18 ` [Tarantool-patches] [PATCH luajit 4/7] test: shrink LUA_PATH environment variable Sergey Kaplun via Tarantool-patches
2024-09-23  8:47   ` Sergey Bronnikov via Tarantool-patches
2024-09-23  7:18 ` [Tarantool-patches] [PATCH luajit 5/7] test: shrink LUA_CPATH and {DY}LD_LIBRARY_PATH Sergey Kaplun via Tarantool-patches
2024-09-23  7:18 ` [Tarantool-patches] [PATCH luajit 6/7] test: skip flaky tests with enabled table bump Sergey Kaplun via Tarantool-patches
2024-09-23  9:44   ` Sergey Bronnikov via Tarantool-patches
2024-09-23 11:08     ` Sergey Kaplun via Tarantool-patches
2024-09-23  7:18 ` [Tarantool-patches] [PATCH luajit 7/7] test: set LD_PRELOAD only when necessary Sergey Kaplun via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=329f67f8-a7b7-4753-96e2-bbc4f2574de3@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 3/7] cmake: introduce AppendTestEnvVar macro' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox