[ovs-dev,2/3] travis: Combine kernel builds.
diff mbox series

Message ID 20190806114607.9659-3-i.maximets@samsung.com
State Accepted
Headers show
Series
  • travis: Build time optimization.
Related show

Commit Message

Ilya Maximets Aug. 6, 2019, 11:46 a.m. UTC
Single kernel build job takes ~3 minutes in average. Most of
this time takes VM spawning and initial configuration.
Combining these 24 jobs in 4 allows us to better utilize workers
and not waste time on spawning VMs.

Before:

    24 jobs * 3 minutes = 72 minutes
    72 minutes / 5 workers = 14.4 minutes / worker

After:

    4 jobs * 10 minutes = 40 minutes
    40 minutes / 4 workers = 10 minutes / worker
    + 1 free worker that able to run other jobs at the same time.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 .travis.yml            | 18 ++++-------------
 .travis/linux-build.sh | 46 +++++++++++++++++++++++++++++++++---------
 2 files changed, 40 insertions(+), 24 deletions(-)

Patch
diff mbox series

diff --git a/.travis.yml b/.travis.yml
index 7fe4bfacf..370b3d0a6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -34,24 +34,14 @@  env:
   - OPTS="--disable-ssl"
   - TESTSUITE=1 KERNEL=3.16
   - TESTSUITE=1 OPTS="--enable-shared"
+  - TESTSUITE=1 DPDK=1
+  - TESTSUITE=1 LIBS=-ljemalloc
+  - KERNEL_LIST="5.0  4.20 4.19 4.18 4.17 4.16"
+  - KERNEL_LIST="4.15 4.14 4.9  4.4  3.19 3.16"
   - BUILD_ENV="-m32" OPTS="--disable-ssl"
   - DPDK=1 OPTS="--enable-shared"
-  - TESTSUITE=1 DPDK=1
   - DPDK_SHARED=1
   - DPDK_SHARED=1 OPTS="--enable-shared"
-  - KERNEL=5.0
-  - KERNEL=4.20
-  - KERNEL=4.19
-  - KERNEL=4.18
-  - KERNEL=4.17
-  - KERNEL=4.16
-  - KERNEL=4.15
-  - KERNEL=4.14
-  - KERNEL=4.9
-  - KERNEL=4.4
-  - KERNEL=3.19
-  - KERNEL=3.16
-  - TESTSUITE=1 LIBS=-ljemalloc
 
 matrix:
   include:
diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index 98aa12b22..1577ae516 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -31,6 +31,8 @@  function install_kernel()
              sed 's/.*\..*\.\(.*\)/\1/' | sort -h | tail -1)
     version="${1}.${lo_ver}"
 
+    rm -rf index* linux-*
+
     url="${base_url}/linux-${version}.tar.xz"
     # Download kernel sources. Try direct link on CDN failure.
     wget ${url} || wget ${url} || wget ${url/cdn/www}
@@ -117,6 +119,23 @@  function configure_ovs()
     ./boot.sh && ./configure $* || { cat config.log; exit 1; }
 }
 
+function build_ovs()
+{
+    local KERNEL=$1
+
+    configure_ovs $OPTS
+    make selinux-policy
+
+    # Only build datapath if we are testing kernel w/o running testsuite
+    if [ "${KERNEL}" ]; then
+        pushd datapath
+        make -j4
+        popd
+    else
+        make -j4
+    fi
+}
+
 if [ "$KERNEL" ]; then
     install_kernel $KERNEL
 fi
@@ -132,18 +151,19 @@  if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
     fi
 fi
 
-OPTS="$EXTRA_OPTS $*"
-
 if [ "$CC" = "clang" ]; then
     export OVS_CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
 elif [[ $BUILD_ENV =~ "-m32" ]]; then
     # Disable sparse for 32bit builds on 64bit machine
     export OVS_CFLAGS="$CFLAGS $BUILD_ENV"
 else
-    OPTS="$OPTS --enable-sparse"
+    OPTS="--enable-sparse"
     export OVS_CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS"
 fi
 
+save_OPTS="${OPTS} $*"
+OPTS="${EXTRA_OPTS} ${save_OPTS}"
+
 if [ "$TESTSUITE" ]; then
     # 'distcheck' will reconfigure with required options.
     # Now we only need to prepare the Makefile without sparse-wrapped CC.
@@ -156,14 +176,20 @@  if [ "$TESTSUITE" ]; then
         exit 1
     fi
 else
-    configure_ovs $OPTS
-    make selinux-policy
-
-    # Only build datapath if we are testing kernel w/o running testsuite
-    if [ "$KERNEL" ]; then
-        cd datapath
+    if [ -z "${KERNEL_LIST}" ]; then build_ovs ${KERNEL};
+    else
+        save_EXTRA_OPTS="${EXTRA_OPTS}"
+        for KERNEL in ${KERNEL_LIST}; do
+            echo "=============================="
+            echo "Building with kernel ${KERNEL}"
+            echo "=============================="
+            EXTRA_OPTS="${save_EXTRA_OPTS}"
+            install_kernel ${KERNEL}
+            OPTS="${EXTRA_OPTS} ${save_OPTS}"
+            build_ovs ${KERNEL}
+            make distclean
+        done
     fi
-    make -j4
 fi
 
 exit 0