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 modify it
13 # under the terms of version 2 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, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 # Further, this software is distributed without any warranty that it is
21 # free of the rightful claim of any third person regarding infringement
22 # or the like. Any license provided herein, whether implied or
23 # otherwise, applies only to this software file. Patent licenses, if
24 # any, provided herein do not apply to combinations of this program with
25 # other software, or any other product whatsoever.
27 # You should have received a copy of the GNU General Public License along
28 # with this program; if not, write the Free Software Foundation, Inc., 59
29 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
31 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
32 # Mountain View, CA 94043, or:
36 # For further information regarding this notice, see:
38 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
39 #-----------------------------------------------------------------------
45 echo "QA output created by $seq"
49 status=1 # failure is the default!
50 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
52 # get standard environment, filters and checks
60 # Print size ($5) and fname ($9).
61 # The size is significant since we add to the file as part
62 # of a file change for the incremental.
64 # Filter out the housekeeping files of xfsrestore
65 # Filter out toplevel "dumpdir/$" report.
68 NF == 9 && $0 ~ /dir/ { print $9; next }
69 NF == 9 { print $5, $9; next }
70 NF == 1 { print } ' |\
71 sed -e 's/.*dumpdir/dumpdir/' |\
72 egrep -v 'housekeeping|dirattr|dirextattr|namreg|state|tree|dumpdir/$|dumpdir:$' |\
73 egrep -v "$restore_dir:"
76 # real QA test starts here
78 _supported_os IRIX Linux
81 # too much hassle to get output matching with quotas turned on
84 umount $SCRATCH_DEV 2>/dev/null
86 $here/src/feature -U $SCRATCH_DEV && \
87 _notrun "Quota enabled, test needs controlled xfsdump output"
88 $here/src/feature -G $SCRATCH_DEV && \
89 _notrun "Quota enabled, test needs controlled xfsdump output"
93 # adding - touch/echo, mkdir
94 # deleting - rm, rmdir
98 # files and directories
102 mkdir -p $dump_dir || _fail "cannot mkdir \"$dump_dir\""
105 echo "Do the incremental dumps"
107 num_dumps=8 # do some extra to ensure nothing changes
108 while [ $i -le $num_dumps ]; do
113 echo 'add0' >addedfile0
114 echo 'add1' >addedfile1
115 echo 'add2' >addedfile2
116 echo 'add3' >addedfile3
121 echo 'add4' >addeddir3/addedfile4
122 echo 'add5' >addeddir4/addedfile5
132 mv addedfile1 addedfile2 # rename to previous existing file
133 mv addeddir4/addedfile5 addeddir4/addedfile4
134 mv addeddir4 addeddir6
135 mv addeddir1 addeddir2 # rename to previous existing dir
139 ln addedfile0 linkfile0
140 ln addedfile0 linkfile0_1 # have a 2nd link to file
141 ln addedfile2 linkfile2
142 ln addeddir6/addedfile4 linkfile64
146 rm linkfile0 # remove a link
147 rm addedfile2 # remove original link
148 rm linkfile64 # remove link
149 rm addeddir6/addedfile4 # remove last link
151 5) # link first - then onto 6)
153 echo 'add6' >addedfile6
154 ln addedfile6 linkfile6_1
155 ln addedfile6 linkfile6_2
156 ln addedfile6 linkfile6_3
158 6) # then move the inode that the links point to
159 mv addedfile6 addedfile6_mv
163 ln addedfile6_mv linkfile6_mv_1
164 ln addedfile6_mv linkfile6_mv_2
165 ln addedfile6_mv linkfile6_mv_3
172 echo "Listing of what files we have at level $i:"
173 ls -lRF $dump_dir | _my_ls_filter | tee $tmp.ls.$i
175 dump_file=$tmp.df.level$i
180 echo "Look at what files are contained in the inc. dump"
182 while [ $i -le $num_dumps ]; do
184 echo "restoring from df.level$i"
185 dump_file=$tmp.df.level$i
190 echo "Do the cumulative restores"
192 while [ $i -le $num_dumps ]; do
193 dump_file=$tmp.df.level$i
195 echo "restoring from df.level$i"
196 _do_restore_file_cum -l $i
197 echo "ls -lRF restore_dir"
198 ls -lRF $restore_dir | _my_ls_filter |\
199 _check_quota_file | tee $tmp.restorals.$i
204 echo "Do the ls comparison"
206 while [ $i -le $num_dumps ]; do
207 echo "Comparing ls of FS with restored FS at level $i"
208 diff -s $tmp.ls.$i $tmp.restorals.$i | sed "s#$tmp#TMP#g"