Commit 0d61bf4b authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

autotest: move NVMe device cleanup to startup



Make sure any partition tables or other random data on the disks is
cleaned up before running the tests, rather than trying to clean it up
on failure when the system is in a potentially bad state.

Change-Id: Ia2119485aee6a50243744328dff2314d7a72adad
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent c3162ca0
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -39,6 +39,23 @@ if hash lcov; then
	$LCOV -q -c -i -t "Baseline" -d $src -o cov_base.info
fi

# Make sure the disks are clean (no leftover partition tables)
timing_enter cleanup
if [ $(uname -s) = Linux ]; then
	# 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
fi
timing_exit cleanup

# set up huge pages
timing_enter afterboot
./scripts/setup.sh
+0 −15
Original line number Diff line number Diff line
@@ -137,21 +137,6 @@ function killprocess() {
	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
}

function iscsicleanup() {
	echo "Cleaning up iSCSI connection"
	iscsiadm -m node --logout || true
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ timing_enter fs_test
$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf &
nvmfpid=$!

trap "killprocess $nvmfpid; nvme_cleanup; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT

sleep 5