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 33533D788A3; Mon, 11 Nov 2024 14:03:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 33533D788A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1731323027; bh=uQ3k26wfGNLv8yFmwOfu6ji4xj35VaUREYZVa+Tqu7s=; 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=uYkj7DTCDZNaUiZvMMVvTMXO3eRc1g4Rkg+by39FuIBTIimRXT0r2PwRIhDbDP87/ NoSO1J2wPn5wcGyk/o1AoIfBI+r4oD0mq6rIucaP17lkOC5jgXgktaK9ZWzGCwvxih DG72xYlH+8/pHEp0ROqZeqzbSwmWLWGWCJu/nOsI= Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 70B53D78880 for ; Mon, 11 Nov 2024 14:03:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 70B53D78880 Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2fb3c3d5513so36603321fa.1 for ; Mon, 11 Nov 2024 03:03:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731323025; x=1731927825; 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=fvyPXDzKu6+wwaiDdYjwTCGAtrNme12GO+XmfNM8zaA=; b=Pysc42XpAL3OXSkcAraIaGDln9mh9yLILxQMmui+lqKYQm5oojkxSD0VbD85DZgSIR fQ1HBLcglsZxsvECY0OaeodIoQodyn4c0j6NRxre5BDBHfFO29TV/70TMrTco/orA7w+ 64TQHsOO7jYXmYoNM593d+ajgdjgwTAUsoLElTAADw8TAAZb0D18GvLyGbHEuyiW+hhZ +LpZ5MZ2aPBrSoaAbaJE/Zfb5/7ZHsnyU+qsAwuuwLHCXW7TzOceJxFe+2iLQS1TQQ1J 4kXukgI9tI4ggc7Yw4939k0HKaDN935qPzMFEYB9XgXO7ej8gyYvQ1gxdBuFfFYGZc/K O+Dg== X-Gm-Message-State: AOJu0Yzh0oux6uBNEL5CZm+FHRvHmR6U+DEliCzqMOj7PCmkiaN4jNAz LiUXnicIjbdqIaNMbCtyb3ivbIHk7h/cAWthVnmfe+5nvmW4litfNu9NKrFKWvI= X-Google-Smtp-Source: AGHT+IFTHWo7Pr5zhihr0/Mh+1jG//leqDm6oDh+2elLXwItwaplDg3blF7G8PPeFIPqr5PNsPfx5A== X-Received: by 2002:a2e:bd02:0:b0:2fb:39e3:592e with SMTP id 38308e7fff4ca-2ff2016dffemr56990471fa.19.1731323024183; Mon, 11 Nov 2024 03:03:44 -0800 (PST) Received: from mandesero.cs.msu.ru (wifi.cs.msu.ru. [188.44.42.48]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ff17991a30sm16634001fa.87.2024.11.11.03.03.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2024 03:03:43 -0800 (PST) To: tarantool-patches@dev.tarantool.org Date: Mon, 11 Nov 2024 11:03:42 +0000 Message-Id: <20241111110342.7519-1-mandesero@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <41109126-36d0-4e5f-8d2c-25d3fc5ed6b7@tarantool.org> References: <41109126-36d0-4e5f-8d2c-25d3fc5ed6b7@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v3 luajit 1/2] cmake: run tests with 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 Cc: mandesero@gmail.com Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Maksim Tiushev This patch enables running tests with Valgrind. Custom Valgrind testing options can be configured by setting the `VALGRIND_OPTIONS` variable. Please note that this environment variable must be set before building, and any updates to it will require a project rebuild. By default, the suppression file is set to `src/lj.supp`. Also this patch disables the following tests when running with Valgrind due to failures: Disabled due #10803: - test/tarantool-tests/gh-7264-add-proto-trace-sysprof-default.test.lua - test/tarantool-tests/lj-512-profiler-hook-finalizers.test.lua - test/tarantool-tests/lj-726-profile-flush-close.test.lua - test/tarantool-tests/misclib-sysprof-lapi.test.lua Timed out due to running under Valgrind: - test/tarantool-tests/gh-7745-oom-on-trace.test.lua - test/tarantool-tests/lj-1034-tabov-error-frame.test.lua Part of #3705 --- CMakeLists.txt | 5 +++++ test/CMakeLists.txt | 16 ++++++++++++++++ test/tarantool-tests/CMakeLists.txt | 3 ++- .../gh-7745-oom-on-trace.test.lua | 1 + .../lj-1034-tabov-error-frame.test.lua | 1 + .../lj-512-profiler-hook-finalizers.test.lua | 5 ++++- .../lj-726-profile-flush-close.test.lua | 5 ++++- ...7264-add-proto-trace-sysprof-default.test.lua | 2 ++ .../profilers/misclib-sysprof-lapi.test.lua | 2 ++ 9 files changed, 37 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa2103b3..854b3613 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,6 +289,11 @@ endif() # ASan enabled. option(LUAJIT_USE_ASAN "Build LuaJIT with AddressSanitizer" OFF) if(LUAJIT_USE_ASAN) + if(LUAJIT_USE_VALGRIND) + message(FATAL_ERROR + "AddressSanitizer and Valgrind cannot be used simultaneously." + ) + endif() if(NOT LUAJIT_USE_SYSMALLOC) message(WARNING "Unfortunately, internal LuaJIT memory allocator is not instrumented yet," diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0db2dd8b..3cc0ddbc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -69,6 +69,22 @@ add_custom_target(${PROJECT_NAME}-lint DEPENDS ) set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]") + +if(LUAJIT_USE_VALGRIND) + if (NOT LUAJIT_USE_SYSMALLOC) + message(WARNING + "LUAJIT_USE_SYSMALLOC option is mandatory for Valgrind's memcheck tool" + " on x64 and the only way to get useful results from it for all other" + " architectures.") + endif() + + find_program(VALGRIND valgrind) + set(LUAJIT_TEST_VALGRIND_OPTS + "--suppressions=${LUAJIT_SOURCE_DIR}/lj.supp $ENV{VALGRIND_OPTIONS}") + set(LUAJIT_TEST_COMMAND + "${VALGRIND} ${LUAJIT_TEST_VALGRIND_OPTS} ${LUAJIT_TEST_COMMAND}") +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 8bdb2cf3..39562f35 100644 --- a/test/tarantool-tests/CMakeLists.txt +++ b/test/tarantool-tests/CMakeLists.txt @@ -110,7 +110,8 @@ foreach(test_path ${tests}) # LUA_CPATH and LD_LIBRARY_PATH variables and also # dependencies list with libraries are set in scope of # BuildTestLib macro. - ENVIRONMENT "LUA_PATH=${LUA_PATH};${LUA_TEST_ENV_MORE}" + ENVIRONMENT "LUA_PATH=${LUA_PATH};${LUA_TEST_ENV_MORE};\ +LJ_USE_VALGRIND=${LUAJIT_USE_VALGRIND}" LABELS ${TEST_SUITE_NAME} DEPENDS tarantool-tests-deps ) diff --git a/test/tarantool-tests/gh-7745-oom-on-trace.test.lua b/test/tarantool-tests/gh-7745-oom-on-trace.test.lua index fe320251..b4ab8872 100644 --- a/test/tarantool-tests/gh-7745-oom-on-trace.test.lua +++ b/test/tarantool-tests/gh-7745-oom-on-trace.test.lua @@ -6,6 +6,7 @@ local test = tap.test('OOM on trace'):skipcond({ (jit.os == 'OSX'), ['Disabled on MacOS due to #8652'] = jit.os == 'OSX', ['Test requires JIT enabled'] = not jit.status(), + ['Disabled with Valgrind (Timeout)'] = os.getenv("LJ_USE_VALGRIND") == 'ON', }) test:plan(1) diff --git a/test/tarantool-tests/lj-1034-tabov-error-frame.test.lua b/test/tarantool-tests/lj-1034-tabov-error-frame.test.lua index 0e23fdb2..5e75973b 100644 --- a/test/tarantool-tests/lj-1034-tabov-error-frame.test.lua +++ b/test/tarantool-tests/lj-1034-tabov-error-frame.test.lua @@ -4,6 +4,7 @@ local test = tap.test('lj-1034-tabov-error-frame'):skipcond({ ['Test requires JIT enabled'] = not jit.status(), ['Test requires GC64 mode enabled'] = not ffi.abi('gc64'), ['Disabled on MacOS due to #8652'] = jit.os == 'OSX', + ['Disabled with Valgrind (Timeout)'] = os.getenv("LJ_USE_VALGRIND") == 'ON', }) -- XXX: The test for the problem uses the table of GC diff --git a/test/tarantool-tests/lj-512-profiler-hook-finalizers.test.lua b/test/tarantool-tests/lj-512-profiler-hook-finalizers.test.lua index f02bd05f..8f32b9ef 100644 --- a/test/tarantool-tests/lj-512-profiler-hook-finalizers.test.lua +++ b/test/tarantool-tests/lj-512-profiler-hook-finalizers.test.lua @@ -1,7 +1,10 @@ local tap = require('tap') local profile = require('jit.profile') -local test = tap.test('lj-512-profiler-hook-finalizers') +local test = tap.test('lj-512-profiler-hook-finalizers'):skipcond({ + -- See also https://github.com/tarantool/tarantool/issues/10803 + ['Disabled due to #10803'] = os.getenv("LJ_USE_VALGRIND") == 'ON', +}) test:plan(1) -- Sampling interval in ms. diff --git a/test/tarantool-tests/lj-726-profile-flush-close.test.lua b/test/tarantool-tests/lj-726-profile-flush-close.test.lua index 36cca43d..27eb3751 100644 --- a/test/tarantool-tests/lj-726-profile-flush-close.test.lua +++ b/test/tarantool-tests/lj-726-profile-flush-close.test.lua @@ -1,6 +1,9 @@ local tap = require('tap') -local test = tap.test('lj-726-profile-flush-close') +local test = tap.test('lj-726-profile-flush-close'):skipcond({ + -- See also https://github.com/tarantool/tarantool/issues/10803 + ['Disabled due to #10803'] = os.getenv("LJ_USE_VALGRIND") == 'ON', +}) test:plan(1) local TEST_FILE = 'lj-726-profile-flush-close.profile' diff --git a/test/tarantool-tests/profilers/gh-7264-add-proto-trace-sysprof-default.test.lua b/test/tarantool-tests/profilers/gh-7264-add-proto-trace-sysprof-default.test.lua index 176c1a15..e6c853a1 100644 --- a/test/tarantool-tests/profilers/gh-7264-add-proto-trace-sysprof-default.test.lua +++ b/test/tarantool-tests/profilers/gh-7264-add-proto-trace-sysprof-default.test.lua @@ -6,6 +6,8 @@ local test = tap.test('gh-7264-add-proto-trace-sysprof-default'):skipcond({ ['Sysprof is implemented for Linux only'] = jit.os ~= 'Linux', -- See also https://github.com/LuaJIT/LuaJIT/issues/606. ['Disabled due to LuaJIT/LuaJIT#606'] = os.getenv('LUAJIT_TABLE_BUMP'), + -- See also https://github.com/tarantool/tarantool/issues/10803 + ['Disabled due to #10803'] = os.getenv("LJ_USE_VALGRIND") == 'ON', }) test:plan(2) diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua index 26c277cd..2210d668 100644 --- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua +++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua @@ -5,6 +5,8 @@ local test = tap.test("misc-sysprof-lapi"):skipcond({ ["Sysprof is implemented for Linux only"] = jit.os ~= "Linux", -- See also https://github.com/LuaJIT/LuaJIT/issues/606. ["Disabled due to LuaJIT/LuaJIT#606"] = os.getenv("LUAJIT_TABLE_BUMP"), + -- See also https://github.com/tarantool/tarantool/issues/10803 + ['Disabled due to #10803'] = os.getenv("LJ_USE_VALGRIND") == 'ON', }) test:plan(19) -- 2.34.1