[ovs-dev] [PATCH] build: Add travis continuous integration support

Thomas Graf tgraf at noironetworks.com
Mon Aug 25 12:51:00 UTC 2014


This enables the use of travis-ci via github. Linking any ovs
github repo to travis-ci [0] will automatically lead to a build
and testsuite run being triggered for each new commit or pull
requests against the repo.

The introduction of any warnings will cause the build to fail as
both gcc and clang are invoked with -Werror.

The build matrix currently includes:
  * --disable-ssl
  * --with-linux=linux-3.14.7
  * --with-dpdk=1.7.0

Each of these builds is performed with gcc+sparse and clang. The
testsuite is only run for the --with-linux build to keep the total
build time on an acceptable level.

Build failures are reported to the author and commiter by email,
through the travis-ci web UI, and in the github pull request.

A full build report example can be found here [1]

[0] http://travis-ci.org/
[1] https://travis-ci.org/tgraf/ovs/builds/33485228

Signed-off-by: Thomas Graf <tgraf at noironetworks.com>
---
 .travis.yml        | 13 +++++++++++++
 .travis/build.sh   | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 .travis/prepare.sh |  8 ++++++++
 Makefile.am        |  3 +++
 4 files changed, 79 insertions(+)
 create mode 100644 .travis.yml
 create mode 100755 .travis/build.sh
 create mode 100755 .travis/prepare.sh

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..85b13d0
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,13 @@
+language: c
+compiler:
+  - gcc
+  - clang
+
+before_install: ./.travis/prepare.sh
+
+env:
+  - OPTS="--disable-ssl"
+  - TESTSUITE=1 KERNEL=1 OPTS="--with-linux=./linux-3.14.7"
+  - KERNEL=1 DPDK=1 OPTS="--with-dpdk=./dpdk-1.7.0
+
+script: ./.travis/build.sh $OPTS
diff --git a/.travis/build.sh b/.travis/build.sh
new file mode 100755
index 0000000..e9bb9e2
--- /dev/null
+++ b/.travis/build.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+KERNELSRC=""
+
+function install_kernel()
+{
+    wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.14.7.tar.gz \
+    && tar xzvf linux-3.14.7.tar.gz > /dev/null \
+    && cd linux-3.14.7 \
+    && make allmodconfig \
+    && make net/openvswitch/ \
+    && KERNELSRC=$(pwd) \
+    && echo "Installed kernel source in $(pwd)" \
+    && cd ..
+
+    [ $? != 0 ] && exit 1
+}
+
+function install_dpdk()
+{
+    wget http://www.dpdk.org/browse/dpdk/snapshot/dpdk-1.7.0.tar.gz \
+    && tar xzvf dpdk-1.7.0.tar.gz > /dev/null \
+    && cd dpdk-1.7.0 \
+    && find ./ -type f | xargs sed -i 's/max-inline-insns-single=100/max-inline-insns-single=400/' \
+    && make config CC=gcc T=x86_64-native-linuxapp-gcc \
+    && make CC=gcc RTE_KERNELDIR=$KERNELSRC \
+    && sudo make install CC=gcc T=x86_64-native-linuxapp-gcc RTE_KERNELDIR=$KERNELSRC \
+    && echo "Installed DPDK source in $(pwd)" \
+    && cd ..
+
+    [ $? != 0 ] && exit 1
+}
+
+function configure_ovs()
+{
+    ./boot.sh && ./configure $*
+    [ $? != 0 ] && exit 1
+}
+
+if [ "$KERNEL" ] || [ "$DPDK" ]; then
+    install_kernel
+fi
+
+[ "$DPDK" ] && install_dpdk
+
+configure_ovs $*
+
+if [ $CC = "clang" ]; then
+    make CFLAGS="-Werror -Wno-error=unused-command-line-argument"
+else
+    make CFLAGS="-Werror" C=1 || exit 1
+    [ "$TESTSUITE" ] && make check
+fi
+
+exit 0
diff --git a/.travis/prepare.sh b/.travis/prepare.sh
new file mode 100755
index 0000000..6b5df00
--- /dev/null
+++ b/.travis/prepare.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+sudo apt-get update -qq
+sudo apt-get install -qq libssl-dev llvm-dev
+
+wget https://www.kernel.org/pub/software/devel/sparse/dist/sparse-0.5.0.tar.gz
+tar -xzvf sparse-0.5.0.tar.gz
+cd sparse-0.5.0 && make && sudo make install PREFIX=/usr && cd ..
diff --git a/Makefile.am b/Makefile.am
index eb58101..b64fb62 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,6 +82,9 @@ EXTRA_DIST = \
 	README-lisp \
 	REPORTING-BUGS \
 	TODO \
+	.travis.yml \
+	.travis/build.sh \
+	.travis/prepare.sh \
 	WHY-OVS \
 	boot.sh \
 	build-aux/cccl \
-- 
1.9.3




More information about the dev mailing list