tests: remove IRIX support from tests also supported on Linux
[xfstests-dev.git] / tests / xfs / 019
1 #! /bin/bash
2 # FS QA Test No. 019
3 #
4 # mkfs protofile test
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 seqfull="$seqres.full"
32 status=1        # failure is the default!
33 # get standard environment, filters and checks
34 . ./common/rc
35 . ./common/filter
36
37 _cleanup()
38 {
39     echo "*** unmount"
40     _scratch_unmount 2>/dev/null
41     rm -f $tmp.*
42 }
43 trap "_cleanup; exit \$status" 0 1 2 3 15
44
45 _full()
46 {
47     echo ""            >>$seqfull
48     echo "*** $* ***"  >>$seqfull
49     echo ""            >>$seqfull
50 }
51
52 _filter_stat()
53 {
54     sed '
55         /^Access:/d;
56         /^Modify:/d;
57         /^Change:/d;
58         s/Device: *[0-9][0-9]*,[0-9][0-9]*/Device: <DEVICE>/;
59         s/Inode: *[0-9][0-9]*/Inode: <INODE>/;
60         s/Size: *[0-9][0-9]* *Filetype: Dir/Size: <DSIZE> Filetype: Dir/;
61     ' | tr -s ' '
62 }
63
64 # real QA test starts here
65 _supported_fs xfs
66 _supported_os Linux
67
68 _require_scratch
69
70 protofile=$tmp.proto
71 tempfile=$tmp.file
72
73 echo fish >$tempfile
74 $here/src/devzero -b 2048 -n 2 -c -v 44 $tempfile.2 
75
76 cat >$protofile <<EOF
77 DUMMY1
78 0 0
79 : root directory
80 d--777 3 1
81 : a directory
82 directory d--755 3 1 
83 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_0 ---755 3 1 $tempfile
84 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_1 ---755 3 1 $tempfile
85 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_2 ---755 3 1 $tempfile
86 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_3 ---755 3 1 $tempfile
87 file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_4 ---755 3 1 $tempfile
88 $
89 : back in the root
90 setuid -u-666 0 0 $tempfile
91 setgid --g666 0 0 $tempfile
92 setugid -ug666 0 0 $tempfile
93 block_device b--012 3 1 161 162 
94 char_device c--345 3 1 177 178
95 pipe p--670 0 0
96 symlink l--123 0 0 bigfile
97 : a file we actually read
98 bigfile ---666 3 0 $tempfile.2
99 : done
100 $
101 EOF
102
103 if [ $? -ne 0 ]
104 then
105     _fail "failed to create test protofile"
106 fi
107
108 _verify_fs()
109 {
110         echo "*** create FS version $1"
111         VERSION="-n version=$1"
112
113         rm -f $seqfull
114         _scratch_unmount >/dev/null 2>&1
115
116         _full "mkfs"
117         _scratch_mkfs_xfs $VERSION -p $protofile >>$seqfull 2>&1 \
118                 || _fail "mkfs failed"
119
120         echo "*** check FS"
121         _check_scratch_fs
122
123         echo "*** mount FS"
124         _full " mount"
125         _scratch_mount >>$seqfull 2>&1 \
126                 || _fail "mount failed"
127
128         echo "*** verify FS"
129         (cd $SCRATCH_MNT ; find . | LC_COLLATE=POSIX sort \
130                 | grep -v ".use_space" \
131                 | xargs $here/src/lstat64 | _filter_stat)
132         diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
133                 || _fail "bigfile corrupted"
134
135         echo "*** unmount FS"
136         _full "umount"
137         _scratch_unmount >>$seqfull 2>&1 \
138                 || _fail "umount failed"
139 }
140
141 #_verify_fs 1
142 _verify_fs 2
143
144 echo "*** done"
145 rm $seqfull
146 status=0
147 exit