diff mbox series

[ovs-dev,1/2] CI: Refactor the linux-build.sh

Message ID 20221128142541.300300-1-amusil@redhat.com
State Accepted
Headers show
Series [ovs-dev,1/2] CI: Refactor the linux-build.sh | expand

Checks

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

Commit Message

Ales Musil Nov. 28, 2022, 2:25 p.m. UTC
Update the build script, so it is easier to
define opts/flags per compiler, but also per architecture.

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

Comments

0-day Robot Nov. 28, 2022, 2:40 p.m. UTC | #1
Bleep bloop.  Greetings Ales Musil, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 82 characters long (recommended limit is 79)
#67 FILE: .ci/linux-build.sh:48:
       COMMON_CFLAGS="${COMMON_CFLAGS} -O1 -fno-omit-frame-pointer -fno-common -g"

Lines checked: 126, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Numan Siddique Dec. 7, 2022, 5:36 p.m. UTC | #2
On Mon, Nov 28, 2022 at 9:26 AM Ales Musil <amusil@redhat.com> wrote:
>
> Update the build script, so it is easier to
> define opts/flags per compiler, but also per architecture.
>
> Signed-off-by: Ales Musil <amusil@redhat.com>

Thanks Ales.

I applied both the patches to the main.

Numan

> ---
>  .ci/linux-build.sh         | 48 +++++++++++++++++++++-----------------
>  .github/workflows/test.yml |  8 +++----
>  2 files changed, 31 insertions(+), 25 deletions(-)
>
> diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
> index dc1ca5240..d7a49b6c0 100755
> --- a/.ci/linux-build.sh
> +++ b/.ci/linux-build.sh
> @@ -3,9 +3,10 @@
>  set -o errexit
>  set -x
>
> +ARCH=${ARCH:-"x86_64"}
>  COMMON_CFLAGS=""
>  OVN_CFLAGS=""
> -EXTRA_OPTS="--enable-Werror"
> +OPTS="$OPTS --enable-Werror"
>
>  function configure_ovs()
>  {
> @@ -23,28 +24,33 @@ function configure_ovn()
>      { cat config.log; exit 1; }
>  }
>
> -save_OPTS="${OPTS} $*"
> -OPTS="${EXTRA_OPTS} ${save_OPTS}"
> -
> -# If AddressSanitizer and UndefinedBehaviorSanitizer are requested, enable them,
> -# but only for OVN, not for OVS.  However, disable some optimizations for
> -# OVS, to make sanitizer reports user friendly.
> -if [ "$SANITIZERS" ]; then
> -    # Use the default options configured in tests/atlocal.in, in UBSAN_OPTIONS.
> -    COMMON_CFLAGS="${COMMON_CFLAGS} -O1 -fno-omit-frame-pointer -fno-common -g"
> -    OVN_CFLAGS="${OVN_CFLAGS} -fsanitize=address,undefined"
> -fi
> +function configure_gcc()
> +{
> +    if [ "$ARCH" = "x86_64" ]; then
> +        # Enable sparse only for x86_64 architecture.
> +        OPTS="$OPTS --enable-sparse"
> +    elif [ "$ARCH" = "x86" ]; then
> +        # Adding m32 flag directly to CC to avoid any possible issues
> +        # with API/ABI difference on 'configure' and 'make' stages.
> +        export CC="$CC -m32"
> +    fi
> +}
>
> -if [ "$CC" = "clang" ]; then
> +function configure_clang()
> +{
> +    # If AddressSanitizer and UndefinedBehaviorSanitizer are requested,
> +    # enable them, but only for OVN, not for OVS.  However, disable some
> +    # optimizations for OVS, to make sanitizer reports user friendly.
> +    if [ "$SANITIZERS" ]; then
> +       # Use the default options configured in tests/atlocal.in,
> +       # in UBSAN_OPTIONS.
> +       COMMON_CFLAGS="${COMMON_CFLAGS} -O1 -fno-omit-frame-pointer -fno-common -g"
> +       OVN_CFLAGS="${OVN_CFLAGS} -fsanitize=address,undefined"
> +    fi
>      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 possible issues with API/ABI
> -    # difference on 'configure' and 'make' stages.
> -    export CC="$CC -m32"
> -else
> -    OPTS="$OPTS --enable-sparse"
> -fi
> +}
> +
> +configure_$CC
>
>  if [ "$TESTSUITE" ]; then
>      if [ "$TESTSUITE" = "system-test" ]; then
> diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
> index cf98a30fa..0f8d9d193 100644
> --- a/.github/workflows/test.yml
> +++ b/.github/workflows/test.yml
> @@ -19,9 +19,9 @@ jobs:
>          libssl-dev llvm-dev libelf-dev libnuma-dev libpcap-dev  \
>          selinux-policy-dev ncat python3-scapy isc-dhcp-server
>        m32_dependecies: gcc-multilib
> +      ARCH:        ${{ matrix.cfg.arch }}
>        CC:          ${{ matrix.cfg.compiler }}
>        LIBS:        ${{ matrix.cfg.libs }}
> -      M32:         ${{ matrix.cfg.m32 }}
>        OPTS:        ${{ matrix.cfg.opts }}
>        TESTSUITE:   ${{ matrix.cfg.testsuite }}
>        TEST_RANGE:  ${{ matrix.cfg.test_range }}
> @@ -56,7 +56,7 @@ jobs:
>          - { compiler: clang, testsuite: system-test, sanitizers: sanitizers, test_range: "-100" }
>          - { compiler: clang, testsuite: system-test, sanitizers: sanitizers, test_range: "101-200" }
>          - { compiler: clang, testsuite: system-test, sanitizers: sanitizers, test_range: "201-" }
> -        - { compiler: gcc,  m32: m32, opts: --disable-ssl}
> +        - { arch: x86, compiler: gcc, opts: --disable-ssl }
>
>      steps:
>      - name: checkout
> @@ -90,11 +90,11 @@ jobs:
>        run:  sudo apt install -y ${{ env.dependencies }}
>
>      - name: install libunbound libunwind
> -      if:   matrix.cfg.m32 == ''
> +      if:   matrix.cfg.arch != 'x86'
>        run:  sudo apt install -y libunbound-dev libunwind-dev
>
>      - name: install 32-bit dependencies
> -      if:   matrix.cfg.m32 != ''
> +      if:   matrix.cfg.arch == 'x86'
>        run:  sudo apt install -y ${{ env.m32_dependecies }}
>
>      - name: update PATH
> --
> 2.38.1
>
> _______________________________________________
> 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 dc1ca5240..d7a49b6c0 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -3,9 +3,10 @@ 
 set -o errexit
 set -x
 
+ARCH=${ARCH:-"x86_64"}
 COMMON_CFLAGS=""
 OVN_CFLAGS=""
-EXTRA_OPTS="--enable-Werror"
+OPTS="$OPTS --enable-Werror"
 
 function configure_ovs()
 {
@@ -23,28 +24,33 @@  function configure_ovn()
     { cat config.log; exit 1; }
 }
 
-save_OPTS="${OPTS} $*"
-OPTS="${EXTRA_OPTS} ${save_OPTS}"
-
-# If AddressSanitizer and UndefinedBehaviorSanitizer are requested, enable them,
-# but only for OVN, not for OVS.  However, disable some optimizations for
-# OVS, to make sanitizer reports user friendly.
-if [ "$SANITIZERS" ]; then
-    # Use the default options configured in tests/atlocal.in, in UBSAN_OPTIONS.
-    COMMON_CFLAGS="${COMMON_CFLAGS} -O1 -fno-omit-frame-pointer -fno-common -g"
-    OVN_CFLAGS="${OVN_CFLAGS} -fsanitize=address,undefined"
-fi
+function configure_gcc()
+{
+    if [ "$ARCH" = "x86_64" ]; then
+        # Enable sparse only for x86_64 architecture.
+        OPTS="$OPTS --enable-sparse"
+    elif [ "$ARCH" = "x86" ]; then
+        # Adding m32 flag directly to CC to avoid any possible issues
+        # with API/ABI difference on 'configure' and 'make' stages.
+        export CC="$CC -m32"
+    fi
+}
 
-if [ "$CC" = "clang" ]; then
+function configure_clang()
+{
+    # If AddressSanitizer and UndefinedBehaviorSanitizer are requested,
+    # enable them, but only for OVN, not for OVS.  However, disable some
+    # optimizations for OVS, to make sanitizer reports user friendly.
+    if [ "$SANITIZERS" ]; then
+       # Use the default options configured in tests/atlocal.in,
+       # in UBSAN_OPTIONS.
+       COMMON_CFLAGS="${COMMON_CFLAGS} -O1 -fno-omit-frame-pointer -fno-common -g"
+       OVN_CFLAGS="${OVN_CFLAGS} -fsanitize=address,undefined"
+    fi
     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 possible issues with API/ABI
-    # difference on 'configure' and 'make' stages.
-    export CC="$CC -m32"
-else
-    OPTS="$OPTS --enable-sparse"
-fi
+}
+
+configure_$CC
 
 if [ "$TESTSUITE" ]; then
     if [ "$TESTSUITE" = "system-test" ]; then
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index cf98a30fa..0f8d9d193 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -19,9 +19,9 @@  jobs:
         libssl-dev llvm-dev libelf-dev libnuma-dev libpcap-dev  \
         selinux-policy-dev ncat python3-scapy isc-dhcp-server
       m32_dependecies: gcc-multilib
+      ARCH:        ${{ matrix.cfg.arch }}
       CC:          ${{ matrix.cfg.compiler }}
       LIBS:        ${{ matrix.cfg.libs }}
-      M32:         ${{ matrix.cfg.m32 }}
       OPTS:        ${{ matrix.cfg.opts }}
       TESTSUITE:   ${{ matrix.cfg.testsuite }}
       TEST_RANGE:  ${{ matrix.cfg.test_range }}
@@ -56,7 +56,7 @@  jobs:
         - { compiler: clang, testsuite: system-test, sanitizers: sanitizers, test_range: "-100" }
         - { compiler: clang, testsuite: system-test, sanitizers: sanitizers, test_range: "101-200" }
         - { compiler: clang, testsuite: system-test, sanitizers: sanitizers, test_range: "201-" }
-        - { compiler: gcc,  m32: m32, opts: --disable-ssl}
+        - { arch: x86, compiler: gcc, opts: --disable-ssl }
 
     steps:
     - name: checkout
@@ -90,11 +90,11 @@  jobs:
       run:  sudo apt install -y ${{ env.dependencies }}
 
     - name: install libunbound libunwind
-      if:   matrix.cfg.m32 == ''
+      if:   matrix.cfg.arch != 'x86'
       run:  sudo apt install -y libunbound-dev libunwind-dev
 
     - name: install 32-bit dependencies
-      if:   matrix.cfg.m32 != ''
+      if:   matrix.cfg.arch == 'x86'
       run:  sudo apt install -y ${{ env.m32_dependecies }}
 
     - name: update PATH