add a sanitizer build #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Memory Sanitizer | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: msan-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| msan: | |
| name: MSan | |
| runs-on: ubuntu-latest | |
| container: | |
| image: helics/buildenv:sanitizers-22 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Mark workspace as safe for git | |
| run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - name: Install SuiteSparse build dependencies | |
| shell: bash | |
| run: | | |
| apt-get update | |
| apt-get install -y libblas-dev liblapack-dev libunwind-dev | |
| - name: Prepare MSan runtime libraries | |
| shell: bash | |
| run: | | |
| libunwind_path="$(ldconfig -p | awk '/libunwind\.so/ { print $NF; exit }')" | |
| if [ -z "${libunwind_path}" ]; then | |
| echo "Unable to locate a libunwind shared library" | |
| exit 1 | |
| fi | |
| if [ ! -e /root/develop/libcxx_msan/lib/libunwind.so.1 ]; then | |
| ln -s "${libunwind_path}" /root/develop/libcxx_msan/lib/libunwind.so.1 | |
| fi | |
| - name: Configure | |
| shell: bash | |
| run: > | |
| cmake -S . -B build | |
| -DCMAKE_C_COMPILER=clang | |
| -DCMAKE_CXX_COMPILER=clang++ | |
| -DCMAKE_C_FLAGS="-fsanitize=memory -fsanitize-ignorelist=${GITHUB_WORKSPACE}/config/msan_ignorelist.txt -fno-omit-frame-pointer -g -O1" | |
| -DCMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-ignorelist=${GITHUB_WORKSPACE}/config/msan_ignorelist.txt -nostdinc++ -nostdlib++ -L/root/develop/libcxx_msan/lib -lc++ -lc++abi -I/root/develop/libcxx_msan/include -I/root/develop/libcxx_msan/include/c++/v1 -Wno-unused-command-line-argument -Wno-reserved-identifier -Wno-reserved-macro-identifier -fno-omit-frame-pointer -g -O1 -Wl,-rpath=/root/develop/libcxx_msan/lib" | |
| -DBUILD_TESTING=ON | |
| -DGRIDDYN_BUILD_TESTS=ON | |
| -DGRIDDYN_SUITESPARSE_FORCE_SUBPROJECT=ON | |
| -DGRIDDYN_ENABLE_FMI=OFF | |
| -DGRIDDYN_ENABLE_HELICS_EXECUTABLE=OFF | |
| - name: Build | |
| shell: bash | |
| run: cmake --build build --parallel 4 | |
| - name: Run MSan tests | |
| shell: bash | |
| run: LD_LIBRARY_PATH="/root/develop/libcxx_msan/lib:/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}" ctest --test-dir build --output-on-failure -L Continuous |