2024-10-10 14:39:53 +02:00
|
|
|
name: Reusable Thread Sanitizer
|
|
|
|
|
2024-03-16 11:10:37 +01:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
config_hash:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
options:
|
|
|
|
required: true
|
|
|
|
type: string
|
2024-04-15 18:08:25 +02:00
|
|
|
suppressions_path:
|
|
|
|
description: 'A repo relative path to the suppressions file'
|
|
|
|
required: true
|
|
|
|
type: string
|
2024-05-10 23:54:23 +02:00
|
|
|
tsan_logs_artifact_name:
|
|
|
|
description: 'Name of the TSAN logs artifact. Must be unique for each job.'
|
|
|
|
required: true
|
|
|
|
type: string
|
2024-03-16 11:10:37 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_tsan_reusable:
|
|
|
|
name: 'Thread sanitizer'
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Runner image version
|
|
|
|
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
|
|
|
- name: Restore config.cache
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: config.cache
|
|
|
|
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
|
|
|
|
- name: Install Dependencies
|
|
|
|
run: |
|
|
|
|
sudo ./.github/workflows/posix-deps-apt.sh
|
2024-05-07 11:04:01 +02:00
|
|
|
# Install clang-18
|
|
|
|
wget https://apt.llvm.org/llvm.sh
|
|
|
|
chmod +x llvm.sh
|
2024-07-30 17:30:52 +02:00
|
|
|
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
|
2024-03-16 11:10:37 +01:00
|
|
|
# Reduce ASLR to avoid TSAN crashing
|
|
|
|
sudo sysctl -w vm.mmap_rnd_bits=28
|
|
|
|
- name: TSAN Option Setup
|
|
|
|
run: |
|
2024-05-10 23:54:23 +02:00
|
|
|
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/${{ inputs.suppressions_path }} handle_segv=0" >> $GITHUB_ENV
|
2024-03-16 11:10:37 +01:00
|
|
|
echo "CC=clang" >> $GITHUB_ENV
|
|
|
|
echo "CXX=clang++" >> $GITHUB_ENV
|
|
|
|
- name: Add ccache to PATH
|
|
|
|
run: |
|
|
|
|
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
|
|
|
|
- name: Configure ccache action
|
|
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
|
|
with:
|
|
|
|
save: ${{ github.event_name == 'push' }}
|
|
|
|
max-size: "200M"
|
|
|
|
- name: Configure CPython
|
|
|
|
run: ${{ inputs.options }}
|
|
|
|
- name: Build CPython
|
|
|
|
run: make -j4
|
|
|
|
- name: Display build info
|
|
|
|
run: make pythoninfo
|
|
|
|
- name: Tests
|
|
|
|
run: ./python -m test --tsan -j4
|
2024-05-10 23:54:23 +02:00
|
|
|
- name: Display TSAN logs
|
|
|
|
if: always()
|
|
|
|
run: find ${GITHUB_WORKSPACE} -name 'tsan_log.*' | xargs head -n 1000
|
|
|
|
- name: Archive TSAN logs
|
|
|
|
if: always()
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: ${{ inputs.tsan_logs_artifact_name }}
|
|
|
|
path: tsan_log.*
|
|
|
|
if-no-files-found: ignore
|