build: Use errtrace to simplify travis-ci failure detection
authorThomas Graf <tgraf@noironetworks.com>
Tue, 26 Aug 2014 10:24:04 +0000 (12:24 +0200)
committerBen Pfaff <blp@nicira.com>
Tue, 26 Aug 2014 18:15:31 +0000 (11:15 -0700)
Causes the build script to fail if any command inside the
script returns nonzero.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
.travis/build.sh

index e9bb9e2..a9e5658 100755 (executable)
@@ -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