nvmf: Delete partitions when tests end

Change-Id: Ia30e037e98df8b0c781ce769453bbf891091334d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-07-21 15:54:23 -07:00 committed by Benjamin Walker
parent 201843a9eb
commit e660e677b8
2 changed files with 18 additions and 1 deletions

View File

@ -112,3 +112,18 @@ function killprocess() {
kill $1
wait $1 || true
}
function nvme_cleanup()
{
# Load the kernel driver
./scripts/setup.sh reset
# Let the kernel discover any filesystems or partitions
sleep 10
# Delete all partitions on NVMe devices
devs=`lsblk -l -o NAME | grep nvme`
for dev in $devs; do
parted -s /dev/$dev mklabel msdos
done
}

View File

@ -18,7 +18,7 @@ timing_enter fs_test
$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf &
nvmfpid=$!
trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $nvmfpid; nvme_cleanup; exit 1" SIGINT SIGTERM EXIT
sleep 5
@ -58,6 +58,8 @@ for dev in $devs; do
umount /mnt/device
timing_exit $fstype
done
parted -s /dev/$dev rm 1
done
sync