build: Use errtrace to simplify travis-ci failure detection
[cascardo/ovs.git] / .travis / build.sh
1 #!/bin/bash
2
3 set -o errexit
4
5 KERNELSRC=""
6
7 function install_kernel()
8 {
9     wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.14.7.tar.gz
10     tar xzvf linux-3.14.7.tar.gz > /dev/null
11     cd linux-3.14.7
12     make allmodconfig
13     make net/openvswitch/
14     KERNELSRC=$(pwd)
15     echo "Installed kernel source in $(pwd)"
16     cd ..
17 }
18
19 function install_dpdk()
20 {
21     wget http://www.dpdk.org/browse/dpdk/snapshot/dpdk-1.7.0.tar.gz
22     tar xzvf dpdk-1.7.0.tar.gz > /dev/null
23     cd dpdk-1.7.0
24     find ./ -type f | xargs sed -i 's/max-inline-insns-single=100/max-inline-insns-single=400/'
25     make config CC=gcc T=x86_64-native-linuxapp-gcc
26     make CC=gcc RTE_KERNELDIR=$KERNELSRC
27     sudo make install CC=gcc T=x86_64-native-linuxapp-gcc RTE_KERNELDIR=$KERNELSRC
28     echo "Installed DPDK source in $(pwd)"
29     cd ..
30 }
31
32 function configure_ovs()
33 {
34     ./boot.sh && ./configure $*
35 }
36
37 if [ "$KERNEL" ] || [ "$DPDK" ]; then
38     install_kernel
39 fi
40
41 [ "$DPDK" ] && install_dpdk
42
43 configure_ovs $*
44
45 if [ $CC = "clang" ]; then
46     make CFLAGS="-Werror -Wno-error=unused-command-line-argument"
47 else
48     make CFLAGS="-Werror" C=1
49     [ "$TESTSUITE" ] && make check
50 fi
51
52 exit 0