various CI refactorings and cleanups (#3142)
This commit is contained in:
parent
dcf32563ea
commit
e783df646a
|
@ -9,7 +9,7 @@ jobs:
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
image: ["centos:7", "ubuntu:14.04", "ubuntu:21.04"]
|
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:21.04"]
|
||||||
fail-fast: false # Prefer quick result
|
fail-fast: false # Prefer quick result
|
||||||
|
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
@ -30,7 +30,7 @@ jobs:
|
||||||
if: matrix.image != 'centos:7'
|
if: matrix.image != 'centos:7'
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y cmake g++ make
|
apt-get install -y cmake g++ make python libxml2-utils
|
||||||
apt-get install -y libpcre3-dev
|
apt-get install -y libpcre3-dev
|
||||||
|
|
||||||
# tests require CMake 3.4
|
# tests require CMake 3.4
|
||||||
|
@ -65,6 +65,10 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
make -j$(nproc) check HAVE_RULES=yes
|
make -j$(nproc) check HAVE_RULES=yes
|
||||||
|
|
||||||
|
- name: Validate
|
||||||
|
run: |
|
||||||
|
make -j$(nproc) checkCWEEntries validateXML
|
||||||
|
|
||||||
- name: Test addons
|
- name: Test addons
|
||||||
run: |
|
run: |
|
||||||
./cppcheck --addon=threadsafety addons/test/threadsafety
|
./cppcheck --addon=threadsafety addons/test/threadsafety
|
||||||
|
|
|
@ -58,6 +58,10 @@ jobs:
|
||||||
make -j$(nproc) CXXFLAGS=-funsigned-char testrunner
|
make -j$(nproc) CXXFLAGS=-funsigned-char testrunner
|
||||||
./testrunner TestSymbolDatabase
|
./testrunner TestSymbolDatabase
|
||||||
|
|
||||||
|
- name: Check syntax with NONNEG
|
||||||
|
run: |
|
||||||
|
ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG
|
||||||
|
|
||||||
- name: Build cppcheck
|
- name: Build cppcheck
|
||||||
run: |
|
run: |
|
||||||
make clean
|
make clean
|
||||||
|
@ -73,8 +77,8 @@ jobs:
|
||||||
|
|
||||||
- name: Validate
|
- name: Validate
|
||||||
run: |
|
run: |
|
||||||
make -j$(nproc) validateCFG validatePlatforms
|
make -j$(nproc) checkCWEEntries validateXML
|
||||||
|
|
||||||
- name: Test addons
|
- name: Test addons
|
||||||
run: |
|
run: |
|
||||||
./cppcheck --addon=threadsafety addons/test/threadsafety
|
./cppcheck --addon=threadsafety addons/test/threadsafety
|
||||||
|
|
|
@ -19,7 +19,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=address -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS="-DCHECK_INTERNAL" make cppcheck testrunner -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
|
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=address -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS="-DCHECK_INTERNAL" make -j$(nproc) cppcheck testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
|
|
||||||
- name: Compile instrumented
|
- name: Compile instrumented
|
||||||
run: |
|
run: |
|
||||||
make test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" USE_Z3=yes HAVE_RULES=yes -j$(nproc)
|
make -j$(nproc) test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" USE_Z3=yes HAVE_RULES=yes
|
||||||
|
|
||||||
- name: Generate coverage report
|
- name: Generate coverage report
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -29,7 +29,7 @@ jobs:
|
||||||
- name: Install missing software on ubuntu (Python 3)
|
- name: Install missing software on ubuntu (Python 3)
|
||||||
if: matrix.python-version != '2.7'
|
if: matrix.python-version != '2.7'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install shellcheck
|
sudo apt-get install shellcheck libxml2-utils
|
||||||
python -m pip install pip --upgrade
|
python -m pip install pip --upgrade
|
||||||
python -m pip install natsort
|
python -m pip install natsort
|
||||||
python -m pip install pexpect
|
python -m pip install pexpect
|
||||||
|
@ -57,6 +57,11 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null
|
find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null
|
||||||
|
|
||||||
|
- name: Validate
|
||||||
|
if: matrix.python-version == '3.8'
|
||||||
|
run: |
|
||||||
|
make -j$(nproc) validateCFG validatePlatforms validateRules
|
||||||
|
|
||||||
- name: check python syntax
|
- name: check python syntax
|
||||||
if: matrix.python-version != '2.7'
|
if: matrix.python-version != '2.7'
|
||||||
run: |
|
run: |
|
||||||
|
@ -71,3 +76,9 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
make -j$(nproc) -s
|
make -j$(nproc) -s
|
||||||
PYTHONPATH=./addons python -m pytest addons/test/test-*.py
|
PYTHONPATH=./addons python -m pytest addons/test/test-*.py
|
||||||
|
|
||||||
|
- name: dmake
|
||||||
|
if: matrix.python-version == '3.8'
|
||||||
|
run: |
|
||||||
|
make -j$(nproc) run-dmake
|
||||||
|
git diff --exit-code
|
||||||
|
|
|
@ -19,7 +19,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS="-DCHECK_INTERNAL" make cppcheck testrunner -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
|
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS="-DCHECK_INTERNAL" make -j$(nproc) cppcheck testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
|
|
34
.travis.yml
34
.travis.yml
|
@ -7,12 +7,10 @@ compiler:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- ORIGINAL_CXXFLAGS="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -D_GLIBCXX_DEBUG -g "
|
- ORIGINAL_CXXFLAGS="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -D_GLIBCXX_DEBUG -g"
|
||||||
# unfortunately we need this to stay within 50min timelimit given by travis.
|
# unfortunately we need this to stay within 50min timelimit given by travis.
|
||||||
- CXXFLAGS="${ORIGINAL_CXXFLAGS} -O2 -march=native -Wstrict-aliasing=2 -Werror=strict-aliasing"
|
- CXXFLAGS="${ORIGINAL_CXXFLAGS} -O2 -march=native -Wstrict-aliasing=2 -Werror=strict-aliasing"
|
||||||
- CPPCHECK=${TRAVIS_BUILD_DIR}/cppcheck
|
- CPPCHECK=${TRAVIS_BUILD_DIR}/cppcheck
|
||||||
- ASAN_OPTIONS=detect_stack_use_after_return=1
|
|
||||||
- UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
|
|
||||||
matrix:
|
matrix:
|
||||||
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
|
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
|
||||||
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" MATCHCOMPILER=yes VERIFY=1
|
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" MATCHCOMPILER=yes VERIFY=1
|
||||||
|
@ -39,9 +37,6 @@ before_install:
|
||||||
matrix:
|
matrix:
|
||||||
# do notify immediately about it when a job of a build fails.
|
# do notify immediately about it when a job of a build fails.
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
|
||||||
- name: "rerun dmake?"
|
|
||||||
compiler: clang
|
|
||||||
# defined extra jobs that run besides what is configured in the build matrix
|
# defined extra jobs that run besides what is configured in the build matrix
|
||||||
include:
|
include:
|
||||||
|
|
||||||
|
@ -56,12 +51,8 @@ matrix:
|
||||||
- make checkCWEEntries
|
- make checkCWEEntries
|
||||||
# check cfg files
|
# check cfg files
|
||||||
- make checkcfg
|
- make checkcfg
|
||||||
# check platform files
|
|
||||||
- make validatePlatforms
|
|
||||||
# Validate Result XML
|
# Validate Result XML
|
||||||
- make validateXML
|
- make validateXML
|
||||||
# Validate rule files
|
|
||||||
- make validateRules
|
|
||||||
# check htmlreport stuff
|
# check htmlreport stuff
|
||||||
- python2 htmlreport/test_htmlreport.py
|
- python2 htmlreport/test_htmlreport.py
|
||||||
- python3 htmlreport/test_htmlreport.py
|
- python3 htmlreport/test_htmlreport.py
|
||||||
|
@ -147,18 +138,6 @@ matrix:
|
||||||
- cd -
|
- cd -
|
||||||
- python3 test/bug-hunting/juliet.py
|
- python3 test/bug-hunting/juliet.py
|
||||||
|
|
||||||
# check if dmake needs to be rerun (this job may fail)
|
|
||||||
- name: "rerun dmake?"
|
|
||||||
compiler: clang
|
|
||||||
# we don't need to install any deps for dmake so skip it explicitly
|
|
||||||
before_install:
|
|
||||||
- true
|
|
||||||
script:
|
|
||||||
- echo "If the following command fails, run 'make dmake; make run-dmake' and commit the resulting change."
|
|
||||||
- make -s dmake -j$(nproc)
|
|
||||||
- make -s run-dmake
|
|
||||||
- git diff --exit-code
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
|
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
|
||||||
- set -e
|
- set -e
|
||||||
|
@ -169,8 +148,6 @@ script:
|
||||||
- echo $CXXFLAGS
|
- echo $CXXFLAGS
|
||||||
- make -s check -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE
|
- make -s check -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE
|
||||||
- touch lib/mathlib.cpp test/testmathlib.cpp
|
- touch lib/mathlib.cpp test/testmathlib.cpp
|
||||||
# syntax checking of cppcheck source code with -DNONNEG
|
|
||||||
- ls lib/*.cpp | xargs -n 1 -P 2 g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG
|
|
||||||
# compile cppcheck, default build
|
# compile cppcheck, default build
|
||||||
- echo $CXXFLAGS
|
- echo $CXXFLAGS
|
||||||
- make -s check -j$(nproc)
|
- make -s check -j$(nproc)
|
||||||
|
@ -182,12 +159,3 @@ script:
|
||||||
# Testing addons (disabled 2020-11-24 because Travis fails, TODO try to enable these)
|
# Testing addons (disabled 2020-11-24 because Travis fails, TODO try to enable these)
|
||||||
# - PYTHONPATH=./addons python -m pytest addons/test/test-*.py
|
# - PYTHONPATH=./addons python -m pytest addons/test/test-*.py
|
||||||
# - PYTHONPATH=./addons python3 -m pytest addons/test/test-*.py
|
# - PYTHONPATH=./addons python3 -m pytest addons/test/test-*.py
|
||||||
|
|
||||||
notifications:
|
|
||||||
irc:
|
|
||||||
channels:
|
|
||||||
- "irc.freenode.org#cppcheck"
|
|
||||||
template:
|
|
||||||
- "[%{commit} : %{author}] %{message}"
|
|
||||||
- "%{build_url}"
|
|
||||||
skip_join: true
|
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -775,7 +775,7 @@ test/testunusedprivfunc.o: test/testunusedprivfunc.cpp externals/simplecpp/simpl
|
||||||
test/testunusedvar.o: test/testunusedvar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkunusedvar.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
|
test/testunusedvar.o: test/testunusedvar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkunusedvar.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
|
||||||
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testunusedvar.o test/testunusedvar.cpp
|
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testunusedvar.o test/testunusedvar.cpp
|
||||||
|
|
||||||
test/testutils.o: test/testutils.cpp lib/config.h lib/errorlogger.h lib/errortypes.h lib/suppressions.h lib/utils.h test/testsuite.h
|
test/testutils.o: test/testutils.cpp lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testutils.h
|
||||||
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testutils.o test/testutils.cpp
|
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testutils.o test/testutils.cpp
|
||||||
|
|
||||||
test/testvaarg.o: test/testvaarg.cpp lib/check.h lib/checkvaarg.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
|
test/testvaarg.o: test/testvaarg.cpp lib/check.h lib/checkvaarg.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
|
||||||
|
|
Loading…
Reference in New Issue