[ovs-dev] [PATCH 2/2] travis: support OS X builds

Lance Richardson lrichard at redhat.com
Wed Mar 23 20:04:47 UTC 2016


Add support for travis-ci OS X builds:
  - Add linux- prefix to existing build/prepare scripts
  - Create new OS X flavored build/prepare scripts
  - Update .travis.yml for OS X

At this time only one build job included in the matrix for OS X.

Signed-off-by: Lance Richardson <lrichard at redhat.com>
---
 .travis.yml              |  13 +++++-
 .travis/build.sh         | 109 -----------------------------------------------
 .travis/linux-build.sh   | 109 +++++++++++++++++++++++++++++++++++++++++++++++
 .travis/linux-prepare.sh |   5 +++
 .travis/osx-build.sh     |  28 ++++++++++++
 .travis/osx-prepare.sh   |   3 ++
 .travis/prepare.sh       |   5 ---
 Makefile.am              |   6 ++-
 8 files changed, 160 insertions(+), 118 deletions(-)
 delete mode 100755 .travis/build.sh
 create mode 100755 .travis/linux-build.sh
 create mode 100755 .travis/linux-prepare.sh
 create mode 100755 .travis/osx-build.sh
 create mode 100755 .travis/osx-prepare.sh
 delete mode 100755 .travis/prepare.sh

diff --git a/.travis.yml b/.travis.yml
index 6618073..ee2cf21 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,9 @@ compiler:
   - gcc
   - clang
 
+os:
+  - linux
+
 addons:
   apt:
     packages:
@@ -13,7 +16,7 @@ addons:
       - libjemalloc1
       - libjemalloc-dev
 
-before_install: ./.travis/prepare.sh
+before_install: ./.travis/${TRAVIS_OS_NAME}-prepare.sh
 
 before_script: export PATH=$PATH:$HOME/bin
 
@@ -34,7 +37,13 @@ env:
   - KERNEL=3.10.96
   - TESTSUITE=1 LIBS=-ljemalloc
 
-script: ./.travis/build.sh $OPTS
+matrix:
+  include:
+    - os: osx
+      compiler: clang
+      env: OPTS="--disable-ssl"
+
+script: ./.travis/${TRAVIS_OS_NAME}-build.sh $OPTS
 
 notifications:
   email:
diff --git a/.travis/build.sh b/.travis/build.sh
deleted file mode 100755
index ef712d0..0000000
--- a/.travis/build.sh
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/bin/bash
-
-set -o errexit
-
-KERNELSRC=""
-CFLAGS="-Werror"
-SPARSE_FLAGS=""
-EXTRA_OPTS=""
-
-function install_kernel()
-{
-    if [[ "$1" =~ ^4.* ]]; then
-        PREFIX="v4.x"
-    elif [[ "$1" =~ ^3.* ]]; then
-        PREFIX="v3.x"
-    else
-        PREFIX="v2.6/longterm/v2.6.32"
-    fi
-
-    wget https://www.kernel.org/pub/linux/kernel/${PREFIX}/linux-${1}.tar.gz
-    tar xzvf linux-${1}.tar.gz > /dev/null
-    cd linux-${1}
-    make allmodconfig
-
-    # Older kernels do not include openvswitch
-    if [ -d "net/openvswitch" ]; then
-        make net/openvswitch/
-    else
-        make net/bridge/
-    fi
-
-    KERNELSRC=$(pwd)
-    if [ ! "$DPDK" ]; then
-        EXTRA_OPTS="--with-linux=$(pwd)"
-    fi
-    echo "Installed kernel source in $(pwd)"
-    cd ..
-}
-
-function install_dpdk()
-{
-    if [ -n "$DPDK_GIT" ]; then
-        git clone $DPDK_GIT dpdk-$1
-        cd dpdk-$1
-        git checkout v$1
-    else
-        wget http://www.dpdk.org/browse/dpdk/snapshot/dpdk-$1.tar.gz
-        tar xzvf dpdk-$1.tar.gz > /dev/null
-        cd dpdk-$1
-    fi
-    find ./ -type f | xargs sed -i 's/max-inline-insns-single=100/max-inline-insns-single=400/'
-    sed -ri 's,(CONFIG_RTE_BUILD_COMBINE_LIBS=).*,\1y,' config/common_linuxapp
-    echo 'CONFIG_RTE_BUILD_FPIC=y' >>config/common_linuxapp
-    sed -ri '/EXECENV_CFLAGS  = -pthread -fPIC/{s/$/\nelse ifeq ($(CONFIG_RTE_BUILD_FPIC),y)/;s/$/\nEXECENV_CFLAGS  = -pthread -fPIC/}' mk/exec-env/linuxapp/rte.vars.mk
-    make config CC=gcc T=x86_64-native-linuxapp-gcc
-    make CC=gcc RTE_KERNELDIR=$KERNELSRC
-    echo "Installed DPDK source in $(pwd)"
-    cd ..
-}
-
-function configure_ovs()
-{
-    ./boot.sh && ./configure $*
-}
-
-if [ "$KERNEL" ] || [ "$DPDK" ]; then
-    install_kernel $KERNEL
-fi
-
-if [ "$DPDK" ]; then
-    if [ -z "$DPDK_VER" ]; then
-        DPDK_VER="2.2.0"
-    fi
-    install_dpdk $DPDK_VER
-    if [ "$CC" = "clang" ]; then
-        # Disregard cast alignment errors until DPDK is fixed
-        CFLAGS="$CFLAGS -Wno-cast-align"
-    fi
-    EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=./dpdk-$DPDK_VER/build"
-elif [ "$CC" != "clang" ]; then
-    # DPDK headers currently trigger sparse errors
-    SPARSE_FLAGS="$SPARSE_FLAGS -Wsparse-error"
-fi
-
-configure_ovs $EXTRA_OPTS $*
-
-# Only build datapath if we are testing kernel w/o running testsuite
-if [ "$KERNEL" ] && [ ! "$TESTSUITE" ] && [ ! "$DPDK" ]; then
-    cd datapath
-fi
-
-if [ "$CC" = "clang" ]; then
-    make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
-elif [[ $BUILD_ENV =~ "-m32" ]]; then
-    # Disable sparse for 32bit builds on 64bit machine
-    make CFLAGS="$CFLAGS $BUILD_ENV"
-else
-    make CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS" C=1
-fi
-
-if [ "$TESTSUITE" ] && [ "$CC" != "clang" ]; then
-    if ! make distcheck RECHECK=yes; then
-        # testsuite.log is necessary for debugging.
-        cat */_build/tests/testsuite.log
-        exit 1
-    fi
-fi
-
-exit 0
diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
new file mode 100755
index 0000000..ef712d0
--- /dev/null
+++ b/.travis/linux-build.sh
@@ -0,0 +1,109 @@
+#!/bin/bash
+
+set -o errexit
+
+KERNELSRC=""
+CFLAGS="-Werror"
+SPARSE_FLAGS=""
+EXTRA_OPTS=""
+
+function install_kernel()
+{
+    if [[ "$1" =~ ^4.* ]]; then
+        PREFIX="v4.x"
+    elif [[ "$1" =~ ^3.* ]]; then
+        PREFIX="v3.x"
+    else
+        PREFIX="v2.6/longterm/v2.6.32"
+    fi
+
+    wget https://www.kernel.org/pub/linux/kernel/${PREFIX}/linux-${1}.tar.gz
+    tar xzvf linux-${1}.tar.gz > /dev/null
+    cd linux-${1}
+    make allmodconfig
+
+    # Older kernels do not include openvswitch
+    if [ -d "net/openvswitch" ]; then
+        make net/openvswitch/
+    else
+        make net/bridge/
+    fi
+
+    KERNELSRC=$(pwd)
+    if [ ! "$DPDK" ]; then
+        EXTRA_OPTS="--with-linux=$(pwd)"
+    fi
+    echo "Installed kernel source in $(pwd)"
+    cd ..
+}
+
+function install_dpdk()
+{
+    if [ -n "$DPDK_GIT" ]; then
+        git clone $DPDK_GIT dpdk-$1
+        cd dpdk-$1
+        git checkout v$1
+    else
+        wget http://www.dpdk.org/browse/dpdk/snapshot/dpdk-$1.tar.gz
+        tar xzvf dpdk-$1.tar.gz > /dev/null
+        cd dpdk-$1
+    fi
+    find ./ -type f | xargs sed -i 's/max-inline-insns-single=100/max-inline-insns-single=400/'
+    sed -ri 's,(CONFIG_RTE_BUILD_COMBINE_LIBS=).*,\1y,' config/common_linuxapp
+    echo 'CONFIG_RTE_BUILD_FPIC=y' >>config/common_linuxapp
+    sed -ri '/EXECENV_CFLAGS  = -pthread -fPIC/{s/$/\nelse ifeq ($(CONFIG_RTE_BUILD_FPIC),y)/;s/$/\nEXECENV_CFLAGS  = -pthread -fPIC/}' mk/exec-env/linuxapp/rte.vars.mk
+    make config CC=gcc T=x86_64-native-linuxapp-gcc
+    make CC=gcc RTE_KERNELDIR=$KERNELSRC
+    echo "Installed DPDK source in $(pwd)"
+    cd ..
+}
+
+function configure_ovs()
+{
+    ./boot.sh && ./configure $*
+}
+
+if [ "$KERNEL" ] || [ "$DPDK" ]; then
+    install_kernel $KERNEL
+fi
+
+if [ "$DPDK" ]; then
+    if [ -z "$DPDK_VER" ]; then
+        DPDK_VER="2.2.0"
+    fi
+    install_dpdk $DPDK_VER
+    if [ "$CC" = "clang" ]; then
+        # Disregard cast alignment errors until DPDK is fixed
+        CFLAGS="$CFLAGS -Wno-cast-align"
+    fi
+    EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=./dpdk-$DPDK_VER/build"
+elif [ "$CC" != "clang" ]; then
+    # DPDK headers currently trigger sparse errors
+    SPARSE_FLAGS="$SPARSE_FLAGS -Wsparse-error"
+fi
+
+configure_ovs $EXTRA_OPTS $*
+
+# Only build datapath if we are testing kernel w/o running testsuite
+if [ "$KERNEL" ] && [ ! "$TESTSUITE" ] && [ ! "$DPDK" ]; then
+    cd datapath
+fi
+
+if [ "$CC" = "clang" ]; then
+    make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
+elif [[ $BUILD_ENV =~ "-m32" ]]; then
+    # Disable sparse for 32bit builds on 64bit machine
+    make CFLAGS="$CFLAGS $BUILD_ENV"
+else
+    make CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS" C=1
+fi
+
+if [ "$TESTSUITE" ] && [ "$CC" != "clang" ]; then
+    if ! make distcheck RECHECK=yes; then
+        # testsuite.log is necessary for debugging.
+        cat */_build/tests/testsuite.log
+        exit 1
+    fi
+fi
+
+exit 0
diff --git a/.travis/linux-prepare.sh b/.travis/linux-prepare.sh
new file mode 100755
index 0000000..752be9f
--- /dev/null
+++ b/.travis/linux-prepare.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+git clone git://git.kernel.org/pub/scm/devel/sparse/chrisl/sparse.git
+cd sparse && make && make install && cd ..
+pip install --disable-pip-version-check --user six
diff --git a/.travis/osx-build.sh b/.travis/osx-build.sh
new file mode 100755
index 0000000..4db9c8d
--- /dev/null
+++ b/.travis/osx-build.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -o errexit
+
+CFLAGS="-Werror -Wno-error=format $CFLAGS"
+EXTRA_OPTS=""
+
+function configure_ovs()
+{
+    ./boot.sh && ./configure $*
+}
+
+configure_ovs $EXTRA_OPTS $*
+
+if [ "$CC" = "clang" ]; then
+    make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
+else
+    make CFLAGS="$CFLAGS $BUILD_ENV"
+fi
+if [ "$TESTSUITE" ] && [ "$CC" != "clang" ]; then
+    if ! make distcheck RECHECK=yes; then
+        # testsuite.log is necessary for debugging.
+        cat */_build/tests/testsuite.log
+        exit 1
+    fi
+fi
+
+exit 0
diff --git a/.travis/osx-prepare.sh b/.travis/osx-prepare.sh
new file mode 100755
index 0000000..cf46d87
--- /dev/null
+++ b/.travis/osx-prepare.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+set -ev
+pip install --user six
diff --git a/.travis/prepare.sh b/.travis/prepare.sh
deleted file mode 100755
index 752be9f..0000000
--- a/.travis/prepare.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-git clone git://git.kernel.org/pub/scm/devel/sparse/chrisl/sparse.git
-cd sparse && make && make install && cd ..
-pip install --disable-pip-version-check --user six
diff --git a/Makefile.am b/Makefile.am
index 8c3ffd6..bd9ee00 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -99,8 +99,10 @@ EXTRA_DIST = \
 	$(docs) \
 	NOTICE \
 	.travis.yml \
-	.travis/build.sh \
-	.travis/prepare.sh \
+	.travis/linux-build.sh \
+	.travis/linux-prepare.sh \
+	.travis/osx-build.sh \
+	.travis/osx-prepare.sh \
 	appveyor.yml \
 	boot.sh \
 	build-aux/cccl \
-- 
2.5.5




More information about the dev mailing list