summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-09-14 09:59:57 +0200
committerThomas Haller <thaller@redhat.com>2018-09-14 14:08:19 +0200
commitfd2e8179d32d98736110ea17fb7ce1253534679c (patch)
tree4ba2cc124754d3c32780202c935558b723486572 /contrib
parent7e6824f4da6de3db22948da316ace6d1758abec9 (diff)
contrib/rpm: disable tests by default and use fatal-warnings with tests
In general, when we build a package, we want no compiler warnings and all unit tests to pass. That is in particular true when building a package for the distribution in koji. When builing in koji, we (rightly) cannot pass rpmbuild options, so the default whether tests/compiler-warnings are fatal matter very much. One could argue: let's have the tests/compiler-warnings fatal and fail the build. During a build in koji for a Fedora release, we want them all pass. And if somebody does a manual build, the person can patch the spec file (or use rpmbuild flags). However, note how commit "f7b5e48cdb contrib/rpm: don't force fatal warnings with tests" already disabled fatal compiler warnings. Why? It seems compiler warnings should be even more stable than our unit tests, as long as you target a particular Fedora release and compiler version. So this was done to support rebuilding an SRPM for a different Fedora release, or to be more graceful during early development phase of a Fedora release, where things are not as stable yet. The exactly same reasoning applies to treating unit-tests failures as fatal. For example, a recent iproute2 issue broke unit tests. That meant, with that iproute2 release in build root, the NetworkManager RPM could not be built. Very annoying. Now: - if "test" is enabled, that means both `make check` and compiler warnings are treated fatal. If "test" is disabled, `make check` and compiler warnings are still done, just not fatal. - "test" is now disabled by default via the spec file. They are not fatal when building in koji or when rebuilding the package manually. - tests can be enabled optionally. Note that the "build_clean.sh" script enables them by default. So, a user using this script would need to explicitly "--without test". (cherry picked from commit ad850c4f03a93a21d745b2e46cca78525bdad843)
Diffstat (limited to 'contrib')
-rw-r--r--contrib/fedora/rpm/NetworkManager.spec6
-rwxr-xr-xcontrib/fedora/rpm/build_clean.sh6
2 files changed, 6 insertions, 6 deletions
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec
index 255c2178d..128597760 100644
--- a/contrib/fedora/rpm/NetworkManager.spec
+++ b/contrib/fedora/rpm/NetworkManager.spec
@@ -56,7 +56,7 @@
%bcond_without nmtui
%bcond_without regen_docs
%bcond_with debug
-%bcond_without test
+%bcond_with test
%bcond_with sanitizer
%if 0%{?fedora} > 28 || 0%{?rhel} > 7
%bcond_with libnm_glib
@@ -541,7 +541,11 @@ intltoolize --automake --copy --force
--with-system-ca-path=/etc/pki/tls/cert.pem \
--with-dbus-sys-dir=%{dbus_sys_dir} \
--with-tests=yes \
+%if %{with test}
+ --enable-more-warnings=error \
+%else
--enable-more-warnings=yes \
+%endif
--with-valgrind=no \
--enable-ifcfg-rh=yes \
%if %{with ppp}
diff --git a/contrib/fedora/rpm/build_clean.sh b/contrib/fedora/rpm/build_clean.sh
index c6d08f538..888cac8cb 100755
--- a/contrib/fedora/rpm/build_clean.sh
+++ b/contrib/fedora/rpm/build_clean.sh
@@ -41,7 +41,7 @@ IGNORE_DIRTY=0
GIT_CLEAN=0
QUICK=0
NO_DIST=0
-WITH_LIST=()
+WITH_LIST=(--with test)
SOURCE_FROM_GIT=0
SNAPSHOT="$NM_BUILD_SNAPSHOT"
@@ -157,10 +157,6 @@ if [[ $NO_DIST != 1 ]]; then
fi
fi
-if [[ $QUICK == 1 ]]; then
- WITH_LIST=(--without test "${WITH_LIST[@]}")
-fi
-
export SOURCE_FROM_GIT
export BUILDTYPE
export NM_RPMBUILD_ARGS="${WITH_LIST[@]}"