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 D11B65426D5; Mon, 24 Jul 2023 14:54:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D11B65426D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1690199691; bh=FWEO+TMZpMBKSgMOPfVewk/eK0KuPa+oD11akxc2qo8=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Z2/cb1RV++V36/V7FixIRWRrY+7OajWwKMFVhKZUBAwnZxCoxi0EytFDLfsDdvm54 vBHzhKzK5K5Oc7CNBPQ7s5Hvck5UamHDDUpyB6OvkAQKXyKsN5t6rX0ocawPVmcVf1 n2z+Efs93qXdTJOkThIvwUZttXuQTIpLaVAuy55g= Received: from smtp49.i.mail.ru (smtp49.i.mail.ru [95.163.41.91]) (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 BB42E53B85B for ; Mon, 24 Jul 2023 14:54:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BB42E53B85B Received: by smtp49.i.mail.ru with esmtpa (envelope-from ) id 1qNu9J-00G92Y-Vd; Mon, 24 Jul 2023 14:54:50 +0300 Message-ID: <35cfadfe-6a66-c38b-ce05-bacf999fa0a6@tarantool.org> Date: Mon, 24 Jul 2023 14:54:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Igor Munkin , Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <97b2ba3cab77d42f00d9e2eefe331e33fe651b55.1689925402.git.imun@tarantool.org> In-Reply-To: <97b2ba3cab77d42f00d9e2eefe331e33fe651b55.1689925402.git.imun@tarantool.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9227D43F3CB451B416C6CF32F71973666A6CA7D30FA526308182A05F538085040907876DA07CB5120138701E1DBD0ECB4D01C4620FF3D495A5C9004D3EAF8FB85 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE76D34FAA3D8B31588C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE70CF6737295EB4C15EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BE5CCB53A13BC8DBA1354A104CA5B9F83F2808AE5D3191F21CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637FBB89C51EA700D9A389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F7900637DE9AA9445CB5F4E7D81D268191BDAD3DBD4B6F7A4D31EC0BE2F48590F00D11D6D81D268191BDAD3D78DA827A17800CE7AFF4C6A39F54B15FEC76A7562686271ED91E3A1F190DE8FD2E808ACE2090B5E14AD6D5ED66289B5278DA827A17800CE7FFC6AE72B53EFDED2EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE7CD707F342D9BDC98731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A50E26BE766AEBBB3F77E34DBF1719D3A59B9A4F9FFC1503B2F87CCE6106E1FC07E67D4AC08A07B9B0DB8A315C1FF4794DBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFB4FB8746453ED53DF09E2A9AEB8305E30AD79A06BBBF2DD9D011635199C53367744A43F78FC6FA90C81315DA36159FFBCC6071908F73B73EBC5DDB04594F33A4E48CAC7CA610320002C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojHVt7enifY/tDeyj1Ujf0SA== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A7692870F0E6F4C8C950138701E1DBD0ECB4C9F871340C5A6C40EBA65886582A37BD66FEC6BF5C9C28D98A98C1125256619760D574B6FC815AB872D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [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: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! See my comments below. Sergey On 7/21/23 11:12, Igor Munkin wrote: > 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' }} Nit: I would left a comment why OSes is limited by Linux only. You actually said it in commit message ("I believe we will be able to add other platforms being supported, when macOS runners starvation is defeated."). > +``` > 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 Nit: I suppose it would be easy read paragraph above if indent it by "-S", not by "cmake". > + - 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: \ > + " This options are used in CI and doesn't present in CMake, so ASAN will work different locally and in CI. Is it expected? > + run: cmake --build . --parallel --target LuaJIT-test > + working-directory: ${{ env.BUILDDIR }}