Cleanup zloop working directory after each pass

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed by: John Kennedy <jwk404@gmail.com>
Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Signed-off-by: Don Brady <don.brady@delphix.com>
Issue #6595
Closes #6663
This commit is contained in:
Don Brady 2017-09-21 11:17:56 -06:00 committed by Tony Hutter
parent 701ebd014a
commit d1630dda58

View File

@ -101,6 +101,7 @@ function store_core
{ {
core="$(core_file)" core="$(core_file)"
if [[ $ztrc -ne 0 ]] || [[ -f "$core" ]]; then if [[ $ztrc -ne 0 ]] || [[ -f "$core" ]]; then
df -h "$workdir" >>ztest.out
coreid=$(date "+zloop-%y%m%d-%H%M%S") coreid=$(date "+zloop-%y%m%d-%H%M%S")
foundcrashes=$((foundcrashes + 1)) foundcrashes=$((foundcrashes + 1))
@ -150,7 +151,8 @@ function store_core
# parse arguments # parse arguments
# expected format: zloop [-t timeout] [-c coredir] [-- extra ztest args] # expected format: zloop [-t timeout] [-c coredir] [-- extra ztest args]
coredir=$DEFAULTCOREDIR coredir=$DEFAULTCOREDIR
workdir=$DEFAULTWORKDIR basedir=$DEFAULTWORKDIR
rundir="zloop-run"
timeout=0 timeout=0
size="512m" size="512m"
while getopts ":ht:s:c:f:" opt; do while getopts ":ht:s:c:f:" opt; do
@ -158,7 +160,7 @@ while getopts ":ht:s:c:f:" opt; do
t ) [[ $OPTARG -gt 0 ]] && timeout=$OPTARG ;; t ) [[ $OPTARG -gt 0 ]] && timeout=$OPTARG ;;
s ) [[ $OPTARG ]] && size=$OPTARG ;; s ) [[ $OPTARG ]] && size=$OPTARG ;;
c ) [[ $OPTARG ]] && coredir=$OPTARG ;; c ) [[ $OPTARG ]] && coredir=$OPTARG ;;
f ) [[ $OPTARG ]] && workdir=$(readlink -f "$OPTARG") ;; f ) [[ $OPTARG ]] && basedir=$(readlink -f "$OPTARG") ;;
h ) usage h ) usage
exit 2 exit 2
;; ;;
@ -202,6 +204,11 @@ curtime=$starttime
while [[ $timeout -eq 0 ]] || [[ $curtime -le $((starttime + timeout)) ]]; do while [[ $timeout -eq 0 ]] || [[ $curtime -le $((starttime + timeout)) ]]; do
zopt="-VVVVV" zopt="-VVVVV"
# start each run with an empty directory
workdir="$basedir/$rundir"
or_die rm -rf "$workdir"
or_die mkdir "$workdir"
# switch between common arrangements & fully randomized # switch between common arrangements & fully randomized
if [[ $((RANDOM % 2)) -eq 0 ]]; then if [[ $((RANDOM % 2)) -eq 0 ]]; then
mirrors=2 mirrors=2