[ovs-dev] [PATCH] build: Use errtrace to simplify travis-ci failure detection

Thomas Graf tgraf at noironetworks.com
Tue Aug 26 10:24:04 UTC 2014


Causes the build script to fail if any command inside the
script returns nonzero.

Signed-off-by: Thomas Graf <tgraf at noironetworks.com>
---
 .travis/build.sh | 43 ++++++++++++++++++++-----------------------
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/.travis/build.sh b/.travis/build.sh
index e9bb9e2..a9e5658 100755
--- a/.travis/build.sh
+++ b/.travis/build.sh
@@ -1,40 +1,37 @@
 #!/bin/bash
 
+set -o errexit
+
 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
+    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 ..
 }
 
 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
+    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 ..
 }
 
 function configure_ovs()
 {
     ./boot.sh && ./configure $*
-    [ $? != 0 ] && exit 1
 }
 
 if [ "$KERNEL" ] || [ "$DPDK" ]; then
@@ -48,7 +45,7 @@ configure_ovs $*
 if [ $CC = "clang" ]; then
     make CFLAGS="-Werror -Wno-error=unused-command-line-argument"
 else
-    make CFLAGS="-Werror" C=1 || exit 1
+    make CFLAGS="-Werror" C=1
     [ "$TESTSUITE" ] && make check
 fi
 
-- 
1.9.3




More information about the dev mailing list