4 # xfs_db type attr test (pv 797508 linux-xfs & IRIX)
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or modify it
10 # under the terms of version 2 of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightful claim of any third person regarding infringement
19 # or the like. Any license provided herein, whether implied or
20 # otherwise, applies only to this software file. Patent licenses, if
21 # any, provided herein do not apply to combinations of this program with
22 # other software, or any other product whatsoever.
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
28 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
29 # Mountain View, CA 94043, or:
33 # For further information regarding this notice, see:
35 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 #-----------------------------------------------------------------------
42 echo "QA output created by $seq"
46 status=0 # success is the default!
47 # get standard environment, filters and checks
54 umount $SCRATCH_MNT 2>/dev/null
57 trap "_cleanup; exit \$status" 0 1 2 3 15
61 attr $* 2>$tmp.err >$tmp.out
64 -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \
65 -e "s#$tmp[^ :]*#<TMPFILE>#g;" \
68 -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \
69 -e "s#$tmp[^ :]*#<TMPFILE>#g;" \
76 getfattr $* 2>$tmp.err >$tmp.out
79 -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \
80 -e "s#$tmp[^ :]*#<TMPFILE>#g;" \
83 -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \
84 -e "s#$tmp[^ :]*#<TMPFILE>#g;" \
89 # real QA test starts here
93 umount $SCRATCH_DEV >/dev/null 2>&1
96 _scratch_mkfs_xfs >/dev/null \
97 || _fail "mkfs failed"
100 _scratch_mount >/dev/null \
101 || _fail "mount failed"
103 testfile=$SCRATCH_MNT/testfile
104 echo "*** make test file 1"
107 echo "v1" | _attr -s "a1" $testfile.1 >/dev/null
108 echo "v2--" | _attr -s "a2--" $testfile.1 >/dev/null
109 _getfattr --absolute-names $testfile.1
110 inum_1=`ls -li $testfile.1 | $AWK_PROG '{ print $1 }'`
112 echo "*** make test file 2"
115 echo "value_1" | _attr -s "a1" $testfile.2 >/dev/null
116 echo "value_2" | _attr -s "a2-----" $testfile.2 >/dev/null
117 ( echo start; POSIXLY_CORRECT=yes dd if=/dev/zero bs=65525 count=1; echo end )\
118 | _attr -s "a3" $testfile.2 >/dev/null
119 _getfattr --absolute-names $testfile.2
121 # print name and size from 1st line of output
122 _attr -g "a3" $testfile.2 > $tmp.hahahahaplonk
123 head -1 $tmp.hahahahaplonk
125 # Above goo works around some truly bizzaro sh/sed/head interaction
126 # for some versions of these tools (fails on Redhat 7+, 6.2 worked)
128 # print out the rest of the data apart from the header
129 # the size is +1 for an extra \n at the end
130 echo -n "size of attr value = "
131 _attr -g "a3" $testfile.2 | tail -3 | wc -c
134 inum_2=`ls -li $testfile.2 | $AWK_PROG '{ print $1 }'`
136 echo "*** unmount FS"
137 umount $SCRATCH_DEV >>$seq.full 2>&1 \
138 || _fail "umount failed"
140 echo "*** dump attributes (1)"
142 xfs_db -r -c "inode $inum_1" -c "print a.sfattr" $SCRATCH_DEV | \
143 sed -e '/secure = /d'
145 echo "*** dump attributes (2)"
147 xfs_db -r -c "inode $inum_2" -c "a a.bmx[0].startblock" -c print $SCRATCH_DEV \
149 s/root,secure,local/root,local/;
150 s/^(hdr.firstused =) (\d+)/\1 FIRSTUSED/;
151 s/^(hdr.freemap\[0-2] = \[base,size]).*/\1 [FREEMAP..]/;
152 s/^(entries\[0-2] = \[hashval,nameidx,incomplete,root,local]).*/\1 [ENTRIES..]/;