xfstests: 219: fix awk filter for duplicate users
[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     dump_file=$tmp.df.level$i
82     _do_dump_file -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     dump_file=$tmp.df.level$i
95     _do_restore_toc
96     let i=$i+1
97 done
98
99 echo "Do the cumulative restores"
100 i=0
101 while [ $i -le 9 ]; do
102     dump_file=$tmp.df.level$i
103     echo ""
104     echo "restoring from df.level$i"
105     _do_restore_file_cum -l $i
106     echo "ls -l restore_dir"
107     ls -lR $restore_dir | _ls_size_filter | _check_quota_file
108     let i=$i+1
109 done
110
111 # success, all done
112 status=0
113 exit