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
29 # IRIX "ls -s" uses a block size of 512, for consistincy on linux use
30 # ls --block-size=512 -s <file>
31 [ $HOSTOS == Linux ] && LS_BLOCKSIZE="--block-size=512"
36 # Print size and fname.
37 # The size is significant since we add to the file as part
38 # of a file change for the incremental.
40 # Filter out the housekeeping files of xfsrestore
41 # Filter out toplevel "dumpdir/$" report.
42 grep -v total | grep -v "^$" | sed "s/^[ \t]*//g" | \
43 sed -e 's/.*dumpdir/dumpdir/' |\
44 egrep -v 'housekeeping|dirattr|dirextattr|namreg|state|tree|dumpdir/$|dumpdir:$' |\
45 egrep -v "$restore_dir:"
48 # real QA test starts here
50 _supported_os IRIX Linux
53 # too much hassle to get output matching with quotas turned on
56 umount $SCRATCH_DEV 2>/dev/null
58 $here/src/feature -U $SCRATCH_DEV && \
59 _notrun "Quota enabled, test needs controlled xfsdump output"
60 $here/src/feature -G $SCRATCH_DEV && \
61 _notrun "Quota 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 ls -sRF $LS_BLOCKSIZE $dump_dir | _my_ls_filter | 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 "ls -sRF restore_dir"
170 ls -sRF $LS_BLOCKSIZE $restore_dir | _my_ls_filter |\
171 _check_quota_file | tee $tmp.restorals.$i
176 echo "Do the ls comparison"
178 while [ $i -le $num_dumps ]; do
179 echo "Comparing ls of FS with restored FS at level $i"
180 diff -s $tmp.ls.$i $tmp.restorals.$i | sed "s#$tmp#TMP#g"