Skip to content

Commit 5779c18

Browse files
committed
Merge TSAN test matrices in CI
Previously, they were duplicated, with custom commands being passed to the same reusable workflow. This patch moves the commands in and adds a matrix resembling the interface of other reusable workflows.
1 parent 556e855 commit 5779c18

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -432,26 +432,20 @@ jobs:
432432
run: xvfb-run make test
433433

434434
build_tsan:
435-
name: 'Thread sanitizer'
436-
needs: check_source
437-
if: needs.check_source.outputs.run_tests == 'true'
438-
uses: ./.github/workflows/reusable-tsan.yml
439-
with:
440-
config_hash: ${{ needs.check_source.outputs.config_hash }}
441-
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
442-
suppressions_path: Tools/tsan/supressions.txt
443-
tsan_logs_artifact_name: tsan-logs-default
444-
445-
build_tsan_free_threading:
446-
name: 'Thread sanitizer (free-threading)'
435+
name: >-
436+
Thread sanitizer
437+
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
447438
needs: check_source
448439
if: needs.check_source.outputs.run_tests == 'true'
440+
strategy:
441+
matrix:
442+
free-threading:
443+
- false
444+
- true
449445
uses: ./.github/workflows/reusable-tsan.yml
450446
with:
451447
config_hash: ${{ needs.check_source.outputs.config_hash }}
452-
options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
453-
suppressions_path: Tools/tsan/suppressions_free_threading.txt
454-
tsan_logs_artifact_name: tsan-logs-free-threading
448+
free-threading: ${{ matrix.free-threading }}
455449

456450
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
457451
cifuzz:
@@ -510,7 +504,6 @@ jobs:
510504
- test_hypothesis
511505
- build_asan
512506
- build_tsan
513-
- build_tsan_free_threading
514507
- cifuzz
515508

516509
runs-on: ubuntu-latest
@@ -543,7 +536,6 @@ jobs:
543536
build_windows,
544537
build_asan,
545538
build_tsan,
546-
build_tsan_free_threading,
547539
'
548540
|| ''
549541
}}

.github/workflows/reusable-tsan.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@ on:
44
config_hash:
55
required: true
66
type: string
7-
options:
8-
required: true
9-
type: string
10-
suppressions_path:
11-
description: 'A repo relative path to the suppressions file'
12-
required: true
13-
type: string
14-
tsan_logs_artifact_name:
15-
description: 'Name of the TSAN logs artifact. Must be unique for each job.'
16-
required: true
17-
type: string
7+
free-threading:
8+
description: Whether to use free-threaded mode
9+
required: false
10+
type: boolean
11+
default: false
1812

1913
jobs:
2014
build_tsan_reusable:
@@ -45,7 +39,11 @@ jobs:
4539
sudo sysctl -w vm.mmap_rnd_bits=28
4640
- name: TSAN Option Setup
4741
run: |
48-
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/${{ inputs.suppressions_path }} handle_segv=0" >> $GITHUB_ENV
42+
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/Tools/tsan/suppressions${{
43+
fromJSON(inputs.free-threading)
44+
&& '_free_threading'
45+
|| ''
46+
}}.txt handle_segv=0" >> $GITHUB_ENV
4947
echo "CC=clang" >> $GITHUB_ENV
5048
echo "CXX=clang++" >> $GITHUB_ENV
5149
- name: Add ccache to PATH
@@ -57,7 +55,12 @@ jobs:
5755
save: ${{ github.event_name == 'push' }}
5856
max-size: "200M"
5957
- name: Configure CPython
60-
run: ${{ inputs.options }}
58+
run: >-
59+
./configure
60+
--config-cache
61+
--with-thread-sanitizer
62+
--with-pydebug
63+
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
6164
- name: Build CPython
6265
run: make -j4
6366
- name: Display build info
@@ -71,6 +74,11 @@ jobs:
7174
if: always()
7275
uses: actions/upload-artifact@v4
7376
with:
74-
name: ${{ inputs.tsan_logs_artifact_name }}
77+
name: >-
78+
tsan-logs-${{
79+
fromJSON(inputs.free-threading)
80+
&& 'free-threading'
81+
|| 'default'
82+
}}
7583
path: tsan_log.*
7684
if-no-files-found: ignore

0 commit comments

Comments
 (0)