File tree Expand file tree Collapse file tree 4 files changed +48
-1
lines changed
Expand file tree Collapse file tree 4 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ separate_arguments(LUAJIT_TEST_COMMAND)
7373
7474set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
7575include (AddTestLib)
76+ include (GetLibCVersion)
7677include (LibRealPath)
7778
7879# CTEST_FLAGS is used by CMake targets in test suites.
Original file line number Diff line number Diff line change @@ -62,6 +62,15 @@ if(CMAKE_C_FLAGS MATCHES "-march=skylake-avx512")
6262 list (APPEND LUAJIT_TEST_TAGS_EXTRA +avx512)
6363endif ()
6464
65+ if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
66+ GetLibCVersion(LIBC_VERSION)
67+ # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of
68+ # which have the bug [1] for "0x1p-2075" parsing. Add the skip
69+ # check for it.
70+ # [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=16151
71+ list (APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION} )
72+ endif ()
73+
6574set (TEST_SUITE_NAME "LuaJIT-tests" )
6675
6776# XXX: The call produces both test and target <LuaJIT-tests-deps>
Original file line number Diff line number Diff line change @@ -186,7 +186,9 @@ do --- tonumber parsing
186186 test_conv (tonumber )
187187end
188188
189- do --- strtod parsing
189+ -- Skip for the old libc version with the bug in the `strtod()`.
190+ -- See also https://sourceware.org/bugzilla/show_bug.cgi?id=16151.
191+ do --- strtod parsing -libc<2.19
190192 test_conv (function (s )
191193 local d = ffi .C .strtod (s , e )
192194 return (e [0 ][0 ] == 0 and # s ~= 0 ) and d or nil
Original file line number Diff line number Diff line change 1+ # Get the libc version installed in the system.
2+ # XXX: uses `LibRealPath`, so unsupported for OSX.
3+ macro (GetLibCVersion output )
4+ LibRealPath(libcpath "libc.so.6" )
5+
6+ # Get the version from the library name.
7+ if (libcpath MATCHES "libc-([0-9]+\. [0-9]+)\. so" )
8+ set (${output} ${CMAKE_MATCH_1} )
9+ else ()
10+ # Try to directly run the library and parse the version from
11+ # the output message.
12+ execute_process (
13+ COMMAND ${libcpath}
14+ OUTPUT_VARIABLE LIB_C_INFO
15+ ERROR_VARIABLE ERROR_MSG
16+ OUTPUT_STRIP_TRAILING_WHITESPACE
17+ RESULT_VARIABLE RES
18+ )
19+
20+ if (NOT RES EQUAL 0)
21+ message (FATAL_ERROR "Executing '${libcpath} ' has failed: '${ERROR_MSG} '" )
22+ endif ()
23+
24+ if (LIB_C_INFO MATCHES "^.*stable release version ([0-9]+\. [0-9]+)" )
25+ set (${output} ${CMAKE_MATCH_1} )
26+ else ()
27+ message (FATAL_ERROR "Can't determine libc version" )
28+ endif ()
29+
30+ unset (RES)
31+ unset (ERROR_MSG)
32+ unset (LIB_C_INFO)
33+ endif ()
34+ unset (CMAKE_MATCH_1)
35+ endmacro ()
You can’t perform that action at this time.
0 commit comments