test/ocf: clean metadata before test
Now that we are switching to json config, metadata takes priority at startup, which can result in test failure because some devices were created from metadata. This patch uses clear_nvme() - the same function that is used in test/ocf/management/persistent-metadata.sh It is factored out in following patch. This patch fixes issue #1287 Change-Id: I16d40d0c1586a970c30761c0e1a81445621a419d Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1628 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
a919a31095
commit
8d22cb3e4d
@ -14,6 +14,27 @@ function cleanup(){
|
||||
rm -f $curdir/modes.conf
|
||||
}
|
||||
|
||||
function clear_nvme()
|
||||
{
|
||||
# Clear metadata on NVMe device
|
||||
$rootdir/scripts/setup.sh reset
|
||||
sleep 5
|
||||
name=$(get_nvme_name_from_bdf $1)
|
||||
|
||||
mountpoints=$(lsblk /dev/$name --output MOUNTPOINT -n | wc -w)
|
||||
if [ "$mountpoints" != "0" ]; then
|
||||
$rootdir/scripts/setup.sh
|
||||
exit 1
|
||||
fi
|
||||
dd if=/dev/zero of=/dev/$name bs=1M count=1000 oflag=direct
|
||||
$rootdir/scripts/setup.sh
|
||||
}
|
||||
|
||||
# Clear only nvme device which we will use in test
|
||||
bdf=$($rootdir/scripts/gen_nvme.sh --json | jq '.config[0].params.traddr' | sed s/\"//g)
|
||||
|
||||
clear_nvme "$bdf"
|
||||
|
||||
trap "cleanup; exit 1" SIGINT SIGTERM EXIT
|
||||
|
||||
nvme_cfg=$($rootdir/scripts/gen_nvme.sh)
|
||||
|
Loading…
Reference in New Issue
Block a user