Skip to content

Address Sanitizer

Address Sanitizer #11

Workflow file for this run

name: C++ CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-run:
runs-on: ubuntu-latest
env:
ASAN_OPTIONS: detect_leaks=1 # automatically detect memory leaks
steps:
# 1. Checkout repo
- name: Checkout code
uses: actions/checkout@v4
# 2. Install build tools
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential g++ clang
# 3. Build and run all examples dynamically
- name: Build and run examples
run: |
# Detect folders with Makefile
folders=$(find . -maxdepth 1 -type d -not -name '.' -exec test -f '{}/Makefile' \; -print | sed 's|^\./||')
# List detected folders
echo "Detected example folders: $folders"
# Loop over each folder and sanitizer
for folder in $folders; do
for san in address thread undefined; do
echo "=== Building $folder with sanitizer $san ==="
make -C $folder SANITIZE=$san
echo "=== Running $folder with sanitizer $san ==="
make -C $folder SANITIZE=$san run
done
done