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