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 EF5C252CCDA; Thu, 13 Jul 2023 00:20:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EF5C252CCDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1689196839; bh=8vH416KChQ/YjCY3XPdVsvRA2DIb/zab81bUOJKY86U=; 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=cb3VRSsEjqbt0lz8JtXqiK1bon7OGl88r++c5s1nsdd0AAe1JQ5Upo4QlelLnGgkO tvzcITtUtp22YTofidwFlNpC/o6m+B4Nh4R0QLCeeYfg4V82r5rvo7NvRhcFvYxr6B BR3aM/7oZGmMkLKkHx1f/8vp0DhBVDjqQ0Zv1xwI= Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [95.163.41.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 78BFE52CCDA for ; Thu, 13 Jul 2023 00:19:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 78BFE52CCDA Received: by smtp58.i.mail.ru with esmtpa (envelope-from ) id 1qJhFK-006ASt-Ee; Thu, 13 Jul 2023 00:19:38 +0300 To: Sergey Kaplun , Sergey Bronnikov Date: Wed, 12 Jul 2023 21:09:35 +0000 Message-Id: <14eab2dd6a619fb33d9b82bd24b4c2515184659d.1689195028.git.imun@tarantool.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9B2A9E02D3479B2E01820269E149F1ED29013C2CAD95D1A59182A05F53808504043621BE363C95B4AABB9E40A96C89928422E447A1D9415FED5BE668283D2697D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7956F10FFCC7409BAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D81244D2CF6B2D5F8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D872A926074A018C0F3B5A48859BE016DB117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF80095D1E57F4578A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735207532CA1512B8198128451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE1E561CDFBCA1751F040F9FF01DFDA4A84AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3A333A05395E4745B76E601842F6C81A1F004C906525384303E02D724532EE2C3F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CAA44A86D94E7BBB043847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A58D6DCAD3758A4DD02269A10514B2A58D6685BE4BC6FE2C98F87CCE6106E1FC07E67D4AC08A07B9B06A1CB4668A9CA5FA9C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF4EE1DD047B53F8F0545C047BEF9795E2F047CD9B38988BE96565CEB3324D6057F33D08354E2B7C92399DF444199BC1D13750D0DBC9D5BF0B54B593164B6C3122A74DFFEFA5DC0E7F02C26D483E81D6BEECAEF3E2CCC1ED8C383653B6C8D9AE0FD16FCAA6493B703A X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj8UPT3baccqRqSPeIMUD1ig== X-Mailru-Sender: 2FEBA92C8E508479FE7B9A1DF348D531571A2A3983CD6C5C8B0EB72E27559558DFCDCEEE5AD869042326FE6F2A341ACE0FB9F97486540B4CD9E8847AB8CFED4D9ABF8A61C016C2CFB0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 2/2] ci: introduce testing workflow with sanitizers 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This commit adds GitHub workflow running all available LuaJIT tests with LUAJIT_USE_ASAN option enabled. For now, sanitizers workflow works only for Linux/x86_64 as the most scaling setup in our CI. I believe we will be able to add other platforms being supported, when ARM64 and macOS runners starvation is defeated. There is also a separate GitHub Action introduced for convenient setup of the environment. Follows up tarantool/tarantool#5878 Signed-off-by: Igor Munkin --- .github/actions/setup-sanitizers/README.md | 12 ++++ .github/actions/setup-sanitizers/action.yml | 24 +++++++ .github/workflows/sanitizers-testing.yml | 79 +++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 .github/actions/setup-sanitizers/README.md create mode 100644 .github/actions/setup-sanitizers/action.yml create mode 100644 .github/workflows/sanitizers-testing.yml diff --git a/.github/actions/setup-sanitizers/README.md b/.github/actions/setup-sanitizers/README.md new file mode 100644 index 00000000..3aa9e214 --- /dev/null +++ b/.github/actions/setup-sanitizers/README.md @@ -0,0 +1,12 @@ +# Setup environment for sanitizers on Linux + +Action setups the environment on Linux runners (install requirements, setup the +workflow environment, etc) for testing with sanitizers enabled. + +## How to use Github Action from Github workflow + +Add the following code to the running steps before LuaJIT configuration: +``` +- uses: ./.github/actions/setup-sanitizers + if: ${{ matrix.OS == 'Linux' }} +``` diff --git a/.github/actions/setup-sanitizers/action.yml b/.github/actions/setup-sanitizers/action.yml new file mode 100644 index 00000000..ca6b6b9f --- /dev/null +++ b/.github/actions/setup-sanitizers/action.yml @@ -0,0 +1,24 @@ +name: Setup CI environment for testing with sanitizers on Linux +description: Common part to tweak Linux CI runner environment for sanitizers +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 clang-11 cmake ninja-build make perl + shell: bash + - name: Set Clang as a default toolchain + run: | + echo CC=clang-11 | tee -a $GITHUB_ENV + echo CXX=clang++-11 | tee -a $GITHUB_ENV + shell: bash diff --git a/.github/workflows/sanitizers-testing.yml b/.github/workflows/sanitizers-testing.yml new file mode 100644 index 00000000..ab8e5dc7 --- /dev/null +++ b/.github/workflows/sanitizers-testing.yml @@ -0,0 +1,79 @@ +name: Sanitizers 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-asan: + strategy: + fail-fast: false + matrix: + # XXX: Let's start with only Linux/x86_64 + BUILDTYPE: [Debug, Release] + GC64: [ON, OFF] + 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 ASan (Linux/x86_64) + ${{ matrix.BUILDTYPE }} + GC64:${{ matrix.GC64 }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: recursive + - name: setup Linux for sanitizers + uses: ./.github/actions/setup-sanitizers + - name: configure + run: > + cmake -S . -B ${{ env.BUILDDIR }} + -G Ninja + ${{ matrix.CMAKEFLAGS }} + -DLUAJIT_ENABLE_GC64=${{ matrix.GC64 }} + -DLUAJIT_USE_ASAN=ON + - name: build + run: cmake --build . --parallel + working-directory: ${{ env.BUILDDIR }} + - name: test + env: + # Enable as much checks as possible. See more info here: + # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags + ASAN_OPTIONS: " \ + detect_invalid_pointer_pairs=1: \ + detect_leaks=1: \ + detect_stack_use_after_return=1: \ + dump_instruction_bytes=1: \ + heap_profile=0: \ + print_suppressions=0 \ + symbolize=1: \ + unmap_shadow_on_exit=1: \ + " + run: cmake --build . --parallel --target LuaJIT-test + working-directory: ${{ env.BUILDDIR }} -- 2.30.2