Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Start using AddressSanitizer (ASan) and UndefinedBehaviorSanitizer (UBSan) #123

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/linux_and_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ jobs:
if: "${{ runner.os == 'Linux' && contains(matrix.cxx, 'clang') }}"
run: |-
sudo apt-get install --yes --no-install-recommends -V \
clang-${{ matrix.clang_major_version }}
clang-${{ matrix.clang_major_version }} \
libclang-rt-${{ matrix.clang_major_version }}-dev

- name: Add versioned aliases for Clang ${{ matrix.clang_major_version }}
if: "${{ runner.os == 'macOS' && contains(matrix.cxx, 'clang') }}"
Expand All @@ -96,7 +97,13 @@ jobs:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: |-
CFLAGS='-std=gnu99 -pedantic -Werror' make
set -x

# ASan: https://clang.llvm.org/docs/AddressSanitizer.html
# UBSan: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
sanitizer='-fsanitize=address,undefined -fno-sanitize-recover=all'

CFLAGS="-std=gnu99 -pedantic -Werror ${sanitizer}" LDFLAGS="${sanitizer}" make

- name: 'Install'
run: |-
Expand Down
3 changes: 2 additions & 1 deletion recordings/record.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ rm -f actual*.*
asciinema_args=(
--cols 90
--rows 20
-c 'timeout -s INT 3s sh -c "{ sleep 0.5; echo \"1 2 3 4\"; sleep 0.5; } | ttyplot -2 -c X"'
# MallocNanoZone=0 is for AddressSanitizer on macOS, see https://stackoverflow.com/a/70209891/11626624 .
-c 'timeout -s INT 5s sh -c "{ sleep 1.5; echo \"1 2 3 4\"; sleep 1.5; } | MallocNanoZone=0 ttyplot -2 -c X"'
-t 'ttyplot waiting, drawing, and shutting down'
)

Expand Down