-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
[3.13] GH-111758: Merge TSan and UBSan reusable GHA workflows (#136820) #137029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
webknjaz
wants to merge
1
commit into
python:3.13
Choose a base branch
from
webknjaz:backport-65d2c51-3.13
base: 3.13
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+130
−7
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: Reusable Sanitizer | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
sanitizer: | ||
required: true | ||
type: string | ||
config_hash: | ||
required: true | ||
type: string | ||
free-threading: | ||
description: Whether to use free-threaded mode | ||
required: false | ||
type: boolean | ||
default: false | ||
|
||
env: | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
build-san-reusable: | ||
name: >- | ||
${{ inputs.sanitizer }}${{ | ||
inputs.free-threading | ||
&& ' (free-threading)' | ||
|| '' | ||
}} | ||
runs-on: ubuntu-24.04 | ||
timeout-minutes: 60 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Runner image version | ||
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV" | ||
- name: Restore config.cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: config.cache | ||
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.sanitizer }}-${{ inputs.config_hash }} | ||
- name: Install dependencies | ||
run: | | ||
sudo ./.github/workflows/posix-deps-apt.sh | ||
# Install clang | ||
wget https://apt.llvm.org/llvm.sh | ||
chmod +x llvm.sh | ||
if [ "${SANITIZER}" = "TSan" ]; then | ||
sudo ./llvm.sh 17 # gh-121946: llvm-18 package is temporarily broken | ||
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100 | ||
sudo update-alternatives --set clang /usr/bin/clang-17 | ||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100 | ||
sudo update-alternatives --set clang++ /usr/bin/clang++-17 | ||
# Reduce ASLR to avoid TSan crashing | ||
sudo sysctl -w vm.mmap_rnd_bits=28 | ||
else | ||
sudo ./llvm.sh 20 | ||
fi | ||
- name: Sanitizer option setup | ||
run: | | ||
if [ "${SANITIZER}" = "TSan" ]; then | ||
echo "TSAN_OPTIONS=${SAN_LOG_OPTION} suppressions=${GITHUB_WORKSPACE}/Tools/tsan/suppressions${{ | ||
fromJSON(inputs.free-threading) | ||
&& '_free_threading' | ||
|| '' | ||
}}.txt handle_segv=0" >> "$GITHUB_ENV" | ||
else | ||
echo "UBSAN_OPTIONS=${SAN_LOG_OPTION}" >> "$GITHUB_ENV" | ||
fi | ||
echo "CC=clang" >> "$GITHUB_ENV" | ||
echo "CXX=clang++" >> "$GITHUB_ENV" | ||
env: | ||
SANITIZER: ${{ inputs.sanitizer }} | ||
SAN_LOG_OPTION: log_path=${{ github.workspace }}/san_log | ||
- name: Add ccache to PATH | ||
run: | | ||
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV" | ||
- name: Configure ccache action | ||
uses: hendrikmuhs/[email protected] | ||
with: | ||
save: ${{ github.event_name == 'push' }} | ||
max-size: "200M" | ||
- name: Configure CPython | ||
run: >- | ||
./configure | ||
--config-cache | ||
${{ | ||
inputs.sanitizer == 'TSan' | ||
&& '--with-thread-sanitizer' | ||
|| '--with-undefined-behavior-sanitizer' | ||
}} | ||
--with-pydebug | ||
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} | ||
- name: Build CPython | ||
run: make -j4 | ||
- name: Display build info | ||
run: make pythoninfo | ||
- name: Tests | ||
run: >- | ||
./python -m test | ||
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }} | ||
-j4 | ||
- name: Display logs | ||
if: always() | ||
run: find "${GITHUB_WORKSPACE}" -name 'san_log.*' | xargs head -n 1000 | ||
- name: Archive logs | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: >- | ||
${{ inputs.sanitizer }}-logs-${{ | ||
fromJSON(inputs.free-threading) | ||
&& 'free-threading' | ||
|| 'default' | ||
}} | ||
path: san_log.* | ||
if-no-files-found: ignore |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not remove the
reusable-tsan.yml
file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@encukou because the goal is to keep the infra across branches as close as possible. It's easier to maintain if every branch doesn't diverge too much. It's also less likely to cause conflicts when automatic backporting is triggered.
This is primarily a maintainability-focused change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused. The file doesn't exist in 3.14 & main. Is this about being close to 3.12?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An unused file doesn't sound good for maintainability.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was renamed from
tsan
to justsan
in #136820. This patch backports that renaming bit. It backported cleanly to 3.14 via #136883 but for 3.13 I've filed this manual backport with fewer changes.