From e995618e77300a61021dc9ae1e5b808ed99c5b01 Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Tue, 18 Jul 2023 12:16:55 -0600 Subject: [PATCH 1/2] CI: Add a sanitizer CI job --- .github/workflows/linux_asan.yml | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/linux_asan.yml diff --git a/.github/workflows/linux_asan.yml b/.github/workflows/linux_asan.yml new file mode 100644 index 000000000000..c8c8fbd7af53 --- /dev/null +++ b/.github/workflows/linux_asan.yml @@ -0,0 +1,55 @@ +name: Test Address Sanitizer Build (Linux) + +on: + pull_request: + branches: + - main + - maintenance/** + +defaults: + run: + shell: bash + +env: + PYTHON_VERSION: 3.11 + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + meson_sanitizers: + if: "github.repository == 'numpy/numpy'" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: ${{ env.PYTHON_VERSION }} + - name: Install dependencies + run: | + pip install -r build_requirements.txt + sudo apt-get install -y libopenblas-serial-dev + - name: Build + shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' + env: + TERM: xterm-256color + run: + spin build -- --werror -Db_sanitize=address,undefined + - name: Test + shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' + env: + TERM: xterm-256color + run: | + pip install pytest pytest-xdist hypothesis typing_extensions + ASAN_OPTIONS=detect_leaks=0:symbolize=1:strict_init_order=true:allocator_may_return_null=1:halt_on_error=1 \ + LD_PRELOAD=$(gcc --print-file-name=libasan.so) \ + python -m spin test -- -v -s + + From 6395203923972cb0129e4dcc5bf80937ca5e00b1 Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Wed, 19 Jul 2023 09:03:30 -0600 Subject: [PATCH 2/2] CI: give the sanitizers CI job a clearer name --- .../{linux_asan.yml => linux_compiler_sanitizers.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{linux_asan.yml => linux_compiler_sanitizers.yml} (95%) diff --git a/.github/workflows/linux_asan.yml b/.github/workflows/linux_compiler_sanitizers.yml similarity index 95% rename from .github/workflows/linux_asan.yml rename to .github/workflows/linux_compiler_sanitizers.yml index c8c8fbd7af53..ad5884765a38 100644 --- a/.github/workflows/linux_asan.yml +++ b/.github/workflows/linux_compiler_sanitizers.yml @@ -1,4 +1,4 @@ -name: Test Address Sanitizer Build (Linux) +name: Test with compiler sanitizers (Linux) on: pull_request: @@ -21,7 +21,7 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: - meson_sanitizers: + gcc_sanitizers: if: "github.repository == 'numpy/numpy'" runs-on: ubuntu-latest steps: