Skip to content

Commit e783df6

Browse files
authored
various CI refactorings and cleanups (danmar#3142)
1 parent dcf3256 commit e783df6

8 files changed

Lines changed: 29 additions & 42 deletions

File tree

.github/workflows/CI-unixish-docker.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99

1010
strategy:
1111
matrix:
12-
image: ["centos:7", "ubuntu:14.04", "ubuntu:21.04"]
12+
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:21.04"]
1313
fail-fast: false # Prefer quick result
1414

1515
runs-on: ubuntu-20.04
@@ -30,7 +30,7 @@ jobs:
3030
if: matrix.image != 'centos:7'
3131
run: |
3232
apt-get update
33-
apt-get install -y cmake g++ make
33+
apt-get install -y cmake g++ make python libxml2-utils
3434
apt-get install -y libpcre3-dev
3535
3636
# tests require CMake 3.4
@@ -65,6 +65,10 @@ jobs:
6565
run: |
6666
make -j$(nproc) check HAVE_RULES=yes
6767
68+
- name: Validate
69+
run: |
70+
make -j$(nproc) checkCWEEntries validateXML
71+
6872
- name: Test addons
6973
run: |
7074
./cppcheck --addon=threadsafety addons/test/threadsafety

.github/workflows/CI-unixish.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ jobs:
5858
make -j$(nproc) CXXFLAGS=-funsigned-char testrunner
5959
./testrunner TestSymbolDatabase
6060
61+
- name: Check syntax with NONNEG
62+
run: |
63+
ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG
64+
6165
- name: Build cppcheck
6266
run: |
6367
make clean
@@ -73,8 +77,8 @@ jobs:
7377
7478
- name: Validate
7579
run: |
76-
make -j$(nproc) validateCFG validatePlatforms
77-
80+
make -j$(nproc) checkCWEEntries validateXML
81+
7882
- name: Test addons
7983
run: |
8084
./cppcheck --addon=threadsafety addons/test/threadsafety

.github/workflows/asan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
2020
- name: Build
2121
run: |
22-
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
22+
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
2323
2424
- name: Run tests
2525
run: |

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
2525
- name: Compile instrumented
2626
run: |
27-
make test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" USE_Z3=yes HAVE_RULES=yes -j$(nproc)
27+
make -j$(nproc) test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" USE_Z3=yes HAVE_RULES=yes
2828
2929
- name: Generate coverage report
3030
run: |

.github/workflows/scriptcheck.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install missing software on ubuntu (Python 3)
3030
if: matrix.python-version != '2.7'
3131
run: |
32-
sudo apt-get install shellcheck
32+
sudo apt-get install shellcheck libxml2-utils
3333
python -m pip install pip --upgrade
3434
python -m pip install natsort
3535
python -m pip install pexpect
@@ -57,6 +57,11 @@ jobs:
5757
run: |
5858
find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null
5959
60+
- name: Validate
61+
if: matrix.python-version == '3.8'
62+
run: |
63+
make -j$(nproc) validateCFG validatePlatforms validateRules
64+
6065
- name: check python syntax
6166
if: matrix.python-version != '2.7'
6267
run: |
@@ -71,3 +76,9 @@ jobs:
7176
run: |
7277
make -j$(nproc) -s
7378
PYTHONPATH=./addons python -m pytest addons/test/test-*.py
79+
80+
- name: dmake
81+
if: matrix.python-version == '3.8'
82+
run: |
83+
make -j$(nproc) run-dmake
84+
git diff --exit-code

.github/workflows/ubsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
2020
- name: Build
2121
run: |
22-
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
22+
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
2323
2424
- name: Run tests
2525
run: |

.travis.yml

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ compiler:
77

88
env:
99
global:
10-
- 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 "
10+
- 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"
1111
# unfortunately we need this to stay within 50min timelimit given by travis.
1212
- CXXFLAGS="${ORIGINAL_CXXFLAGS} -O2 -march=native -Wstrict-aliasing=2 -Werror=strict-aliasing"
1313
- CPPCHECK=${TRAVIS_BUILD_DIR}/cppcheck
14-
- ASAN_OPTIONS=detect_stack_use_after_return=1
15-
- UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
1614
matrix:
1715
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
1816
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" MATCHCOMPILER=yes VERIFY=1
@@ -39,9 +37,6 @@ before_install:
3937
matrix:
4038
# do notify immediately about it when a job of a build fails.
4139
fast_finish: true
42-
allow_failures:
43-
- name: "rerun dmake?"
44-
compiler: clang
4540
# defined extra jobs that run besides what is configured in the build matrix
4641
include:
4742

@@ -56,12 +51,8 @@ matrix:
5651
- make checkCWEEntries
5752
# check cfg files
5853
- make checkcfg
59-
# check platform files
60-
- make validatePlatforms
6154
# Validate Result XML
6255
- make validateXML
63-
# Validate rule files
64-
- make validateRules
6556
# check htmlreport stuff
6657
- python2 htmlreport/test_htmlreport.py
6758
- python3 htmlreport/test_htmlreport.py
@@ -147,18 +138,6 @@ matrix:
147138
- cd -
148139
- python3 test/bug-hunting/juliet.py
149140

150-
# check if dmake needs to be rerun (this job may fail)
151-
- name: "rerun dmake?"
152-
compiler: clang
153-
# we don't need to install any deps for dmake so skip it explicitly
154-
before_install:
155-
- true
156-
script:
157-
- echo "If the following command fails, run 'make dmake; make run-dmake' and commit the resulting change."
158-
- make -s dmake -j$(nproc)
159-
- make -s run-dmake
160-
- git diff --exit-code
161-
162141
script:
163142
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
164143
- set -e
@@ -169,8 +148,6 @@ script:
169148
- echo $CXXFLAGS
170149
- make -s check -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE
171150
- touch lib/mathlib.cpp test/testmathlib.cpp
172-
# syntax checking of cppcheck source code with -DNONNEG
173-
- ls lib/*.cpp | xargs -n 1 -P 2 g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG
174151
# compile cppcheck, default build
175152
- echo $CXXFLAGS
176153
- make -s check -j$(nproc)
@@ -182,12 +159,3 @@ script:
182159
# Testing addons (disabled 2020-11-24 because Travis fails, TODO try to enable these)
183160
# - PYTHONPATH=./addons python -m pytest addons/test/test-*.py
184161
# - PYTHONPATH=./addons python3 -m pytest addons/test/test-*.py
185-
186-
notifications:
187-
irc:
188-
channels:
189-
- "irc.freenode.org#cppcheck"
190-
template:
191-
- "[%{commit} : %{author}] %{message}"
192-
- "%{build_url}"
193-
skip_join: true

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ test/testunusedprivfunc.o: test/testunusedprivfunc.cpp externals/simplecpp/simpl
775775
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
776776
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testunusedvar.o test/testunusedvar.cpp
777777

778-
test/testutils.o: test/testutils.cpp lib/config.h lib/errorlogger.h lib/errortypes.h lib/suppressions.h lib/utils.h test/testsuite.h
778+
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
779779
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testutils.o test/testutils.cpp
780780

781781
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

0 commit comments

Comments
 (0)