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 455F0DF4D30; Mon, 29 Jul 2024 20:51:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 455F0DF4D30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1722275477; bh=+g2lGt0KpmdjEyGJlUYonKAKwBoeX3ZrBERvFaM96T4=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=rGNOf0ORU/4mW2YHq894C8QogyKIc9i8Mk33D15L1nTMvgo+ByixuLWnsWRV+dA/r NI9m3zrlQjr1uZt4byZMuedrvx6zt25uDtTLvBISHwitVd2eXnsS66ImdTgM5zY9pB jHqy2WTdQ0SRcbG0g4SgpY+6vhxg4RPavP89lTYo= Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 EE83BBB00AF for ; Wed, 26 Jun 2024 15:27:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EE83BBB00AF Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-52cdb0d816bso450844e87.1 for ; Wed, 26 Jun 2024 05:27:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719404858; x=1720009658; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JX+8EhbxSFSoqTg+Cy38Mi0YmEB1SaLjpiXNKle60KU=; b=pNxcHyr+UG1qJ0nM4wp917RCppp7vfqFe+9tlE6+rv1lmCvRUbaAIQE9mjxst/6uqs iWMbXMaFEbFYqhksCej/P51sAhT5AoV/udfyOClyxNAmtaPW6/22Jlncds+w/EJwrfq2 M64CBAXiIOM1vjZOjcWNKFEOBaiqX902ZDjvnhXgZb+ych711IJM7KXEWRjbXGNHuNCC jGl8v/gIi+yleNLjsm39KqboaN7lDucNK5IZqPO+BrccDP5slu17BQUBGtDktHjn6l56 6Vk8QYLyJBZvV+L82+R7y/LdjVIUwCQQbKbcTQJQQY5XcqBiG2uZvb5QeBmsCmtXBgU3 jG9g== X-Gm-Message-State: AOJu0YyYMLsFMxUb/BxdVjgZVpwrwRA4Q6r5z/lcG1a5ztk0XWfI4ZjW JiYiGFsvv6ZQIBipxnHNxDYNweW+Bbluaf7I/5o1fTf6IdJNaE6pg1ALySPA X-Google-Smtp-Source: AGHT+IGOKIJIx5bTl8R+eyA1Zc/3INiHc63GcJNAGYfosfu60Eu227nCWyWAK+4OT2EeDgNJFdu90w== X-Received: by 2002:a05:6512:1594:b0:52c:dcf8:d597 with SMTP id 2adb3069b0e04-52cdf00906amr4159952e87.10.1719404858060; Wed, 26 Jun 2024 05:27:38 -0700 (PDT) Received: from mandesero.mail.msk ([5.181.62.96]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd84b23d9sm1508886e87.202.2024.06.26.05.27.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 05:27:37 -0700 (PDT) To: tarantool-patches@dev.tarantool.org, skaplun@tarantool.org, m.kokryashkin@tarantool.org Cc: mandesero Date: Wed, 26 Jun 2024 12:27:35 +0000 Message-Id: <20240626122735.165672-3-mandesero@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626122735.165672-1-mandesero@gmail.com> References: <20240626122735.165672-1-mandesero@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Mon, 29 Jul 2024 20:51:14 +0300 Subject: [Tarantool-patches] [PATCH luajit 2/2] cmake: running tests under Valgrind, disable tests that failed under Valgrind 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: mandesero--- via Tarantool-patches Reply-To: mandesero@gmail.com Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: mandesero --- .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