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