From: mandesero--- via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org, skaplun@tarantool.org,
m.kokryashkin@tarantool.org
Cc: mandesero <mandesero@gmail.com>
Subject: [Tarantool-patches] [PATCH luajit 2/2] cmake: running tests under Valgrind, disable tests that failed under Valgrind
Date: Wed, 26 Jun 2024 12:27:35 +0000 [thread overview]
Message-ID: <20240626122735.165672-3-mandesero@gmail.com> (raw)
In-Reply-To: <20240626122735.165672-1-mandesero@gmail.com>
From: mandesero <mandesero@gmail.com>
---
.github/actions/setup-sanitizers/action.yml | 2 +-
.github/workflows/sanitizers-testing.yml | 53 +++++++++++++++++++++
src/lj_no_str_opt.supp | 16 +++++++
test/CMakeLists.txt | 6 ++-
test/tarantool-tests/CMakeLists.txt | 17 +++++++
5 files changed, 92 insertions(+), 2 deletions(-)
create mode 100644 src/lj_no_str_opt.supp
diff --git a/.github/actions/setup-sanitizers/action.yml b/.github/actions/setup-sanitizers/action.yml
index 8642d553..53f95075 100644
--- a/.github/actions/setup-sanitizers/action.yml
+++ b/.github/actions/setup-sanitizers/action.yml
@@ -20,7 +20,7 @@ runs:
- name: Install build and test dependencies
run: |
apt -y update
- apt -y install ${CC_NAME} libstdc++-10-dev cmake ninja-build make perl
+ apt -y install ${CC_NAME} libstdc++-10-dev cmake ninja-build make perl valgrind
shell: bash
env:
CC_NAME: ${{ inputs.cc_name }}
diff --git a/.github/workflows/sanitizers-testing.yml b/.github/workflows/sanitizers-testing.yml
index 154ebe40..85ccf580 100644
--- a/.github/workflows/sanitizers-testing.yml
+++ b/.github/workflows/sanitizers-testing.yml
@@ -93,3 +93,56 @@ jobs:
"
run: cmake --build . --parallel --target LuaJIT-test
working-directory: ${{ env.BUILDDIR }}
+
+
+ test-valgrind:
+ strategy:
+ fail-fast: false
+ matrix:
+ # XXX: Let's start with only Linux/x86_64
+ BUILDTYPE: [Debug, Release]
+ CC: [gcc-10, clang-11]
+ include:
+ - BUILDTYPE: Debug
+ CMAKEFLAGS: -DCMAKE_BUILD_TYPE=Debug -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON
+ - BUILDTYPE: Release
+ CMAKEFLAGS: -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ runs-on: [self-hosted, regular, Linux, x86_64]
+ name: >
+ LuaJIT with Valgrind (Linux/x86_64)
+ ${{ matrix.BUILDTYPE }}
+ CC:${{ matrix.CC }}
+ GC64:ON SYSMALLOC:ON
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - name: setup Linux for sanitizers
+ uses: ./.github/actions/setup-sanitizers
+ with:
+ cc_name: ${{ matrix.CC }}
+ - name: configure
+ # XXX: LuaJIT configuration requires a couple of tweaks:
+ # LUAJIT_USE_SYSMALLOC=ON: Valgrind requires the use of
+ # a system-provided memory allocator (realloc) instead
+ # of the built-in memory allocator.
+ # configuration phase with -DLUAJIT_USE_SYSMALLOC=ON).
+ # For more info, see root CMakeLists.txt.
+ # LUAJIT_ENABLE_GC64=ON: LUAJIT_USE_SYSMALLOC cannot be
+ # enabled on x64 without GC64, since realloc usually
+ # doesn't return addresses in the right address range.
+ # For more info, see root CMakeLists.txt.
+ run: >
+ cmake -S . -B ${{ env.BUILDDIR }}
+ -G Ninja
+ ${{ matrix.CMAKEFLAGS }}
+ -DLUAJIT_USE_VALGRIND=ON
+ -DLUAJIT_USE_SYSMALLOC=ON
+ -DLUAJIT_ENABLE_GC64=ON
+ - name: build
+ run: cmake --build . --parallel
+ working-directory: ${{ env.BUILDDIR }}
+ - name: test
+ run: cmake --build . --parallel --target LuaJIT-test
+ working-directory: ${{ env.BUILDDIR }}
\ No newline at end of file
diff --git a/src/lj_no_str_opt.supp b/src/lj_no_str_opt.supp
new file mode 100644
index 00000000..1ec470f8
--- /dev/null
+++ b/src/lj_no_str_opt.supp
@@ -0,0 +1,16 @@
+# Valgrind suppression file for LuaJIT 2.0.
+{
+ Optimized string compare
+ Memcheck:Addr4
+ fun:lj_str_new
+}
+{
+ Optimized string compare
+ Memcheck:Addr1
+ fun:lj_str_new
+}
+{
+ Optimized string compare
+ Memcheck:Cond
+ fun:lj_str_new
+}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 19726f5a..fc2791f6 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -71,7 +71,11 @@ add_custom_target(${PROJECT_NAME}-lint DEPENDS
${PROJECT_NAME}-codespell
)
-set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
+if(LUAJIT_USE_VALGRIND)
+ set(LUAJIT_TEST_COMMAND "valgrind --suppressions=${CMAKE_SOURCE_DIR}/src/lj_no_str_opt.supp ${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
+else()
+ set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
+endif()
separate_arguments(LUAJIT_TEST_COMMAND)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/CMakeLists.txt
index d7c96078..ac09e993 100644
--- a/test/tarantool-tests/CMakeLists.txt
+++ b/test/tarantool-tests/CMakeLists.txt
@@ -121,9 +121,26 @@ add_test_suite_target(tarantool-tests
DEPENDS ${LUAJIT_TEST_DEPS} tarantool-tests-libs
)
+# Tests are disabled as they fail with Valgrind enabled due to SIGPROF
+# signals from the profiler or exceeding the maximum test duration time.
+list(APPEND valgrind_excluded_tests
+ "gh-5688-tool-cli-flag.test.lua"
+ "gh-5813-resolving-of-c-symbols.test.lua"
+ "gh-7264-add-proto-trace-sysprof-default.test.lua"
+ "gh-7745-oom-on-trace.test.lua"
+ "lj-1034-tabov-error-frame.test.lua"
+ "lj-512-profiler-hook-finalizers.test.lua"
+ "lj-726-profile-flush-close.test.lua"
+ "misclib-sysprof-lapi.test.lua"
+)
+
file(GLOB_RECURSE tests ${CMAKE_CURRENT_SOURCE_DIR} "*${LUA_TEST_SUFFIX}")
foreach(test_path ${tests})
get_filename_component(test_name ${test_path} NAME)
+ list(FIND valgrind_excluded_tests ${test_name} test_index)
+ if(LUAJIT_USE_VALGRIND AND NOT test_index EQUAL -1)
+ continue()
+ endif()
set(test_title "test/${TEST_SUITE_NAME}/${test_name}")
add_test(NAME ${test_title}
COMMAND ${LUAJIT_TEST_COMMAND} ${test_path}
--
2.34.1
prev parent reply other threads:[~2024-07-29 17:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 12:27 [Tarantool-patches] [PATCH luajit 0/2] Disable strcmp optimizations in Valgrind build mandesero--- via Tarantool-patches
2024-06-26 12:27 ` [Tarantool-patches] [PATCH luajit 1/2] c: disable strcmp optimization " mandesero--- via Tarantool-patches
2024-07-03 10:10 ` Sergey Kaplun via Tarantool-patches
2024-09-13 14:52 ` Sergey Bronnikov via Tarantool-patches
2024-06-26 12:27 ` mandesero--- via Tarantool-patches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240626122735.165672-3-mandesero@gmail.com \
--to=tarantool-patches@dev.tarantool.org \
--cc=m.kokryashkin@tarantool.org \
--cc=mandesero@gmail.com \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit 2/2] cmake: running tests under Valgrind, disable tests that failed under Valgrind' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox