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