Add cleanup option -c to zpios-sanity.sh

See commit a6644f49a5 for full
details of cleanup option.
This commit is contained in:
Brian Behlendorf 2010-08-05 11:15:09 -07:00
parent a469c62186
commit f6233da863
1 changed files with 12 additions and 2 deletions

View File

@ -17,7 +17,7 @@ HEADER=
usage() {
cat << EOF
USAGE:
$0 [hv]
$0 [hvxfc]
DESCRIPTION:
ZPIOS sanity tests
@ -27,11 +27,12 @@ OPTIONS:
-v Verbose
-x Destructive hd/sd/md/dm/ram tests
-f Don't prompt due to -x
-c Cleanup lo+file devices at start
EOF
}
while getopts 'hvxf' OPTION; do
while getopts 'hvxfc?' OPTION; do
case $OPTION in
h)
usage
@ -46,6 +47,9 @@ while getopts 'hvxf' OPTION; do
f)
FORCE=1
;;
c)
CLEANUP=1
;;
?)
usage
exit
@ -57,6 +61,12 @@ if [ $(id -u) != 0 ]; then
die "Must run as root"
fi
# Perform pre-cleanup is requested
if [ ${CLEANUP} ]; then
cleanup_loop_devices
rm -f /tmp/zpool.cache.*
fi
zpios_test() {
CONFIG=$1
TEST=$2