Skip to content

Commit

Permalink
Add Thread Sanitizer CI/CD
Browse files Browse the repository at this point in the history
------------------------------

ThreadSanitizer is a tool that detects data races. It consists of a compiler instrumentation module and a run-time library.

This help us to identify race conditions within the program. It will have greater coverage if we can mock MMD.
  • Loading branch information
sherry-yuan authored and pcolberg committed Mar 4, 2022
1 parent 0efaa5d commit a7ae1bb
Showing 1 changed file with 99 additions and 0 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/tsan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause

# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

name: thread sanitizer

# https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/
permissions:
# Grant read permissions to repository in case it is not a forked public
# repository, but a private repository that was created manually.
contents: read

# Grant read permissions to private container images.
packages: read

on:
push:
paths:
- '**'
- '!**.md'
- '!**/.clang-format'
- '!**/COPYING'
- '!**/LICENSE'
- '!.github/**'
- '.github/workflows/tsan.yml'
- '!.gitignore'
- '!cmake/manifests/**'
- 'cmake/manifests/linux/**'
- '!container/**'
- '!docs/**'
- '!scripts/**'

pull_request:
paths:
- '**'
- '!**.md'
- '!**/.clang-format'
- '!**/COPYING'
- '!**/LICENSE'
- '!.github/**'
- '.github/workflows/tsan.yml'
- '!.gitignore'
- '!cmake/manifests/**'
- 'cmake/manifests/linux/**'
- '!container/**'
- '!docs/**'
- '!scripts/**'

jobs:
build:
runs-on: ubuntu-20.04

container:
image: ghcr.io/intel/fpga-runtime-for-opencl/ubuntu-20.04-dev:main

continue-on-error: true

steps:
- name: change ownership of workspace to current user
run: sudo chown -R build:build .

- name: checkout code
uses: actions/checkout@v2

- name: query distribution
run: cat /etc/os-release

- name: create build directory
run: mkdir build

- name: create build files
run: |
cd build
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug -DACL_TSAN=ON
env:
CC: gcc
CXX: g++

- name: build runtime
run: |
cd build
ninja -v -k0
- name: test runtime
run: |
cd build
ctest -V
- name: tsan result
uses: actions/upload-artifact@v2
if: always()
with:
name: tsan-report
path: build/Testing/Temporary/LastTest.log

- name: revert ownership of workspace to root
run: sudo chown -R root:root .
if: always()

0 comments on commit a7ae1bb

Please # to comment.