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
35 # list recursively the directory
37 # e.g. lstat output: src/lstat64 31056 -rwxr-xr-x 38403,0
38 # Don't print out sizes of directories - which can vary - overwrite with XXX.
43 find $__dir -exec $here/src/lstat64 -t {} \; |\
44 sed -e 's/.*dumpdir/dumpdir/' -e '/^dumpdir /d' |\
45 sed -e 's/.*restoredir/restoredir/' -e '/^restoredir /d' |\
46 egrep -v 'housekeeping|dirattr|dirextattr|namreg|state|tree' |\
47 awk '$3 ~ /^d/ { $2 = "XXX" } {print}' |\
51 # real QA test starts here
56 # too much hassle to get output matching with quotas turned on
59 _scratch_mkfs_xfs >> $seqres.full
60 _qmount_option noquota
62 $here/src/feature -U $SCRATCH_DEV && \
63 _notrun "UQuota enabled, test needs controlled xfsdump output"
64 $here/src/feature -G $SCRATCH_DEV && \
65 _notrun "GQuota enabled, test needs controlled xfsdump output"
66 $here/src/feature -P $SCRATCH_DEV && \
67 _notrun "PQuota enabled, test needs controlled xfsdump output"
71 # adding - touch/echo, mkdir
72 # deleting - rm, rmdir
76 # files and directories
80 mkdir -p $dump_dir || _fail "cannot mkdir \"$dump_dir\""
83 echo "Do the incremental dumps"
85 num_dumps=8 # do some extra to ensure nothing changes
86 while [ $i -le $num_dumps ]; do
91 echo 'add0' >addedfile0
92 echo 'add1' >addedfile1
93 echo 'add2' >addedfile2
94 echo 'add3' >addedfile3
99 echo 'add4' >addeddir3/addedfile4
100 echo 'add5' >addeddir4/addedfile5
110 mv addedfile1 addedfile2 # rename to previous existing file
111 mv addeddir4/addedfile5 addeddir4/addedfile4
112 mv addeddir4 addeddir6
113 mv addeddir1 addeddir2 # rename to previous existing dir
117 ln addedfile0 linkfile0
118 ln addedfile0 linkfile0_1 # have a 2nd link to file
119 ln addedfile2 linkfile2
120 ln addeddir6/addedfile4 linkfile64
124 rm linkfile0 # remove a link
125 rm addedfile2 # remove original link
126 rm linkfile64 # remove link
127 rm addeddir6/addedfile4 # remove last link
129 5) # link first - then onto 6)
131 echo 'add6' >addedfile6
132 ln addedfile6 linkfile6_1
133 ln addedfile6 linkfile6_2
134 ln addedfile6 linkfile6_3
136 6) # then move the inode that the links point to
137 mv addedfile6 addedfile6_mv
141 ln addedfile6_mv linkfile6_mv_1
142 ln addedfile6_mv linkfile6_mv_2
143 ln addedfile6_mv linkfile6_mv_3
150 echo "Listing of what files we have at level $i:"
151 _list_dir $dump_dir | tee $tmp.ls.$i
153 _do_dump_file -f $tmp.df.level$i -l $i
157 echo "Look at what files are contained in the inc. dump"
159 while [ $i -le $num_dumps ]; do
161 echo "restoring from df.level$i"
162 _do_restore_toc -f $tmp.df.level$i
166 echo "Do the cumulative restores"
169 while [ $i -le $num_dumps ]; do
171 echo "restoring from df.level$i"
172 _do_restore_file_cum -f $tmp.df.level$i
173 echo "list restore_dir"
174 _list_dir $restore_dir | _check_quota_file | tee $tmp.restorals.$i
179 echo "Do the ls comparison"
181 while [ $i -le $num_dumps ]; do
182 echo "Comparing ls of FS with restored FS at level $i"
183 diff -s $tmp.ls.$i $tmp.restorals.$i | sed "s#$tmp#TMP#g"