diff mbox series

[ovs-dev,4/8] travis: Run testsuite with desired options.

Message ID 20190208164900.30679-5-i.maximets@samsung.com
State Accepted
Headers show
Series travis: Fix equal distcheck runs. | expand

Commit Message

Ilya Maximets Feb. 8, 2019, 4:48 p.m. UTC
'make distcheck' executes it's own './configure' without any options
provided to the script. This means that in current configuration
Travis CI always re-builds and runs testsuite on a defualt binaries.
i.e. we're not checking testsuite with DPDK, not checking testsuite
with '--enable-shared' and not checking it with '-ljemalloc'.
We just 8 times running the testsuite without arguments. Only compiler
changes (gcc or clang) because CC is exported by Travis.

This patch reorders the commands in the build script and provides
'DISTCHECK_CONFIGURE_FLAGS' to force 'make distcheck' using our
desired configuration.

Another issue that addressed here is that we will no longe build
twice in case of TESTSUITE.

For linking inside the distcheck we also need to provide absulute path
to DPDK libraries.

'configure' executed before 'distcheck' to have a Makefile target.
It's executed without arguments because 'configure' inside the
'distcheck' will fail if we'll use sparse-wrapped CC.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 .travis/linux-build.sh | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index 8c931ebc5..e91fa1395 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -95,37 +95,44 @@  if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; 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"
+    EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=$(pwd)/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 $*
-
-make selinux-policy
-
-# Only build datapath if we are testing kernel w/o running testsuite
-if [ "$KERNEL" ] && [ ! "$TESTSUITE" ] && \
-   [ ! "$DPDK" ] && [ ! "$DPDK_SHARED" ]; then
-    cd datapath
-fi
+OPTS="$EXTRA_OPTS $*"
 
 if [ "$CC" = "clang" ]; then
-    make -j2 CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
+    export OVS_CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
 elif [[ $BUILD_ENV =~ "-m32" ]]; then
     # Disable sparse for 32bit builds on 64bit machine
-    make -j2 CFLAGS="$CFLAGS $BUILD_ENV"
+    export OVS_CFLAGS="$CFLAGS $BUILD_ENV"
 else
-    make -j2 CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS" C=1
+    OPTS="$OPTS --enable-sparse"
+    export OVS_CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS"
 fi
 
 if [ "$TESTSUITE" ]; then
+    # 'distcheck' will reconfigure with required options.
+    # Now we only need to prepare the Makefile wihtout sparse-wrapped CC.
+    configure_ovs
+
+    export DISTCHECK_CONFIGURE_FLAGS="$OPTS"
     if ! make distcheck TESTSUITEFLAGS=-j4 RECHECK=yes; then
         # testsuite.log is necessary for debugging.
         cat */_build/tests/testsuite.log
         exit 1
     fi
+else
+    configure_ovs $OPTS
+    make selinux-policy
+
+    # Only build datapath if we are testing kernel w/o running testsuite
+    if [ "$KERNEL" ] && [ ! "$DPDK" ] && [ ! "$DPDK_SHARED" ]; then
+        cd datapath
+    fi
+    make -j4
 fi
 
 exit 0