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
55 # too much hassle to get output matching with quotas turned on
58 _scratch_mkfs_xfs >> $seqres.full
60 $here/src/feature -U $SCRATCH_DEV && \
61 _notrun "UQuota enabled, test needs controlled xfsdump output"
62 $here/src/feature -G $SCRATCH_DEV && \
63 _notrun "GQuota enabled, test needs controlled xfsdump output"
64 $here/src/feature -P $SCRATCH_DEV && \
65 _notrun "PQuota enabled, test needs controlled xfsdump output"
69 # adding - touch/echo, mkdir
70 # deleting - rm, rmdir
74 # files and directories
78 mkdir -p $dump_dir || _fail "cannot mkdir \"$dump_dir\""
81 echo "Do the incremental dumps"
83 num_dumps=8 # do some extra to ensure nothing changes
84 while [ $i -le $num_dumps ]; do
89 echo 'add0' >addedfile0
90 echo 'add1' >addedfile1
91 echo 'add2' >addedfile2
92 echo 'add3' >addedfile3
97 echo 'add4' >addeddir3/addedfile4
98 echo 'add5' >addeddir4/addedfile5
108 mv addedfile1 addedfile2 # rename to previous existing file
109 mv addeddir4/addedfile5 addeddir4/addedfile4
110 mv addeddir4 addeddir6
111 mv addeddir1 addeddir2 # rename to previous existing dir
115 ln addedfile0 linkfile0
116 ln addedfile0 linkfile0_1 # have a 2nd link to file
117 ln addedfile2 linkfile2
118 ln addeddir6/addedfile4 linkfile64
122 rm linkfile0 # remove a link
123 rm addedfile2 # remove original link
124 rm linkfile64 # remove link
125 rm addeddir6/addedfile4 # remove last link
127 5) # link first - then onto 6)
129 echo 'add6' >addedfile6
130 ln addedfile6 linkfile6_1
131 ln addedfile6 linkfile6_2
132 ln addedfile6 linkfile6_3
134 6) # then move the inode that the links point to
135 mv addedfile6 addedfile6_mv
139 ln addedfile6_mv linkfile6_mv_1
140 ln addedfile6_mv linkfile6_mv_2
141 ln addedfile6_mv linkfile6_mv_3
148 echo "Listing of what files we have at level $i:"
149 _list_dir $dump_dir | tee $tmp.ls.$i
151 _do_dump_file -f $tmp.df.level$i -l $i
155 echo "Look at what files are contained in the inc. dump"
157 while [ $i -le $num_dumps ]; do
159 echo "restoring from df.level$i"
160 _do_restore_toc -f $tmp.df.level$i
164 echo "Do the cumulative restores"
167 while [ $i -le $num_dumps ]; do
169 echo "restoring from df.level$i"
170 _do_restore_file_cum -f $tmp.df.level$i
171 echo "list restore_dir"
172 _list_dir $restore_dir | _check_quota_file | tee $tmp.restorals.$i
177 echo "Do the ls comparison"
179 while [ $i -le $num_dumps ]; do
180 echo "Comparing ls of FS with restored FS at level $i"
181 diff -s $tmp.ls.$i $tmp.restorals.$i | sed "s#$tmp#TMP#g"