Merge the uid/gid username/groupname install target fixup to all packages.
[xfstests-dev.git] / 087
1 #! /bin/sh
2 # FS QA Test No. 087
3 #
4 # * like 086 but want to create more/different kinds of metadata
5 #   and so will use fsstress
6 # * also can interrupt metadata with godown
7 #
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
10 #-----------------------------------------------------------------------
11 #
12 # creator
13 owner=tes@melbourne.sgi.com
14
15 seq=`basename $0`
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 tmp=/tmp/$$
20 status=1        # failure is the default!
21 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
22
23 # get standard environment, filters and checks
24 . ./common.rc
25 . ./common.filter
26 . ./common.log
27
28 _do_meta()
29 {
30     out=$SCRATCH_MNT/fsstress
31     count=10000
32     param="-p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 \
33            -f rename=30 -f stat=30 -f unlink=30 -f truncate=20"
34     _echofull "calling fsstress $param -m8 -n $count"
35     if ! $FSSTRESS_PROG $param $FSSTRESS_AVOID -m 8 -n $count -d $out >>$seq.full 2>&1
36     then
37         _echofull "fsstress failed"
38     fi
39 }
40
41 # real QA test starts here
42 _supported_fs xfs
43 _supported_os IRIX Linux
44
45 rm -f $seq.full $tmp.*
46 _require_scratch
47 _require_v2log 
48
49 echo "*** init FS"
50 umount $SCRATCH_DEV >/dev/null 2>&1
51
52 cat >$tmp.seq.params <<EOF
53 # mkfs-opt             mount-opt
54 # ------------------------------
55   version=2            logbsize=32k
56   version=2,su=4096    logbsize=32k
57   version=2,su=32768   logbsize=32k
58   version=2            logbsize=64k
59   version=2,su=64k     logbsize=64k
60   version=2            logbsize=128k
61   version=2,su=128k    logbsize=128k
62   version=2            logbsize=256k
63   version=2,su=256k    logbsize=256k
64 EOF
65
66 cat $tmp.seq.params \
67 | while read mkfs mnt restofline
68 do
69     if [ "$mkfs" = "#" ]; then 
70         continue
71     fi
72
73     echo "--- mkfs=$mkfs, mnt=$mnt ---"
74     export MKFS_OPTIONS="-l $mkfs"
75     export MOUNT_OPTIONS="-o $mnt"
76
77     # mkfs the FS
78     _echofull "mkfs"
79     _scratch_mkfs_xfs >>$seq.full 2>&1
80     if [ $? -ne 0 ] ; then 
81         _echofull "mkfs failed: $MKFS_OPTIONS"
82         continue
83     fi
84
85     # mount the FS
86     _echofull "mount"
87     if ! _scratch_mount >>$seq.full 2>&1; then
88         _echofull "mount failed: $MOUNT_OPTIONS"
89         continue
90     fi
91
92     # create the metadata
93     _do_meta
94
95     # check before on what FS should look like
96     _echofull "ls -RF SCRATCH_MNT"
97     ls -RF $SCRATCH_MNT >$tmp.ls1
98
99     _echofull "godown"
100     src/godown -v -f $SCRATCH_MNT >> $seq.full
101
102     _echofull "unmount"
103     umount $SCRATCH_DEV >>$seq.full 2>&1 \
104         || _fail "umount failed"
105
106     _echofull "logprint after going down..."
107     _print_logstate
108
109     _full "logprint headers"
110     _scratch_xfs_logprint -n >>$seq.full 2>&1
111
112     _echofull "mount with replay"
113     _scratch_mount >>$seq.full 2>&1 \
114         || _fail "mount failed: $MOUNT_OPTIONS"
115
116     # check on what FS looks like after log recovery
117     _echofull "ls -RF SCRATCH_MNT"
118     ls -RF $SCRATCH_MNT >$tmp.ls2
119
120     _echofull "diff ls before and after"
121     diff -us $tmp.ls1 $tmp.ls2 | sed "s#$tmp#TMP#g"
122
123     _echofull "unmount"
124     umount $SCRATCH_MNT
125
126     _echofull "logprint after mount and replay..."
127     _print_logstate
128
129     if _check_scratch_fs; then
130         _echofull "filesystem is checked ok"
131     else
132         _echofull "filesystem is NOT ok"
133     fi
134 done
135
136 status=0 
137 exit