common/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify
[xfstests-dev.git] / tests / generic / 051
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 051
6 #
7 # Basic log recovery stress test - do lots of stuff, shut down in the middle of
8 # it and check that recovery runs to completion and everything can be
9 # successfully removed afterwards..
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18
19 # get standard environment, filters and checks
20 . ./common/rc
21 . ./common/filter
22
23 _cleanup()
24 {
25         cd /
26         _scratch_unmount 2>/dev/null
27         rm -f $tmp.*
28 }
29 trap "_cleanup; exit \$status" 0 1 2 3 15
30
31 # real QA test starts here
32 _supported_fs generic
33 _supported_os Linux
34
35 _require_scratch
36 _require_scratch_shutdown
37 _require_command "$KILLALL_PROG" killall
38
39 rm -f $seqres.full
40
41 _scratch_mkfs > $seqres.full 2>&1
42 _require_metadata_journaling $SCRATCH_DEV
43 _scratch_mount
44
45 SLEEP_TIME=$((30 * $TIME_FACTOR))
46 PROCS=$((2 * LOAD_FACTOR))
47
48 load_dir=$SCRATCH_MNT/test
49
50 # let this run for a while
51 $FSSTRESS_PROG $FSSTRESS_AVOID -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
52 sleep $SLEEP_TIME
53 $KILLALL_PROG -q $FSSTRESS_PROG
54 wait
55 sync
56 _scratch_unmount
57
58 # now mount again, run the load again, this time with a shutdown.
59 _scratch_mount
60 $XFS_FSR_PROG -v $load_dir >> $seqres.full 2>&1
61 $FSSTRESS_PROG -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
62 sleep $SLEEP_TIME
63 sync
64
65 # now shutdown and unmount
66 sleep 5
67 _scratch_shutdown
68 $KILLALL_PROG -q $FSSTRESS_PROG
69 wait
70
71 # for some reason fsstress processes manage to live on beyond the wait?
72 sleep 5
73 _scratch_unmount
74
75 # now recover, check the filesystem for consistency
76 _scratch_mount
77 _scratch_unmount
78 _check_scratch_fs
79
80 # now clean up.
81 _scratch_mount
82 for d in $load_dir/*; do
83         rm -rf $d > /dev/null 2>&1 &
84 done
85 wait
86 _scratch_unmount
87
88 echo "No output is good. Failures are loud."
89
90 status=0
91 exit