Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v2 luajit 0/2] Fix LuaJIT tests for old libc versions
@ 2024-12-09 10:16 Sergey Kaplun via Tarantool-patches
  2024-12-09 10:16 ` [Tarantool-patches] [PATCH v2 luajit 1/2] test: support number value of tag in LuaJIT-tests Sergey Kaplun via Tarantool-patches
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-12-09 10:16 UTC (permalink / raw)
  To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches

This patch set consists of 2 patches:
The first allows the use of tags with number values in the LuaJIT-tests
suite runner <test.lua>. This is required for the second patch -- it
skips the `strtod parsing` test in <tonumber_scan.lua> for libc versions
older than 2.19, due to the bug [1] in it.

Branch:
https://github.com/tarantool/luajit/tree/skaplun/fix-luajit-tests-centos7
PR in the Tarantool with tests enabled:
https://github.com/tarantool/tarantool/pull/10824

Only sysprof-related tests are failing, this will be fixed in the
separate patch-set.

[1]: https://sourceware.org/bugzilla/show_bug.cgi?id=16151

Changes in v2:
* Parse -E of #include <gnu/libc-version.h> instead of trying to run
  or parse the name of the libc.so.6 to determine its version.
* Typo fixes

Sergey Kaplun (2):
  test: support number value of tag in LuaJIT-tests
  test: fix LuaJIT-tests for old libc version

 test/CMakeLists.txt                          |  1 +
 test/LuaJIT-tests/CMakeLists.txt             |  9 +++++
 test/LuaJIT-tests/lib/base/tonumber_scan.lua |  4 +-
 test/LuaJIT-tests/test.lua                   |  7 +++-
 test/cmake/GetLibCVersion.cmake              | 41 ++++++++++++++++++++
 5 files changed, 60 insertions(+), 2 deletions(-)
 create mode 100644 test/cmake/GetLibCVersion.cmake

-- 
2.47.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Tarantool-patches] [PATCH v2 luajit 1/2] test: support number value of tag in LuaJIT-tests
  2024-12-09 10:16 [Tarantool-patches] [PATCH v2 luajit 0/2] Fix LuaJIT tests for old libc versions Sergey Kaplun via Tarantool-patches
@ 2024-12-09 10:16 ` Sergey Kaplun via Tarantool-patches
  2024-12-09 11:12   ` Sergey Bronnikov via Tarantool-patches
  2024-12-09 10:16 ` [Tarantool-patches] [PATCH v2 luajit 2/2] test: fix LuaJIT-tests for old libc version Sergey Kaplun via Tarantool-patches
  2024-12-17 12:30 ` [Tarantool-patches] [PATCH v2 luajit 0/2] Fix LuaJIT tests for old libc versions Sergey Kaplun via Tarantool-patches
  2 siblings, 1 reply; 8+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-12-09 10:16 UTC (permalink / raw)
  To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches

The LuaJIT-tests suite lacks the ability to specify tags with custom
values. This patch adds the ability to specify number tags in the format
`+tag=number`. It is useful for version specification of system
libraries (like libc).

Required for the next patch.
---
 test/LuaJIT-tests/test.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/LuaJIT-tests/test.lua b/test/LuaJIT-tests/test.lua
index ab178331..2a535605 100644
--- a/test/LuaJIT-tests/test.lua
+++ b/test/LuaJIT-tests/test.lua
@@ -161,7 +161,12 @@ local function parse_args(t)
         error(arg .." does not expect an argument")
       end
     elseif arg:find"^[-+]" then
-      opts.tags[arg:sub(2)] = (arg:sub(1, 1) == "+")
+      local tagval = arg:find"="
+      if tagval then
+        opts.tags[arg:sub(2, tagval - 1)] = tonumber(arg:sub(tagval + 1))
+      else
+        opts.tags[arg:sub(2)] = (arg:sub(1, 1) == "+")
+      end
     elseif arg:find"^%d+$" then
       if not opts.numbers_to_run then
         opts.numbers_to_run = {}
-- 
2.47.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Tarantool-patches] [PATCH v2 luajit 2/2] test: fix LuaJIT-tests for old libc version
  2024-12-09 10:16 [Tarantool-patches] [PATCH v2 luajit 0/2] Fix LuaJIT tests for old libc versions Sergey Kaplun via Tarantool-patches
  2024-12-09 10:16 ` [Tarantool-patches] [PATCH v2 luajit 1/2] test: support number value of tag in LuaJIT-tests Sergey Kaplun via Tarantool-patches
@ 2024-12-09 10:16 ` Sergey Kaplun via Tarantool-patches
  2024-12-09 11:17   ` Sergey Bronnikov via Tarantool-patches
  2024-12-17 12:30 ` [Tarantool-patches] [PATCH v2 luajit 0/2] Fix LuaJIT tests for old libc versions Sergey Kaplun via Tarantool-patches
  2 siblings, 1 reply; 8+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-12-09 10:16 UTC (permalink / raw)
  To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches

The `strtod parsing` subtest in the <lib/base/tonumber_scan.lua> 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: <tonumber_scan.lua> 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 <LuaJIT-tests-deps>
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 <gnu/libc-version.h>"
+    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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2 luajit 1/2] test: support number value of tag in LuaJIT-tests
  2024-12-09 10:16 ` [Tarantool-patches] [PATCH v2 luajit 1/2] test: support number value of tag in LuaJIT-tests Sergey Kaplun via Tarantool-patches
@ 2024-12-09 11:12   ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 8+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2024-12-09 11:12 UTC (permalink / raw)
  To: Sergey Kaplun, Maxim Kokryashkin; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]

Hi, Sergey,

thanks for the pacth! LGTM

On 09.12.2024 13:16, Sergey Kaplun wrote:
> The LuaJIT-tests suite lacks the ability to specify tags with custom
> values. This patch adds the ability to specify number tags in the format
> `+tag=number`. It is useful for version specification of system
> libraries (like libc).
>
> Required for the next patch.
> ---
>   test/LuaJIT-tests/test.lua | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/test/LuaJIT-tests/test.lua b/test/LuaJIT-tests/test.lua
> index ab178331..2a535605 100644
> --- a/test/LuaJIT-tests/test.lua
> +++ b/test/LuaJIT-tests/test.lua
> @@ -161,7 +161,12 @@ local function parse_args(t)
>           error(arg .." does not expect an argument")
>         end
>       elseif arg:find"^[-+]" then
> -      opts.tags[arg:sub(2)] = (arg:sub(1, 1) == "+")
> +      local tagval = arg:find"="
> +      if tagval then
> +        opts.tags[arg:sub(2, tagval - 1)] = tonumber(arg:sub(tagval + 1))
> +      else
> +        opts.tags[arg:sub(2)] = (arg:sub(1, 1) == "+")
> +      end
>       elseif arg:find"^%d+$" then
>         if not opts.numbers_to_run then
>           opts.numbers_to_run = {}

[-- Attachment #2: Type: text/html, Size: 1613 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2 luajit 2/2] test: fix LuaJIT-tests for old libc version
  2024-12-09 10:16 ` [Tarantool-patches] [PATCH v2 luajit 2/2] test: fix LuaJIT-tests for old libc version Sergey Kaplun via Tarantool-patches
@ 2024-12-09 11:17   ` Sergey Bronnikov via Tarantool-patches
  2024-12-09 14:40     ` Sergey Kaplun via Tarantool-patches
  0 siblings, 1 reply; 8+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2024-12-09 11:17 UTC (permalink / raw)
  To: Sergey Kaplun, Maxim Kokryashkin; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 5097 bytes --]

Hi, Sergey!

thanks for the patch!

LGTM after fix a comment below

On 09.12.2024 13:16, Sergey Kaplun wrote:
> The `strtod parsing` subtest in the <lib/base/tonumber_scan.lua> 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: <tonumber_scan.lua> 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 <LuaJIT-tests-deps>
> 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 alsohttps://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 <gnu/libc-version.h>"

I propose to replace "echo" with a variable set by `find_program()`:


diff --git a/test/cmake/GetLibCVersion.cmake 
b/test/cmake/GetLibCVersion.cmake
index d87e8b70..15a8b440 100644
--- a/test/cmake/GetLibCVersion.cmake
+++ b/test/cmake/GetLibCVersion.cmake
@@ -1,8 +1,14 @@
  # Get the libc version installed in the system.
  macro(GetLibCVersion output)
+  find_program(ECHO echo)
+  if(NOT ECHO)
+    message(FATAL_ERROR "`echo` is not found'")
+    return()
+  endif()
+
    # Try to directly parse the version.
    execute_process(
-    COMMAND echo "#include <gnu/libc-version.h>"
+    COMMAND ${ECHO} "#include <gnu/libc-version.h>"
      COMMAND ${CMAKE_C_COMPILER} -E -dM -
      OUTPUT_VARIABLE LIB_C_INFO
      ERROR_VARIABLE ERROR_MSG
@@ -31,6 +37,7 @@ macro(GetLibCVersion output)

    set(${output} "${GLIBC_MAJOR}.${GLIBC_MINOR}")

+  unset(ECHO)
    unset(CMAKE_MATCH_1)
    unset(GLIBC_MAJOR)
    unset(GLIBC_MINOR)

> +    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()

[-- Attachment #2: Type: text/html, Size: 6217 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2 luajit 2/2] test: fix LuaJIT-tests for old libc version
  2024-12-09 11:17   ` Sergey Bronnikov via Tarantool-patches
@ 2024-12-09 14:40     ` Sergey Kaplun via Tarantool-patches
  2024-12-10  7:37       ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 8+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-12-09 14:40 UTC (permalink / raw)
  To: Sergey Bronnikov; +Cc: tarantool-patches

Hi, Sergey!
Thanks for the review!

On 09.12.24, Sergey Bronnikov wrote:
> Hi, Sergey!
> 
> thanks for the patch!
> 
> LGTM after fix a comment below

Fixed the comment with a slightly modified patch of yours:

===================================================================
diff --git a/test/cmake/GetLibCVersion.cmake b/test/cmake/GetLibCVersion.cmake
index d87e8b70..521a6e45 100644
--- a/test/cmake/GetLibCVersion.cmake
+++ b/test/cmake/GetLibCVersion.cmake
@@ -1,8 +1,12 @@
 # Get the libc version installed in the system.
 macro(GetLibCVersion output)
+  find_program(ECHO echo)
+  if(NOT ECHO)
+    message(FATAL_ERROR "`echo' is not found")
+  endif()
   # Try to directly parse the version.
   execute_process(
-    COMMAND echo "#include <gnu/libc-version.h>"
+    COMMAND ${ECHO} "#include <gnu/libc-version.h>"
     COMMAND ${CMAKE_C_COMPILER} -E -dM -
     OUTPUT_VARIABLE LIB_C_INFO
     ERROR_VARIABLE ERROR_MSG
@@ -31,6 +35,7 @@ macro(GetLibCVersion output)
 
   set(${output} "${GLIBC_MAJOR}.${GLIBC_MINOR}")
 
+  unset(ECHO)
   unset(CMAKE_MATCH_1)
   unset(GLIBC_MAJOR)
   unset(GLIBC_MINOR)
===================================================================

Force-pushed the branch and updated the PR.

> 
> On 09.12.2024 13:16, Sergey Kaplun wrote:
> > The `strtod parsing` subtest in the <lib/base/tonumber_scan.lua> 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
> > ---

<snipped>

> > 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 <gnu/libc-version.h>"
> 
> I propose to replace "echo" with a variable set by `find_program()`:
> 
> 
> diff --git a/test/cmake/GetLibCVersion.cmake 
> b/test/cmake/GetLibCVersion.cmake
> index d87e8b70..15a8b440 100644
> --- a/test/cmake/GetLibCVersion.cmake
> +++ b/test/cmake/GetLibCVersion.cmake
> @@ -1,8 +1,14 @@
>   # Get the libc version installed in the system.
>   macro(GetLibCVersion output)
> +  find_program(ECHO echo)
> +  if(NOT ECHO)
> +    message(FATAL_ERROR "`echo` is not found'")
> +    return()
> +  endif()
> +
>     # Try to directly parse the version.
>     execute_process(
> -    COMMAND echo "#include <gnu/libc-version.h>"
> +    COMMAND ${ECHO} "#include <gnu/libc-version.h>"
>       COMMAND ${CMAKE_C_COMPILER} -E -dM -
>       OUTPUT_VARIABLE LIB_C_INFO
>       ERROR_VARIABLE ERROR_MSG
> @@ -31,6 +37,7 @@ macro(GetLibCVersion output)
> 
>     set(${output} "${GLIBC_MAJOR}.${GLIBC_MINOR}")
> 
> +  unset(ECHO)
>     unset(CMAKE_MATCH_1)
>     unset(GLIBC_MAJOR)
>     unset(GLIBC_MINOR)
> 
> > +    COMMAND ${CMAKE_C_COMPILER} -E -dM -
> > +    OUTPUT_VARIABLE LIB_C_INFO
> > +    ERROR_VARIABLE ERROR_MSG
> > +    OUTPUT_STRIP_TRAILING_WHITESPACE
> > +    RESULT_VARIABLE RES
> > +  )
> > +

<snipped>

> > +endmacro()

-- 
Best regards,
Sergey Kaplun

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2 luajit 2/2] test: fix LuaJIT-tests for old libc version
  2024-12-09 14:40     ` Sergey Kaplun via Tarantool-patches
@ 2024-12-10  7:37       ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 8+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2024-12-10  7:37 UTC (permalink / raw)
  To: Sergey Kaplun; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 3559 bytes --]

Hi, Sergey!

thanks for fixes! LGTM

On 09.12.2024 17:40, Sergey Kaplun wrote:
> Hi, Sergey!
> Thanks for the review!
>
> On 09.12.24, Sergey Bronnikov wrote:
>> Hi, Sergey!
>>
>> thanks for the patch!
>>
>> LGTM after fix a comment below
> Fixed the comment with a slightly modified patch of yours:
>
> ===================================================================
> diff --git a/test/cmake/GetLibCVersion.cmake b/test/cmake/GetLibCVersion.cmake
> index d87e8b70..521a6e45 100644
> --- a/test/cmake/GetLibCVersion.cmake
> +++ b/test/cmake/GetLibCVersion.cmake
> @@ -1,8 +1,12 @@
>   # Get the libc version installed in the system.
>   macro(GetLibCVersion output)
> +  find_program(ECHO echo)
> +  if(NOT ECHO)
> +    message(FATAL_ERROR "`echo' is not found")
> +  endif()
>     # Try to directly parse the version.
>     execute_process(
> -    COMMAND echo "#include <gnu/libc-version.h>"
> +    COMMAND ${ECHO} "#include <gnu/libc-version.h>"
>       COMMAND ${CMAKE_C_COMPILER} -E -dM -
>       OUTPUT_VARIABLE LIB_C_INFO
>       ERROR_VARIABLE ERROR_MSG
> @@ -31,6 +35,7 @@ macro(GetLibCVersion output)
>   
>     set(${output} "${GLIBC_MAJOR}.${GLIBC_MINOR}")
>   
> +  unset(ECHO)
>     unset(CMAKE_MATCH_1)
>     unset(GLIBC_MAJOR)
>     unset(GLIBC_MINOR)
> ===================================================================
>
> Force-pushed the branch and updated the PR.
>
>> On 09.12.2024 13:16, Sergey Kaplun wrote:
>>> The `strtod parsing` subtest in the <lib/base/tonumber_scan.lua> 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
>>> ---
> <snipped>
>
>>> 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 <gnu/libc-version.h>"
>> I propose to replace "echo" with a variable set by `find_program()`:
>>
>>
>> diff --git a/test/cmake/GetLibCVersion.cmake
>> b/test/cmake/GetLibCVersion.cmake
>> index d87e8b70..15a8b440 100644
>> --- a/test/cmake/GetLibCVersion.cmake
>> +++ b/test/cmake/GetLibCVersion.cmake
>> @@ -1,8 +1,14 @@
>>    # Get the libc version installed in the system.
>>    macro(GetLibCVersion output)
>> +  find_program(ECHO echo)
>> +  if(NOT ECHO)
>> +    message(FATAL_ERROR "`echo` is not found'")
>> +    return()
>> +  endif()
>> +
>>      # Try to directly parse the version.
>>      execute_process(
>> -    COMMAND echo "#include <gnu/libc-version.h>"
>> +    COMMAND ${ECHO} "#include <gnu/libc-version.h>"
>>        COMMAND ${CMAKE_C_COMPILER} -E -dM -
>>        OUTPUT_VARIABLE LIB_C_INFO
>>        ERROR_VARIABLE ERROR_MSG
>> @@ -31,6 +37,7 @@ macro(GetLibCVersion output)
>>
>>      set(${output} "${GLIBC_MAJOR}.${GLIBC_MINOR}")
>>
>> +  unset(ECHO)
>>      unset(CMAKE_MATCH_1)
>>      unset(GLIBC_MAJOR)
>>      unset(GLIBC_MINOR)
>>
>>> +    COMMAND ${CMAKE_C_COMPILER} -E -dM -
>>> +    OUTPUT_VARIABLE LIB_C_INFO
>>> +    ERROR_VARIABLE ERROR_MSG
>>> +    OUTPUT_STRIP_TRAILING_WHITESPACE
>>> +    RESULT_VARIABLE RES
>>> +  )
>>> +
> <snipped>
>
>>> +endmacro()

[-- Attachment #2: Type: text/html, Size: 4812 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2 luajit 0/2] Fix LuaJIT tests for old libc versions
  2024-12-09 10:16 [Tarantool-patches] [PATCH v2 luajit 0/2] Fix LuaJIT tests for old libc versions Sergey Kaplun via Tarantool-patches
  2024-12-09 10:16 ` [Tarantool-patches] [PATCH v2 luajit 1/2] test: support number value of tag in LuaJIT-tests Sergey Kaplun via Tarantool-patches
  2024-12-09 10:16 ` [Tarantool-patches] [PATCH v2 luajit 2/2] test: fix LuaJIT-tests for old libc version Sergey Kaplun via Tarantool-patches
@ 2024-12-17 12:30 ` Sergey Kaplun via Tarantool-patches
  2 siblings, 0 replies; 8+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-12-17 12:30 UTC (permalink / raw)
  To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches

I've applied the patch-set into all long-term branches in
tarantool/luajit and bumped a new version in master [1],
release/3.3 [2], release/3.2 [3] and release/2.11 [4].

[1]: https://github.com/tarantool/tarantool/pull/10936
[2]: https://github.com/tarantool/tarantool/pull/10937
[3]: https://github.com/tarantool/tarantool/pull/10938
[4]: https://github.com/tarantool/tarantool/pull/10939

-- 
Best regards,
Sergey Kaplun

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-12-17 12:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-09 10:16 [Tarantool-patches] [PATCH v2 luajit 0/2] Fix LuaJIT tests for old libc versions Sergey Kaplun via Tarantool-patches
2024-12-09 10:16 ` [Tarantool-patches] [PATCH v2 luajit 1/2] test: support number value of tag in LuaJIT-tests Sergey Kaplun via Tarantool-patches
2024-12-09 11:12   ` Sergey Bronnikov via Tarantool-patches
2024-12-09 10:16 ` [Tarantool-patches] [PATCH v2 luajit 2/2] test: fix LuaJIT-tests for old libc version Sergey Kaplun via Tarantool-patches
2024-12-09 11:17   ` Sergey Bronnikov via Tarantool-patches
2024-12-09 14:40     ` Sergey Kaplun via Tarantool-patches
2024-12-10  7:37       ` Sergey Bronnikov via Tarantool-patches
2024-12-17 12:30 ` [Tarantool-patches] [PATCH v2 luajit 0/2] Fix LuaJIT tests for old libc versions Sergey Kaplun via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox