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 098C5E6C25A; Mon, 9 Dec 2024 13:18:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 098C5E6C25A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1733739531; bh=NU9pGxeT4u1W6hxr5yACAq+sSN4kd4mlB7pbUjPqKF0=; 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=zP8pWnTV7atRNOaoaSIOgFnLWNHE9v/92Xcrxx2DUk60hq8m3/bYMc2x2pRlVzECT qTiT5PeJEPSqKdhCIAmrXTwwKQFgi6dEdqgU+VJcMxva7GvtKlm6TbBuRgf88tFVXB ASRY0YsifHO9J0DY9egkjo+2IROqFYJYykGVU/+w= Received: from send241.i.mail.ru (send241.i.mail.ru [95.163.59.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 DD3BAE6C25A for ; Mon, 9 Dec 2024 13:17:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DD3BAE6C25A Received: by exim-smtp-fb95f984f-hjgj4 with esmtpa (envelope-from ) id 1tKapp-000000006NW-40E5; Mon, 09 Dec 2024 13:17:50 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Mon, 9 Dec 2024 13:16:54 +0300 Message-ID: <616560a5fc0131d0f6c5358cebbc267025444334.1733739230.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9008082F162C500070414C36455464A53F9247FEF4D9EB6A6182A05F53808504093556D7EEDF829C93DE06ABAFEAF67059CC695CA734B77BA67A8EC0B997EF9A9A3FFAFA2033DE9A6 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7EED5D2FAB4CEB1EDEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637A431CDDF496E6E598638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D802A35060A06858EE1F6EEC3D34FA56C89E2F7840B588AC86CC7F00164DA146DAFE8445B8C89999728AA50765F79006370B730A9793D99025389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8C6602A96AF88C695F6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE33AC447995A7AD182BEBFE083D3B9BA73A03B725D353964B2FFDA4F57982C5F435872C767BF85DA227C277FBC8AE2E8BC6A536F79815AD9275ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A58DB12F6389C13CA85002B1117B3ED6962A7A756E9F02D13EFB820E9FE7BD014C823CB91A9FED034534781492E4B8EEADAE4FDBF11360AC9BC79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF62AA4395C67F4BE2103011752A1457BC893450FDD61349D57FA1CFB920FD4D83EBEAAAAF261D74165C69F0120C2109DF1C8DE4C4C9C873A01AF4D3FCB6219F7D4FEFB49E263CD4EFC226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojBv0bg8QSzYQXtZpDpsVFEw== X-DA7885C5: 5A07DB683D7DBF46F255D290C0D534F9ECE7E6EEB83A0473FBE2850E8CC78F50E8A8052EEFF0316A5B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F739381B31377CF4CA2193382633D6461244062C2911B6B55F59AA90F64F25472B726E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 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 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" The `strtod parsing` subtest in the checks the results yielded by the `strtod()` via FFI call. In GLibc versions before 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 | 41 ++++++++++++++++++++ 4 files changed, 54 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..d87e8b70 --- /dev/null +++ b/test/cmake/GetLibCVersion.cmake @@ -0,0 +1,41 @@ +# Get the libc version installed in the system. +macro(GetLibCVersion output) + # Try to directly parse the version. + execute_process( + COMMAND echo "#include " + COMMAND ${CMAKE_C_COMPILER} -E -dM - + OUTPUT_VARIABLE LIB_C_INFO + ERROR_VARIABLE ERROR_MSG + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE RES + ) + + if(NOT RES EQUAL 0) + message(FATAL_ERROR + "gnu/libc-version preprocessing has failed: '${ERROR_MSG}'") + endif() + + string(REGEX MATCH "__GLIBC__ ([0-9]+)" MATCH ${LIB_C_INFO}) + if(MATCH) + set(GLIBC_MAJOR ${CMAKE_MATCH_1}) + else() + message(FATAL_ERROR "Can't determine GLIBC_MAJOR version.") + endif() + + string(REGEX MATCH "__GLIBC_MINOR__ ([0-9]+)" MATCH ${LIB_C_INFO}) + if(MATCH) + set(GLIBC_MINOR ${CMAKE_MATCH_1}) + else() + message(FATAL_ERROR "Can't determine GLIBC_MINOR version.") + endif() + + set(${output} "${GLIBC_MAJOR}.${GLIBC_MINOR}") + + unset(CMAKE_MATCH_1) + unset(GLIBC_MAJOR) + unset(GLIBC_MINOR) + unset(MATCH) + unset(RES) + unset(ERROR_MSG) + unset(LIB_C_INFO) +endmacro() -- 2.47.0