235: do smaller test IO
[xfstests-dev.git] / 064
1 #! /bin/bash
2 # FS QA Test No. 064
3 #
4 # test multilevel dump and restores with hardlinks
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24 # creator
25 owner=tes@sgi.com
26
27 seq=`basename $0`
28 echo "QA output created by $seq"
29
30 here=`pwd`
31 tmp=/tmp/$$
32 status=1        # failure is the default!
33 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
34
35 # get standard environment, filters and checks
36 . ./common.rc
37 . ./common.filter
38 . ./common.dump
39
40
41 _ls_size_filter()
42 {
43     #
44     # Print size ($5) and fname ($9).
45     # The size is significant since we add to the file as part
46     # of a file change for the incremental.
47     #
48     # Filter out the housekeeping files of xfsrestore
49     #
50     $AWK_PROG 'NF == 9 { print $5, $9 }' |\
51     egrep -v 'dumpdir|housekeeping|dirattr|dirextattr|namreg|state|tree' 
52 }
53
54 # real QA test starts here
55 _supported_fs xfs
56 _supported_os IRIX Linux
57
58 _create_dumpdir_hardlinks 9
59
60 echo "Do the incremental dumps"
61 i=0
62 while [ $i -le 9 ]; do
63     if [ $i -gt 0 ]; then
64         sleep 2
65         _modify_level $i
66     fi 
67
68     _stable_fs
69     sleep 2
70
71     echo "********* level $i ***********" >>$seq.full
72     date >>$seq.full
73     find $SCRATCH_MNT -exec $here/src/lstat64 {} \; | sed 's/(00.*)//' >$tmp.dates.$i
74     if [ $i -gt 0 ]; then
75        let level_1=$i-1
76        diff -c $tmp.dates.$level_1 $tmp.dates.$i >>$seq.full
77     else
78        cat $tmp.dates.$i >>$seq.full
79     fi
80
81     _do_dump_file -f $tmp.df.level$i -l $i
82     let i=$i+1
83 done
84
85 echo "Listing of what files we start with:"
86 ls -l $dump_dir | _ls_size_filter
87
88 echo "Look at what files are contained in the inc. dump"
89 i=0
90 while [ $i -le 9 ]; do
91     echo ""
92     echo "restoring from df.level$i"
93     _do_restore_toc -f $tmp.df.level$i
94     let i=$i+1
95 done
96
97 echo "Do the cumulative restores"
98 _prepare_restore_dir
99 i=0
100 while [ $i -le 9 ]; do
101     echo ""
102     echo "restoring from df.level$i"
103     _do_restore_file_cum -f $tmp.df.level$i
104     echo "ls -l restore_dir"
105     ls -lR $restore_dir | _ls_size_filter | _check_quota_file
106     let i=$i+1
107 done
108
109 # success, all done
110 status=0
111 exit