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