Re: [spice-streaming-agent v2] build: Add --enable-tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 07, 2018 at 04:26:50AM -0500, Frediano Ziglio wrote:
> > 
> > On Thu, 2018-03-01 at 18:28 +0100, Christophe Fergeau wrote:
> > > Tests require 'catch' to be installed, one might want to disable them if
> > > catch is not available. This patch adds a --disable-tests switch. By
> > > default, tests are enabled depending on 'catch' availability.
> > > 
> > > Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> > > ---
> > >  configure.ac    | 21 +++++++++++++++++++--
> > >  src/Makefile.am |  3 +++
> > >  2 files changed, 22 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/configure.ac b/configure.ac
> > > index 1bb1f5d..4333c42 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -38,8 +38,6 @@ PKG_CHECK_MODULES(XFIXES, xfixes)
> > >  
> > >  PKG_CHECK_MODULES(JPEG, libjpeg)
> > >  
> > > -AC_CHECK_HEADER([catch/catch.hpp],,[AC_MSG_ERROR([Could not find Catch
> > > dependency header (catch/catch.hpp)])])
> > > -
> > >  dnl
> > >  ===========================================================================
> > >  dnl check compiler flags
> > >  
> > > @@ -50,6 +48,25 @@ LIBVIRT_LINKER_NO_INDIRECT
> > >  AC_SUBST(WARN_CFLAGS)
> > >  AC_SUBST(WARN_CXXFLAGS)
> > >  
> > > +dnl
> > > =========================================================================
> > > +dnl tests
> > > +AC_ARG_ENABLE([tests],
> > > +              AS_HELP_STRING([--disable-tests=@<:@yes/no@:>@],
> > > +                             [Disable tests (they require 'catch' to be
> > > installed) @<:@default=auto@:>@]),
> > > +                             [],
> > > +                             [enable_tests="auto"])
> > > +case "$enable_tests" in
> > > +  0|no) enable_tests="no" ;;
> > > +  1|yes) enable_tests="yes" ;;
> > > +  auto) enable_tests="auto" ;;
> > > +  *) AC_MSG_ERROR([bad value ${enable_tests} for enable-tests option]) ;;
> > > +esac
> > > +AS_IF([test "x$enable_tests" != "xno"],
> > > +      [AC_CHECK_HEADER([catch/catch.hpp],have_check="yes",)])
> > > +AS_IF([test "x$enable_tests" = "xyes" && test "x$have_check" != "xyes"],
> > > +      [AC_MSG_ERROR([Could not find Catch dependency header
> > > (catch/catch.hpp)])])
> > > +AM_CONDITIONAL([ENABLE_TESTS], [test "x$have_check" = "xyes"])
> > > +
> > >  AC_DEFINE_DIR([BINDIR], [bindir], [Where binaries are installed.])
> > >  
> > >  AC_OUTPUT([
> > > diff --git a/src/Makefile.am b/src/Makefile.am
> > > index 857d763..606f51a 100644
> > > --- a/src/Makefile.am
> > > +++ b/src/Makefile.am
> > > @@ -4,7 +4,10 @@
> > >  # Copyright 2016-2017 Red Hat Inc. All rights reserved.
> > >  
> > >  NULL =
> > > +
> > > +if ENABLE_TESTS
> > >  SUBDIRS = . unittests
> > > +endif
> > >  
> > >  AM_CPPFLAGS = \
> > >  	-DSPICE_STREAMING_AGENT_PROGRAM \
> > 
> > Looks fine, lets merge this :)
> > 
> > Acked-by: Lukáš Hrázký <lhrazky@xxxxxxxxxx>
> 
> As a follow up I would add an explicit --enable-tests to the SPEC file.
> Maybe as the default is "auto" and not "yes" we want a --enable-tests in the documentation
> string.

Ah, definitely, I'll squash both of these suggestions in, unless you
prefer a separate patch for the SPEC file change.

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]