mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
CMake changes and simple testing system
This commit is contained in:
parent
145a76d300
commit
4c430bcebc
2 changed files with 40 additions and 2 deletions
|
|
@ -324,12 +324,17 @@ else()
|
|||
|
||||
endif()
|
||||
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_link_options(-fsanitize=${SANITIZERS})
|
||||
endif()
|
||||
if(DEBUG)
|
||||
add_compile_options(-g3 -fno-omit-frame-pointer)
|
||||
add_compile_options(
|
||||
-g3
|
||||
-fno-omit-frame-pointer
|
||||
-Og
|
||||
-Wall
|
||||
-Wextra)
|
||||
else()
|
||||
add_compile_options(
|
||||
-O2
|
||||
|
|
|
|||
33
tests.sh
Normal file
33
tests.sh
Normal 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
|
||||
Loading…
Reference in a new issue