use CMake for sanitizer builds / some CMake command cleanups (#4147)
This commit is contained in:
parent
ce945ec7fc
commit
cfab6aeecf
|
@ -26,27 +26,35 @@ jobs:
|
|||
- name: Install missing software on ubuntu
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y make libpcre3-dev
|
||||
apt-get install -y cmake make libpcre3-dev
|
||||
apt-get install -y clang-14
|
||||
|
||||
- name: Build
|
||||
run: make -j$(nproc) cppcheck testrunner HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
|
||||
- name: CMake
|
||||
run: |
|
||||
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On
|
||||
env:
|
||||
CC: clang-14
|
||||
CXX: clang++-14
|
||||
CXXFLAGS: "-fsanitize=address -O2 -g3 -DCPPCHK_GLIBCXX_DEBUG"
|
||||
CPPFLAGS: "-DCHECK_INTERNAL"
|
||||
|
||||
- name: Build cppcheck
|
||||
run: |
|
||||
cmake --build cmake.output --target cppcheck -- -j $(nproc)
|
||||
|
||||
- name: Build test
|
||||
run: |
|
||||
cmake --build cmake.output --target testrunner -- -j $(nproc)
|
||||
|
||||
- name: Run tests
|
||||
run: ./testrunner
|
||||
|
||||
# TODO: re-enable - was being killed because of incresaed memory usage
|
||||
# - name: Self check
|
||||
# run: |
|
||||
# ec=0
|
||||
# ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
# ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
# ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
# ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
# exit $ec
|
||||
run: ./cmake.output/bin/testrunner
|
||||
|
||||
# TODO: re-enable - was being killed because of incresaed memory usage
|
||||
# TODO: no gui/temp/*.cpp files available
|
||||
- name: Self check
|
||||
if: false
|
||||
run: |
|
||||
ec=0
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
exit $ec
|
||||
|
|
|
@ -43,10 +43,7 @@ jobs:
|
|||
|
||||
- name: Prepare CMake
|
||||
run: |
|
||||
mkdir cmake.output
|
||||
cd cmake.output
|
||||
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off ..
|
||||
cd ..
|
||||
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off
|
||||
env:
|
||||
CC: clang-14
|
||||
CXX: clang++-14
|
||||
|
|
|
@ -25,10 +25,7 @@ jobs:
|
|||
|
||||
- name: Prepare CMake
|
||||
run: |
|
||||
mkdir cmake.output
|
||||
cd cmake.output
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off ..
|
||||
cd ..
|
||||
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off
|
||||
|
||||
- name: Prepare CMake dependencies
|
||||
run: |
|
||||
|
|
|
@ -26,26 +26,33 @@ jobs:
|
|||
- name: Install missing software on ubuntu
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y make libpcre3-dev
|
||||
apt-get install -y cmake make libpcre3-dev
|
||||
apt-get install -y clang-14
|
||||
|
||||
- name: Build
|
||||
run: make -j$(nproc) cppcheck testrunner HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
|
||||
- name: CMake
|
||||
run: |
|
||||
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On
|
||||
env:
|
||||
CC: clang-14
|
||||
CXX: clang++-14
|
||||
CXXFLAGS: "-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow -O2 -g3 -DCPPCHK_GLIBCXX_DEBUG"
|
||||
CPPFLAGS: "-DCHECK_INTERNAL"
|
||||
|
||||
- name: Build cppcheck
|
||||
run: |
|
||||
cmake --build cmake.output --target cppcheck -- -j $(nproc)
|
||||
|
||||
- name: Build test
|
||||
run: |
|
||||
cmake --build cmake.output --target testrunner -- -j $(nproc)
|
||||
|
||||
- name: Run tests
|
||||
run: ./testrunner
|
||||
run: ./cmake.output/bin/testrunner
|
||||
|
||||
# TODO: no gui/temp/*.cpp files available
|
||||
- name: Self check
|
||||
run: |
|
||||
ec=0
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
exit $ec
|
||||
|
||||
|
|
|
@ -18,11 +18,12 @@ elseif(ANALYZE_THREAD)
|
|||
endif()
|
||||
|
||||
if(ANALYZE_UNDEFINED)
|
||||
add_compile_options(-fsanitize=undefined)
|
||||
# TODO: enable signed-integer-overflow
|
||||
add_compile_options(-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow)
|
||||
add_compile_options(-fno-sanitize-recover=all)
|
||||
add_compile_options(-fno-omit-frame-pointer)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow")
|
||||
endif()
|
||||
|
||||
if(ANALYZE_DATAFLOW)
|
||||
|
|
|
@ -10,6 +10,7 @@ message( STATUS "C++ flags (General) = ${CMAKE_CXX_FLAGS}")
|
|||
message( STATUS "C++ flags (Release) = ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
message( STATUS "C++ flags (RelWithDebInfo) = ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
message( STATUS "C++ flags (Debug) = ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
message( STATUS "CMAKE_EXE_LINKER_FLAGS = ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
message( STATUS "CPPCHK_GLIBCXX_DEBUG = ${CPPCHK_GLIBCXX_DEBUG}" )
|
||||
get_directory_property( DirDefs DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS )
|
||||
foreach( d ${DirDefs} )
|
||||
|
|
Loading…
Reference in New Issue