Changed kermit xfsqa targets
[xfstests-dev.git] / 148
1 #! /bin/sh
2 # FS QA Test No. 148
3 #
4 # Exercise xfs parallel repair on broken filesystems
5 # This is a clone of test 030 useing xfs_prepair64 instead of xfs_repair
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
9 #-----------------------------------------------------------------------
10 #
11 # creator
12 owner=ddiss@sgi.com
13
14 seq=`basename $0`
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20
21 _cleanup()
22 {
23         cd /
24         umount $SCRATCH_DEV 2>/dev/null
25         rm -f $tmp.*
26 }
27
28 trap "_cleanup; exit \$status" 0 1 2 3 15
29
30 # get standard environment, filters and checks
31 . ./common.rc
32 . ./common.filter
33 . ./common.repair
34
35 [ -z "$XFS_PARALLEL_REPAIR64_PROG" ] && _notrun "parallel repair binary xfs_prepair64 is not installed"
36
37 # force use of parallel repair
38 export XFS_REPAIR_PROG=$XFS_PARALLEL_REPAIR64_PROG
39
40 # nuke the superblock, AGI, AGF, AGFL; then try repair the damage
41
42 _check_ag()
43 {
44         for structure in 'sb 0' 'agf 0' 'agi 0' 'agfl 0'
45         do
46                 echo "Corrupting $structure - setting bits to $1"
47                 _check_repair $1 "$structure"
48         done
49 }
50
51 # real QA test starts here
52 _supported_fs xfs
53 _supported_os IRIX Linux
54
55 _require_nobigloopfs
56 _require_scratch
57
58 DSIZE="-dsize=100m"
59
60 # first we need to ensure there are no bogus secondary
61 # superblocks between the primary and first secondary
62 # superblock (hanging around from earlier tests)...
63 #
64
65 _scratch_mkfs_xfs $DSIZE >/dev/null 2>&1
66 if [ $? -ne 0 ]         # probably don't have a big enough scratch
67 then
68         _notrun "SCRATCH_DEV too small, results would be non-deterministic"
69 else
70         _scratch_mount
71         src/feature -U $SCRATCH_DEV && \
72                 _notrun "UQuota are enabled, test needs controlled sb recovery"
73         src/feature -G $SCRATCH_DEV && \
74                 _notrun "GQuota are enabled, test needs controlled sb recovery"
75         src/feature -P $SCRATCH_DEV && \
76                 _notrun "PQuota are enabled, test needs controlled sb recovery"
77         umount $SCRATCH_DEV
78 fi
79 clear=""
80 eval `xfs_db -r -c "sb 1" -c stack $SCRATCH_DEV | $PERL_PROG -ne '
81         if (/byte offset (\d+), length (\d+)/) {
82                 print "clear=", $1 / 512, "\n"; exit
83         }'`
84 [ -z "$clear" ] && echo "Cannot calculate length to clear"
85 src/devzero -v -1 -n "$clear" $SCRATCH_DEV >/dev/null
86
87 # now kick off the real prepair test...
88 #
89 _scratch_mkfs_xfs $DSIZE | _filter_mkfs 2>$tmp.mkfs
90 . $tmp.mkfs
91 _check_ag 0
92 _check_ag -1
93
94
95 # success, all done
96 status=0
97 exit