Skip to content

Commit 1ff5ad1

Browse files
committed
ci: add thread sanitizer job
1 parent ff5141c commit 1ff5ad1

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
config: [default, llvm, gnu32]
14+
config: [default, llvm, gnu32, tsan]
1515

1616
name: build • ${{ matrix.config }}
1717

ci/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ To run jobs locally:
1919
CI_CONFIG=ci/configs/default.sh ci/scripts/run.sh
2020
CI_CONFIG=ci/configs/llvm.sh ci/scripts/run.sh
2121
CI_CONFIG=ci/configs/gnu32.sh ci/scripts/run.sh
22+
CI_CONFIG=ci/configs/tsan.sh ci/scripts/run.sh
2223
```
2324

2425
By default CI jobs will reuse their build directories. `CI_CLEAN=1` can be specified to delete them before running instead.

ci/configs/tsan.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CI_DESC="CI job running thread sanitizer"
2+
CI_DIR=build-tsan
3+
export CXX=clang++
4+
export CXXFLAGS="-ggdb -Werror -Wall -Wextra -Wpedantic -Wthread-safety-analysis -Wno-unused-parameter -fsanitize=thread"
5+
CMAKE_ARGS=()
6+
BUILD_ARGS=(-k -j4)
7+
BUILD_TARGETS=(mptest)

ci/scripts/ci.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ set -o errexit -o nounset -o pipefail -o xtrace
44
[ "${CI_CONFIG+x}" ] && source "$CI_CONFIG"
55

66
: "${CI_DIR:=build}"
7+
if ! [ -v BUILD_TARGETS ]; then
8+
BUILD_TARGETS=(all tests mpexamples)
9+
fi
710

811
[ -n "${CI_CLEAN-}" ] && rm -rf "${CI_DIR}"
912

1013
cmake -B "$CI_DIR" "${CMAKE_ARGS[@]+"${CMAKE_ARGS[@]}"}"
11-
cmake --build "$CI_DIR" -t all tests mpexamples -- "${BUILD_ARGS[@]+"${BUILD_ARGS[@]}"}"
14+
cmake --build "$CI_DIR" -t "${BUILD_TARGETS[@]}" -- "${BUILD_ARGS[@]+"${BUILD_ARGS[@]}"}"
1215
ctest --test-dir "$CI_DIR" --output-on-failure

0 commit comments

Comments
 (0)