generic/554: hide permision warning on exfat
[xfstests-dev.git] / tests / generic / 055
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 055
6 #
7 # * like 054 but want to create more/different kinds of metadata
8 #   and so will use fsstress
9 # * also can interrupt metadata with godown
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 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
19
20 # get standard environment, filters and checks
21 . ./common/rc
22 . ./common/filter
23 . ./common/log
24 . ./common/quota
25
26 _do_meta()
27 {
28     out=$SCRATCH_MNT/fsstress
29     count=10000
30     param="-p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 \
31            -f rename=30 -f stat=30 -f unlink=30 -f truncate=20"
32     _echofull "calling fsstress $param -m8 -n $count"
33     FSSTRESS_ARGS=`_scale_fsstress_args $param $FSSTRESS_AVOID -m 8 -n $count -d $out`
34     if ! $FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.full 2>&1
35     then
36         _echofull "fsstress failed"
37     fi
38 }
39
40 _get_quota_option()
41 {
42     case $FSTYP in
43     xfs)
44         _require_xfs_quota
45         echo "-o uquota"
46         ;;
47     *)
48         ;;
49     esac
50 }
51
52 # real QA test starts here
53 _supported_fs generic
54
55 rm -f $seqres.full $tmp.*
56 _require_scratch
57 _require_scratch_shutdown
58 _require_logstate
59
60 QUOTA_OPTION=`_get_quota_option`
61
62 echo "*** init FS"
63 _scratch_unmount >/dev/null 2>&1
64
65 _scratch_mkfs >/dev/null 2>&1
66 _require_metadata_journaling $SCRATCH_DEV
67
68 _get_log_configs > $tmp.seq.params
69
70 cat $tmp.seq.params \
71 | while read mkfs mnt restofline
72 do
73     if [ "$mkfs" = "#" ]; then
74         continue
75     fi
76
77     echo "--- mkfs=$mkfs, mnt=$mnt ---" >> $seqres.full
78     export MKFS_OPTIONS="-l $mkfs"
79     export MOUNT_OPTIONS="-o $mnt"
80
81     # mkfs the FS
82     _echofull "mkfs"
83     _scratch_mkfs >>$seqres.full 2>&1
84     if [ $? -ne 0 ] ; then
85         _echofull "mkfs failed: $MKFS_OPTIONS"
86         continue
87     fi
88
89     # mount the FS
90     _echofull "mount"
91     if ! _try_scratch_mount $QUOTA_OPTION >>$seqres.full 2>&1; then
92         _echofull "mount failed: $MOUNT_OPTIONS"
93         continue
94     fi
95
96     # create the metadata
97     _do_meta
98
99     # check before on what FS should look like
100     _echofull "ls -RF SCRATCH_MNT"
101     ls -RF $SCRATCH_MNT >$tmp.ls1
102
103     _echofull "godown"
104     _scratch_shutdown -v -f >> $seqres.full
105
106     _echofull "unmount"
107     _scratch_unmount >>$seqres.full 2>&1 \
108         || _fail "umount failed"
109
110     _echofull "logprint after going down..."
111     _print_logstate
112
113     _full "logprint headers"
114     _scratch_xfs_logprint -n >>$seqres.full 2>&1
115
116     _echofull "mount with replay"
117     _try_scratch_mount $QUOTA_OPTION >>$seqres.full 2>&1 \
118         || _fail "mount failed: $MOUNT_OPTIONS"
119
120     # check on what FS looks like after log recovery
121     _echofull "ls -RF SCRATCH_MNT"
122     ls -RF $SCRATCH_MNT >$tmp.ls2
123
124     _echofull "diff ls before and after"
125     diff -us $tmp.ls1 $tmp.ls2 | sed "s#$tmp#TMP#g"
126
127     _echofull "unmount"
128     _scratch_unmount
129
130     _echofull "logprint after mount and replay..."
131     _print_logstate
132
133     if _check_scratch_fs; then
134         _echofull "filesystem is checked ok"
135     else
136         _echofull "filesystem is NOT ok"
137     fi
138 done
139
140 status=0
141 exit