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 8A246DAB18E; Thu, 12 Sep 2024 13:22:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8A246DAB18E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1726136549; bh=jJs9C48jGDsLjlgOuPKrg8w6NzBiZuDT/FgumzYPNd0=; 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=AYqHt0H3nsNNvonMHMR0iPFll2lFNSCPTO74Pd7tPEErId5DCaOmyKFNPLlxt4Qq3 vkXjPRgtdVeev6ihrr58NKc8VvutuI5TEPP7JKFGOKz6VYXCHPkC22f5U7LxaGnx6y PA1ABCXUySb0g6ohZ7N7LpuQ69Ty0m4SPtFkbdb0= Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 7AF9FDAB18E for ; Thu, 12 Sep 2024 13:21:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7AF9FDAB18E Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5365a9574b6so1153949e87.1 for ; Thu, 12 Sep 2024 03:21:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726136517; x=1726741317; 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=D+d69mikYcZyJ2e7JL3J9BttbwnvFzJaUgRYZHI4WB8=; b=WwvKadxj3yWS9t7rkaXbr1H+YjsxXSDLymrNy9KLhSIu9xCZfG+DuxpbEu787swj/V ztN4tbv7EKsh3mzbfv/DUpVFuKmaZKzgIv7Uh9X+yWMS9gA7wuWPo46nkSC+XL3Qfgtj jB2YD+D9WzkVlULphDFNYrrL4nmF8jiBHtNQLJlE6oXzlhMm23wWBGdvAcbGBKfkJCYL UV5lz3JieMOs99uDWRbcHyvIi7yp9ZcjJqf129OUcDk4hFZp+fe42BCHCJHZbC+TuthU V12RPFKbBKXcE3Vx1ccqhwBiDKpx0XVQMkfSN62BYmyHbEXF/YzuuOXXuk+5nkinpoq3 RFtQ== X-Gm-Message-State: AOJu0YwfFU5w87wdpwrRLHq3v8rTZ0HIGqibt41Gwk5LSgupeIl8M308 6tjTWO1hYTiQOIlYi6dMq+gT5JGocz9qtnJ45zRLla/EcyzHoHCkehP/ka2AV0w= X-Google-Smtp-Source: AGHT+IFKuj9LvJXXp7UYmcLxncoUsFVn1VazU8VjHyIpYbuIObDSbWMZ5gksWgVo7GBHaDrYuVWmpg== X-Received: by 2002:a05:6512:2203:b0:536:5509:8862 with SMTP id 2adb3069b0e04-53678fc2317mr1785249e87.36.1726136515585; Thu, 12 Sep 2024 03:21:55 -0700 (PDT) Received: from mandesero.www.tendawifi.com ([85.89.127.21]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5365f8cb707sm1848449e87.176.2024.09.12.03.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 03:21:55 -0700 (PDT) To: tarantool-patches@dev.tarantool.org, skaplun@tarantool.org, m.kokryashkin@tarantool.org Cc: Maksim Tiushev Date: Thu, 12 Sep 2024 10:21:51 +0000 Message-Id: <20240912102153.163481-2-mandesero@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240912102153.163481-1-mandesero@gmail.com> References: <20240912102153.163481-1-mandesero@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v2 luajit 1/3] 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Maksim Tiushev This patch adds the ability to run tests using Valgrind. Custom Valgrind testing options can be set via the environment variable `VALGRIND_OPTIONS`. By default, only the suppression file is set to `src/lj.supp`. --- CMakeLists.txt | 5 +++++ test/CMakeLists.txt | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) 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..280f0042 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -68,7 +68,29 @@ 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) + + if (NOT LUAJIT_USE_SYSMALLOC) + message(FATAL_ERROR + "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() + + if (NOT LUAJIT_ENABLE_GC64) + message(FATAL_ERROR + "LUAJIT_USE_SYSMALLOC cannot be enabled on x64 without GC64, since" + " realloc usually doesn't return addresses in the right address range.") + endif() + + set(SUPPRESSIONS_FILE "${CMAKE_SOURCE_DIR}/src/lj.supp") + set(VALGRIND_OPTIONS "--suppressions=${SUPPRESSIONS_FILE} $ENV{VALGRIND_OPTIONS}") + + set(LUAJIT_TEST_COMMAND "valgrind ${VALGRIND_OPTIONS} ${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") -- 2.34.1