Skip to content

Commit

Permalink
Cleanup zloop working directory after each pass
Browse files Browse the repository at this point in the history
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed by: John Kennedy <[email protected]>
Reviewed-by: Olaf Faaland <[email protected]>
Signed-off-by: Don Brady <[email protected]>
Issue openzfs#6595 
Closes openzfs#6663
  • Loading branch information
don-brady authored and tonyhutter committed Jan 18, 2018
1 parent 5e36a8d commit 465986e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/zloop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function store_core
{
core="$(core_file)"
if [[ $ztrc -ne 0 ]] || [[ -f "$core" ]]; then
df -h "$workdir" >>ztest.out
coreid=$(date "+zloop-%y%m%d-%H%M%S")
foundcrashes=$((foundcrashes + 1))

Expand Down Expand Up @@ -149,15 +150,16 @@ function store_core
# parse arguments
# expected format: zloop [-t timeout] [-c coredir] [-- extra ztest args]
coredir=$DEFAULTCOREDIR
workdir=$DEFAULTWORKDIR
basedir=$DEFAULTWORKDIR
rundir="zloop-run"
timeout=0
size="512m"
while getopts ":ht:s:c:f:" opt; do
case $opt in
t ) [[ $OPTARG -gt 0 ]] && timeout=$OPTARG ;;
s ) [[ $OPTARG ]] && size=$OPTARG ;;
c ) [[ $OPTARG ]] && coredir=$OPTARG ;;
f ) [[ $OPTARG ]] && workdir=$(readlink -f "$OPTARG") ;;
f ) [[ $OPTARG ]] && basedir=$(readlink -f "$OPTARG") ;;
h ) usage
exit 2
;;
Expand Down Expand Up @@ -201,6 +203,11 @@ curtime=$starttime
while [[ $timeout -eq 0 ]] || [[ $curtime -le $((starttime + timeout)) ]]; do
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
if [[ $((RANDOM % 2)) -eq 0 ]]; then
mirrors=2
Expand Down

0 comments on commit 465986e

Please sign in to comment.