From e8f2d3d03dd234dd422af6d131b3bc88258cf83c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=87=BA=F0=9F=87=A6=20Sviatoslav=20Sydorenko=20=28?= =?UTF-8?q?=D0=A1=D0=B2=D1=8F=D1=82=D0=BE=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A1?= =?UTF-8?q?=D0=B8=D0=B4=D0=BE=D1=80=D0=B5=D0=BD=D0=BA=D0=BE=29?= Date: Wed, 29 Jan 2025 10:16:51 +0100 Subject: [PATCH] Merge TSAN test matrices in CI (#123278) (cherry picked from commit 03d9cdb7298cdbf67535dfeb3af5c1a619be7580) --- .github/workflows/build.yml | 26 ++++------- .github/workflows/reusable-tsan.yml | 43 +++++++++++-------- .../{supressions.txt => suppressions.txt} | 0 3 files changed, 33 insertions(+), 36 deletions(-) rename Tools/tsan/{supressions.txt => suppressions.txt} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05a2382fccbe25..63ea274755ea37 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -539,26 +539,20 @@ jobs: run: xvfb-run make test build_tsan: - name: 'Thread sanitizer' - needs: check_source - if: needs.check_source.outputs.run_tests == 'true' - uses: ./.github/workflows/reusable-tsan.yml - with: - config_hash: ${{ needs.check_source.outputs.config_hash }} - options: ./configure --config-cache --with-thread-sanitizer --with-pydebug - suppressions_path: Tools/tsan/supressions.txt - tsan_logs_artifact_name: tsan-logs-default - - build_tsan_free_threading: - name: 'Thread sanitizer (free-threading)' + name: >- + Thread sanitizer + ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} needs: check_source if: needs.check_source.outputs.run_tests == 'true' + strategy: + matrix: + free-threading: + - false + - true uses: ./.github/workflows/reusable-tsan.yml with: config_hash: ${{ needs.check_source.outputs.config_hash }} - options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug - suppressions_path: Tools/tsan/suppressions_free_threading.txt - tsan_logs_artifact_name: tsan-logs-free-threading + free-threading: ${{ matrix.free-threading }} # CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/ cifuzz: @@ -618,7 +612,6 @@ jobs: - test_hypothesis - build_asan - build_tsan - - build_tsan_free_threading - cifuzz runs-on: ubuntu-latest @@ -652,7 +645,6 @@ jobs: build_windows, build_asan, build_tsan, - build_tsan_free_threading, ' || '' }} diff --git a/.github/workflows/reusable-tsan.yml b/.github/workflows/reusable-tsan.yml index 47a63be32560bb..4fac8e53820b85 100644 --- a/.github/workflows/reusable-tsan.yml +++ b/.github/workflows/reusable-tsan.yml @@ -6,17 +6,11 @@ on: config_hash: required: true type: string - options: - required: true - type: string - suppressions_path: - description: 'A repo relative path to the suppressions file' - required: true - type: string - tsan_logs_artifact_name: - description: 'Name of the TSAN logs artifact. Must be unique for each job.' - required: true - type: string + free-threading: + description: Whether to use free-threaded mode + required: false + type: boolean + default: false env: FORCE_COLOR: 1 @@ -26,9 +20,6 @@ jobs: name: 'Thread sanitizer' runs-on: ubuntu-24.04 timeout-minutes: 60 - env: - OPTIONS: ${{ inputs.options }} - SUPPRESSIONS_PATH: ${{ inputs.suppressions_path }} steps: - uses: actions/checkout@v4 with: @@ -55,9 +46,13 @@ jobs: sudo sysctl -w vm.mmap_rnd_bits=28 - name: TSAN Option Setup run: | - echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/${SUPPRESSIONS_PATH} handle_segv=0" >> $GITHUB_ENV - echo "CC=clang" >> $GITHUB_ENV - echo "CXX=clang++" >> $GITHUB_ENV + echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/Tools/tsan/suppressions${{ + fromJSON(inputs.free-threading) + && '_free_threading' + || '' + }}.txt handle_segv=0" >> "$GITHUB_ENV" + echo "CC=clang" >> "$GITHUB_ENV" + echo "CXX=clang++" >> "$GITHUB_ENV" - name: Add ccache to PATH run: | echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV @@ -67,7 +62,12 @@ jobs: save: ${{ github.event_name == 'push' }} max-size: "200M" - name: Configure CPython - run: "${OPTIONS}" + run: >- + ./configure + --config-cache + --with-thread-sanitizer + --with-pydebug + ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} - name: Build CPython run: make -j4 - name: Display build info @@ -81,6 +81,11 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: ${{ inputs.tsan_logs_artifact_name }} + name: >- + tsan-logs-${{ + fromJSON(inputs.free-threading) + && 'free-threading' + || 'default' + }} path: tsan_log.* if-no-files-found: ignore diff --git a/Tools/tsan/supressions.txt b/Tools/tsan/suppressions.txt similarity index 100% rename from Tools/tsan/supressions.txt rename to Tools/tsan/suppressions.txt