diff mbox series

[ovs-dev] ci: Use CFLAGS instead of OVS_CFLAGS

Message ID 20220712063006.52713-1-amusil@redhat.com
State Accepted
Headers show
Series [ovs-dev] ci: Use CFLAGS instead of OVS_CFLAGS | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Ales Musil July 12, 2022, 6:30 a.m. UTC
The OVS_CFLAGS variable is for internal use only.
Use regular CFLAGS instead. This also has the effect
of correctly propagating the flags, when the OVS_CFLAGS
variable was used the -O1 was in the overwritten by
autoconf defaulting to -O2.

Signed-off-by: Ales Musil <amusil@redhat.com>
---
 .ci/linux-build.sh         | 24 +++++++++++-------------
 .github/workflows/test.yml |  2 --
 2 files changed, 11 insertions(+), 15 deletions(-)

Comments

Mark Michelson July 12, 2022, 9:02 p.m. UTC | #1
Thanks Ales.

Acked-by: Mark Michelson <mmichels@redhat.com>

On 7/12/22 02:30, Ales Musil wrote:
> The OVS_CFLAGS variable is for internal use only.
> Use regular CFLAGS instead. This also has the effect
> of correctly propagating the flags, when the OVS_CFLAGS
> variable was used the -O1 was in the overwritten by
> autoconf defaulting to -O2.
> 
> Signed-off-by: Ales Musil <amusil@redhat.com>
> ---
>   .ci/linux-build.sh         | 24 +++++++++++-------------
>   .github/workflows/test.yml |  2 --
>   2 files changed, 11 insertions(+), 15 deletions(-)
> 
> diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
> index 8c6d751dc..dc32564fa 100755
> --- a/.ci/linux-build.sh
> +++ b/.ci/linux-build.sh
> @@ -3,15 +3,15 @@
>   set -o errexit
>   set -x
>   
> -CFLAGS=""
> +COMMON_CFLAGS=""
>   OVN_CFLAGS=""
> -SPARSE_FLAGS=""
>   EXTRA_OPTS="--enable-Werror"
>   
>   function configure_ovs()
>   {
>       pushd ovs
> -    ./boot.sh && ./configure $* || { cat config.log; exit 1; }
> +    ./boot.sh && ./configure CFLAGS="${COMMON_CFLAGS}" $* || \
> +    { cat config.log; exit 1; }
>       make -j4 || { cat config.log; exit 1; }
>       popd
>   }
> @@ -19,9 +19,7 @@ function configure_ovs()
>   function configure_ovn()
>   {
>       configure_ovs $*
> -
> -    export OVS_CFLAGS="${OVS_CFLAGS} ${OVN_CFLAGS}"
> -    ./boot.sh && ./configure $* || \
> +    ./boot.sh && ./configure CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" $* || \
>       { cat config.log; exit 1; }
>   }
>   
> @@ -33,21 +31,19 @@ OPTS="${EXTRA_OPTS} ${save_OPTS}"
>   # OVS, to make sanitizer reports user friendly.
>   if [ "$SANITIZERS" ]; then
>       # Use the default options configured in tests/atlocal.in, in UBSAN_OPTIONS.
> -    CFLAGS="-O1 -fno-omit-frame-pointer -fno-common -g"
> -    CFLAGS_SANITIZERS="-fsanitize=address,undefined"
> -    OVN_CFLAGS="${OVN_CFLAGS} ${CFLAGS_SANITIZERS}"
> +    COMMON_CFLAGS="${COMMON_CFLAGS} -O1 -fno-omit-frame-pointer -fno-common -g"
> +    OVN_CFLAGS="${OVN_CFLAGS} -fsanitize=address,undefined"
>   fi
>   
>   if [ "$CC" = "clang" ]; then
> -    export OVS_CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
> +    COMMON_CFLAGS="${COMMON_CFLAGS} -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
> +    # Adding m32 flag directly to CC to avoid any possible issues with API/ABI
>       # difference on 'configure' and 'make' stages.
>       export CC="$CC -m32"
>   else
>       OPTS="$OPTS --enable-sparse"
> -    export OVS_CFLAGS="$CFLAGS $SPARSE_FLAGS"
>   fi
>   
>   if [ "$TESTSUITE" ]; then
> @@ -65,7 +61,9 @@ if [ "$TESTSUITE" ]; then
>           configure_ovn
>   
>           export DISTCHECK_CONFIGURE_FLAGS="$OPTS"
> -        if ! make distcheck -j4 TESTSUITEFLAGS="-j4" RECHECK=yes; then
> +        if ! make distcheck CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" -j4 \
> +            TESTSUITEFLAGS="-j4" RECHECK=yes
> +        then
>               # testsuite.log is necessary for debugging.
>               cat */_build/sub/tests/testsuite.log
>               exit 1
> diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
> index e0de7c60e..71541503d 100644
> --- a/.github/workflows/test.yml
> +++ b/.github/workflows/test.yml
> @@ -21,7 +21,6 @@ jobs:
>         OPTS:        ${{ matrix.opts }}
>         TESTSUITE:   ${{ matrix.testsuite }}
>         SANITIZERS:  ${{ matrix.sanitizers }}
> -      CFLAGS:      ${{ matrix.cflags }}
>   
>       name: linux ${{ join(matrix.*, ' ') }}
>       runs-on: ubuntu-20.04
> @@ -42,7 +41,6 @@ jobs:
>             - compiler:     clang
>               testsuite:    test
>               sanitizers:   sanitizers
> -            cflags:       -g
>   
>             - compiler:     gcc
>               testsuite:    test
>
Numan Siddique July 14, 2022, 8:09 p.m. UTC | #2
On Tue, Jul 12, 2022 at 4:04 PM Mark Michelson <mmichels@redhat.com> wrote:
>
> Thanks Ales.
>
> Acked-by: Mark Michelson <mmichels@redhat.com>

Thanks.  I applied this patch to the main branch.

Numan

>
> On 7/12/22 02:30, Ales Musil wrote:
> > The OVS_CFLAGS variable is for internal use only.
> > Use regular CFLAGS instead. This also has the effect
> > of correctly propagating the flags, when the OVS_CFLAGS
> > variable was used the -O1 was in the overwritten by
> > autoconf defaulting to -O2.
> >
> > Signed-off-by: Ales Musil <amusil@redhat.com>
> > ---
> >   .ci/linux-build.sh         | 24 +++++++++++-------------
> >   .github/workflows/test.yml |  2 --
> >   2 files changed, 11 insertions(+), 15 deletions(-)
> >
> > diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
> > index 8c6d751dc..dc32564fa 100755
> > --- a/.ci/linux-build.sh
> > +++ b/.ci/linux-build.sh
> > @@ -3,15 +3,15 @@
> >   set -o errexit
> >   set -x
> >
> > -CFLAGS=""
> > +COMMON_CFLAGS=""
> >   OVN_CFLAGS=""
> > -SPARSE_FLAGS=""
> >   EXTRA_OPTS="--enable-Werror"
> >
> >   function configure_ovs()
> >   {
> >       pushd ovs
> > -    ./boot.sh && ./configure $* || { cat config.log; exit 1; }
> > +    ./boot.sh && ./configure CFLAGS="${COMMON_CFLAGS}" $* || \
> > +    { cat config.log; exit 1; }
> >       make -j4 || { cat config.log; exit 1; }
> >       popd
> >   }
> > @@ -19,9 +19,7 @@ function configure_ovs()
> >   function configure_ovn()
> >   {
> >       configure_ovs $*
> > -
> > -    export OVS_CFLAGS="${OVS_CFLAGS} ${OVN_CFLAGS}"
> > -    ./boot.sh && ./configure $* || \
> > +    ./boot.sh && ./configure CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" $* || \
> >       { cat config.log; exit 1; }
> >   }
> >
> > @@ -33,21 +31,19 @@ OPTS="${EXTRA_OPTS} ${save_OPTS}"
> >   # OVS, to make sanitizer reports user friendly.
> >   if [ "$SANITIZERS" ]; then
> >       # Use the default options configured in tests/atlocal.in, in UBSAN_OPTIONS.
> > -    CFLAGS="-O1 -fno-omit-frame-pointer -fno-common -g"
> > -    CFLAGS_SANITIZERS="-fsanitize=address,undefined"
> > -    OVN_CFLAGS="${OVN_CFLAGS} ${CFLAGS_SANITIZERS}"
> > +    COMMON_CFLAGS="${COMMON_CFLAGS} -O1 -fno-omit-frame-pointer -fno-common -g"
> > +    OVN_CFLAGS="${OVN_CFLAGS} -fsanitize=address,undefined"
> >   fi
> >
> >   if [ "$CC" = "clang" ]; then
> > -    export OVS_CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
> > +    COMMON_CFLAGS="${COMMON_CFLAGS} -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
> > +    # Adding m32 flag directly to CC to avoid any possible issues with API/ABI
> >       # difference on 'configure' and 'make' stages.
> >       export CC="$CC -m32"
> >   else
> >       OPTS="$OPTS --enable-sparse"
> > -    export OVS_CFLAGS="$CFLAGS $SPARSE_FLAGS"
> >   fi
> >
> >   if [ "$TESTSUITE" ]; then
> > @@ -65,7 +61,9 @@ if [ "$TESTSUITE" ]; then
> >           configure_ovn
> >
> >           export DISTCHECK_CONFIGURE_FLAGS="$OPTS"
> > -        if ! make distcheck -j4 TESTSUITEFLAGS="-j4" RECHECK=yes; then
> > +        if ! make distcheck CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" -j4 \
> > +            TESTSUITEFLAGS="-j4" RECHECK=yes
> > +        then
> >               # testsuite.log is necessary for debugging.
> >               cat */_build/sub/tests/testsuite.log
> >               exit 1
> > diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
> > index e0de7c60e..71541503d 100644
> > --- a/.github/workflows/test.yml
> > +++ b/.github/workflows/test.yml
> > @@ -21,7 +21,6 @@ jobs:
> >         OPTS:        ${{ matrix.opts }}
> >         TESTSUITE:   ${{ matrix.testsuite }}
> >         SANITIZERS:  ${{ matrix.sanitizers }}
> > -      CFLAGS:      ${{ matrix.cflags }}
> >
> >       name: linux ${{ join(matrix.*, ' ') }}
> >       runs-on: ubuntu-20.04
> > @@ -42,7 +41,6 @@ jobs:
> >             - compiler:     clang
> >               testsuite:    test
> >               sanitizers:   sanitizers
> > -            cflags:       -g
> >
> >             - compiler:     gcc
> >               testsuite:    test
> >
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 8c6d751dc..dc32564fa 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -3,15 +3,15 @@ 
 set -o errexit
 set -x
 
-CFLAGS=""
+COMMON_CFLAGS=""
 OVN_CFLAGS=""
-SPARSE_FLAGS=""
 EXTRA_OPTS="--enable-Werror"
 
 function configure_ovs()
 {
     pushd ovs
-    ./boot.sh && ./configure $* || { cat config.log; exit 1; }
+    ./boot.sh && ./configure CFLAGS="${COMMON_CFLAGS}" $* || \
+    { cat config.log; exit 1; }
     make -j4 || { cat config.log; exit 1; }
     popd
 }
@@ -19,9 +19,7 @@  function configure_ovs()
 function configure_ovn()
 {
     configure_ovs $*
-
-    export OVS_CFLAGS="${OVS_CFLAGS} ${OVN_CFLAGS}"
-    ./boot.sh && ./configure $* || \
+    ./boot.sh && ./configure CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" $* || \
     { cat config.log; exit 1; }
 }
 
@@ -33,21 +31,19 @@  OPTS="${EXTRA_OPTS} ${save_OPTS}"
 # OVS, to make sanitizer reports user friendly.
 if [ "$SANITIZERS" ]; then
     # Use the default options configured in tests/atlocal.in, in UBSAN_OPTIONS.
-    CFLAGS="-O1 -fno-omit-frame-pointer -fno-common -g"
-    CFLAGS_SANITIZERS="-fsanitize=address,undefined"
-    OVN_CFLAGS="${OVN_CFLAGS} ${CFLAGS_SANITIZERS}"
+    COMMON_CFLAGS="${COMMON_CFLAGS} -O1 -fno-omit-frame-pointer -fno-common -g"
+    OVN_CFLAGS="${OVN_CFLAGS} -fsanitize=address,undefined"
 fi
 
 if [ "$CC" = "clang" ]; then
-    export OVS_CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
+    COMMON_CFLAGS="${COMMON_CFLAGS} -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
+    # Adding m32 flag directly to CC to avoid any possible issues with API/ABI
     # difference on 'configure' and 'make' stages.
     export CC="$CC -m32"
 else
     OPTS="$OPTS --enable-sparse"
-    export OVS_CFLAGS="$CFLAGS $SPARSE_FLAGS"
 fi
 
 if [ "$TESTSUITE" ]; then
@@ -65,7 +61,9 @@  if [ "$TESTSUITE" ]; then
         configure_ovn
 
         export DISTCHECK_CONFIGURE_FLAGS="$OPTS"
-        if ! make distcheck -j4 TESTSUITEFLAGS="-j4" RECHECK=yes; then
+        if ! make distcheck CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" -j4 \
+            TESTSUITEFLAGS="-j4" RECHECK=yes
+        then
             # testsuite.log is necessary for debugging.
             cat */_build/sub/tests/testsuite.log
             exit 1
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e0de7c60e..71541503d 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -21,7 +21,6 @@  jobs:
       OPTS:        ${{ matrix.opts }}
       TESTSUITE:   ${{ matrix.testsuite }}
       SANITIZERS:  ${{ matrix.sanitizers }}
-      CFLAGS:      ${{ matrix.cflags }}
 
     name: linux ${{ join(matrix.*, ' ') }}
     runs-on: ubuntu-20.04
@@ -42,7 +41,6 @@  jobs:
           - compiler:     clang
             testsuite:    test
             sanitizers:   sanitizers
-            cflags:       -g
 
           - compiler:     gcc
             testsuite:    test