8000 Merge TSAN test matrices in CI · python/cpython@7593210 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7593210

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 379ab85 commit 7593210

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -512,26 +512,20 @@ jobs:
512512
run: xvfb-run make ci
513513

514514
build_tsan:
515-
name: 'Thread sanitizer'
516-
needs: check_source
517-
if: needs.check_source.outputs.run_tests == 'true'
518-
uses: ./.github/workflows/reusable-tsan.yml
519-
with:
520-
config_hash: ${{ needs.check_source.outputs.config_hash }}
521-
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
522-
suppressions_path: Tools/tsan/supressions.txt
523-
tsan_logs_artifact_name: tsan-logs-default
524-
525-
build_tsan_free_threading:
526-
name: 'Thread sanitizer (free-threading)'
515+
name: >-
516+
Thread sanitizer
517+
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
527518
needs: check_source
528519
if: needs.check_source.outputs.run_tests == 'true'
520+
strategy:
521+
matrix:
522+
free-threading:
523+
- false
524+
- true
529525
uses: ./.github/workflows/reusable-tsan.yml
530526
with:
531527
config_hash: ${{ needs.check_source.outputs.config_hash }}
532-
options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
533-
suppressions_path: Tools/tsan/suppressions_free_threading.txt
534-
tsan_logs_artifact_name: tsan-logs-free-threading
528+
free-threading: ${{ matrix.free-threading }}
535529

536530
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
537531
cifuzz:
@@ -591,7 +585,6 @@ jobs:
591585
- test_hypothesis
592586
- build_asan
593587
- build_tsan
594-
- build_tsan_free_threading
595588
- cifuzz
596589

597590
runs-on: ubuntu-latest
@@ -625,7 +618,6 @@ jobs:
625618
build_windows,
626619
build_asan,
627620
build_tsan,
628-
build_tsan_free_threading,
629621
'
630622
|| ''
631623
}}

.github/workflows/reusable-tsan.yml

Lines changed: 22 additions & 17 deletions
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,7 +46,11 @@ 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"
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"
5954
echo "CC=clang" >> "$GITHUB_ENV"
6055
echo "CXX=clang++" >> "$GITHUB_ENV"
6156
- name: Add ccache to PATH
@@ -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

0 commit comments

Comments
 (0)
0