Skip to content

Clang Sanitizer

Clang Sanitizer #44

Workflow file for this run

name: Clang Sanitizer
on:
workflow_dispatch:
inputs:
cmakeextra:
description: "Extra CMake options"
required: false
default: ""
sanitizer:
description: 'Sanitizer to run'
required: true
default: 'address'
# caution: memory sanitizer is currently broken with Catch
options: ['address', 'thread', 'memory', 'undefined']
type: choice
defaults:
run:
shell: bash
env:
LLVM_VERSION: 17
jobs:
build:
name: "${{ github.event.inputs.sanitizer }}"
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- name: Install build toolchain
run: |
curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/llvm.gpg
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-$LLVM_VERSION main" | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt update
sudo apt install -y libpugixml-dev clang-$LLVM_VERSION gdb
- name: Configure CMake
run: |
# linking a C++ library to a C program fails with ubsan enabled; disable lslver for this run
sed -i -e'/lslver/d' CMakeLists.txt
cmake --version
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=clang-$LLVM_VERSION \
-DCMAKE_{CXX_COMPILER,LINKER}=clang++-$LLVM_VERSION \
-DCMAKE_{C,CXX,EXE_LINKER,SHARED_LINKER}_FLAGS="-fsanitize=${{ github.event.inputs.sanitizer }}" \
-DLSL_COMFY_DEFAULTS=ON \
-DLSL_UNITTESTS=ON \
-DLSL_BENCHMARKS=ON \
-DLSL_BUILD_EXAMPLES=OFF \
-DLSL_BUNDLED_PUGIXML=OFF \
-DLSL_SLIMARCHIVE=ON \
-DLSL_OPTIMIZATIONS=ON \
-Dlslgitrevision=${{ github.sha }} \
-Dlslgitbranch=${{ github.ref }} \
${{ github.event.inputs.cmakeextra }}
echo ${PWD}
- name: make
run: cmake --build build --config RelWithDebInfo -j
- name: run unit tests
run: |
# alias gdbwrap="gdb --batch -ex 'run --order rand --wait-for-keypress never --durations yes' -ex 'thread apply all bt' -return-child-result"
gdb --batch -ex 'run --order rand --wait-for-keypress never --durations yes' -ex 'thread apply all bt' -return-child-result build/testing/lsl_test_internal
gdb --batch -ex 'run --order rand --wait-for-keypress never --durations yes' -ex 'thread apply all bt' -return-child-result build/testing/lsl_test_exported
timeout-minutes: 15