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 A0C33E0262C; Mon, 16 Sep 2024 18:51:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A0C33E0262C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1726501862; bh=117mjYNySTiEBriWxJVTqMA9T5jyPYboUIrIKKwJy7g=; 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=c5uOusNW/FfQHOea3YlPZpQp+Y9fVs8femF3/ydUYuZj/Mz6lb+fHOXjixNnnpGHS YFCptNg3YMTPtzkt5vaWXDCoYioG1y70LtDe16JF5huHpfQVwNMCnc7euAgmPu3seA ovI4yFvctEOhNzGLJWphHCwttmc12m+8LVUgKTLA= Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 D68A5E02607 for ; Mon, 16 Sep 2024 18:51:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D68A5E02607 Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2f762de00e5so52329191fa.3 for ; Mon, 16 Sep 2024 08:51:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726501860; x=1727106660; 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=mQTZ89Ixg2hrpPOn8OhZGWTUovv4N92LRqWqoXPwDXo=; b=u8pywpCXibVK+ARCARA1i9rPKyB2TdlPksmvz2UWzvZ5evngioYSC9WXKEu+52AMiO 2vIA+QdySto3m9oAyHNerHa/Cc8GHfsIS29sCSqSp5rvvissfNWXllmdnQWLpsS73LF9 qf8ByS2PCFtEWpkhhNXbQ9ZqW46w9u0MmBJWuhs59Z3HNu44nZnoBfaDstUitguHeMkd 8iq9Khqw1MiSP5Fpsi1tU60N+li4ddtfNbHXfz4lBRsk9zNWGbvRUPcKGD/bXAj4fzFa 5LEXLZD2ZcAai3QI++gK1OWjbLImpu2f0DWk6jeiALINWDkhAHop7bgGP5EXHo/2YvFg 5A9w== X-Gm-Message-State: AOJu0YykQTfSHxes+YBkr4GtiXvKHUxVR1LpJuzbsNA65st+JbuBe1oU KtZX4G2qRMbDvsDsSsHhbiIYmjLzLqs9whh/jKSVYdLAjmrhjRwYznUEAGV1fEI= X-Google-Smtp-Source: AGHT+IHp5nEeCwtQcgFEtOozPHDU8edv+QI/04QT08FSCJu8A0MWWKxcDnHBU6eS9uPEywWGcl3lvA== X-Received: by 2002:a05:651c:198e:b0:2ec:637a:c212 with SMTP id 38308e7fff4ca-2f787f57612mr78405701fa.39.1726501858935; Mon, 16 Sep 2024 08:50:58 -0700 (PDT) Received: from mandesero.www.tendawifi.com ([85.89.127.21]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f79d301352sm8239641fa.37.2024.09.16.08.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 08:50:58 -0700 (PDT) To: tarantool-patches@dev.tarantool.org Date: Mon, 16 Sep 2024 15:50:57 +0000 Message-Id: <20240916155057.56919-1-mandesero@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <262398e1-121b-4d2e-a5bd-cc92bc56eef3@tarantool.org> References: <262398e1-121b-4d2e-a5bd-cc92bc56eef3@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v2 luajit 1/3] cmake: run tests with Valgrind 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 Hi, Sergey! Thanks for the review! Changes: 1. Requested by Sergey Bronnikov > realloc -> realloc() > to highlight that realloc is a function - This message was dropped by Sergey Kaplun. > In the commit message, you say that VALGRIND_OPTIONS is an env variable. > However, it is not: - You're right, it doesn't work in the scenario you provided. I've updated the commit message to be more informative: "Custom Valgrind testing options can be configured by setting the `VALGRIND_OPTIONS` variable before running `cmake <..params..>`. To update the value of this variable, modify the environment variable `VALGRIND_OPTIONS` and rebuild the project using `cmake <..params..>` again." > Also, replace "valgrind" in LUAJIT_TEST_COMMAND by ${VALGRIND_BIN} and > put "find_program(VALGRIND valgrind)" before: > > > > I would add default set() with "LUAJIT_TEST_COMMAND" and remove a second > branch: - I kept the default `LUAJIT_TEST_COMMAND` and added a conditional branch for `LUAJIT_USE_VALGRIND` with the provided changes. 2. Requested by Sergey Kaplun > It is better to be a warning by analog with the ASAN build. > > I don't get this comment. Why valgrind depends on x64, and GC64 as well? > I suppose we can drop the comment and the check above. - I changed the message level to warning and removed the last one. > Please use `LUAJIT_SOURCE_DIR` instead. - Done. --- CMakeLists.txt | 5 +++++ test/CMakeLists.txt | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) 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") -- 2.34.1