diff --git a/scripts/zpios-sanity.sh b/scripts/zpios-sanity.sh index 20744a9eb8..194ae82e2e 100755 --- a/scripts/zpios-sanity.sh +++ b/scripts/zpios-sanity.sh @@ -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