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 _begin_fstest dump auto
15 # Override the default cleanup function.
23 # Import common functions.
29 # list recursively the directory
31 # e.g. lstat output: src/lstat64 31056 -rwxr-xr-x 38403,0
32 # Don't print out sizes of directories - which can vary - overwrite with XXX.
37 find $__dir -exec $here/src/lstat64 -t {} \; |\
38 sed -e 's/.*dumpdir/dumpdir/' -e '/^dumpdir /d' |\
39 sed -e 's/.*restoredir/restoredir/' -e '/^restoredir /d' |\
40 egrep -v 'housekeeping|dirattr|dirextattr|namreg|state|tree' |\
41 awk '$3 ~ /^d/ { $2 = "XXX" } {print}' |\
45 # real QA test starts here
50 # too much hassle to get output matching with quotas turned on
53 _scratch_mkfs_xfs >> $seqres.full
54 _qmount_option noquota
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 _do_dump_file -f $tmp.df.level$i -l $i
151 echo "Look at what files are contained in the inc. dump"
153 while [ $i -le $num_dumps ]; do
155 echo "restoring from df.level$i"
156 _do_restore_toc -f $tmp.df.level$i
160 echo "Do the cumulative restores"
163 while [ $i -le $num_dumps ]; do
165 echo "restoring from df.level$i"
166 _do_restore_file_cum -f $tmp.df.level$i
167 echo "list restore_dir"
168 _list_dir $restore_dir | _check_quota_file | tee $tmp.restorals.$i
173 echo "Do the ls comparison"
175 while [ $i -le $num_dumps ]; do
176 echo "Comparing ls of FS with restored FS at level $i"
177 diff -s $tmp.ls.$i $tmp.restorals.$i | sed "s#$tmp#TMP#g"