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 0A2BA53B849; Fri, 21 Jul 2023 11:26:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0A2BA53B849 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1689927961; bh=Fu2YycX5WDTk/xdHfYkhPTwJmsP9xoX6uuR8GaKwcb8=; 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=vraO+C/MJ2TQEekWqDzqCARpXhLTKTrTIY+fwYRsnXN9NRH5dG0Alx35XPJpgPUTN zkcxrxKkzdSBgid8tlHgougHIKsTB63ZnXfnnAxcEfV7/0Tv+IIQjzrsa/pQH6Do8Y ZAxvmOy5zXYBNNApjqjHrkMYNj+dEw1UrZbiaY20= Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [95.163.41.74]) (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 3BF7C53A8EE for ; Fri, 21 Jul 2023 11:23:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3BF7C53A8EE Received: by smtp33.i.mail.ru with esmtpa (envelope-from ) id 1qMlQ9-007UVO-BV; Fri, 21 Jul 2023 11:23:29 +0300 To: Sergey Kaplun , Sergey Bronnikov Date: Fri, 21 Jul 2023 08:12:08 +0000 Message-Id: <97b2ba3cab77d42f00d9e2eefe331e33fe651b55.1689925402.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: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD934D79E090D608E19FACDEAA14F13C942F3CE58EDC8F252321313CFAB8367EF908E2BE116634AD74DD8AEC592461806B43C2011C50C0DD2CDE2867D9886DDC57461CD1C36FF7CC69F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7D9C4478D0B876341EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378F6D32451C4A3CAA8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F8F1EB006E88468B9910D46B87E425F2117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3A703B70628EAD7BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735207532CA1512B81981E5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE26055571C92BF10FE0F2381F647739FAD8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE32D01283D1ACF37BA6136E347CC761E07C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637F765F39FA4E70FFE43847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A5295420D897656440F1FBBE4910BDE6B51D9E88F247E88A4BF87CCE6106E1FC07E67D4AC08A07B9B04B6F6234D9065C979C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF9F375B71EA6C77EE270DD301624CA7A03554E7281C80681EA20B0A7F2B40DB80519D809D4148B4967A512D943FCE53BF5EE1978DACFAB4A5A0874FB920FC739AA74DFFEFA5DC0E7F02C26D483E81D6BEECAEF3E2CCC1ED8C383653B6C8D9AE0FD16FCAA6493B703A X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojhjdY/2lpWUIyGEAD0P6dbw== X-Mailru-Sender: 2FEBA92C8E508479FE7B9A1DF348D5312354B6DF3EEE8F1406D1BE6DC80203BAA6A5CFB839A513C12326FE6F2A341ACE0FB9F97486540B4CD9E8847AB8CFED4D9ABF8A61C016C2CFB0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit v2 5/5] 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 macOS runners starvation is defeated. There is also a separate GitHub Action introduced for convenient setup of the environment. Besided, internal LuaJIT memory allocator is not instrumented yet unfortunately, so to find any memory faults it's better to build LuaJIT with system provided memory allocator (i.e. run CMake configuration phase with -DLUAJIT_USE_SYSMALLOC=ON). However, 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. 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 | 89 +++++++++++++++++++++ 3 files changed, 125 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..6c345108 --- /dev/null +++ b/.github/workflows/sanitizers-testing.yml @@ -0,0 +1,89 @@ +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] + 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:ON SYSMALLOC:ON + 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_USE_ASAN=ON + # XXX: 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. + -DLUAJIT_USE_SYSMALLOC=ON + # XXX: 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. + -DLUAJIT_ENABLE_GC64=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