Commit ad850c4f authored by Thomas Haller's avatar Thomas Haller

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 "f7b5e48c 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".
parent 58b030f3
......@@ -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}
......
......@@ -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[@]}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment