autotest_common: Simplify check for libiscsi's API version

This is done to get rid of this:
autotest_common.sh: line 384: [: -ge: unary operator expected

This happens for older libiscsi which doesn't define
LIBISCSI_API_VERSION in the iscsi.h.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I658ab2936e161d648fc301fadcc510b84a61d916
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8710
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
This commit is contained in:
Michal Berger 2021-07-08 09:48:41 +02:00 committed by Tomasz Zawadzki
parent 9378515eee
commit 85bf4c81a4

View File

@ -378,8 +378,9 @@ function get_config_params() {
fi
if [ -d /usr/include/iscsi ]; then
libiscsi_version=$(grep LIBISCSI_API_VERSION /usr/include/iscsi/iscsi.h | head -1 | awk '{print $3}' | awk -F '(' '{print $2}' | awk -F ')' '{print $1}')
if [ $libiscsi_version -ge 20150621 ]; then
[[ $(< /usr/include/iscsi/iscsi.h) =~ "define LIBISCSI_API_VERSION ("([0-9]+)")" ]] \
&& libiscsi_version=${BASH_REMATCH[1]}
if ((libiscsi_version >= 20150621)); then
config_params+=' --with-iscsi-initiator'
fi
fi