4 # Testing incremental dumps and cumulative restores with
5 # "adding, deleting, renaming, linking, and unlinking files and
7 # Do different operations for each level.
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
43 # list recursively the directory
45 # e.g. lstat output: src/lstat64 31056 -rwxr-xr-x 38403,0
46 # Don't print out sizes of directories - which can vary - overwrite with XXX.
51 find $__dir -exec $here/src/lstat64 -t {} \; |\
52 sed -e 's/.*dumpdir/dumpdir/' -e '/^dumpdir /d' |\
53 sed -e 's/.*restoredir/restoredir/' -e '/^restoredir /d' |\
54 egrep -v 'housekeeping|dirattr|dirextattr|namreg|state|tree' |\
55 awk '$3 ~ /^d/ { $2 = "XXX" } {print}' |\
59 # real QA test starts here
61 _supported_os IRIX Linux
64 # too much hassle to get output matching with quotas turned on
67 _scratch_unmount 2>/dev/null
69 $here/src/feature -U $SCRATCH_DEV && \
70 _notrun "UQuota enabled, test needs controlled xfsdump output"
71 $here/src/feature -G $SCRATCH_DEV && \
72 _notrun "GQuota enabled, test needs controlled xfsdump output"
73 $here/src/feature -P $SCRATCH_DEV && \
74 _notrun "PQuota enabled, test needs controlled xfsdump output"
78 # adding - touch/echo, mkdir
79 # deleting - rm, rmdir
83 # files and directories
87 mkdir -p $dump_dir || _fail "cannot mkdir \"$dump_dir\""
90 echo "Do the incremental dumps"
92 num_dumps=8 # do some extra to ensure nothing changes
93 while [ $i -le $num_dumps ]; do
98 echo 'add0' >addedfile0
99 echo 'add1' >addedfile1
100 echo 'add2' >addedfile2
101 echo 'add3' >addedfile3
106 echo 'add4' >addeddir3/addedfile4
107 echo 'add5' >addeddir4/addedfile5
117 mv addedfile1 addedfile2 # rename to previous existing file
118 mv addeddir4/addedfile5 addeddir4/addedfile4
119 mv addeddir4 addeddir6
120 mv addeddir1 addeddir2 # rename to previous existing dir
124 ln addedfile0 linkfile0
125 ln addedfile0 linkfile0_1 # have a 2nd link to file
126 ln addedfile2 linkfile2
127 ln addeddir6/addedfile4 linkfile64
131 rm linkfile0 # remove a link
132 rm addedfile2 # remove original link
133 rm linkfile64 # remove link
134 rm addeddir6/addedfile4 # remove last link
136 5) # link first - then onto 6)
138 echo 'add6' >addedfile6
139 ln addedfile6 linkfile6_1
140 ln addedfile6 linkfile6_2
141 ln addedfile6 linkfile6_3
143 6) # then move the inode that the links point to
144 mv addedfile6 addedfile6_mv
148 ln addedfile6_mv linkfile6_mv_1
149 ln addedfile6_mv linkfile6_mv_2
150 ln addedfile6_mv linkfile6_mv_3
157 echo "Listing of what files we have at level $i:"
158 _list_dir $dump_dir | tee $tmp.ls.$i
160 _do_dump_file -f $tmp.df.level$i -l $i
164 echo "Look at what files are contained in the inc. dump"
166 while [ $i -le $num_dumps ]; do
168 echo "restoring from df.level$i"
169 _do_restore_toc -f $tmp.df.level$i
173 echo "Do the cumulative restores"
176 while [ $i -le $num_dumps ]; do
178 echo "restoring from df.level$i"
179 _do_restore_file_cum -f $tmp.df.level$i
180 echo "list restore_dir"
181 _list_dir $restore_dir | _check_quota_file | tee $tmp.restorals.$i
186 echo "Do the ls comparison"
188 while [ $i -le $num_dumps ]; do
189 echo "Comparing ls of FS with restored FS at level $i"
190 diff -s $tmp.ls.$i $tmp.restorals.$i | sed "s#$tmp#TMP#g"