From 7a57f5e8cd21a02148ebe8ac320ef3b192b5a556 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 15 Oct 2024 10:49:31 +0200 Subject: [PATCH] tasks: Properly convert sanitizers to meson --- .github/workflows/build-and-test-all.yml | 12 ++++++------ tasks.py | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-test-all.yml b/.github/workflows/build-and-test-all.yml index a93a8b83410f5..b4d7be90b83a7 100644 --- a/.github/workflows/build-and-test-all.yml +++ b/.github/workflows/build-and-test-all.yml @@ -139,7 +139,7 @@ jobs: needs: get-runner-container-image strategy: matrix: - sanitizers: [ubsan+asan, tsan] + sanitizers: [asan+ubsan, tsan] features: [least, full] exclude: - sanitizers: tsan @@ -214,7 +214,7 @@ jobs: strategy: matrix: builder: [autotools, meson] - sanitizers: [ubsan+asan, tsan] + sanitizers: [asan+ubsan, tsan] features: [least, full] exclude: - sanitizers: tsan @@ -532,7 +532,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - sanitizers: [ubsan+asan, tsan] + sanitizers: [asan+ubsan, tsan] dist_name: [debian] pdns_repo_version: ['48'] container: @@ -578,7 +578,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - sanitizers: [ubsan+asan, tsan] + sanitizers: [asan+ubsan, tsan] dist_name: [debian] pdns_repo_version: ['48'] container: @@ -627,7 +627,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - sanitizers: [ubsan+asan, tsan] + sanitizers: [asan+ubsan, tsan] threads: [1, 2, 3, 4, 8] mthreads: [2048] shards: [1, 2, 1024] @@ -672,7 +672,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - sanitizers: [ubsan+asan, tsan] + sanitizers: [asan+ubsan, tsan] container: image: "${{ needs.get-runner-container-image.outputs.id }}:${{ needs.get-runner-container-image.outputs.tag }}" env: diff --git a/tasks.py b/tasks.py index c9783e915e945..0ec51cc5633a3 100644 --- a/tasks.py +++ b/tasks.py @@ -394,7 +394,22 @@ def ci_docs_add_ssh(c, ssh_key, host_key): def get_sanitizers(meson=False): sanitizers = os.getenv('SANITIZERS', '') if meson: - return f'-D b_sanitize={sanitizers}' if sanitizers != '' else '' + subst = { + 'tsan': 'thread', + 'asan': 'address', + 'ubsan': 'undefined' + } + meson_sanitizers = '' + sanitizers = sanitizers.split('+') + for sanitizer in sanitizers: + if sanitizer in subst: + if meson_sanitizers != '': + meson_sanitizers = meson_sanitizers + ',' + meson_sanitizers = meson_sanitizers + subst[sanitizer] + else: + meson_sanitizers = meson_sanitizers + sanitizer + + return f'-D b_sanitize={meson_sanitizers}' if meson_sanitizers != '' else '' if sanitizers != '': sanitizers = sanitizers.split('+') sanitizers = ['--enable-' + sanitizer for sanitizer in sanitizers]