From: Claudio André <claudioandre.br(a)gmail.com>
It is possible to test libvirt using other distros in Travis via Docker; including (but
not limited to) Fedora and Ubuntu.
---
Notes:
* see it working at:
https://travis-ci.org/claudioandre/libvirt/builds/237015534
* now, I introduced an error:
https://travis-ci.org/claudioandre/libvirt/builds/237018298
* I'm using Ubuntu 17.04 because I need to pick something. Could be Xenial and/or
Fedora and/or ...;
* One test is failing in Ubuntu 17.04 in Travis. The error log says:
-----
TEST: virkmodtest
Failed to get config
!... 4 FAIL
FAIL virkmodtest (exit status: 1)
-----
* Since it is failing, I used the 'allow_failures'.
.travis.yml | 19 +++++++++-------
tests/travis-ci.sh | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 8 deletions(-)
create mode 100755 tests/travis-ci.sh
diff --git a/.travis.yml b/.travis.yml
index 5a3e765..7b73761 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -62,11 +62,8 @@ git:
before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update &&
brew install gnutls libgcrypt yajl gettext rpcgen ; fi
-# the custom PATH is just to pick up OS-X homebrew & its harmless on Linux
-before_script:
- - PATH="/usr/local/opt/gettext/bin:/usr/local/opt/rpcgen/bin:$PATH"
./autogen.sh
script:
- - VIR_TEST_DEBUG=1 make -j3 && make -j3 syntax-check && make -j3 check
+ - tests/travis-ci.sh
# Environments here are run in addition to the main environment defined above
matrix:
@@ -79,10 +76,16 @@ matrix:
dist: trusty
- compiler: clang
os: osx
- script:
- # many unit tests fail & so does syntax-check, so skip for now
- # one day we must fix it though....
- - make -j3
+ - services: docker
+ env: IMAGE=ubuntu:17.04 CCO=gcc
+ dist: trusty
+ - services: docker
+ env: IMAGE=ubuntu:17.04 CCO=clang
+ dist: trusty
+
+ allow_failures:
+ - env: IMAGE=ubuntu:17.04 CCO=gcc
+ - env: IMAGE=ubuntu:17.04 CCO=clang
after_failure:
- echo
'============================================================================'
diff --git a/tests/travis-ci.sh b/tests/travis-ci.sh
new file mode 100755
index 0000000..d115564
--- /dev/null
+++ b/tests/travis-ci.sh
@@ -0,0 +1,64 @@
+#!/bin/bash -e
+
+function do_Install_Dependencies(){
+ echo
+ echo '-- Installing Dependencies --'
+
+ apt-get update -qq
+ apt-get -y -qq install \
+ build-essential git clang autoconf libtool libcmpicppimpl0 gettext \
+ xsltproc autopoint libxml2-dev libncurses5-dev libreadline-dev \
+ zlib1g-dev libgnutls28-dev libgcrypt11-dev libavahi-client-dev libsasl2-dev
\
+ libxen-dev lvm2 libgcrypt11-dev libparted0-dev libdevmapper-dev uuid-dev \
+ libudev-dev libpciaccess-dev libcap-ng-dev libnl-3-dev libnl-route-3-dev \
+ libyajl-dev libpcap0.8-dev libnuma-dev libnetcf-dev libaudit-dev \
+ libxml2-utils libapparmor-dev dnsmasq-base librbd-dev w3c-markup-validator
+}
+
+
+function do_Show_Info(){
+ echo
+ echo '-- Environment --'
+ echo "Running on Docker: $DISTRO"
+}
+
+
+function do_Show_Compiler(){
+
+ if [[ -n $CC ]]; then
+ echo
+ echo '-- Compiler in use --'
+ "$CC" --version
+ fi
+}
+
+
+# ----------- Build and Test libvirt -----------
+
+if [[ -n $IMAGE ]]; then
+ # Run docker using the selected image; then build and test
+ docker run -v "$(pwd)":/cwd -e CC=$CCO -e DISTRO=$IMAGE "$IMAGE"
sh -e -c " \
+ cd /cwd; \
+ tests/travis-ci.sh"
+ exit $?
+fi
+
+if [[ -n $DISTRO ]]; then
+ do_Show_Info
+ do_Install_Dependencies
+ do_Show_Compiler
+fi
+
+# The custom PATH is just to pick up OS-X homebrew & its harmless on Linux
+PATH="/usr/local/opt/gettext/bin:/usr/local/opt/rpcgen/bin:$PATH" ./autogen.sh
+
+# Build and test
+if [[ "$TRAVIS_OS_NAME" = "osx" ]]; then
+ # many unit tests fail & so does syntax-check, so skip for now
+ # one day we must fix it though....
+ make -j3
+else
+ VIR_TEST_DEBUG=1 make -j3 && make -j3 syntax-check && make -j3 check
+fi
+
+exit $?
--
2.11.0