fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / xfs / 044
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 044
6 #
7 # external log uuid/format tests (TODO - version 2 log format)
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21
22 # real QA test starts here
23 _supported_fs xfs
24
25 _require_logdev
26
27 _check_mount()
28 {
29     echo "    *** mount (expect success)"
30     if ! _try_scratch_mount
31     then
32         echo "        !!! mount failed (expecting success)"
33         status=1
34         exit
35     fi
36
37     echo "    *** umount"
38     if ! _scratch_unmount
39     then
40         echo "        !!! umount failed (expecting success)"
41         status=1
42         exit
43     fi
44 }
45
46 _check_no_mount()
47 {
48     echo "    *** mount (expect failure)"
49     if _try_scratch_mount >$tmp.err 2>&1
50     then
51         cat $tmp.err
52         echo "        !!! mount succeeded (expecting failure)"
53         status=1
54         exit
55     fi
56 }
57
58 _check_require_logdev()
59 {
60     echo "    *** mount without logdev (expect failure)"
61     if mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >$tmp.err 2>&1
62     then
63         cat $tmp.err
64         echo "        !!! mount succeeded (expecting failure)"
65         status=1
66         exit
67     fi
68 }
69
70 _unexpected()
71 {
72     echo "        !!! unexpected XFS command failure"
73     status=1
74     exit
75 }
76
77 # real QA test starts here
78
79 _require_scratch
80
81 echo "*** mkfs"
82
83 # this test only works for version 1 logs currently
84 lversion=1
85 lsize=16777216
86 _scratch_mkfs_xfs -lsize=$lsize,version=$lversion >$tmp.mkfs0 2>&1
87 [ $? -ne 0 ] && \
88     _notrun "Cannot mkfs for this test using MKFS_OPTIONS specified"
89 _filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs1
90 . $tmp.mkfs1
91 [ $lversion -ne 1 ] && \
92     _notrun "Cannot run this test yet using MKFS_OPTIONS specified"
93
94 _require_test_program "loggen"
95
96 _check_mount
97 _check_require_logdev
98
99 echo "*** set uuid"
100 _scratch_xfs_db -x  -l $SCRATCH_LOGDEV -c "uuid 02020202-0202-0202-0202-020202020202"
101 [ $? -ne 0 ] && _unexpected
102 _check_mount
103
104 echo "*** zero log"
105 $here/src/loggen -z 100 >$SCRATCH_LOGDEV
106 _check_mount
107
108 echo "*** write clean log"
109 $here/src/loggen -u 2 -f 1 -m 1 -z 100 >$SCRATCH_LOGDEV
110 _check_mount
111
112 echo "*** write clean log (different format)"
113 $here/src/loggen -u 2 -f 99 -m 1 -z 100 >$SCRATCH_LOGDEV
114 _check_mount
115
116 echo "*** write clean log (different uuid)"
117 $here/src/loggen -u 7 -m 1 -z 100 >$SCRATCH_LOGDEV
118 _check_no_mount
119
120 echo "*** write clean log (different uuid & format)"
121 $here/src/loggen -u 7 -f 99 -m 1 -z 100 >$SCRATCH_LOGDEV
122 _check_no_mount
123
124 echo "*** write dirty log"
125 $here/src/loggen -u 2 -e 1 -z 100 >$SCRATCH_LOGDEV
126 _check_mount
127
128 echo "*** write dirty log (different format)"
129 $here/src/loggen -u 2 -f 99 -e 1 -z 100 >$SCRATCH_LOGDEV
130 _check_no_mount
131
132 echo "*** write dirty log (irix style)"
133 $here/src/loggen -u 0 -f 0 -e 1 -z 100 >$SCRATCH_LOGDEV
134 _check_no_mount
135
136 echo "*** write large dirty log"
137 $here/src/loggen -u 2 -e 16000 -z 100 >$SCRATCH_LOGDEV
138 _check_mount
139
140 echo -e -n "\n\r*** XFS QA 044 - done\n\r\n\r" >/dev/console
141
142 status=0
143 # if error
144 exit