test: fix errors in test persistent-metadata.sh

Test failed both on x86_64 and aarch64 on some cases:
1.nvme_cfg=$($rootdir/scripts/gen_nvme.sh)
If the driver haven't been changed to vfio-pci(haven't run
scripts/setup.sh), we got no result from gen_nvme.sh.
2."mountpoints=$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w)"
The global variable "blkname" (defined in get_nvme_name_from_bdf) is
always null here. For the scope of shell global variable is current
process. However, "name=$(get_nvme_name_from_bdf $1)" will create a
new process. We use variable "name" here.
3."name=$(get_nvme_name_from_bdf $1)"
If the "$rootdir/scripts/setup.sh reset" above is not ready, $name
will be null. For some non-x86 platforms, the waiting time maybe not
enough. So I adjust it to 5 seconds according to repeated tests.

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: Ia91460a3116bc0cc7c6c5f5ee471957caf9d0e06
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474184
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Richael Zhuang 2019-11-14 16:48:11 +08:00 committed by Tomasz Zawadzki
parent e9e3f61525
commit a95aefc38a

View File

@ -9,9 +9,9 @@ function clear_nvme()
{
# Clear metadata on NVMe device
$rootdir/scripts/setup.sh reset
sleep 1
sleep 5
name=$(get_nvme_name_from_bdf $1)
mountpoints=$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w)
mountpoints=$(lsblk /dev/$name --output MOUNTPOINT -n | wc -w)
if [ "$mountpoints" != "0" ]; then
$rootdir/scripts/setup.sh
exit 1
@ -22,6 +22,7 @@ function clear_nvme()
rpc_py=$rootdir/scripts/rpc.py
$rootdir/scripts/setup.sh
nvme_cfg=$($rootdir/scripts/gen_nvme.sh)
config="