From f6233da86363842237d373cdf8e102894be29c8f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 5 Aug 2010 11:15:09 -0700 Subject: [PATCH] Add cleanup option -c to zpios-sanity.sh See commit a6644f49a5af1dae5de7c87b704c8a7bee2ccf87 for full details of cleanup option. --- scripts/zpios-sanity.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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