]> granicus.if.org Git - zfs/commitdiff
Cleanup zloop working directory after each pass
authorDon Brady <dev.fs.zfs@gmail.com>
Thu, 21 Sep 2017 17:17:56 +0000 (11:17 -0600)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 21 Sep 2017 17:17:56 +0000 (10:17 -0700)
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

scripts/zloop.sh

index d3ec93202ad1ef37b86654f7b04c4fc623d60fe8..f285d6a252365e12679868b45733242da7c5a84f 100755 (executable)
@@ -99,6 +99,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))
 
@@ -148,13 +149,14 @@ 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
 while getopts ":ht:c:f:" opt; do
        case $opt in
                t ) [[ $OPTARG -gt 0 ]] && timeout=$OPTARG ;;
                c ) [[ $OPTARG ]] && coredir=$OPTARG ;;
-               f ) [[ $OPTARG ]] && workdir=$(readlink -f "$OPTARG") ;;
+               f ) [[ $OPTARG ]] && basedir=$(readlink -f "$OPTARG") ;;
                h ) usage
                    exit 2
                    ;;
@@ -198,6 +200,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