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

GHA Workflow for running tests under a more strict memory checking environment #398

Merged
merged 7 commits into from
May 18, 2023
Merged
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
51 changes: 51 additions & 0 deletions .github/workflows/sanitizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Sanitize

on: workflow_dispatch

env:
CAREFUL_VER: v0.3.4

jobs:
cargo-careful:
runs-on: ubuntu-latest
container:
image: ghcr.io/osgeo/gdal:ubuntu-full-3.6.4

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install build deps
shell: bash
# Note: clang, etc. are needed so cargo-careful can build std with extra checks enabled
run: |
apt-get update -y
apt-get install build-essential pkg-config libclang-dev curl -y
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --profile minimal --default-toolchain none -y
echo "${HOME}/.cargo/bin" >> $GITHUB_PATH

- name: Setup building
run: |
export CC="clang-9"
export CXX="clang++-9"

- name: Install Rust nightly
run: |
rustup toolchain install nightly --profile minimal --component rust-src
rustup override set nightly

- name: Install cargo-careful
run: |
CAREFUL=${HOME}/.cargo/bin/cargo-careful
curl -Lo "${CAREFUL}" https://github.com/RalfJung/cargo-careful/releases/download/${CAREFUL_VER}/cargo-careful.x86_64-unknown-linux-musl
chmod +x "${CAREFUL}"
cargo careful setup

- name: Run tests with careful
env:
# See: https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags
# Note: because we don't build GDAL with sanitizers, we need to turn off
# leak detection, otherwise it'll report memory leak false positives
ASAN_OPTIONS: verbose=0:atexit=1:detect_stack_use_after_return=1:strict_string_checks=1:detect_leaks=0
run: |
cargo careful test -Zbuild-std --all -Zcareful-sanitizer