CMake changes and simple testing system

This commit is contained in:
DepressedTWM 2026-07-31 20:38:42 +04:00
parent 145a76d300
commit 4c430bcebc
2 changed files with 40 additions and 2 deletions

View file

@ -324,12 +324,17 @@ else()
endif() endif()
if(SANITIZERS) if(SANITIZERS)
set(SANITIZERS "address,undefined,leak,shift,shift-base,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,signed-integer-overflow,bounds,bounds-strict,alignment,object-size,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin,pointer-subtract,pointer-compare") set(SANITIZERS "undefined,leak,shift,shift-base,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,signed-integer-overflow,bounds,bounds-strict,alignment,object-size,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin,pointer-subtract,pointer-compare")
add_compile_options(-fsanitize=${SANITIZERS}) add_compile_options(-fsanitize=${SANITIZERS})
add_link_options(-fsanitize=${SANITIZERS}) add_link_options(-fsanitize=${SANITIZERS})
endif() endif()
if(DEBUG) if(DEBUG)
add_compile_options(-g3 -fno-omit-frame-pointer) add_compile_options(
-g3
-fno-omit-frame-pointer
-Og
-Wall
-Wextra)
else() else()
add_compile_options( add_compile_options(
-O2 -O2

33
tests.sh Normal file
View file

@ -0,0 +1,33 @@
#!/bin/bash
set -euo pipefail
FASTERER_PATH="$1"
check_file() {
local f="$1"
case "$f" in
*.c|*.cc|*.cpp|*.cxx)
cppcheck --check-level=exhaustive --disable=missingInclude --enable=all --force -q -I . "$f" \
|| echo "cppcheck is not installed or reported issues for: $f"
gcc -fanalyzer -Wall -Wextra -Wpedantic -std=c11 -c "$f" -o /dev/null 2>/dev/null \
|| echo "gcc is not installed or analyzer reported issues for: $f"
cbmc "$f" \
|| echo "cbmc is not installed or reported issues for: $f"
;;
*.h|*.hh|*.hpp|*.hxx)
cppcheck --check-level=exhaustive --enable=all --disable=missingInclude -q "$f" \
|| echo "cppcheck is not installed or reported issues for header: $f"
;;
esac
}
export -f check_file
find . -type f \( \
-name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.cxx' \
-o -name '*.h' -o -name '*.hh' -o -name '*.hpp' -o -name '*.hxx' \
\) -print0 \
| xargs -0 -n 1 bash -c 'check_file "$1"' _
find . | grep .rb | $FASTERER_PATH