xfs/530: skip test if user MKFS_OPTIONS screw up formatting
[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 . ./common/preamble
10 _begin_fstest dump auto
11
12 # Override the default cleanup function.
13 _cleanup()
14 {
15         _cleanup_dump
16         cd /
17         rm -f $tmp.*
18 }
19
20 # Import common functions.
21 . ./common/filter
22 . ./common/dump
23
24 _ls_size_filter()
25 {
26     #
27     # Print size ($5) and fname ($9).
28     # The size is significant since we add to the file as part
29     # of a file change for the incremental.
30     #
31     # Filter out the housekeeping files of xfsrestore
32     #
33     $AWK_PROG 'NF == 9 { print $5, $9 }' |\
34     egrep -v 'dumpdir|housekeeping|dirattr|dirextattr|namreg|state|tree' 
35 }
36
37 # real QA test starts here
38 _supported_fs xfs
39
40 _create_dumpdir_hardlinks 9
41
42 echo "Do the incremental dumps"
43 i=0
44 while [ $i -le 9 ]; do
45     if [ $i -gt 0 ]; then
46         sleep 2
47         _modify_level $i
48     fi 
49
50     _stable_fs
51     sleep 2
52
53     echo "********* level $i ***********" >>$seqres.full
54     date >>$seqres.full
55     find $SCRATCH_MNT -exec $here/src/lstat64 {} \; | sed 's/(00.*)//' >$tmp.dates.$i
56     if [ $i -gt 0 ]; then
57        let level_1=$i-1
58        diff -c $tmp.dates.$level_1 $tmp.dates.$i >>$seqres.full
59     else
60        cat $tmp.dates.$i >>$seqres.full
61     fi
62
63     _do_dump_file -f $tmp.df.level$i -l $i
64     let i=$i+1
65 done
66
67 echo "Listing of what files we start with:"
68 ls -l $dump_dir | _ls_size_filter
69
70 echo "Look at what files are contained in the inc. dump"
71 i=0
72 while [ $i -le 9 ]; do
73     echo ""
74     echo "restoring from df.level$i"
75     _do_restore_toc -f $tmp.df.level$i
76     let i=$i+1
77 done
78
79 echo "Do the cumulative restores"
80 _prepare_restore_dir
81 i=0
82 while [ $i -le 9 ]; do
83     echo ""
84     echo "restoring from df.level$i"
85     _do_restore_file_cum -f $tmp.df.level$i
86     echo "ls -l restore_dir"
87     ls -lR $restore_dir | _ls_size_filter | _check_quota_file
88     let i=$i+1
89 done
90
91 # success, all done
92 status=0
93 exit