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.
11 #-----------------------------------------------------------------------
17 echo "QA output created by $seq"
21 status=1 # failure is the default!
22 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
30 # list recursively the directory
32 # e.g. lstat output: src/lstat64 31056 -rwxr-xr-x 38403,0
33 # Don't print out sizes of directories - which can vary - overwrite with XXX.
38 find $__dir -exec $here/src/lstat64 -t {} \; |\
39 sed -e 's/.*dumpdir/dumpdir/' -e '/^dumpdir /d' |\
40 sed -e 's/.*restoredir/restoredir/' -e '/^restoredir /d' |\
41 egrep -v 'housekeeping|dirattr|dirextattr|namreg|state|tree' |\
42 awk '$3 ~ /^d/ { $2 = "XXX" } {print}' |\
46 # real QA test starts here
48 _supported_os IRIX Linux
51 # too much hassle to get output matching with quotas turned on
54 umount $SCRATCH_DEV 2>/dev/null
56 $here/src/feature -U $SCRATCH_DEV && \
57 _notrun "UQuota enabled, test needs controlled xfsdump output"
58 $here/src/feature -G $SCRATCH_DEV && \
59 _notrun "GQuota enabled, test needs controlled xfsdump output"
60 $here/src/feature -P $SCRATCH_DEV && \
61 _notrun "PQuota enabled, test needs controlled xfsdump output"
65 # adding - touch/echo, mkdir
66 # deleting - rm, rmdir
70 # files and directories
74 mkdir -p $dump_dir || _fail "cannot mkdir \"$dump_dir\""
77 echo "Do the incremental dumps"
79 num_dumps=8 # do some extra to ensure nothing changes
80 while [ $i -le $num_dumps ]; do
85 echo 'add0' >addedfile0
86 echo 'add1' >addedfile1
87 echo 'add2' >addedfile2
88 echo 'add3' >addedfile3
93 echo 'add4' >addeddir3/addedfile4
94 echo 'add5' >addeddir4/addedfile5
104 mv addedfile1 addedfile2 # rename to previous existing file
105 mv addeddir4/addedfile5 addeddir4/addedfile4
106 mv addeddir4 addeddir6
107 mv addeddir1 addeddir2 # rename to previous existing dir
111 ln addedfile0 linkfile0
112 ln addedfile0 linkfile0_1 # have a 2nd link to file
113 ln addedfile2 linkfile2
114 ln addeddir6/addedfile4 linkfile64
118 rm linkfile0 # remove a link
119 rm addedfile2 # remove original link
120 rm linkfile64 # remove link
121 rm addeddir6/addedfile4 # remove last link
123 5) # link first - then onto 6)
125 echo 'add6' >addedfile6
126 ln addedfile6 linkfile6_1
127 ln addedfile6 linkfile6_2
128 ln addedfile6 linkfile6_3
130 6) # then move the inode that the links point to
131 mv addedfile6 addedfile6_mv
135 ln addedfile6_mv linkfile6_mv_1
136 ln addedfile6_mv linkfile6_mv_2
137 ln addedfile6_mv linkfile6_mv_3
144 echo "Listing of what files we have at level $i:"
145 _list_dir $dump_dir | tee $tmp.ls.$i
147 dump_file=$tmp.df.level$i
152 echo "Look at what files are contained in the inc. dump"
154 while [ $i -le $num_dumps ]; do
156 echo "restoring from df.level$i"
157 dump_file=$tmp.df.level$i
162 echo "Do the cumulative restores"
164 while [ $i -le $num_dumps ]; do
165 dump_file=$tmp.df.level$i
167 echo "restoring from df.level$i"
168 _do_restore_file_cum -l $i
169 echo "list restore_dir"
170 _list_dir $restore_dir | _check_quota_file | tee $tmp.restorals.$i
175 echo "Do the ls comparison"
177 while [ $i -le $num_dumps ]; do
178 echo "Comparing ls of FS with restored FS at level $i"
179 diff -s $tmp.ls.$i $tmp.restorals.$i | sed "s#$tmp#TMP#g"