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 30443DFE5A9; Fri, 6 Dec 2024 14:25:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 30443DFE5A9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1733484336; bh=uTetrtv0ko9ro8GFHt+LR5J8lzs/nzOLgnNvXz+lSdY=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=CGkUSL5a5xGm6xn3I10ogpsDJYC5oqwObKBSHp3X1N6/CgNs8t6hRNbEZECJNl99y QLjSwetSZ0Ls+KqzEdZGIKW/VzahCCPp/rZt5FL+eP1M1YdBqIzPSN8RI1/wvYvJou bYTMBXdMH8JK9LiAdrBKS8Dawhy3CX5XRUOGOCb0= Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 3D2AADFE5AA for ; Fri, 6 Dec 2024 14:25:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3D2AADFE5AA Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-aa549f2fa32so369976066b.0 for ; Fri, 06 Dec 2024 03:25:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733484333; x=1734089133; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hPoQrcAM8mCkCpxI6pwlQHVIije02me5B3n6LyZcyv0=; b=W2/F+2+y06qrIfcMicmvFcdhfWpVULjva7whrjHUYF6X5G0D7xzqTxVgd0ey5/UAmw xkSSo7Y6wSSSIGjvsgdS73ce8dM6SP4QucSfXqxhHc1uI/n6BRimkyTosm8frfLaf1IH jq7UhvJ03nvRCDPEBKBBQKawGQS3TpUenCzCbGE2x8WmCU1nYD2/SRqPNFyjOPZXiCj7 XJ7fYYEyO8/mPcvH3/twHoivr7zIJdKieO6kU2VXn+S4U/sTQG0DKT+eL1uwjOPuANAQ fY5ro40gHgpa1jDAs6xiuTQywWKp7D7Dr+sro+s8uNIC3kVkxcjCrJUOVYPovcHm1XG0 rjJQ== X-Forwarded-Encrypted: i=1; AJvYcCXiWhhSLbqmr2SKPw2l3Hl9Zwbiydg7TMkRcIaPQBjKyN90rZAkKLvgU9h/yUylQER1qQkw9fsppny4zRnDe7zOtA==@dev.tarantool.org X-Gm-Message-State: AOJu0Yyf92SKdexkHVkf/8i7X83Dou2c8oibvWWPQ0ehG88C2WTJ+0vL rc4DP1mbQMnODiGfbbm0+Sr/zYSExrrSYkkdbakFqOHrXWksNteR X-Gm-Gg: ASbGncv9fXo5xr/xLuBAkgzQUjnJYZhAbU2mV7qOdNH8K2b/edQaiCPvK0dtTbJZjfQ dj/1OtPe5OvAQWIKfVK3JkgEBMIs2L0wxsWpdOwtfT+/XgstQfqUZG6GD9XazOviWGIIw1fEBPv x6rvHwQLWgQC555yptmTKIu9Q/Wls5729l4BlpoB3a06O5SPiMe8XW7NZbUD31wz+t4KS9bA6/A PQibE/cSbBxxd/GbW0xwsv58Gng6P/W3RtzNFX4/A6iMw== X-Google-Smtp-Source: AGHT+IEZpDUsDwlVnCOcXQ305TdLrqla+fgezAcc6msP8m5LMaMyn9d5p0zyFcDQ/wGUi7u+GIAIWw== X-Received: by 2002:a17:906:18b2:b0:aa6:23ba:d8c5 with SMTP id a640c23a62f3a-aa639fbda5cmr218470566b.10.1733484333027; Fri, 06 Dec 2024 03:25:33 -0800 (PST) Received: from localhost ([5.181.62.98]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa62602cf6dsm222925366b.112.2024.12.06.03.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 03:25:32 -0800 (PST) X-Google-Original-From: Sergey Bronnikov Date: Fri, 6 Dec 2024 14:25:31 +0300 To: Sergey Kaplun Message-ID: References: <8fb12a94cdf48fb1475dbe374dc91a86be74bdbc.1733405666.git.skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: <8fb12a94cdf48fb1475dbe374dc91a86be74bdbc.1733405666.git.skaplun@tarantool.org> X-Url: https://bronevichok.ru/ Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] test: fix LuaJIT-tests for old libc version 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 Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey, thanks for the patch! On 16:42 Thu 05 Dec , Sergey Kaplun wrote: >The `strtod parsing` subtest in the checks >the results yielded by the `strtod()` via FFI call. In versions before s/versions/GLibc versions/ >2.19 it returns an incorrect result for "0x1p-2075" [1]. This patch >skips this test for a smaller version of the libc installed. > >[1]: https://sourceware.org/bugzilla/show_bug.cgi?id=16151 >--- > test/CMakeLists.txt | 1 + > test/LuaJIT-tests/CMakeLists.txt | 9 +++++ > test/LuaJIT-tests/lib/base/tonumber_scan.lua | 4 ++- > test/cmake/GetLibCVersion.cmake | 35 ++++++++++++++++++++ > 4 files changed, 48 insertions(+), 1 deletion(-) > create mode 100644 test/cmake/GetLibCVersion.cmake > >diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt >index 0db2dd8b..be02d2e4 100644 >--- a/test/CMakeLists.txt >+++ b/test/CMakeLists.txt >@@ -73,6 +73,7 @@ separate_arguments(LUAJIT_TEST_COMMAND) > > set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") > include(AddTestLib) >+include(GetLibCVersion) > include(LibRealPath) > > # CTEST_FLAGS is used by CMake targets in test suites. >diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt >index 019762e0..d0771e14 100644 >--- a/test/LuaJIT-tests/CMakeLists.txt >+++ b/test/LuaJIT-tests/CMakeLists.txt >@@ -62,6 +62,15 @@ if(CMAKE_C_FLAGS MATCHES "-march=skylake-avx512") > list(APPEND LUAJIT_TEST_TAGS_EXTRA +avx512) > endif() > >+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") >+ GetLibCVersion(LIBC_VERSION) >+ # XXX: uses `strtod()`, old versions of >+ # which have the bug [1] for "0x1p-2075" parsing. Add the skip >+ # check for it. >+ # [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=16151 >+ list(APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION}) >+endif() >+ > set(TEST_SUITE_NAME "LuaJIT-tests") > > # XXX: The call produces both test and target >diff --git a/test/LuaJIT-tests/lib/base/tonumber_scan.lua b/test/LuaJIT-tests/lib/base/tonumber_scan.lua >index e2dcd4d0..ac7d68a4 100644 >--- a/test/LuaJIT-tests/lib/base/tonumber_scan.lua >+++ b/test/LuaJIT-tests/lib/base/tonumber_scan.lua >@@ -186,7 +186,9 @@ do --- tonumber parsing > test_conv(tonumber) > end > >-do --- strtod parsing >+-- Skip for the old libc version with the bug in the `strtod()`. >+-- See also https://sourceware.org/bugzilla/show_bug.cgi?id=16151. >+do --- strtod parsing -libc<2.19 > test_conv(function(s) > local d = ffi.C.strtod(s, e) > return (e[0][0] == 0 and #s ~= 0) and d or nil >diff --git a/test/cmake/GetLibCVersion.cmake b/test/cmake/GetLibCVersion.cmake >new file mode 100644 >index 00000000..fd05fa6d >--- /dev/null >+++ b/test/cmake/GetLibCVersion.cmake >@@ -0,0 +1,35 @@ >+# Get the libc version installed in the system. >+# XXX: uses `LibRealPath`, so unsupported for OSX. >+macro(GetLibCVersion output) >+ LibRealPath(libcpath "libc.so.6") I don't get why shared lib filename is hardcoded. Version (6) can be changed and our test will fail. We can use gcc: [1] ~/sources/MRG/tarantool/third_party/luajit $ gcc -Wl,--trace main.c | grep libc /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libc.so /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib/x86_64-linux-gnu/libc_nonshared.a or ldd: [1] ~/sources/MRG/tarantool/third_party/luajit $ ldd build/src/luajit linux-vdso.so.1 (0x00007ffd161fd000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f272b6ac000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f272b68c000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f272b400000) /lib64/ld-linux-x86-64.so.2 (0x00007f272b88a000) >+ >+ # Get the version from the library name. >+ if(libcpath MATCHES "libc-([0-9]+\.[0-9]+)\.so") >+ set(${output} ${CMAKE_MATCH_1}) >+ else() >+ # Try to directly run the library and parse the version from >+ # the output message. >+ execute_process( >+ COMMAND ${libcpath} >+ OUTPUT_VARIABLE LIB_C_INFO >+ ERROR_VARIABLE ERROR_MSG >+ OUTPUT_STRIP_TRAILING_WHITESPACE >+ RESULT_VARIABLE RES >+ ) >+ >+ if(NOT RES EQUAL 0) >+ message(FATAL_ERROR "Executing '${libcpath}' has failed: '${ERROR_MSG}'") >+ endif() >+ >+ if(LIB_C_INFO MATCHES "^.*stable release version ([0-9]+\.[0-9]+)") >+ set(${output} ${CMAKE_MATCH_1}) >+ else() >+ message(FATAL_ERROR "Can't determine libc version") >+ endif() >+ >+ unset(RES) >+ unset(ERROR_MSG) >+ unset(LIB_C_INFO) >+ endif() >+ unset(CMAKE_MATCH_1) >+endmacro() >-- >2.47.0 > -- sergeyb@