Whamcloud - gitweb
LU-14682 tests: sanity-flr to remove temporary files 69/43669/4
authorAlex Zhuravlev <bzzz@whamcloud.com>
Wed, 12 May 2021 04:33:02 +0000 (07:33 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 2 Jun 2021 17:50:10 +0000 (17:50 +0000)
otherwise the test fails frequently on small local systems due
to lack of space.

Test-Parameters: trivial testlist=sanity-flr
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I7076bcf2346ae1ec7a4d1bead3d94b2c4bb57bbf
Reviewed-on: https://review.whamcloud.com/43669
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-flr.sh

index 49566ec..a0b6792 100644 (file)
@@ -962,6 +962,8 @@ test_21() {
 
        [[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" && return
 
+       stack_trap "rm -f $tf $tf2"
+
        $LFS setstripe -E EOF -o 0 $tf
        $LFS setstripe -E EOF -o 1 $tf2
 
@@ -1006,6 +1008,8 @@ get_osc_lock_count() {
 test_22() {
        local tf=$DIR/$tfile
 
+       stack_trap "rm -f $tf"
+
        $LFS setstripe -E EOF -o 0 $tf
        dd if=/dev/zero of=$tf bs=1M count=$((RANDOM % 20 + 1))
 
@@ -1070,6 +1074,8 @@ test_32() {
        [[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" && return
        rm -f $DIR/$tfile $DIR/$tfile-2
 
+       stack_trap "rm -f $DIR/$tfile"
+
        $LFS setstripe -E EOF -o 0 $DIR/$tfile
        dd if=/dev/urandom of=$DIR/$tfile bs=1M count=$((RANDOM % 10 + 2))
 
@@ -1407,6 +1413,8 @@ create_file_36() {
 test_36() {
        local tf=$DIR/$tfile
 
+       stack_trap "rm -f $tf $tf-2 $tf-3"
+
        create_file_36 $tf $tf-2 $tf-3
 
        [ $($LFS getstripe -N $tf) -gt 1 ] || error "wrong mirror count"
@@ -1484,6 +1492,8 @@ test_37()
        local tf3=$DIR/$tfile-3
        local tf4=$DIR/$tfile-4
 
+       stack_trap "rm -f $tf $tf2 $tf3 $tf4"
+
        create_files_37 $((RANDOM + 15 * 1048576)) $tf $tf2 $tf3
        rm -f $tf4
        cp $tf $tf4
@@ -1548,6 +1558,8 @@ test_38() {
        local tf=$DIR/$tfile
        local ref=$DIR/${tfile}-ref
 
+       stack_trap "rm -f $tf $ref"
+
        $LFS setstripe -E 1M -S 1M -c 1 -E 4M -c 2 -E eof -c -1 $tf ||
                error "creating $tf failed"
        $LFS setstripe -E 2M -S 1M -c 1 -E 6M -c 2 -E 8M -c -1 -E eof -c -1 \
@@ -1684,6 +1696,8 @@ run_test 40 "PFLR rdonly state instantiation check"
 test_41() {
        local tf=$DIR/$tfile
 
+       stack_trap "rm -f $tf $tf-1"
+
        rm -f $tf $tf-1
        echo " **create two FLR files $tf $tf-1"
        $LFS mirror create -N -E 2M -S 1M -E 4M -E -1 \
@@ -1780,6 +1794,8 @@ test_42() {
        local mirror_cmd="$LFS mirror verify"
        local i
 
+       stack_trap "rm -rf $td"
+
        # create parent directory
        mkdir $td || error "mkdir $td failed"
 
@@ -1948,6 +1964,7 @@ test_43b() {
 
        test_mkdir $DIR/$tdir
        rm -f $tf
+       stack_trap "rm -rf $tf"
 
        # create 3 mirrors FLR file, the first 2 mirrors are preferred
        $LFS setstripe -N -Eeof --flags=prefer -N -Eeof --flags=prefer \
@@ -1971,6 +1988,8 @@ test_44() {
        local tf=$DIR/$tdir/$tfile
        local tf1=$DIR/$tdir-1/$tfile-1
 
+       stack_trap "rm -rf $tf $tf1"
+
        $LFS setdirstripe -i 0 -c 1 $DIR/$tdir ||
                error "create directory failed"
        $LFS setdirstripe -i 1 -c 1 $DIR/$tdir-1 ||