mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
70363ea9ff
The gnulib testsuite is relatively stable - the only times it is likely to have a test change from pass to fail is on a gnulib submodule update or a major system change (such as moving from Fedora 18 to 19, or other large change to libc). While it is an important test for end users on arbitrary machines (to make sure that the portability glue works for their machine), it mostly wastes time for development testing (as most developers aren't making any of the major changes that would cause gnulib tests to alter behavior). Thus, it pays to make the tests optional at configure time, defaulting to off for development, on for tarballs, with autobuilders requesting it to be on. It also helps to allow a make-time override, via VIR_TEST_EXPENSIVE=[01] (much the way automake sets up V=[01] for overriding the configure time default of how verbose to be). Automake has some pretty hard-coded magic with regards to the TESTS variable; I had quite a job figuring out how to keep 'make distcheck' passing regardless of the configure option setting in use, while still disabling the tests at runtime when I did not configure them on and did not use the override variable. Thankfully, we require GNU make, which lets me hide some information from Automake's magic handling of TESTS. * bootstrap.conf (bootstrap_epilogue): Munge gnulib test variable. * configure.ac (--enable-expensive-tests): Add new enable switch. (VIR_TEST_EXPENSIVE_DEFAULT, WITH_EXPENSIVE_TESTS): Set new witnesses. * gnulib/tests/Makefile.am (TESTS): Make tests conditional on configure settings and the VIR_TEST_EXPENSIVE variable. * tests/Makefile.am (TESTS_ENVIRONMENT): Expose VIR_TEST_EXPENSIVE to all tests. * autobuild.sh: Enable all tests during autobuilds. * libvirt.spec.in (%configure): Likewise. * mingw-libvirt.spec.in (%mingw_configure): Likewise. * docs/hacking.html.in: Document the option. * HACKING: Regenerate. Signed-off-by: Eric Blake <eblake@redhat.com>
120 lines
2.9 KiB
Bash
Executable File
120 lines
2.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
set -v
|
|
|
|
# Make things clean.
|
|
|
|
test -n "$1" && RESULTS=$1 || RESULTS=results.log
|
|
: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder}
|
|
|
|
test -f Makefile && make -k distclean || :
|
|
rm -rf coverage
|
|
|
|
rm -rf build
|
|
mkdir build
|
|
cd build
|
|
|
|
# Run with options not normally exercised by the rpm build, for
|
|
# more complete code coverage.
|
|
../autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \
|
|
--enable-expensive-tests \
|
|
--enable-test-coverage \
|
|
--disable-nls \
|
|
--enable-werror \
|
|
--enable-static
|
|
|
|
# If the MAKEFLAGS envvar does not yet include a -j option,
|
|
# add -jN where N depends on the number of processors.
|
|
case $MAKEFLAGS in
|
|
*-j*) ;;
|
|
*) n=$(getconf _NPROCESSORS_ONLN 2> /dev/null)
|
|
test "$n" -gt 0 || n=1
|
|
n=$(expr $n + 1)
|
|
MAKEFLAGS="$MAKEFLAGS -j$n"
|
|
export MAKEFLAGS
|
|
;;
|
|
esac
|
|
|
|
make
|
|
make install
|
|
|
|
# set -o pipefail is a bashism; this use of exec is the POSIX alternative
|
|
exec 3>&1
|
|
st=$(
|
|
exec 4>&1 >&3
|
|
{ make check syntax-check 2>&1 3>&- 4>&-; echo $? >&4; } | tee "$RESULTS"
|
|
)
|
|
exec 3>&-
|
|
test "$st" = 0
|
|
test -x /usr/bin/lcov && make cov
|
|
|
|
rm -f *.tar.gz
|
|
make dist
|
|
|
|
if test -n "$AUTOBUILD_COUNTER" ; then
|
|
EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER"
|
|
else
|
|
NOW=`date +"%s"`
|
|
EXTRA_RELEASE=".$USER$NOW"
|
|
fi
|
|
|
|
if test -f /usr/bin/rpmbuild ; then
|
|
rpmbuild --nodeps \
|
|
--define "extra_release $EXTRA_RELEASE" \
|
|
--define "_sourcedir `pwd`" \
|
|
-ba --clean libvirt.spec
|
|
fi
|
|
|
|
# Test mingw32 cross-compile
|
|
if test -x /usr/bin/i686-w64-mingw32-gcc ; then
|
|
make distclean
|
|
|
|
PKG_CONFIG_LIBDIR="/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig" \
|
|
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
|
|
CC="i686-w64-mingw32-gcc" \
|
|
../configure \
|
|
--build=$(uname -m)-w64-linux \
|
|
--host=i686-w64-mingw32 \
|
|
--prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
|
|
--enable-expensive-tests \
|
|
--enable-werror \
|
|
--without-libvirtd \
|
|
--without-python
|
|
|
|
make
|
|
make install
|
|
|
|
fi
|
|
|
|
# Test mingw64 cross-compile
|
|
if test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
|
|
make distclean
|
|
|
|
PKG_CONFIG_LIBDIR="/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig" \
|
|
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
|
|
CC="x86_64-w64-mingw32-gcc" \
|
|
../configure \
|
|
--build=$(uname -m)-w64-linux \
|
|
--host=x86_64-w64-mingw32 \
|
|
--prefix="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw" \
|
|
--enable-expensive-tests \
|
|
--enable-werror \
|
|
--without-libvirtd \
|
|
--without-python
|
|
|
|
make
|
|
make install
|
|
|
|
fi
|
|
|
|
|
|
if test -x /usr/bin/i686-w64-mingw32-gcc && test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
|
|
if test -f /usr/bin/rpmbuild ; then
|
|
rpmbuild --nodeps \
|
|
--define "extra_release $EXTRA_RELEASE" \
|
|
--define "_sourcedir `pwd`" \
|
|
-ba --clean mingw-libvirt.spec
|
|
fi
|
|
fi
|