File: tsan.yml

package info (click to toggle)
ocaml 5.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 44,372 kB
  • sloc: ml: 370,196; ansic: 52,820; sh: 27,396; asm: 5,462; makefile: 3,679; python: 974; awk: 278; javascript: 273; perl: 59; fortran: 21; cs: 9
file content (103 lines) | stat: -rw-r--r-- 4,001 bytes parent folder | download | duplicates (2)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Build the compiler and run the testsuite with ThreadSanitizer, if PR is
# labelled with run-thread-sanitizer
name: Run testsuite with ThreadSanitizer
on:
  pull_request:
    types: [opened, synchronize, reopened, labeled, unlabeled]

# Restrict the GITHUB_TOKEN
permissions: {}

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
# Concurrent workflows are grouped by the PR or branch that triggered them
# (github.ref) and the name of the workflow (github.workflow). The
# 'cancel-in-progress' option then make sure that only one workflow is running
# at a time. This doesn't prevent new jobs from running, rather it cancels
# already running jobs before scheduling new jobs.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'pull_request' || github.sha }}
  cancel-in-progress: true

jobs:
# This job will do the initial build of the compiler (on linux).
# We then upload the compiler tree as a build artifact to enable re-use in
# subsequent jobs.
  build:
    if: contains(github.event.pull_request.labels.*.name, 'run-thread-sanitizer')
    runs-on: 'ubuntu-latest'
    outputs:
      manual_changed: ${{ steps.manual.outputs.manual_changed }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          persist-credentials: false
      - name: Install libunwind
        run: |
          sudo apt-get update -y
          sudo apt-get install -y libunwind-dev
      # This temporary workaround reduces the number of random bits for the base
      # address of vma regions for mmap allocation, to avoid the
      # "FATAL: ThreadSanitizer: unexpected memory mapping" TSan error.
      # See:  https://github.com/google/sanitizers/issues/1716
      - name: Tune vm.mmap_rnd_bits value for TSan
        run: sudo sysctl vm.mmap_rnd_bits=28
      - name: Configure tree
        run: |
          MAKE_ARG=-j CONFIG_ARG='--enable-cmm-invariants --enable-dependency-generation --enable-native-toplevel --enable-tsan --enable-ocamltest CPPFLAGS=-DTSAN_INSTRUMENT_ALL' OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh configure
      - name: Build
        run: |
          MAKE_ARG=-j bash -xe tools/ci/actions/runner.sh build
      - name: Prepare Artifact
        run: tar --zstd -cf /tmp/sources.tar.zstd .
      - name: Upload Artifact
        uses: actions/upload-artifact@v4
        with:
          name: compiler
          path: /tmp/sources.tar.zstd
          retention-days: 1

# Testsuite run jobs:
# normal: Run the full testsuite
# debug: Run the full testsuite with the debug runtime and minor heap
#        verification.
  normal:
    if: contains(github.event.pull_request.labels.*.name, 'run-thread-sanitizer')
    name: ${{ matrix.name }}
    needs: build
    runs-on: ubuntu-latest
    strategy:
      matrix:
        include:
          - id: normal
            name: normal
            dependencies: libunwind-dev
          - id: debug
            name: debug runtime
            dependencies: libunwind-dev
    steps:
      - name: Download Artifact
        uses: actions/download-artifact@v4
        with:
          name: compiler
      - name: Unpack Artifact
        run: |
          tar --zstd -xf sources.tar.zstd
          rm -f sources.tar.zstd
      - name: Packages
        if: matrix.dependencies != ''
        run: |
          sudo apt-get update -y
          sudo apt-get install -y ${{ matrix.dependencies }}
      - name: Run the testsuite
        if: matrix.id == 'normal'
        # Run testsuite with 30-minute timeout per test
        run: |
          TIMEOUT=1800 TSAN_OPTIONS=history_size=6 OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh test_sequential
      - name: Run the testsuite (debug runtime)
        if: matrix.id == 'debug'
        env:
          OCAMLRUNPARAM: v=0,V=1
          USE_RUNTIME: d
        run: |
          bash -cxe "TSAN_OPTIONS=history_size=6 SHOW_TIMINGS=1 tools/ci/actions/runner.sh test_sequential"