Update the build script, so it is easier to define opts/flags per compiler, but also per architecture.
Signed-off-by: Ales Musil <[email protected]> --- .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 [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
