fixed mkfs options to stop failure when sunit and swidth are set as MKFS_OPTIONS
[xfstests-dev.git] / 033
1 #! /bin/sh
2 # FS QA Test No. 033
3 #
4 # exercise xfs_repair repairing broken filesystems (root inodes)
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
8 #-----------------------------------------------------------------------
9 #
10 # creator
11 owner=nathans@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19
20 _cleanup()
21 {
22     cd /
23     umount $SCRATCH_DEV 2>/dev/null
24     rm -f $tmp.*
25 }
26
27 trap "_cleanup; exit \$status" 0 1 2 3 15
28
29 # get standard environment, filters and checks
30 . ./common.rc
31 . ./common.filter
32 . ./common.repair
33
34 # link correct .out file
35 _link_out_file $seq.out
36
37 # nuke the root, rt bitmap, and rt summary inodes
38
39 _check_root_inos()
40 {
41         echo "Corrupting root inode - setting bits to $1"
42         _check_repair $1 "inode $rootino"
43         echo "Corrupting rt bitmap inode - setting bits to $1"
44         _check_repair $1 "inode $rbmino"
45         echo "Corrupting rt summary inode - setting bits to $1"
46         _check_repair $1 "inode $rsumino"
47 }
48
49 #
50 # pv#909621
51 # IRIX checks for valid user and group ids as we have a 
52 # limit of MAXID
53 # As it is unsigned on Linux, this test is not done
54 # (i.e. -1 is a valid id on Linux but not on IRIX)
55 # So we make the output the same for both OS's.
56 #
57 _filter_bad_ids()
58 {
59         egrep -v 'bad user id 0xffffffff|bad group id 0xffffffff'
60 }
61
62 # real QA test starts here
63 _supported_fs xfs
64 _supported_os IRIX Linux
65  
66 _require_nobigloopfs
67 _require_scratch
68
69 # devzero blows away 512byte blocks, so make 512byte inodes (at least)
70 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
71 . $tmp.mkfs
72 [ $isize -lt 512 ] && \
73         _scratch_mkfs_xfs -isize=512 | _filter_mkfs >/dev/null 2>&1
74
75 `xfs_db -r -c sb -c p $SCRATCH_DEV | grep 'ino = ' | \
76         sed -e 's/ //g' -e 's/^/export /'`
77
78 # check we won't get any quota inodes setup on mount
79 _scratch_mount
80 src/feature -U $SCRATCH_DEV && \
81         _notrun "UQuota are enabled, test needs controlled sb recovery"
82 src/feature -G $SCRATCH_DEV && \
83         _notrun "GQuota are enabled, test needs controlled sb recovery"
84 src/feature -P $SCRATCH_DEV && \
85         _notrun "PQuota are enabled, test needs controlled sb recovery"
86 umount $SCRATCH_DEV
87
88 # rootino, rbmino, and rsumino are now set (lets blow em away!)
89 _check_root_inos 0
90 _check_root_inos -1 | _filter_bad_ids
91
92 # success, all done
93 status=0
94 exit