test/nvmf: Replace [ with [[ test in allocate_nic_ips()

The former will force Bash to complain if $ip consists of more than
one ip address. E.g.:

  1:08:55	# '[' -z 192.168.121.37 192.168.121.36 ']'
  line 104: [: 192.168.121.37: binary operator expected

The alternative is to properly quote the $ip inside [, however, [[
is always the safest approach.

Change-Id: Iced7319a106ce35a183840984aa6e6e1e52caa16
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4478
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Michal Berger 2020-09-30 13:32:49 +02:00 committed by Tomasz Zawadzki
parent 26811624b8
commit e351dca373

View File

@ -101,7 +101,7 @@ function allocate_nic_ips() {
((count = NVMF_IP_LEAST_ADDR)) ((count = NVMF_IP_LEAST_ADDR))
for nic_name in $(get_rdma_if_list); do for nic_name in $(get_rdma_if_list); do
ip="$(get_ip_address $nic_name)" ip="$(get_ip_address $nic_name)"
if [ -z $ip ]; then if [[ -z $ip ]]; then
ip addr add $NVMF_IP_PREFIX.$count/24 dev $nic_name ip addr add $NVMF_IP_PREFIX.$count/24 dev $nic_name
ip link set $nic_name up ip link set $nic_name up
((count = count + 1)) ((count = count + 1))