Skip to content

Commit 0898548

Browse files
committed
CI: Introduce and use LIBPCAP_CMAKE_TAINTED
The new environment variable provides means to declare all or some libpcap cmake run of a specific environment (CI or a working copy) as tainted. Add explicit conditions to exempt the cmake run that emit warnings now and request the compiler to treat warnings as errors *iff* the cmake run is not tainted. This way if a cmake run that is warning-free now degrades later, CI will fail it. The treat warnings as errors cmake option used is: -Werror=dev Make developer warnings errors. Make warnings that are meant for the author of the CMake- Lists.txt files errors. By default this will also turn on depre- cated warnings as errors.
1 parent 16e1e24 commit 0898548

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

build.sh

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
: "${CMAKE:=no}"
77
: "${REMOTE:=no}"
88
: "${LIBPCAP_TAINTED:=no}"
9+
: "${LIBPCAP_CMAKE_TAINTED:=no}"
910
: "${MAKE_BIN:=make}"
1011

1112
. ./build_common.sh
@@ -107,6 +108,12 @@ suncc-5.1[45]/SunOS-5.11)
107108
esac
108109
[ "$LIBPCAP_TAINTED" != yes ] && CFLAGS=`cc_werr_cflags`
109110

111+
# If necessary, set LIBPCAP_CMAKE_TAINTED here to exempt particular cmake from
112+
# warnings. Use as specific terms as possible (e.g. some specific version and
113+
# some specific OS).
114+
115+
[ "$LIBPCAP_CMAKE_TAINTED" != yes ] && CMAKE_OPTIONS='-Werror=dev'
116+
110117
if [ "$CMAKE" = no ]; then
111118
run_after_echo ./configure --prefix="$PREFIX" --enable-remote="$REMOTE"
112119
else
@@ -120,6 +127,7 @@ else
120127
run_after_echo mkdir build
121128
run_after_echo cd build
122129
run_after_echo cmake ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
130+
"$CMAKE_OPTIONS" \
123131
-DCMAKE_INSTALL_PREFIX="$PREFIX" -DENABLE_REMOTE="$REMOTE" ..
124132
fi
125133
run_after_echo "$MAKE_BIN" -s clean

build_matrix.sh

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
: "${MATRIX_CC:=gcc clang}"
77
: "${MATRIX_CMAKE:=no yes}"
88
: "${MATRIX_REMOTE:=no yes}"
9+
# Set this variable to "yes" before calling this script to disregard all cmake
10+
# warnings in a particular environment (CI or a local working copy). Set it
11+
# to "yes" in this script or in build.sh when a matrix subset is known to be
12+
# not cmake warning-free because of the version or whatever other factor
13+
# that the scripts can detect both in and out of CI.
14+
: "${LIBPCAP_CMAKE_TAINTED:=no}"
915
# Set this variable to "yes" before calling this script to disregard all
1016
# warnings in a particular environment (CI or a local working copy). Set it
1117
# to "yes" in this script or in build.sh when a matrix subset is known to be
@@ -28,6 +34,7 @@ if [ -z "$PREFIX" ]; then
2834
fi
2935
COUNT=0
3036
export LIBPCAP_TAINTED
37+
export LIBPCAP_CMAKE_TAINTED
3138
if command -v valgrind >/dev/null 2>&1; then
3239
VALGRIND_CMD="valgrind --leak-check=full --error-exitcode=1"
3340
export VALGRIND_CMD

0 commit comments

Comments
 (0)