Skip to content

Commit b5eed8c

Browse files
authored
[3.13] Merge TSAN test matrices in CI (#123278) (#129673)
1 parent 8529d64 commit b5eed8c

File tree

3 files changed

+33
-36
lines changed

3 files changed

+33
-36
lines changed

Diff for: .github/workflows/build.yml

+9-17
Original file line numberDiff line numberDiff line change
@@ -539,26 +539,20 @@ jobs:
539539
run: xvfb-run make test
540540

541541
build_tsan:
542-
name: 'Thread sanitizer'
543-
needs: check_source
544-
if: needs.check_source.outputs.run_tests == 'true'
545-
uses: ./.github/workflows/reusable-tsan.yml
546-
with:
547-
config_hash: ${{ needs.check_source.outputs.config_hash }}
548-
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
549-
suppressions_path: Tools/tsan/supressions.txt
550-
tsan_logs_artifact_name: tsan-logs-default
551-
552-
build_tsan_free_threading:
553-
name: 'Thread sanitizer (free-threading)'
542+
name: >-
543+
Thread sanitizer
544+
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
554545
needs: check_source
555546
if: needs.check_source.outputs.run_tests == 'true'
547+
strategy:
548+
matrix:
549+
free-threading:
550+
- false
551+
- true
556552
uses: ./.github/workflows/reusable-tsan.yml
557553
with:
558554
config_hash: ${{ needs.check_source.outputs.config_hash }}
559-
options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
560-
suppressions_path: Tools/tsan/suppressions_free_threading.txt
561-
tsan_logs_artifact_name: tsan-logs-free-threading
555+
free-threading: ${{ matrix.free-threading }}
562556

563557
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
564558
cifuzz:
@@ -618,7 +612,6 @@ jobs:
618612
- test_hypothesis
619613
- build_asan
620614
- build_tsan
621-
- build_tsan_free_threading
622615
- cifuzz
623616

624617
runs-on: ubuntu-latest
@@ -652,7 +645,6 @@ jobs:
652645
build_windows,
653646
build_asan,
654647
build_tsan,
655-
build_tsan_free_threading,
656648
'
657649
|| ''
658650
}}

Diff for: .github/workflows/reusable-tsan.yml

+24-19
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@ on:
66
config_hash:
77
required: true
88
type: string
9-
options:
10-
required: true
11-
type: string
12-
suppressions_path:
13-
description: 'A repo relative path to the suppressions file'
14-
required: true
15-
type: string
16-
tsan_logs_artifact_name:
17-
description: 'Name of the TSAN logs artifact. Must be unique for each job.'
18-
required: true
19-
type: string
9+
free-threading:
10+
description: Whether to use free-threaded mode
11+
required: false
12+
type: boolean
13+
default: false
2014

2115
env:
2216
FORCE_COLOR: 1
@@ -26,9 +20,6 @@ jobs:
2620
name: 'Thread sanitizer'
2721
runs-on: ubuntu-24.04
2822
timeout-minutes: 60
29-
env:
30-
OPTIONS: ${{ inputs.options }}
31-
SUPPRESSIONS_PATH: ${{ inputs.suppressions_path }}
3223
steps:
3324
- uses: actions/checkout@v4
3425
with:
@@ -55,9 +46,13 @@ jobs:
5546
sudo sysctl -w vm.mmap_rnd_bits=28
5647
- name: TSAN Option Setup
5748
run: |
58-
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/${SUPPRESSIONS_PATH} handle_segv=0" >> $GITHUB_ENV
59-
echo "CC=clang" >> $GITHUB_ENV
60-
echo "CXX=clang++" >> $GITHUB_ENV
49+
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/Tools/tsan/suppressions${{
50+
fromJSON(inputs.free-threading)
51+
&& '_free_threading'
52+
|| ''
53+
}}.txt handle_segv=0" >> "$GITHUB_ENV"
54+
echo "CC=clang" >> "$GITHUB_ENV"
55+
echo "CXX=clang++" >> "$GITHUB_ENV"
6156
- name: Add ccache to PATH
6257
run: |
6358
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
@@ -67,7 +62,12 @@ jobs:
6762
save: ${{ github.event_name == 'push' }}
6863
max-size: "200M"
6964
- name: Configure CPython
70-
run: "${OPTIONS}"
65+
run: >-
66+
./configure
67+
--config-cache
68+
--with-thread-sanitizer
69+
--with-pydebug
70+
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
7171
- name: Build CPython
7272
run: make -j4
7373
- name: Display build info
@@ -81,6 +81,11 @@ jobs:
8181
if: always()
8282
uses: actions/upload-artifact@v4
8383
with:
84-
name: ${{ inputs.tsan_logs_artifact_name }}
84+
name: >-
85+
tsan-logs-${{
86+
fromJSON(inputs.free-threading)
87+
&& 'free-threading'
88+
|| 'default'
89+
}}
8590
path: tsan_log.*
8691
if-no-files-found: ignore
File renamed without changes.

0 commit comments

Comments
 (0)