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: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
c3162ca0fb
commit
0d61bf4b50
17
autotest.sh
17
autotest.sh
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user