Add `sanitizers` check: ASan/UBSan (or Miri) are used

Aperta
#10 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cmake, python
Ambito
tooling

Direzione di ricerca

Start by reading the existing checks in the project validator and the referenced cmake/Sanitizers.cmake implementation. Add a sanitizers check that recognizes AddressSanitizer and UndefinedBehaviorSanitizer in CMake files or CI, warns when only one is found, and fails when neither is found. Done means the check passes when both are enabled in at least one configuration; use the existing check tests to verify its outcomes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Check

New check sanitizers. Applies to: C/C++, Rust, Go. Python: SKIP.

Ecosystem Passes when Warns when Fails when
C/C++ AddressSanitizer and UndefinedBehaviorSanitizer are used in at least one configuration (CMake files or CI): -fsanitize=address, -fsanitize=undefined, /fsanitize=address, or cmake_template-style ENABLE_SANITIZER_* options only one of the two neither
Rust CI runs cargo miri test, or builds with -Zsanitizer=address neither
Go CI runs go test -race (the race detector, Go's ThreadSanitizer); -asan / -msan are a bonus not run

ThreadSanitizer / MemorySanitizer are reported as a bonus.

Relation to ci-build-types

ci-build-types already requires each OS/toolchain to build with sanitizers, but it accepts any sanitizer (sanitizers_enabled in project_validator/build_configurations.py). This check is about which sanitizers are used. Reuse and extend _SANITIZERS_ENABLED instead of adding a second detector.

Reference

cmake/Sanitizers.cmake, enabled by default for top-level builds in ProjectOptions.cmake; Miri; Go race detector.


Implementation: a @practice (project_validator/ecosystems/__init__.py) over a new rule type in project_validator/rules.py. Each ecosystem profile (project_validator/ecosystems/<name>.py) supplies its rule; rules that differ by build system go on that BuildSystem (e.g. ecosystems/c_cpp/cmake.py, meson.py). Ecosystems without the rule report SKIP. The check's "Applies to" (README, --list --format json) follows from the registry, so it grows as new profiles add the rule.

Lingua principale
Python
Stelle
4
Fork
1
Merge medio
10h 41m
PR unite (30g)
79

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cpp-best-practices/project_validator

Tutte le issue di cpp-best-practices/project_validator

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.