.travis.yml | 19 +++++++++------- tests/travis-ci.sh | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 8 deletions(-) create mode 100755 tests/travis-ci.sh
From: Claudio André <claudioandre.br@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
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Sun, May 28, 2017 at 11:07:41PM -0300, claudioandre.br@gmail.com wrote: >From: Claudio André <claudioandre.br@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'. > 'modprobe -c' fails for some reason. Is the user inside the container root? I don't think so. Some more info output could be nice, like 'uname -a', 'id', and so on, so that we can gather as much info about the system as possible. At least for people who don't want to pull the docker image just to try it out. > .travis.yml | 19 +++++++++------- > tests/travis-ci.sh | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ One disadvantage for using the script is that it couples al output together. I know it's needed for running that inside the container, but the installation and configuration parts take lot of output that I had to scroll through. Could _that_ be separated at least? The less there needs to be in the script the better as with this you cannot see the configuration from the Web UI, which is sometimes pretty convenient. > 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 > Maybe doing the setup part inside the before_script, so that it is not taken as a part of the output. I'm not that familiar with Travis, though. Also in your config (not here), you have some differences, for example compiler: ["gcc"] even though it doesn't take arrays. It doesn't matter, I know, it just confused me a bit :D > # 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 \ Somehow the -qq didn't work, or you didn't have it in the script in the build you sent the link to. That's ione of the things hidden fromt he Web UI. >+ 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 If there is no way how to make output of this command collapsed in the travis output, I suggest (although others might disagree), to create a wrapper that does something like the following: COUNTER=0 silent_if_passes() { tmp_name="/tmp/$$_$COUNTER_$RANDOM" COUNTER=$((COUNTER+1)) "$@" >$tmp_name.1.txt 2>$tmp_name.2.txt; if [[ "$?" -ne "0" ]]; then echo "Command $* failed" >&2 echo " stdout:" >&2 cat $tmp_name.1.txt >&2 cat $tmp_name.2.txt >&2 fi } And then call not really important setup commands with the silent_if_passes prefix. That's just a suggestion, though. Also it might not work at all, I just typed it in the mail without actually trying it out. You can also print the output of all commands at the end in case the build fails, but that might be too much data. >+} >+ >+ >+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 > >-- >libvir-list mailing list >libvir-list@redhat.com >https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Em 29/05/2017 08:54, Martin Kletzander escreveu: > On Sun, May 28, 2017 at 11:07:41PM -0300, claudioandre.br@gmail.com > wrote: >> From: Claudio André <claudioandre.br@gmail.com> > > 'modprobe -c' fails for some reason. Ahh! Well, it is possible to run modprobe inside Docker if I enable some options. I'll check it. > Is the user inside the container root? I don't think so. Some more > info output > could be nice, like 'uname -a', 'id', and so on. I did it. > One disadvantage for using the script is that it couples al output > together. I know it's needed for running that inside the container, but > the installation and configuration parts take lot of output that I had > to scroll through. Could _that_ be separated at least? You can fold/collapsed the output yourself. That said, I folded the autogen part, but I'll keep the make unfolded (the way Travis does). Please, let me know if you want anything else folded (e.g., hide everything but tests). And, please: - access https://travis-ci.org/claudioandre/libvirt/jobs/237625211 - and look at line 485 to see the folding in action > Also in your config (not here), you have some differences, for example > compiler: ["gcc"] even though it doesn't take arrays. It doesn't > matter, I know, it just confused me a bit :D This was Travis itself. I fixed it, please, confirm that using the link seen above. > Somehow the -qq didn't work, or you didn't have it in the script in the > build you sent the link to. That's ione of the things hidden fromt he > Web UI. Without -qq is much worse. We can: 1. collapse as seen above; 2. redirect stdout to /dev/null (I mean, there is no important information here). I prefer (and use) #2. The silent_if_passes() has some drawbacks. Claudio -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Tue, May 30, 2017 at 03:52:06PM -0300, Claudio André wrote: >Em 29/05/2017 08:54, Martin Kletzander escreveu: >> On Sun, May 28, 2017 at 11:07:41PM -0300, claudioandre.br@gmail.com >> wrote: >>> From: Claudio André <claudioandre.br@gmail.com> >> >> 'modprobe -c' fails for some reason. > >Ahh! Well, it is possible to run modprobe inside Docker if I enable some >options. I'll >check it. > >> Is the user inside the container root? I don't think so. Some more >> info output >> could be nice, like 'uname -a', 'id', and so on. > >I did it. > >> One disadvantage for using the script is that it couples al output >> together. I know it's needed for running that inside the container, but >> the installation and configuration parts take lot of output that I had >> to scroll through. Could _that_ be separated at least? > >You can fold/collapsed the output yourself. That said, I folded the >autogen part, but I'll >keep the make unfolded (the way Travis does). Please, let me know if you >want anything else folded (e.g., hide everything but tests). > That's great. I was just talking about the fact that I didn't see the option to keep something folded by default. >And, please: >- access https://travis-ci.org/claudioandre/libvirt/jobs/237625211 >- and look at line 485 to see the folding in action > Yeah, this looks great. I like when it's more compact, I just want to save some people some time in the future. >> Also in your config (not here), you have some differences, for example >> compiler: ["gcc"] even though it doesn't take arrays. It doesn't >> matter, I know, it just confused me a bit :D > >This was Travis itself. I fixed it, please, confirm that using the link >seen above. > >> Somehow the -qq didn't work, or you didn't have it in the script in the >> build you sent the link to. That's ione of the things hidden fromt he >> Web UI. > >Without -qq is much worse. We can: >1. collapse as seen above; >2. redirect stdout to /dev/null (I mean, there is no important >information here). > >I prefer (and use) #2. > either -qq collapsed or just put it to /dev/null. I don't care which one, if there is a problem with the installation it will be in stderr anyway. >The silent_if_passes() has some drawbacks. > Sure, I didn't know you can collapse part of the output of one command and that was the first idea that came to my mind. So the link shows the output with the current patch? >Claudio > -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Em 31/05/2017 04:12, Martin Kletzander escreveu: > >> Without -qq is much worse. We can: >> 1. collapse as seen above; >> 2. redirect stdout to /dev/null (I mean, there is no important >> information here). >> >> I prefer (and use) #2. >> > > either -qq collapsed or just put it to /dev/null. I don't care which > one, if there is a problem with the installation it will be in stderr > anyway. > >> The silent_if_passes() has some drawbacks. >> > > Sure, I didn't know you can collapse part of the output of one command > and that was the first idea that came to my mind. > > So the link shows the output with the current patch? This is the output of the current patch: https://travis-ci.org/claudioandre/libvirt/builds/237687907 - everything passes (including Ubuntu 17.04) - folded 'autogen' - apt-get redirecting stdout to dev/null - precise (gcc + clang) - (note: libvirt master builds only for clang) - trusty (gcc + clang) - OSX with more than 10000 lines (note: this already happens in libvirt master) So, you now have 2+2+1+2 builds. The current patch follows ASAP. Thank you Claudio -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.