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 3AA9E6F155; Thu, 6 Aug 2026 15:48:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3AA9E6F155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1786020539; bh=SuxAgFun7v5h6HA2EaPVFTg+gyWimA3Ba9jOiKLq1ck=; 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=cjX8ktc66Oii63J3io+617aOHrLnLY/Luq8qOut6tjXyqKcTySGDDg+5teXyygLuZ rAHdXc/Ah0hK1q5M79CuHICzknTY9FE7LkHaxXqI8vNTfDLtAoU82dh2CObwstf8Dn E5Ek4gjnMY2SXXLS66scpf50deMjZ03u26vya1oA= Received: from send37.i.mail.ru (send37.i.mail.ru [89.221.237.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 A3D236F155 for ; Thu, 6 Aug 2026 15:47:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A3D236F155 Received: by exim-smtp-5b67d868c6-wvmsj with esmtpa (envelope-from ) id 1wrxVt-000000009R6-3MRx; Thu, 06 Aug 2026 15:47:58 +0300 To: Sergey Kaplun , Sergey Bronnikov Date: Thu, 6 Aug 2026 15:47:53 +0300 Message-ID: <9d4e2c67dcc3640a917a649cfcd2f19253ddd2f1.1786019520.git.e.temirgaleev@tarantool.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9AF9F8853D868A25967263B06EE83022EEC2DE0FE16DCD5D3182A05F53808504060EF630ED5134B233DE06ABAFEAF67052B06BF1D0DB88D39B030FFE3B72AD3EB9B0C14B1D048C08F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7818460412E3A2163EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB553375665DE04DC009CF06249A3C98B45FEE1DD2E85D5FD06D40CD70594D271DD91A8006389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C045A75973B56231AD8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B625DC386152A6764ACC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C224925ECCA29681764E776E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B803160D0BC219E2D3AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735843AE0F20224B8D0C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A54EC339592E8BFD525002B1117B3ED696B2A4F8C6F8B5A8874A0A47EBA01A636A823CB91A9FED034534781492E4B8EEADCB90D27EC661B0B9C79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659C205C177F765FE0F24F1D7F79B552638B7E4AA5597DD55813941D47FA386DE8E574B7CA3A1530852B8341EE9D5BE9A0ACB4FF051FAD23FA4ECF62AFEBF4A3D0DE621D19A31245CBCC7CEAA0681F5848F4C41F94D744909CEEF9E35A692215F79327F81E6EEE0AEB67A0F9F91F029B6AF33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVQHpos7JM5NNfknz7dvewgM= X-Mailru-Sender: 015BA6FC0EFA223A63A6570A1A031285CDEF0E6B6BC7FD50B951B70A5BD4BD8EBE23E0B8575987EADE369B216F14D11CE62B12C1FE0372A178274A4A9E9E44FD2A114EDA040D8818F01FF9DF31C397A372D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit v3 2/3] ci: enabled sanitizer tests for macOS 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: Evgeniy Temirgaleev via Tarantool-patches Reply-To: Evgeniy Temirgaleev Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Temir Galeev The arm64 and x86_64 architectures with clang/gcc compiler were added to the matrix. --- .../README.md | 0 .../action.yml | 8 +- .../actions/setup-sanitizers-macos/README.md | 15 +++ .../actions/setup-sanitizers-macos/action.yml | 73 +++++++++++++ .github/workflows/sanitizers-testing.yml | 101 ++++++++++++++++-- 5 files changed, 186 insertions(+), 11 deletions(-) rename .github/actions/{setup-sanitizers => setup-sanitizers-linux}/README.md (100%) rename .github/actions/{setup-sanitizers => setup-sanitizers-linux}/action.yml (76%) create mode 100644 .github/actions/setup-sanitizers-macos/README.md create mode 100644 .github/actions/setup-sanitizers-macos/action.yml diff --git a/.github/actions/setup-sanitizers/README.md b/.github/actions/setup-sanitizers-linux/README.md similarity index 100% rename from .github/actions/setup-sanitizers/README.md rename to .github/actions/setup-sanitizers-linux/README.md diff --git a/.github/actions/setup-sanitizers/action.yml b/.github/actions/setup-sanitizers-linux/action.yml similarity index 76% rename from .github/actions/setup-sanitizers/action.yml rename to .github/actions/setup-sanitizers-linux/action.yml index 8642d553..18f5a75d 100644 --- a/.github/actions/setup-sanitizers/action.yml +++ b/.github/actions/setup-sanitizers-linux/action.yml @@ -20,13 +20,17 @@ runs: - name: Install build and test dependencies run: | apt -y update + echo Available compilers: + export CC_FAMILY=`echo ${CC_NAME} | sed 's/-.*$//'` + apt list | grep -Pe "^${CC_FAMILY}-[0-9]+/" + # Try to install apt -y install ${CC_NAME} libstdc++-10-dev cmake ninja-build make perl shell: bash env: CC_NAME: ${{ inputs.cc_name }} - - name: Set specific C compiler as a default toolchain + - name: Set specific C compiler as a default toolchain for cmake run: | - echo CC=${CC_NAME} | tee -a $GITHUB_ENV + echo CMAKE_C_COMPILER=${CC_NAME} | tee -a $GITHUB_ENV shell: bash env: CC_NAME: ${{ inputs.cc_name }} diff --git a/.github/actions/setup-sanitizers-macos/README.md b/.github/actions/setup-sanitizers-macos/README.md new file mode 100644 index 00000000..9ac5eb38 --- /dev/null +++ b/.github/actions/setup-sanitizers-macos/README.md @@ -0,0 +1,15 @@ +# Setup environment for sanitizers on macOS + +Action setups the environment on macOS runners (install requirements, setup the +workflow environment, etc) for testing with sanitizers enabled. + +Requires input: +- cc_name as versioned C compiler: gcc-ver or clang-ver. + +## How to use Github Action from Github workflow + +Add the following code to the running steps before LuaJIT configuration: +``` +- uses: ./.github/actions/setup-sanitizers-macos + if: ${{ matrix.OS == 'macOS' }} +``` diff --git a/.github/actions/setup-sanitizers-macos/action.yml b/.github/actions/setup-sanitizers-macos/action.yml new file mode 100644 index 00000000..9836ea03 --- /dev/null +++ b/.github/actions/setup-sanitizers-macos/action.yml @@ -0,0 +1,73 @@ +name: Setup CI environment for testing with sanitizers on macOS +description: Common part to tweak macOS CI runner environment for sanitizers +inputs: + cc_name: + description: C compiler name (for example, gcc-12) + required: false + default: clang-21 +runs: + using: composite + steps: + - name: Get compiler version from cc_name + shell: bash + env: + CC_NAME: ${{ inputs.cc_name }} + run: | + echo CC_VERSION=`echo ${CC_NAME} | sed 's/.*-//'` | tee -a $GITHUB_ENV + - name: Get brew formula from cc_name + shell: bash + env: + CC_FORMULA_NAME: |- + ${{ case( + startsWith(inputs.cc_name, 'gcc'), 'gcc', + startsWith(inputs.cc_name, 'clang'), 'llvm', + 'MISCONFIG' + ) }} + run: | + echo CC_FORMULA=${CC_FORMULA_NAME}@${CC_VERSION} | tee -a $GITHUB_ENV + echo Available formulas: `brew search ${CC_FORMULA_NAME}` + - name: Setup CI environment + uses: ./.github/actions/setup + - name: Set CMAKE_BUILD_PARALLEL_LEVEL + shell: bash + run: | + # Set CMAKE_BUILD_PARALLEL_LEVEL environment variable to + # limit the number of parallel jobs for build/test step. + NPROC=$(sysctl -n hw.logicalcpu 2>/dev/null) + echo CMAKE_BUILD_PARALLEL_LEVEL=$(($NPROC + 1)) | tee -a $GITHUB_ENV + - name: Set MACOSX_DEPLOYMENT_TARGERT + shell: bash + run: | + # Set required MACOSX_DEPLOYMENT_TARGERT environment + # variable for Makefile.original build. + # See https://github.com/LuaJIT/LuaJIT/issues/484, + # https://github.com/LuaJIT/LuaJIT/issues/653. + echo MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion) | tee -a $GITHUB_ENV + - name: Install build and test dependencies + shell: bash + run: | + # Install brew using the command from Homebrew repository + # instructions: https://github.com/Homebrew/install. + # XXX: 'echo' command below is required since brew + # installation script obliges the one to enter a newline + # for confirming the installation via Ruby script. + brew update || + echo | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + # Try to install the packages either upgrade it to avoid + # of fails if the package already exists with the previous + # version. + brew install --force ${CC_FORMULA} cmake make ninja perl || + brew upgrade ${CC_FORMULA} cmake make ninja perl + - name: Set specific C compiler as a default toolchain for cmake + shell: bash + env: + CC_NAME: ${{ inputs.cc_name }} + run: | + echo CMAKE_C_COMPILER=${CC_NAME} | tee -a $GITHUB_ENV + echo CMAKE_PREFIX_PATH="`brew --prefix ${CC_FORMULA}`" | tee -a $GITHUB_ENV + - name: Log installed compilers + shell: bash + run: | + echo default clang: `clang --version` + echo default gcc: `gcc --version` + echo cmake compiler: `${CMAKE_PREFIX_PATH}/bin/${CMAKE_C_COMPILER} --version` diff --git a/.github/workflows/sanitizers-testing.yml b/.github/workflows/sanitizers-testing.yml index 4bf7d023..fe550b81 100644 --- a/.github/workflows/sanitizers-testing.yml +++ b/.github/workflows/sanitizers-testing.yml @@ -31,17 +31,41 @@ jobs: strategy: fail-fast: false matrix: - # XXX: Let's start with only Linux/x86_64 + ARCH: [ARM64, x86_64] BUILDTYPE: [Debug, Release] - CC: [gcc-10, clang-11] + OS: [Linux, macOS] + # There are different top-level versions available for Linux and macOS runners. + CC: [gcc-10, clang-11, gcc-15, clang-21] 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] + exclude: + # On current runners with Linux/ARM64 environment and + # with LUAJIT_USE_SYSMALLOC=ON the system allocator returns addresses + # with 48-bit set. Thus checkptrGC() fails with new Lua state pointer + # and luajit fails to start with 'cannot create state: not enough memory' + # error. So, we exclude these cases. + - ARCH: ARM64 + OS: Linux + # Exclude nonsuitable OS/compiler pairs. + - OS: macOS + CC: gcc-10 + - OS: macOS + CC: clang-11 + - OS: Linux + CC: gcc-15 + - OS: Linux + CC: clang-21 + # Exclude macOS/ARM64/gcc case due to some tests are failed. + # Details: https://github.com/tarantool/tarantool/issues/13018 + - ARCH: ARM64 + OS: macOS + CC: gcc-15 + runs-on: [self-hosted, regular, '${{ matrix.OS }}', '${{ matrix.ARCH }}'] name: > - LuaJIT with ASan and UBSan (Linux/x86_64) + LuaJIT with ASan and UBSan (${{ matrix.OS }}/${{ matrix.ARCH }}) ${{ matrix.BUILDTYPE }} CC:${{ matrix.CC }} GC64:ON SYSMALLOC:ON @@ -51,7 +75,13 @@ jobs: fetch-depth: 0 submodules: recursive - name: setup Linux for sanitizers - uses: ./.github/actions/setup-sanitizers + if: ${{ matrix.OS == 'Linux' }} + uses: ./.github/actions/setup-sanitizers-linux + with: + cc_name: ${{ matrix.CC }} + - name: setup macOS for sanitizers + if: ${{ matrix.OS == 'macOS' }} + uses: ./.github/actions/setup-sanitizers-macos with: cc_name: ${{ matrix.CC }} - name: configure @@ -70,18 +100,46 @@ jobs: cmake -S . -B ${{ env.BUILDDIR }} -G Ninja ${{ matrix.CMAKEFLAGS }} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DLUAJIT_ENABLE_GC64=ON -DLUAJIT_USE_ASAN=ON -DLUAJIT_USE_SYSMALLOC=ON -DLUAJIT_USE_UBSAN=ON + - name: Check for possible compiler misconfig + working-directory: ${{ env.BUILDDIR }} + env: + CC_NAME: ${{ matrix.CC }} + run: grep CMakeCache.txt -e CMAKE_C_COMPILER:STRING | grep ${CC_NAME} - name: build run: cmake --build . --parallel working-directory: ${{ env.BUILDDIR }} - - name: test + + # Enable as much checks as possible. See more info here: + # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags, + # https://github.com/google/sanitizers/wiki/SanitizerCommonFlags. + - name: setup sanitizer options for Linux + if: ${{ matrix.OS == 'Linux' }} + env: + 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: \ + " + UBSAN_OPTIONS: " + print_stacktrace=1 \ + " + run: | + echo ASAN_OPTIONS=${ASAN_OPTIONS} | tee -a $GITHUB_ENV + echo UBSAN_OPTIONS=${UBSAN_OPTIONS} | tee -a $GITHUB_ENV + - name: setup sanitizer options for macOS (common) + if: ${{ matrix.OS == 'macOS' && matrix.ARCH != 'ARM64' && matrix.CC != 'clang-21' }} env: - # Enable as much checks as possible. See more info here: - # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags, - # https://github.com/google/sanitizers/wiki/SanitizerCommonFlags. ASAN_OPTIONS: " \ detect_invalid_pointer_pairs=1: \ detect_leaks=1: \ @@ -95,5 +153,30 @@ jobs: UBSAN_OPTIONS: " print_stacktrace=1 \ " + run: | + echo ASAN_OPTIONS=${ASAN_OPTIONS} | tee -a $GITHUB_ENV + echo UBSAN_OPTIONS=${UBSAN_OPTIONS} | tee -a $GITHUB_ENV + - name: setup sanitizer options for macOS (ARM64/clang-21) + if: ${{ matrix.OS == 'macOS' && matrix.ARCH == 'ARM64' && matrix.CC == 'clang-21' }} + # detect_leaks is disabled due to some tests build is failed. + # Details: https://github.com/tarantool/tarantool/issues/13019 + env: + ASAN_OPTIONS: " \ + detect_invalid_pointer_pairs=1: \ + detect_leaks=0: \ + detect_stack_use_after_return=1: \ + dump_instruction_bytes=1: \ + heap_profile=0: \ + print_suppressions=0: \ + symbolize=1: \ + unmap_shadow_on_exit=1: \ + " + UBSAN_OPTIONS: " + print_stacktrace=1 \ + " + run: | + echo ASAN_OPTIONS=${ASAN_OPTIONS} | tee -a $GITHUB_ENV + echo UBSAN_OPTIONS=${UBSAN_OPTIONS} | tee -a $GITHUB_ENV + - name: test run: cmake --build . --parallel --target LuaJIT-test working-directory: ${{ env.BUILDDIR }} -- 2.49.0