2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
7 # Testing incremental dumps and cumulative restores with
8 # "adding, deleting, renaming, linking, and unlinking files and
10 # Do different operations for each level.
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
34 # list recursively the directory
36 # e.g. lstat output: src/lstat64 31056 -rwxr-xr-x 38403,0
37 # Don't print out sizes of directories - which can vary - overwrite with XXX.
42 find $__dir -exec $here/src/lstat64 -t {} \; |\
43 sed -e 's/.*dumpdir/dumpdir/' -e '/^dumpdir /d' |\
44 sed -e 's/.*restoredir/restoredir/' -e '/^restoredir /d' |\
45 egrep -v 'housekeeping|dirattr|dirextattr|namreg|state|tree' |\
46 awk '$3 ~ /^d/ { $2 = "XXX" } {print}' |\
50 # real QA test starts here
56 # too much hassle to get output matching with quotas turned on
59 _scratch_mkfs_xfs >> $seqres.full
61 $here/src/feature -U $SCRATCH_DEV && \
62 _notrun "UQuota enabled, test needs controlled xfsdump output"
63 $here/src/feature -G $SCRATCH_DEV && \
64 _notrun "GQuota enabled, test needs controlled xfsdump output"
65 $here/src/feature -P $SCRATCH_DEV && \
66 _notrun "PQuota enabled, test needs controlled xfsdump output"
70 # adding - touch/echo, mkdir
71 # deleting - rm, rmdir
75 # files and directories
79 mkdir -p $dump_dir || _fail "cannot mkdir \"$dump_dir\""
82 echo "Do the incremental dumps"
84 num_dumps=8 # do some extra to ensure nothing changes
85 while [ $i -le $num_dumps ]; do
90 echo 'add0' >addedfile0
91 echo 'add1' >addedfile1
92 echo 'add2' >addedfile2
93 echo 'add3' >addedfile3
98 echo 'add4' >addeddir3/addedfile4
99 echo 'add5' >addeddir4/addedfile5
109 mv addedfile1 addedfile2 # rename to previous existing file
110 mv addeddir4/addedfile5 addeddir4/addedfile4
111 mv addeddir4 addeddir6
112 mv addeddir1 addeddir2 # rename to previous existing dir
116 ln addedfile0 linkfile0
117 ln addedfile0 linkfile0_1 # have a 2nd link to file
118 ln addedfile2 linkfile2
119 ln addeddir6/addedfile4 linkfile64
123 rm linkfile0 # remove a link
124 rm addedfile2 # remove original link
125 rm linkfile64 # remove link
126 rm addeddir6/addedfile4 # remove last link
128 5) # link first - then onto 6)
130 echo 'add6' >addedfile6
131 ln addedfile6 linkfile6_1
132 ln addedfile6 linkfile6_2
133 ln addedfile6 linkfile6_3
135 6) # then move the inode that the links point to
136 mv addedfile6 addedfile6_mv
140 ln addedfile6_mv linkfile6_mv_1
141 ln addedfile6_mv linkfile6_mv_2
142 ln addedfile6_mv linkfile6_mv_3
149 echo "Listing of what files we have at level $i:"
150 _list_dir $dump_dir | tee $tmp.ls.$i
152 _do_dump_file -f $tmp.df.level$i -l $i
156 echo "Look at what files are contained in the inc. dump"
158 while [ $i -le $num_dumps ]; do
160 echo "restoring from df.level$i"
161 _do_restore_toc -f $tmp.df.level$i
165 echo "Do the cumulative restores"
168 while [ $i -le $num_dumps ]; do
170 echo "restoring from df.level$i"
171 _do_restore_file_cum -f $tmp.df.level$i
172 echo "list restore_dir"
173 _list_dir $restore_dir | _check_quota_file | tee $tmp.restorals.$i
178 echo "Do the ls comparison"
180 while [ $i -le $num_dumps ]; do
181 echo "Comparing ls of FS with restored FS at level $i"
182 diff -s $tmp.ls.$i $tmp.restorals.$i | sed "s#$tmp#TMP#g"