xfstests: include test subdirectory support
[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
25 seq=`basename $0`
26 echo "QA output created by $seq"
27
28 here=`pwd`
29 tmp=/tmp/$$
30 status=1        # failure is the default!
31 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
32
33 # get standard environment, filters and checks
34 . ./common.rc
35 . ./common.filter
36 . ./common.dump
37
38
39 _ls_size_filter()
40 {
41     #
42     # Print size ($5) and fname ($9).
43     # The size is significant since we add to the file as part
44     # of a file change for the incremental.
45     #
46     # Filter out the housekeeping files of xfsrestore
47     #
48     $AWK_PROG 'NF == 9 { print $5, $9 }' |\
49     egrep -v 'dumpdir|housekeeping|dirattr|dirextattr|namreg|state|tree' 
50 }
51
52 # real QA test starts here
53 _supported_fs xfs
54 _supported_os IRIX Linux
55
56 _create_dumpdir_hardlinks 9
57
58 echo "Do the incremental dumps"
59 i=0
60 while [ $i -le 9 ]; do
61     if [ $i -gt 0 ]; then
62         sleep 2
63         _modify_level $i
64     fi 
65
66     _stable_fs
67     sleep 2
68
69     echo "********* level $i ***********" >>$seq.full
70     date >>$seq.full
71     find $SCRATCH_MNT -exec $here/src/lstat64 {} \; | sed 's/(00.*)//' >$tmp.dates.$i
72     if [ $i -gt 0 ]; then
73        let level_1=$i-1
74        diff -c $tmp.dates.$level_1 $tmp.dates.$i >>$seq.full
75     else
76        cat $tmp.dates.$i >>$seq.full
77     fi
78
79     _do_dump_file -f $tmp.df.level$i -l $i
80     let i=$i+1
81 done
82
83 echo "Listing of what files we start with:"
84 ls -l $dump_dir | _ls_size_filter
85
86 echo "Look at what files are contained in the inc. dump"
87 i=0
88 while [ $i -le 9 ]; do
89     echo ""
90     echo "restoring from df.level$i"
91     _do_restore_toc -f $tmp.df.level$i
92     let i=$i+1
93 done
94
95 echo "Do the cumulative restores"
96 _prepare_restore_dir
97 i=0
98 while [ $i -le 9 ]; do
99     echo ""
100     echo "restoring from df.level$i"
101     _do_restore_file_cum -f $tmp.df.level$i
102     echo "ls -l restore_dir"
103     ls -lR $restore_dir | _ls_size_filter | _check_quota_file
104     let i=$i+1
105 done
106
107 # success, all done
108 status=0
109 exit