summaryrefslogtreecommitdiffstats
path: root/.github/workflows/reusable-tsan.yml
blob: 48bd5b547e8cba87846a3f7762eefa942fe49fc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
on:
  workflow_call:
    inputs:
      config_hash:
        required: true
        type: string
      options:
        required: true
        type: string
      suppressions_path:
        description: 'A repo relative path to the suppressions file'
        required: true
        type: string

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
        # Install clang-18
        wget https://apt.llvm.org/llvm.sh
        chmod +x llvm.sh
        sudo ./llvm.sh 18
        sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
        sudo update-alternatives --set clang /usr/bin/clang-18
        sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
        sudo update-alternatives --set clang++ /usr/bin/clang++-18
        # Reduce ASLR to avoid TSAN crashing
        sudo sysctl -w vm.mmap_rnd_bits=28
    - name: TSAN Option Setup
      run: |
        echo "TSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/${{ inputs.suppressions_path }}" >> $GITHUB_ENV
        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