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 C6207E9EAC8; Thu, 5 Dec 2024 16:44:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C6207E9EAC8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1733406295; bh=ArGkYHyZeB9+H9nOT9HbBuhj5xa4qY2mJYC4ca1YoDo=; 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=uLJRBaK6hRnjkC8O+I8NsE+2llFds6YoPwG9Q4Dw8bUM+6eXa2u1VyLwkyrXb2ipZ Oqz00kV/3kj9sw9djkhM+NmlF9UV+HZBive/TrdRjWpF8sj6UtKnAG8oJbODhPzEdS 5sVymvLjiUv3UD01M0jMTZjkZlpa9+d9N51Osfr8= Received: from send172.i.mail.ru (send172.i.mail.ru [95.163.59.11]) (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 63CE9E9EAC8 for ; Thu, 5 Dec 2024 16:43:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 63CE9E9EAC8 Received: by exim-smtp-57cd6dcbd5-7n52v with esmtpa (envelope-from ) id 1tJC94-00000000R4c-1K6A; Thu, 05 Dec 2024 16:43:54 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Thu, 5 Dec 2024 16:42:57 +0300 Message-ID: <8fb12a94cdf48fb1475dbe374dc91a86be74bdbc.1733405666.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: 4F1203BC0FB41BD9008082F162C5000712644023712AFACA779C4CFAA97061F1182A05F538085040118EE35BBB170FD83DE06ABAFEAF67055F772AE80727D6730FA6E57DF25AD70F33F93C1B0E960678 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7DB6A86BDF2D5A895EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AAF0FBE7E77B7ED78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8CAB88B38367CE0F6FD110F1E252D00C096C2DFA0EE897A25CC7F00164DA146DAFE8445B8C89999728AA50765F790063707A1F3761B83B09E389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8D166953D3EA3826BF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE33AC447995A7AD186D8C47C27EEC5E9FD5E8D9A59859A8B6D635BA3ABDB36C18089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A58F6F46B889034D095002B1117B3ED696F0628878A1703B14B48B7A7F94616420823CB91A9FED034534781492E4B8EEAD9CFA8CFAC159CE19C79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFCD89B289EEB446DE59E48F2F50A262B4D3962C733415636530433E6EC1A3931E1230ACE34F2D113D494E10A735AF7C93C6D453349D7665BFC9B10268BAD843F1D6CD5E47C1E5DAB7C226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojOp8qHLJs/nTHOA3Hr4KQVQ== X-DA7885C5: FEA94F63348F02D3F255D290C0D534F9AC1D766CD23447BA8EC67652850AA8CD8A5402E5C20803875B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F739381B31377CF4CA2197465D0A649241BEDB2D42FB825E7ADF7C83BA2559E5E551DE49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: [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 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 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 | 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") + + # 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