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 353AAA653E2; Tue, 26 Mar 2024 11:35:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 353AAA653E2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1711442154; bh=iezbEz0056BjdExIbDtLAGQisFnZnzVt3EuesjuqjlY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=jdW6/lM85/Zr5drE2MdP7l3GFIpE9aPD9Ulmkh+LlhfYO1E1+ZGPoo+vp5cWxE4Gk 36iepozw/rGU9dE09CzPKnAbS2W+DTbQ41B8U4lddYPzlZhWFbETO8Ar1jd6x7ziV7 qI7VyUK0eOwNEKypHCVSogLv+8j35CEE0HwvluEw= Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 011C8A653CD for ; Tue, 26 Mar 2024 11:34:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 011C8A653CD Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-513cfc93f4eso5641259e87.3 for ; Tue, 26 Mar 2024 01:34:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711442068; x=1712046868; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QRRtQd3ufys2Oq/+vzsqvEF2ZW3lbO/ViYxZe+vGF3M=; b=XnfKAYnN1+ozV8GC+Tu8AgOqP9x5L24PuWZQk8sFhhCZJWg6MIHhNcJSljCQszZuJV yFNWVO7UTQp52tiyDfBxRO+krzotjACtmc5Zk8rEuG4EUkdMZXz5RX0ps/bzAZkwyqdh 7leXzOiFgQ+aRYHGqIG9nvIefjXjAhuMXQZ6uErVRRFhIC25CBalGNLL3uLMNWWRxcXT ilK1/kqriJhrz5ARt5vpGHYiJcoYNfT7+JiPQgsEr1wPt+VELIhDL1uNT/oqVDvDI13Y YnWxXDGGTIvqNqrZP5gDwGoOZeVmIV7zj3B0bvYHfvD6rFrFT/OsqkFk9wh2o+KTupt0 bdRw== X-Gm-Message-State: AOJu0Ywi1iRDSIGdUkQxycGfvLIdAX9+bf2CPj/c+09NVMru6MQ7xB7x oZZhvmKaPNWGIO1ZWYfOdZTujP6M3GADdSElWADeJtdKAPx5XCVXH3xDMwVBY4s= X-Google-Smtp-Source: AGHT+IH53JfbNpKVQhP19ecdlljJogYHRr3oZinFp3UJvGu71GaXEdxQ+Jzok7wKy5AaCfXvAvVYwA== X-Received: by 2002:ac2:5bd0:0:b0:513:db96:2be9 with SMTP id u16-20020ac25bd0000000b00513db962be9mr1343438lfn.64.1711442067944; Tue, 26 Mar 2024 01:34:27 -0700 (PDT) Received: from pony.. ([5.181.62.126]) by smtp.gmail.com with ESMTPSA id y11-20020a056512044b00b005159c7939basm1434099lfk.185.2024.03.26.01.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 01:34:27 -0700 (PDT) To: tarantool-patches@dev.tarantool.org, Sergey Kaplun , Maxim Kokryashkin Date: Tue, 26 Mar 2024 11:33:29 +0300 Message-Id: <1b5d9c264a39a35cb3d930ef78f4d4473c80d8bc.1711441864.git.sergeyb@tarantool.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit 3/6] test: move LibRealPath to the separate module 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" From: Sergey Kaplun This patch moves the `LibRealPath` macro to a separate module to be used in other test suites. Needed for tarantool/tarantool#9656 --- test/CMakeLists.txt | 1 + test/LuaJIT-tests/CMakeLists.txt | 37 ---------------------------- test/cmake/LibRealPath.cmake | 41 ++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 test/cmake/LibRealPath.cmake diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3ad5d15f..62478441 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -76,6 +76,7 @@ separate_arguments(LUAJIT_TEST_COMMAND) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(AddTestLib) +include(LibRealPath) add_subdirectory(LuaJIT-tests) add_subdirectory(PUC-Rio-Lua-5.1-tests) diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt index badec91d..e8361e97 100644 --- a/test/LuaJIT-tests/CMakeLists.txt +++ b/test/LuaJIT-tests/CMakeLists.txt @@ -31,43 +31,6 @@ if(LUAJIT_USE_ASAN) # "((__interception::real___cxa_throw)) != (0)" (0x0, 0x0) # This is a workaround suggested at # https://github.com/google/sanitizers/issues/934. - macro(LibRealPath output lib) - execute_process( - # CMAKE_C_COMPILER is used because it has the same behaviour - # as CMAKE_CXX_COMPILER, but CMAKE_CXX_COMPILER is not - # required for building LuaJIT and can be missed in GH - # Actions. - COMMAND ${CMAKE_C_COMPILER} -print-file-name=${lib} - OUTPUT_VARIABLE LIB_LINK - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE RES - ) - - if(NOT RES EQUAL 0) - message(FATAL_ERROR - "Executing '${CMAKE_C_COMPILER} -print-file-name=${lib}' has failed" - ) - endif() - - # GCC and Clang return a passed filename when a library is - # not found. - if(LIB_LINK STREQUAL ${lib}) - message(FATAL_ERROR "Library '${lib}' is not found") - endif() - - # Fortunately, we are not interested in macOS here, so we can - # use realpath. Beware, `realpath` always returns an exit code - # equal to 0, so we cannot check if it fails. - execute_process( - COMMAND realpath ${LIB_LINK} - OUTPUT_VARIABLE ${output} - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - unset(LIB_LINK) - unset(RES) - endmacro() - LibRealPath(LIB_STDCPP libstdc++.so) # XXX: GCC requires both. Clang requires only libstdc++. if(CMAKE_C_COMPILER_ID STREQUAL "GNU") diff --git a/test/cmake/LibRealPath.cmake b/test/cmake/LibRealPath.cmake new file mode 100644 index 00000000..70d43c50 --- /dev/null +++ b/test/cmake/LibRealPath.cmake @@ -0,0 +1,41 @@ +# Find a full path of a library used by a compiler and set it to +# the given variable. +macro(LibRealPath output lib) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + message(FATAL_ERROR "LibRealPath macro is unsupported for OSX") + endif() + execute_process( + # CMAKE_C_COMPILER is used because it has the same behaviour + # as CMAKE_CXX_COMPILER, but CMAKE_CXX_COMPILER is not + # required for building LuaJIT and can be missed in GH + # Actions. + COMMAND ${CMAKE_C_COMPILER} -print-file-name=${lib} + OUTPUT_VARIABLE LIB_LINK + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE RES + ) + + if(NOT RES EQUAL 0) + message(FATAL_ERROR + "Executing '${CMAKE_C_COMPILER} -print-file-name=${lib}' has failed" + ) + endif() + + # GCC and Clang return a passed filename when a library is + # not found. + if(LIB_LINK STREQUAL ${lib}) + message(FATAL_ERROR "Library '${lib}' is not found") + endif() + + # Fortunately, we are not interested in macOS here, so we can + # use realpath. Beware, `realpath` always returns an exit code + # equal to 0, so we cannot check if it fails. + execute_process( + COMMAND realpath ${LIB_LINK} + OUTPUT_VARIABLE ${output} + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + unset(LIB_LINK) + unset(RES) +endmacro() -- 2.34.1