Enable build of test suite programs by default for GIT checkouts

Add a new flag '--with-test-suite' to configure to control whether
the test suite binaries are built by default. ie built with a
plain 'make', as opposed to delayed until 'make check'

For builds from tar.gz tests will not be built by default. For
builds from GIT, tests with be on by default, to try and ensure
that patch developers don't accidentally break the test suites
without noticing.

* configure.ac: Add --with-test-suite
* tests/Makefile.am: Use noinst_PROGRAMS instead of check_PROGRAMS
  if building tests by default. Consolidate setting of TESTS and
  {noinst,check}_PROGRAMS to avoid duplication
This commit is contained in:
Daniel P. Berrange 2012-03-27 16:35:01 +01:00
parent 53e1d56dd4
commit 3a2fc2770b
2 changed files with 50 additions and 90 deletions

View File

@ -2162,6 +2162,25 @@ AM_CONDITIONAL([WITH_PYTHON], [test "$with_python" = "yes"])
AC_SUBST([PYTHON_VERSION]) AC_SUBST([PYTHON_VERSION])
AC_SUBST([PYTHON_INCLUDES]) AC_SUBST([PYTHON_INCLUDES])
AC_ARG_ENABLE([with-test-suite],
AC_HELP_STRING([--with-test-suite], [build test suite by default @<:@default=check@:>@]),
[case "${withval}" in
yes|no|check) ;;
*) AC_MSG_ERROR([bad value ${withval} for tests option]) ;;
esac],
[withval=check])
AC_MSG_CHECKING([Whether to build test suite by default])
if test "$withval" = "check" ; then
if test -d $srcdir/.git ; then
withval=yes
else
withval=no
fi
fi
AC_MSG_RESULT([$withval])
AM_CONDITIONAL([WITH_TESTS], [test "$withval" = "yes"])
AC_ARG_ENABLE([test-coverage], AC_ARG_ENABLE([test-coverage],
AC_HELP_STRING([--enable-test-coverage], [turn on code coverage instrumentation @<:@default=no@:>@]), AC_HELP_STRING([--enable-test-coverage], [turn on code coverage instrumentation @<:@default=no@:>@]),
[case "${enableval}" in [case "${enableval}" in

View File

@ -92,69 +92,68 @@ EXTRA_DIST = \
xml2vmxdata \ xml2vmxdata \
.valgrind.supp .valgrind.supp
check_PROGRAMS = virshtest conftest sockettest \ test_helpers = commandhelper ssh conftest
test_programs = virshtest sockettest \
nodeinfotest virbuftest \ nodeinfotest virbuftest \
commandtest commandhelper seclabeltest \ commandtest seclabeltest \
virhashtest virnetmessagetest virnetsockettest ssh \ virhashtest virnetmessagetest virnetsockettest \
utiltest virnettlscontexttest shunloadtest \ utiltest virnettlscontexttest shunloadtest \
virtimetest viruritest virkeyfiletest \ virtimetest viruritest virkeyfiletest \
virauthconfigtest virauthconfigtest
check_LTLIBRARIES = libshunload.la
# This is a fake SSH we use from virnetsockettest # This is a fake SSH we use from virnetsockettest
ssh_SOURCES = ssh.c ssh_SOURCES = ssh.c
ssh_LDADD = $(COVERAGE_LDFLAGS) ssh_LDADD = $(COVERAGE_LDFLAGS)
if WITH_XEN if WITH_XEN
check_PROGRAMS += xml2sexprtest sexpr2xmltest \ test_programs += xml2sexprtest sexpr2xmltest \
xmconfigtest xencapstest statstest reconnect xmconfigtest xencapstest statstest reconnect
endif endif
if WITH_QEMU if WITH_QEMU
check_PROGRAMS += qemuxml2argvtest qemuxml2xmltest qemuxmlnstest \ test_programs += qemuxml2argvtest qemuxml2xmltest qemuxmlnstest \
qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \ qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \
qemumonitortest qemumonitortest
endif endif
if WITH_LXC if WITH_LXC
check_PROGRAMS += lxcxml2xmltest test_programs += lxcxml2xmltest
endif endif
if WITH_OPENVZ if WITH_OPENVZ
check_PROGRAMS += openvzutilstest test_programs += openvzutilstest
endif endif
if WITH_ESX if WITH_ESX
check_PROGRAMS += esxutilstest test_programs += esxutilstest
endif endif
if WITH_VMX if WITH_VMX
check_PROGRAMS += vmx2xmltest xml2vmxtest test_programs += vmx2xmltest xml2vmxtest
endif endif
if WITH_CIL if WITH_CIL
check_PROGRAMS += object-locking test_programs += object-locking
endif endif
if HAVE_YAJL if HAVE_YAJL
check_PROGRAMS += jsontest test_programs += jsontest
endif endif
check_PROGRAMS += networkxml2xmltest test_programs += networkxml2xmltest
if WITH_NETWORK if WITH_NETWORK
check_PROGRAMS += networkxml2argvtest test_programs += networkxml2argvtest
endif endif
check_PROGRAMS += nwfilterxml2xmltest test_programs += nwfilterxml2xmltest
check_PROGRAMS += storagevolxml2xmltest storagepoolxml2xmltest test_programs += storagevolxml2xmltest storagepoolxml2xmltest
check_PROGRAMS += nodedevxml2xmltest test_programs += nodedevxml2xmltest
check_PROGRAMS += interfacexml2xmltest test_programs += interfacexml2xmltest
check_PROGRAMS += cputest test_programs += cputest
test_scripts = \ test_scripts = \
capabilityschematest \ capabilityschematest \
@ -185,6 +184,8 @@ test_scripts += \
virsh-optparse \ virsh-optparse \
virsh-schedinfo \ virsh-schedinfo \
virsh-synopsis virsh-synopsis
test_programs += eventtest
else else
EXTRA_DIST += \ EXTRA_DIST += \
test_conf.sh \ test_conf.sh \
@ -213,78 +214,17 @@ endif
EXTRA_DIST += $(test_scripts) EXTRA_DIST += $(test_scripts)
TESTS = virshtest \ if WITH_TESTS
nodeinfotest \ noinst_PROGRAMS = $(test_programs) $(test_helpers)
virbuftest \ noinst_LTLIBRARIES = libshunload.la
sockettest \ else
commandtest \ check_PROGRAMS = $(test_programs) $(test_helpers)
seclabeltest \ check_LTLIBRARIES = libshunload.la
virhashtest \ endif
virnetmessagetest \
virnetsockettest \ TESTS = $(test_programs) \
virnettlscontexttest \
virtimetest \
viruritest \
virkeyfiletest \
virauthconfigtest \
shunloadtest \
utiltest \
$(test_scripts) $(test_scripts)
if HAVE_YAJL
TESTS += jsontest
endif
if WITH_XEN
TESTS += xml2sexprtest \
sexpr2xmltest \
xmconfigtest \
xencapstest \
reconnect \
statstest
endif
if WITH_QEMU
TESTS += qemuxml2argvtest qemuxml2xmltest qemuxmlnstest qemuargv2xmltest \
qemuhelptest domainsnapshotxml2xmltest nwfilterxml2xmltest \
qemumonitortest
endif
if WITH_LXC
TESTS += lxcxml2xmltest
endif
if WITH_OPENVZ
TESTS += openvzutilstest
endif
if WITH_ESX
TESTS += esxutilstest
endif
if WITH_VMX
TESTS += vmx2xmltest xml2vmxtest
endif
if WITH_LIBVIRTD
check_PROGRAMS += eventtest
TESTS += eventtest
endif
TESTS += networkxml2xmltest
if WITH_NETWORK
TESTS += networkxml2argvtest
endif
TESTS += storagevolxml2xmltest storagepoolxml2xmltest
TESTS += nodedevxml2xmltest
TESTS += interfacexml2xmltest
TESTS += cputest
# NB, automake < 1.10 does not provide the real # NB, automake < 1.10 does not provide the real
# abs_top_{src/build}dir or builddir variables, so don't rely # abs_top_{src/build}dir or builddir variables, so don't rely
# on them here. Fake them with 'pwd' # on them here. Fake them with 'pwd'
@ -306,6 +246,7 @@ TESTS_ENVIRONMENT = \
LC_ALL=C \ LC_ALL=C \
$(VG) $(VG)
valgrind: valgrind:
$(MAKE) check VG="valgrind --quiet --leak-check=full --suppressions=$(srcdir)/.valgrind.supp" $(MAKE) check VG="valgrind --quiet --leak-check=full --suppressions=$(srcdir)/.valgrind.supp"