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 F0123DAB1A0; Thu, 12 Sep 2024 13:22:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F0123DAB1A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1726136578; bh=IFqbB9s8yr3kzuUy2ZuecNAW07cVxSqgrDe0lfTBN8Q=; 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=eJ9QH69ynNkqzHq8T4XteRBODgnzOqQ5DubLDYETr+SX23tUyWEby/68OW4yBr1jf NbMDaQ/iQ2Dg8odgBA+OQpnS9euMIGPTb17otiJc65v3iQazYATxFNn3gq/AgOqU24 RyuK7AR3wRsmOAizOAIdruV4yoU/U5CzlJx5+Fsw= Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 94C5CDAB18D for ; Thu, 12 Sep 2024 13:21:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 94C5CDAB18D Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5365aa568ceso1023840e87.0 for ; Thu, 12 Sep 2024 03:21:58 -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=XvybgW0hOH3kE8yCHuICcaE/KarCgpRrjnipH7NSs5w=; b=VN9UatLA3AZ80RlaExtCkL3IkiS2xcj/BmuUkzZocxbmrReZ7DKDlkyw+H800YN/Se QnqY00HjIFMh37mw19JGcHhLQI0jq2lI0WpvTEO7FqGIiOMmR1gT0PDnB8FDWkgmZkyR AZAra3p5jkIZlA8HXZHHNGgnMopSB8EsQNIWD/uGQ5WPaoX9Tym4AWA9nyiC+mUsMUXG EeDskV50uT/BJMiUYAZJc/2HYcEEikCeimnTRLgxbNHLNdClakaMJJrieCKqW/Vy5MVW sx6gT/nrPwbjhH/K7XQNISIZDi7IwwNwcBLWM1Gd/XgqPCXnFTTKdX8NxtR7DgKdacX+ QXuw== X-Gm-Message-State: AOJu0YyA3H+jXDtAu/IfqRYAcOmQgl7FQJS0vnDT/O7okS5m09mCivYE aXwM05Ho7FCuett4mgVKZhaeu/6/htTHTVE9znHgWOGfaVMEOItYcHLZjSDRTJg= X-Google-Smtp-Source: AGHT+IHfkVp9Ql8JB/xe7M7ArG7TqOPR6Bu5Xjqh9YnLvz0kHhIPPWIGWusg2JEwJ8zhS/2pKNbtkw== X-Received: by 2002:a05:6512:2812:b0:531:8f2f:8ae7 with SMTP id 2adb3069b0e04-53678fbf743mr1669990e87.25.1726136516173; Thu, 12 Sep 2024 03:21:56 -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:52 +0000 Message-Id: <20240912102153.163481-3-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 2/3] ci: add Valgrind testing workflow 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 CI testing with Valgrind in three scenarios: - Full checks enabled. - No leak checks, with memory fill set to `--malloc-fill=0x00` and `--free-fill=0x00`. - No leak checks, with memory fill set to `--malloc-fill=0xFF` and `--free-fill=0xFF`. --- .github/actions/setup-valgrind/README.md | 12 +++ .github/actions/setup-valgrind/action.yml | 19 +++++ .github/workflows/valgrind-testing.yaml | 91 +++++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 .github/actions/setup-valgrind/README.md create mode 100644 .github/actions/setup-valgrind/action.yml create mode 100644 .github/workflows/valgrind-testing.yaml diff --git a/.github/actions/setup-valgrind/README.md b/.github/actions/setup-valgrind/README.md new file mode 100644 index 00000000..fabd5af1 --- /dev/null +++ b/.github/actions/setup-valgrind/README.md @@ -0,0 +1,12 @@ +# Setup environment for Valgrind on Linux + +Action setups the environment on Linux runners (install requirements, setup the +workflow environment, etc) for testing with Valgrind. + +## How to use Github Action from Github workflow + +Add the following code to the running steps before LuaJIT configuration: +``` +- uses: ./.github/actions/setup-linux + if: ${{ matrix.OS == 'Linux' }} +``` diff --git a/.github/actions/setup-valgrind/action.yml b/.github/actions/setup-valgrind/action.yml new file mode 100644 index 00000000..4f6cfba4 --- /dev/null +++ b/.github/actions/setup-valgrind/action.yml @@ -0,0 +1,19 @@ +name: Setup CI environment for Valgrind on Linux +description: Common part to tweak Linux CI runner environment +runs: + using: composite + steps: + - name: Setup CI environment + uses: ./.github/actions/setup + - name: Set CMAKE_BUILD_PARALLEL_LEVEL + run: | + # Set CMAKE_BUILD_PARALLEL_LEVEL environment variable to + # limit the number of parallel jobs for build/test step. + NPROC=$(nproc) + echo CMAKE_BUILD_PARALLEL_LEVEL=$(($NPROC + 1)) | tee -a $GITHUB_ENV + shell: bash + - name: Install build and test dependencies + run: | + apt -y update + apt -y install cmake gcc make ninja-build perl valgrind + shell: bash diff --git a/.github/workflows/valgrind-testing.yaml b/.github/workflows/valgrind-testing.yaml new file mode 100644 index 00000000..693799ea --- /dev/null +++ b/.github/workflows/valgrind-testing.yaml @@ -0,0 +1,91 @@ +name: Valgrind testing + +on: + push: + branches-ignore: + - '**-notest' + - 'upstream-**' + tags-ignore: + - '**' + +concurrency: + # An update of a developer branch cancels the previously + # scheduled workflow run for this branch. However, the default + # branch, and long-term branch (tarantool/release/2.11, + # tarantool/release/2.10, etc) workflow runs are never canceled. + # + # We use a trick here: define the concurrency group as 'workflow + # run ID' + # 'workflow run attempt' because it is a unique + # combination for any run. So it effectively discards grouping. + # + # XXX: we cannot use `github.sha` as a unique identifier because + # pushing a tag may cancel a run that works on a branch push + # event. + group: ${{ startsWith(github.ref, 'refs/heads/tarantool/') + && format('{0}-{1}', github.run_id, github.run_attempt) + || format('{0}-{1}', github.workflow, github.ref) }} + cancel-in-progress: true + +jobs: + test-valgrind: + strategy: + fail-fast: false + matrix: + # XXX: Let's start with only Linux/x86_64 + BUILDTYPE: [Debug, Release] + VALGRIND_SCENARIO: [full, malloc-free-fill-0x00, malloc-free-fill-0xff] + include: + - BUILDTYPE: Debug + CMAKEFLAGS: -DCMAKE_BUILD_TYPE=Debug -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON + - BUILDTYPE: Release + CMAKEFLAGS: -DCMAKE_BUILD_TYPE=RelWithDebInfo + - VALGRIND_SCENARIO: full + VALGRIND_OPTIONS: --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose + JOB_POSTFIX: "leak-check: full" + - VALGRIND_SCENARIO: malloc-free-fill-0x00 + VALGRIND_OPTIONS: --leak-check=no --malloc-fill=0x00 --free-fill=0x00 + JOB_POSTFIX: "malloc/free-fill: 0x00" + - VALGRIND_SCENARIO: malloc-free-fill-0xff + VALGRIND_OPTIONS: --leak-check=no --malloc-fill=0xff --free-fill=0xff + JOB_POSTFIX: "malloc/free-fill: 0xff" + runs-on: [self-hosted, regular, Linux, x86_64] + name: > + LuaJIT with Valgrind (Linux/x86_64) + ${{ matrix.BUILDTYPE }} + CC: gcc + GC64:ON SYSMALLOC:ON + ${{ matrix.JOB_POSTFIX }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + - name: setup Linux for Valgrind + uses: ./.github/actions/setup-valgrind + - name: configure + # XXX: LuaJIT configuration requires a couple of tweaks: + # LUAJIT_USE_SYSMALLOC=ON: Unfortunately, internal LuaJIT + # memory allocator is not instrumented yet, so to find + # any memory errors it's better to build LuaJIT with + # system provided memory allocator (i.e. run CMake + # 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. + env: + VALGRIND_OPTIONS: ${{ matrix.VALGRIND_OPTIONS }} + run: > + cmake -S . -B ${{ env.BUILDDIR }} + -G Ninja + ${{ matrix.CMAKEFLAGS }} + -DLUAJIT_USE_VALGRIND=ON + -DLUAJIT_ENABLE_GC64=ON + -DLUAJIT_USE_SYSMALLOC=ON + - name: build + run: cmake --build . --parallel + working-directory: ${{ env.BUILDDIR }} + - name: test + run: cmake --build . --parallel --target LuaJIT-test + working-directory: ${{ env.BUILDDIR }} -- 2.34.1