autobuild: Consider use of clang while building DPDK

Our CI has a separate job dedicated for clang builds. Consider that
while specifying arguments to make sure they are compatible with the
actual compiler that is being used during the test.

Also, be strict as to what compilers can be used for the test -
gcc and clang only.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ia1a4e9fea9a46e37c07fffe5077c4dacbe13102a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9614
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Michal Berger 2021-09-24 11:07:07 +02:00 committed by Tomasz Zawadzki
parent bcd3ed39e7
commit 71a8e5658c

View File

@ -55,10 +55,17 @@ function ocf_precompile() {
function build_native_dpdk() {
local external_dpdk_dir
local external_dpdk_base_dir
local gcc_version
local compiler_version
local compiler
gcc_version=$(gcc -dumpversion)
gcc_version=${gcc_version//./}
compiler=${CC:-gcc}
if [[ $compiler != *clang* && $compiler != *gcc* ]]; then
echo "Unsupported compiler detected ($compiler), failing the test" >&2
return 1
fi
compiler_version=$("$compiler" -dumpversion)
compiler_version=${compiler_version%%.*}
external_dpdk_dir="$SPDK_RUN_EXTERNAL_DPDK"
external_dpdk_base_dir="$(dirname $external_dpdk_dir)"
@ -75,11 +82,11 @@ function build_native_dpdk() {
dpdk_cflags="-fPIC -g -fcommon"
dpdk_ldflags=""
if [[ $gcc_version -ge 5 ]]; then
if [[ $compiler == *gcc* && $compiler_version -ge 5 ]]; then
dpdk_cflags+=" -Werror"
fi
if [[ $gcc_version -ge 10 ]]; then
if [[ $compiler == *gcc* && $compiler_version -ge 10 ]]; then
dpdk_cflags+=" -Wno-stringop-overflow"
fi