From a95aefc38a3d2f6b29fa0e6d25e838c0b552497f Mon Sep 17 00:00:00 2001 From: Richael Zhuang Date: Thu, 14 Nov 2019 16:48:11 +0800 Subject: [PATCH] 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 Change-Id: Ia91460a3116bc0cc7c6c5f5ee471957caf9d0e06 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474184 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Vitaliy Mysak Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- test/ocf/management/persistent-metadata.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/ocf/management/persistent-metadata.sh b/test/ocf/management/persistent-metadata.sh index cab8398e8..8a8968240 100755 --- a/test/ocf/management/persistent-metadata.sh +++ b/test/ocf/management/persistent-metadata.sh @@ -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="