[ovs-dev] [PATCH] ci: Get rid of OVS_CFLAGS in CI scripts.

Ilya Maximets i.maximets at ovn.org
Thu Oct 3 15:47:29 UTC 2019


Our CI scripts uses OVS_CFLAGS variable that is intended for internal
usage by 'configure' script only.  Usual CFLAGS should be used instead
to avoid giving bad example to users.

Additionally, '-m32' flag passed directly to CC variable to avoid
splitting it from the compiler invocations and force same API/ABI for
invocations of 'configure' and 'make'.
'BUILD_ENV' dropped as not needed anymore.

Before this patch 'configure' always checked for 64bit libraries
regardless of fact that we're going to build 32bit binary.  This
caused issues if only 64bit version of desired library was available.

Suggested-by: Ben Pfaff <blp at ovn.org>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
---
 .cirrus.yml            |  4 ++--
 .travis.yml            |  2 +-
 .travis/linux-build.sh | 23 +++++++++++++----------
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 654e63ee0..1080729fe 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -20,11 +20,11 @@ freebsd_build_task:
 
   configure_script:
     - ./boot.sh
-    - ./configure CC=${COMPILER} MAKE=gmake OVS_CFLAGS='-Wall' --enable-Werror
+    - ./configure CC=${COMPILER} MAKE=gmake --enable-Werror
                   || { cat config.log; exit 1; }
 
   build_script:
-    - gmake -j8
+    - gmake -j8 CFLAGS="-g -O2 -Wall"
 
   check_script:
     - gmake -j8 check TESTSUITEFLAGS=-j8 RECHECK=yes
diff --git a/.travis.yml b/.travis.yml
index b547eb041..eabbad92d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -39,7 +39,7 @@ env:
   - 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"
+  - M32=1 OPTS="--disable-ssl"
   - DPDK=1 OPTS="--enable-shared"
   - DPDK_SHARED=1
   - DPDK_SHARED=1 OPTS="--enable-shared"
diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index 89496e2a2..9599ee4e2 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -3,7 +3,7 @@
 set -o errexit
 set -x
 
-CFLAGS=""
+CFLAGS_FOR_OVS="-g -O2"
 SPARSE_FLAGS=""
 EXTRA_OPTS="--enable-Werror"
 TARGET="x86_64-native-linuxapp-gcc"
@@ -129,10 +129,10 @@ function build_ovs()
     # Only build datapath if we are testing kernel w/o running testsuite
     if [ "${KERNEL}" ]; then
         pushd datapath
-        make -j4
+        make CFLAGS="${CFLAGS_FOR_OVS}" -j4
         popd
     else
-        make -j4 || { cat config.log; exit 1; }
+        make CFLAGS="${CFLAGS_FOR_OVS}" -j4 || { cat config.log; exit 1; }
     fi
 }
 
@@ -147,18 +147,20 @@ if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
     install_dpdk $DPDK_VER
     if [ "$CC" = "clang" ]; then
         # Disregard cast alignment errors until DPDK is fixed
-        CFLAGS="$CFLAGS -Wno-cast-align"
+        CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} -Wno-cast-align"
     fi
 fi
 
 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"
+    CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} -Wno-error=unused-command-line-argument"
+elif [ "$M32" ]; then
+    # Not using sparse for 32bit builds on 64bit machine.
+    # Adding m32 flag directly to CC to avoid any posiible issues with API/ABI
+    # difference on 'configure' and 'make' stages.
+    export CC="$CC -m32"
 else
     OPTS="--enable-sparse"
-    export OVS_CFLAGS="$CFLAGS $BUILD_ENV $SPARSE_FLAGS"
+    CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${SPARSE_FLAGS}"
 fi
 
 save_OPTS="${OPTS} $*"
@@ -170,7 +172,8 @@ if [ "$TESTSUITE" ]; then
     configure_ovs
 
     export DISTCHECK_CONFIGURE_FLAGS="$OPTS"
-    if ! make distcheck TESTSUITEFLAGS=-j4 RECHECK=yes; then
+    if ! make distcheck CFLAGS="${CFLAGS_FOR_OVS}" \
+         TESTSUITEFLAGS=-j4 RECHECK=yes; then
         # testsuite.log is necessary for debugging.
         cat */_build/sub/tests/testsuite.log
         exit 1
-- 
2.17.1



More information about the dev mailing list